Browse Source

登录提示添加延时

lihuilin/feature-20251024095243-我的
wangyi 4 weeks ago
parent
commit
5fefad7772
  1. 24
      components/login-prompt.vue

24
components/login-prompt.vue

@ -28,7 +28,9 @@ const loginStore = useLoginStore();
// //
onMounted(() => { onMounted(() => {
if (!userStore.userInfo) { if (!userStore.userInfo) {
setTimeout(() => {
show(); show();
}, 500);
} }
}), }),
// watch( // watch(
@ -45,11 +47,20 @@ onMounted(() => {
loginStore.$subscribe(() => { loginStore.$subscribe(() => {
if (loginStore.loginInfo === "false") { if (loginStore.loginInfo === "false") {
console.log("登录失败");
console.log("游客访问");
setTimeout(() => {
show(); show();
}, 500);
} }
}); });
loginStore.$subscribe(() => {
if (loginStore.loginInfo === "true") {
console.log("用户登录");
hide();
}
});
// //
const showPrompt = ref(false); const showPrompt = ref(false);
const showAnimation = ref(false); const showAnimation = ref(false);
@ -79,14 +90,17 @@ const goLogin = () => {
uni.navigateTo({ uni.navigateTo({
url: "/pages/start/login/login", url: "/pages/start/login/login",
}); });
hide();
loginStore.setLoginInfo("true");
// hide();
}; };
// //
const goRegister = () => { const goRegister = () => {
uni.navigateTo({ uni.navigateTo({
url: "/pages/start/Registration/Registration", url: "/pages/start/Registration/Registration",
}); });
hide();
loginStore.setLoginInfo("true");
// hide();
}; };
// 访 // 访
@ -108,8 +122,8 @@ const continueAsVisitor = async () => {
hide(); hide();
// //
uni.$emit('visitorLoginSuccess', {
userInfo: res.data
uni.$emit("visitorLoginSuccess", {
userInfo: res.data,
}); });
} }
}; };

Loading…
Cancel
Save