修复bug

This commit is contained in:
zhouyanli
2026-08-01 18:10:56 +08:00
parent f74fb33e11
commit 2010c63d70
7 changed files with 107 additions and 47 deletions

View File

@@ -73,30 +73,17 @@
<script setup>
import { ref, onMounted } from 'vue';
// 守卫:已登录或已看过引导页的用户不展示引导页,直接跳转
const hasShowGuide = uni.getStorageSync('hasShowGuide')
const tokenSave = uni.getStorageSync('token')
// 是否需要重定向(老用户跳过引导页)
const needRedirect = hasShowGuide || tokenSave
if (needRedirect) {
// 已登录或已看过引导页:直接进首页
uni.reLaunch({ url: '/pages/index/index' })
}
// ========== 响应式数据 ==========
// ========== 响应式数据 ==========
// 当前引导步骤0/1/2
const currentStep = ref(0);
const mode = ref("default")
// 防重复跳转锁
const isNavigating = ref(false)
// 控制是否展示引导内容(初始为 false避免重定向用户看到闪烁
// 控制是否展示引导内容
const showContent = ref(false)
// 页面挂载后延迟显示,让过渡更平滑
onMounted(() => {
// 需要重定向的用户不展示引导内容
if (needRedirect) return
setTimeout(() => {
showContent.value = true
}, 100)
@@ -110,16 +97,12 @@ const handleSwiperChange = (e) => {
// 点击按钮操作
const handleBtnClick = () => {
// 前两步:点击下一步切换
if (currentStep.value < 2) {
currentStep.value++;
} else {
// 防重复跳转:已触发过跳转则直接返回
if (isNavigating.value) return;
isNavigating.value = true;
// 记录引导已完成
uni.setStorageSync('hasShowGuide', true);
// 直接进入首页(未登录用户可正常浏览首页,需登录的功能由点击拦截处理)
uni.switchTab({
url: '/pages/index/index'
})