Commit bcba9699 by 陆志强

feat: 投票结束自动跳转

parent 2b7f76eb
...@@ -45,6 +45,7 @@ export const state = () => ({ ...@@ -45,6 +45,7 @@ export const state = () => ({
voteRankState: false, // 排行开启开关 1开启 0关闭 voteRankState: false, // 排行开启开关 1开启 0关闭
isShowInvite: false, // 是否显示马上拉票 isShowInvite: false, // 是否显示马上拉票
shareTitle: '', // 分享标题 shareTitle: '', // 分享标题
referUrl: '', // 回跳地址
bind_service: '', // 绑定服务 bind_service: '', // 绑定服务
bind_service_force_open: 0, // 绑定服务强制开启 bind_service_force_open: 0, // 绑定服务强制开启
bind_service_id: 0 // 绑定服务id bind_service_id: 0 // 绑定服务id
...@@ -120,6 +121,10 @@ export const actions = { ...@@ -120,6 +121,10 @@ export const actions = {
is_invite, is_invite,
shareTitle, shareTitle,
share_img, share_img,
refer_url,
bind_service,
bind_service_force_open,
bind_service_id
} = data } = data
const voteRankState = parseInt(is_rank, 10) === 1 const voteRankState = parseInt(is_rank, 10) === 1
const obj = { const obj = {
...@@ -137,7 +142,11 @@ export const actions = { ...@@ -137,7 +142,11 @@ export const actions = {
voteRankState, voteRankState,
isShowInvite: Number(is_invite) === 1, isShowInvite: Number(is_invite) === 1,
shareTitle, shareTitle,
shareImg: share_img shareImg: share_img,
referUrl,
bindService,
bindServiceForceOpen,
bindServiceId
} }
// 设置网页标题 // 设置网页标题
document.title = topic || '投票' document.title = topic || '投票'
...@@ -216,6 +225,18 @@ export const actions = { ...@@ -216,6 +225,18 @@ export const actions = {
setVote(params).then(res => { setVote(params).then(res => {
const { code, errorCode, errorMessage, data } = res const { code, errorCode, errorMessage, data } = res
if (code === 200 && errorCode === 0) { if (code === 200 && errorCode === 0) {
const referUrl = voteInfo.referUrl
if (referUrl) {
Toast.success({
message: '投票成功,正在跳转',
onClose: () => {
if (referUrl) {
window.location.href = state.questionnaireInfo.referUrl
}
},
})
return
}
Toast.success('投票成功') Toast.success('投票成功')
const updateData = { id, newData: { vote_num: data.row_total || vote_num + 1 } } const updateData = { id, newData: { vote_num: data.row_total || vote_num + 1 } }
Bus.$emit('VoteSuccessCallback', updateData) Bus.$emit('VoteSuccessCallback', updateData)
......
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