Commit af65d8ee by 陆志强

feat: 修复问题

parent e98509ab
...@@ -11,9 +11,9 @@ import '@/plugins/vueClipboard' ...@@ -11,9 +11,9 @@ import '@/plugins/vueClipboard'
import '@/plugins/dmsService' import '@/plugins/dmsService'
import '@/plugins/deviceId' import '@/plugins/deviceId'
import '@/plugins/hlsInstance' import '@/plugins/hlsInstance'
import { Dialog } from 'vant'
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
const { id = 0, uin = 0, optionId = 0 } = to.query const { id = 0, uin = 0, optionId = 0, type = '' } = to.query
store.commit('users/SET_UIN', uin) store.commit('users/SET_UIN', uin)
if ( if (
[ [
...@@ -29,8 +29,22 @@ router.beforeEach((to, from, next) => { ...@@ -29,8 +29,22 @@ router.beforeEach((to, from, next) => {
].includes(to.path) ].includes(to.path)
) { ) {
store store
.dispatch('vote/getVoteInfo', { id }) .dispatch('vote/getVoteInfo', { id }, type)
.then(res => { .then(res => {
if (res.referUrl && Number(res.vote_status) === 2) {
Dialog.alert({
message: `活动已结束,点击“确认”可以直接${type === 'draw' ? '参与抽奖' : '返回直播间'}`,
}).then(() => {
window.location.href = res.referUrl
})
}
if (res.referUrl && !!res.isJoined && Number(res.vote_status) === 1) {
Dialog.alert({
message: `您已参与过投票,点击“确认”可以直接${type === 'draw' ? '参与抽奖' : '返回直播间'}`,
}).then(() => {
window.location.href = res.referUrl
})
}
// 判断是否有进入"排行榜"权限 // 判断是否有进入"排行榜"权限
if ((to.path === '/rank' || to.path === '/mini/rank') && !store.state.vote.voteInfo.voteRankState) { if ((to.path === '/rank' || to.path === '/mini/rank') && !store.state.vote.voteInfo.voteRankState) {
next('/error') next('/error')
......
/* eslint-disable camelcase */ /* eslint-disable camelcase */
import { getVoteInfos, getVoteList, setVote, checkQuestionnaire } from '@/api/modules/vote' import { getVoteInfos, getVoteList, setVote, checkQuestionnaire } from '@/api/modules/vote'
import { VOTE_TYPE_LIST, VOTE_STATUS, VOTE_STATUS_TXT } from '@/utils/constant' import { VOTE_TYPE_LIST, VOTE_STATUS, VOTE_STATUS_TXT } from '@/utils/constant'
import { Toast, Dialog } from 'vant' import { Toast } from 'vant'
import { cloneDeep } from 'lodash' import { cloneDeep } from 'lodash'
import Bus from '@/utils/Bus' import Bus from '@/utils/Bus'
...@@ -90,22 +90,7 @@ export const actions = { ...@@ -90,22 +90,7 @@ export const actions = {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
getVoteInfos(params).then(res => { getVoteInfos(params).then(res => {
const { code, errorCode, data, errorMessage } = res const { code, errorCode, data, errorMessage } = res
const referType = this.$route.query.type
if (code === 200 && errorCode === 0) { if (code === 200 && errorCode === 0) {
if (data.referUrl && Number(data.vote_status) === 2) {
Dialog.alert({
message: `活动已结束,点击“确认”可以直接${referType === 'lottery' ? '参与抽奖' : '返回直播间'}`,
}).then(() => {
window.location.href = data.referUrl
})
}
if (data.referUrl && !!data.isJoined && Number(data.vote_status) === 1) {
Dialog.alert({
message: `您已参与过投票,点击“确认”可以直接${referType === 'lottery' ? '参与抽奖' : '返回直播间'}`,
}).then(() => {
window.location.href = data.referUrl
})
}
const { const {
start_time: startTime, start_time: startTime,
end_time: endTime, end_time: endTime,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment