From 0d8c7476d97211d6fa69fb0d8df0b42901833339 Mon Sep 17 00:00:00 2001 From: KarolChang Date: Sun, 24 Apr 2022 14:38:55 +0800 Subject: [PATCH] feat: add btn --- deploy.sh | 2 +- src/utils/lineBotMsg.ts | 2 +- src/views/Home.vue | 18 +++++++++++++++++- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/deploy.sh b/deploy.sh index fc80fcf..31621e5 100755 --- a/deploy.sh +++ b/deploy.sh @@ -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://.github.io # git push -f https://github.com//.GitHub.io.git master diff --git a/src/utils/lineBotMsg.ts b/src/utils/lineBotMsg.ts index 4b67784..54eca5f 100644 --- a/src/utils/lineBotMsg.ts +++ b/src/utils/lineBotMsg.ts @@ -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', diff --git a/src/views/Home.vue b/src/views/Home.vue index b593042..d09d741 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -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(true) const records = ref([]) const thisMonthData = ref(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) + } +}