登录提示
Showing
1 changed file
with
20 additions
and
12 deletions
| ... | @@ -214,6 +214,7 @@ import { | ... | @@ -214,6 +214,7 @@ import { |
| 214 | unbindUser, | 214 | unbindUser, |
| 215 | downStuCertSingle | 215 | downStuCertSingle |
| 216 | } from '@/common/api.js' | 216 | } from '@/common/api.js' |
| 217 | import {onShow} from "@dcloudio/uni-app"; | ||
| 217 | 218 | ||
| 218 | const userStore = useUserStore() | 219 | const userStore = useUserStore() |
| 219 | const userInfo = computed(() => userStore.user ?? {}) | 220 | const userInfo = computed(() => userStore.user ?? {}) |
| ... | @@ -233,31 +234,38 @@ const bindForm = ref({ | ... | @@ -233,31 +234,38 @@ const bindForm = ref({ |
| 233 | idcCode: '' | 234 | idcCode: '' |
| 234 | }) | 235 | }) |
| 235 | const showConfirm = ref(false) | 236 | const showConfirm = ref(false) |
| 237 | // 标记是否已经弹出过绑定框(避免重复弹出) | ||
| 238 | let hasOpenedBindPopup = false | ||
| 236 | 239 | ||
| 237 | onMounted(() => { | 240 | onShow(() => { |
| 238 | let webUserName = uni.getStorageSync('webUserName') | 241 | let webUserName = uni.getStorageSync('webUserName') |
| 239 | if (!webUserName) { | 242 | if (!webUserName) { |
| 240 | wxLogin().then(getWebInfo) | 243 | wxLogin().then(getWebInfo) |
| 241 | } | 244 | } |
| 242 | }) | ||
| 243 | |||
| 244 | // 标记是否已经弹出过绑定框(避免重复弹出) | ||
| 245 | let hasOpenedBindPopup = false | ||
| 246 | |||
| 247 | watch(() => perInfo.value, (newVal, oldVal) => { | ||
| 248 | console.log(444, newVal?.perCode) | ||
| 249 | |||
| 250 | // 只有当 perInfo 数据存在且 perCode 为空时才弹出 | 245 | // 只有当 perInfo 数据存在且 perCode 为空时才弹出 |
| 251 | if (newVal && !newVal.perCode && !hasOpenedBindPopup) { | 246 | if (perInfo.value && !perInfo.value.perCode && !hasOpenedBindPopup) { |
| 252 | hasOpenedBindPopup = true | 247 | hasOpenedBindPopup = true |
| 253 | nextTick(() => { | 248 | nextTick(() => { |
| 254 | openBindPopup() | 249 | openBindPopup() |
| 255 | }) | 250 | }) |
| 256 | } | 251 | } |
| 257 | }, { | ||
| 258 | immediate: true | ||
| 259 | }) | 252 | }) |
| 260 | 253 | ||
| 254 | |||
| 255 | // watch(() => perInfo.value, (newVal, oldVal) => { | ||
| 256 | // console.log(444, newVal?.perCode) | ||
| 257 | // | ||
| 258 | // // 只有当 perInfo 数据存在且 perCode 为空时才弹出 | ||
| 259 | // if (newVal && !newVal.perCode && !hasOpenedBindPopup) { | ||
| 260 | // hasOpenedBindPopup = true | ||
| 261 | // nextTick(() => { | ||
| 262 | // openBindPopup() | ||
| 263 | // }) | ||
| 264 | // } | ||
| 265 | // }, { | ||
| 266 | // immediate: true | ||
| 267 | // }) | ||
| 268 | |||
| 261 | // 打开绑定弹框 | 269 | // 打开绑定弹框 |
| 262 | const openBindPopup = () => { | 270 | const openBindPopup = () => { |
| 263 | if (bindPopup.value) { | 271 | if (bindPopup.value) { | ... | ... |
-
Please register or sign in to post a comment