diff --git a/src/pages/login/login.vue b/src/pages/login/login.vue index eb6b248..a2e93f6 100644 --- a/src/pages/login/login.vue +++ b/src/pages/login/login.vue @@ -63,6 +63,7 @@ const onLoginSuccess = () => { icon: 'none', success: () => { setTimeout(() => { + userStore.showtoast = false uni.reLaunch({ url: '/pages/votingElection/index' }) }, 1000) } diff --git a/src/pages/votingElection/index.vue b/src/pages/votingElection/index.vue index eb2ece5..8d82274 100644 --- a/src/pages/votingElection/index.vue +++ b/src/pages/votingElection/index.vue @@ -114,15 +114,12 @@ onShow(() => { }) } else if (isEmptyObject(userStore.userInfo)) { showDialogRef.value.show = true + } else if (!userStore.showtoast) { + userStore.showtoast = true + uni.showToast({ title: '签到成功,等待投票!', icon: 'success', duration: 1000 }) + setTimeout(() => reListRef.value.refreshFn(), 1100) } else { - uni.showToast({ - title: '签到成功,等待投票!', - icon: 'success', - duration: 1000, - complete: () => { - setTimeout(() => reListRef.value.refreshFn(), 1100) - } - }) + reListRef.value.refreshFn() } }) }) diff --git a/src/store/user.ts b/src/store/user.ts index 9e33664..753ec44 100644 --- a/src/store/user.ts +++ b/src/store/user.ts @@ -12,6 +12,7 @@ export default defineStore( () => { const openId = ref('') const mobile = ref('') + const showtoast = ref(false) const userInfo = ref({}) function getopenid(params: { code: string }) { @@ -74,6 +75,7 @@ export default defineStore( return { openId, mobile, + showtoast, userInfo, getopenid, bindUser,