优化登录,修改bug
This commit is contained in:
@@ -71,17 +71,19 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { ref, onMounted } from 'vue';
|
||||
|
||||
// 守卫:已登录或已看过引导页的用户不展示引导页,直接跳转
|
||||
const hasShowGuide = uni.getStorageSync('hasShowGuide')
|
||||
const tokenSave = uni.getStorageSync('token')
|
||||
// 是否需要重定向(老用户跳过引导页)
|
||||
const needRedirect = hasShowGuide || tokenSave
|
||||
|
||||
if (hasShowGuide || tokenSave) {
|
||||
if (needRedirect) {
|
||||
if (tokenSave) {
|
||||
uni.reLaunch({ url: '/pages/index/index' })
|
||||
} else if (hasShowGuide) {
|
||||
uni.reLaunch({ url: '/pageSubPack/loginSub/pwd-login' })
|
||||
uni.reLaunch({ url: '/pageSubPack/loginSub/login?mode=pwd' })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,8 +93,17 @@ const currentStep = ref(0);
|
||||
const mode = ref("default")
|
||||
// 防重复跳转锁
|
||||
const isNavigating = ref(false)
|
||||
// 控制是否展示引导内容(已登录用户不展示,避免闪烁)
|
||||
const showContent = ref(!hasShowGuide && !tokenSave)
|
||||
// 控制是否展示引导内容(初始为 false,避免重定向用户看到闪烁)
|
||||
const showContent = ref(false)
|
||||
|
||||
// 页面挂载后延迟显示,让过渡更平滑
|
||||
onMounted(() => {
|
||||
// 需要重定向的用户不展示引导内容
|
||||
if (needRedirect) return
|
||||
setTimeout(() => {
|
||||
showContent.value = true
|
||||
}, 100)
|
||||
})
|
||||
|
||||
// ========== 方法 ==========
|
||||
// 滑动swiper切换步骤
|
||||
@@ -119,7 +130,7 @@ const handleBtnClick = () => {
|
||||
})
|
||||
} else {
|
||||
uni.redirectTo({
|
||||
url: "/pageSubPack/loginSub/pwd-login"
|
||||
url: "/pageSubPack/loginSub/login?mode=pwd"
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -136,6 +147,19 @@ const handleBtnClick = () => {
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
box-sizing: border-box;
|
||||
animation: guideFadeIn 0.5s ease-out;
|
||||
}
|
||||
|
||||
/* 引导页淡入动画 */
|
||||
@keyframes guideFadeIn {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(20rpx);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
/* 状态栏 - 自适应设备状态栏高度 */
|
||||
|
||||
Reference in New Issue
Block a user