feat: add btn

This commit is contained in:
KarolChang 2022-04-24 14:38:55 +08:00
parent 6127f45298
commit 0d8c7476d9
3 changed files with 19 additions and 3 deletions

View File

@ -14,7 +14,7 @@ cd dist
git init
git add -A
git commit -m 'deploy: config'
git commit -m 'deploy: config & view'
# if you are deploying to https://<USERNAME>.github.io
# git push -f https://github.com/<USERNAME>/<USERNAME>.GitHub.io.git master

View File

@ -2,7 +2,7 @@ import lineBotAPI from '@/apis/lineBot'
export const pushMsgToBoth = async (text: string) => {
try {
const input = {
const input: any = {
to: [import.meta.env.VITE_KAROL_USERID, import.meta.env.VITE_JIANMIAU_USERID],
messages: {
type: 'text',

View File

@ -4,6 +4,7 @@ import recordAPI from '@/apis/record'
import lineBotAPI from '@/apis/lineBot'
import { Record } from '@/models'
import { CallParent } from '@/cocos/config'
import { useStore } from '../store/index'
// components
import Spinner from '@/components/Spinner.vue'
import CreateRecordModalButton from '@/components/ModalButton/Record/CreateRecordModalButton.vue'
@ -16,6 +17,7 @@ class MonthData {
}
// data
const store = useStore()
const isLoading = ref<boolean>(true)
const records = ref<Record[]>([])
const thisMonthData = ref<MonthData>(new MonthData())
@ -72,7 +74,7 @@ fetchRecords()
//
const handle = async () => {
try {
const input = {
const input: any = {
to: [import.meta.env.VITE_KAROL_USERID, import.meta.env.VITE_JIANMIAU_USERID],
messages: { type: 'text', text: '卡比覺得促咪!' }
}
@ -82,6 +84,19 @@ const handle = async () => {
console.error('error', error)
}
}
// xx
const call = async () => {
try {
const input: any = {
to: [import.meta.env.VITE_KAROL_USERID, import.meta.env.VITE_JIANMIAU_USERID],
messages: { type: 'text', text: '呼叫呆喵! 聽到請回答!' }
}
await lineBotAPI.push(input)
} catch (error) {
console.error('error', error)
}
}
</script>
<template>
@ -89,6 +104,7 @@ const handle = async () => {
<div class="d-flex mb-3" style="width: 100vw">
<CreateRecordModalButton view="Home" class="me-3" />
<button type="button" class="btn btn-danger me-3" @click="handle">笨蛋才按我</button>
<button type="button" class="btn btn-primary me-3" @click="call">哈囉</button>
</div>
<div class="list-group list-group-checkable">
<label class="list-group-item py-3 mb-3">