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 init
git add -A git add -A
git commit -m 'deploy: config' git commit -m 'deploy: config & view'
# if you are deploying to https://<USERNAME>.github.io # if you are deploying to https://<USERNAME>.github.io
# git push -f https://github.com/<USERNAME>/<USERNAME>.GitHub.io.git master # 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) => { export const pushMsgToBoth = async (text: string) => {
try { try {
const input = { const input: any = {
to: [import.meta.env.VITE_KAROL_USERID, import.meta.env.VITE_JIANMIAU_USERID], to: [import.meta.env.VITE_KAROL_USERID, import.meta.env.VITE_JIANMIAU_USERID],
messages: { messages: {
type: 'text', type: 'text',

View File

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