diff --git a/src/api/auth/index.js b/src/api/auth/index.js index 1846559..3a90252 100644 --- a/src/api/auth/index.js +++ b/src/api/auth/index.js @@ -43,3 +43,10 @@ export const workInfo = (data) => { data, }) } +export const voteAPI = (data) => { + return request({ + url: '/api/children/competition/vote', + method: 'POST', + data, + }) +} diff --git a/src/store/auth/index.js b/src/store/auth/index.js index 098c662..21f6769 100644 --- a/src/store/auth/index.js +++ b/src/store/auth/index.js @@ -1,6 +1,14 @@ import {ref,computed} from 'vue' import {createGlobalState,useStorage} from '@vueuse/core' -import {competitionApply, competitionWorks, loginRegister, sendCode, uploadFile, workInfo} from '@/api/auth/index.js' +import { + competitionApply, + competitionWorks, + loginRegister, + sendCode, + uploadFile, + voteAPI, + workInfo +} from '@/api/auth/index.js' import {message} from "@/utils/message.js" import { useRouter } from 'vue-router'; import { showImagePreview } from 'vant'; @@ -18,6 +26,13 @@ export const useAuth=createGlobalState(()=>{ const showTextCode=computed(()=>{ return isCountingDown.value ? `${countdown.value}s` : '获取验证码' }) + const sendVote=async ()=>{ + + const res= await voteAPI({workUid:workUid.value}) + if (res.status===0){ + message.success('投票成功') + } + } const getWorkInfo=async ()=>{ const res=await workInfo({workUid:workUid.value}) if (res.status===0){ @@ -198,6 +213,7 @@ export const useAuth=createGlobalState(()=>{ })*/ } return { + sendVote, workData, workUid, getWorkInfo, diff --git a/src/views/vote/index.vue b/src/views/vote/index.vue index f372d16..d5cae87 100644 --- a/src/views/vote/index.vue +++ b/src/views/vote/index.vue @@ -1,7 +1,7 @@