From 3c8da5e9dc7dcbd8772da2f7cbe34276d689cf78 Mon Sep 17 00:00:00 2001 From: Sun_sun <469361609@qq.com> Date: Wed, 17 Sep 2025 16:59:23 +0800 Subject: [PATCH] =?UTF-8?q?2025-09-17=20=E4=BF=AE=E6=94=B9=E7=99=BB?= =?UTF-8?q?=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.vue | 11 +++++++++++ manifest.json | 4 ++-- pages.json | 21 ++++++++++----------- pages/login/login.vue | 23 +++++++++++++---------- pages/program/programDetail.vue | 1 - 5 files changed, 36 insertions(+), 24 deletions(-) diff --git a/App.vue b/App.vue index 1ca1ee6..594993f 100644 --- a/App.vue +++ b/App.vue @@ -2,6 +2,17 @@ export default { onLaunch: function() { console.log('App Launch') + let token = uni.getStorageSync("token") + if (token) { + plus.navigator.closeSplashscreen(); + return + } + uni.reLaunch({ + url: "/pages/login/login", + success() { + plus.navigator.closeSplashscreen(); + } + }) }, onShow: function() { console.log('App Show') diff --git a/manifest.json b/manifest.json index 9cbd354..633fbb0 100644 --- a/manifest.json +++ b/manifest.json @@ -11,9 +11,9 @@ "nvueStyleCompiler" : "uni-app", "compilerVersion" : 3, "splashscreen" : { - "alwaysShowBeforeRender" : true, + "alwaysShowBeforeRender" : false, // 登录修改 "waiting" : true, - "autoclose" : true, + "autoclose" : false, // 登录修改 "delay" : 0 }, /* 模块配置 */ diff --git a/pages.json b/pages.json index 6c3e261..13f38f2 100644 --- a/pages.json +++ b/pages.json @@ -1,12 +1,5 @@ { "pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages - { - "path": "pages/login/login", - "style": { - "navigationBarTitleText": "登录", - "navigationStyle": "custom" - } - }, { "path": "pages/home/index", "style": { @@ -14,6 +7,13 @@ "navigationStyle": "custom" } }, + { + "path": "pages/login/login", + "style": { + "navigationBarTitleText": "登录", + "navigationStyle": "custom" + } + }, { "path": "pages/my/my", "style": { @@ -41,10 +41,9 @@ } }, { - "path" : "pages/register/register", - "style" : - { - "navigationBarTitleText" : "注册", + "path": "pages/register/register", + "style": { + "navigationBarTitleText": "注册", "navigationStyle": "custom" } }, diff --git a/pages/login/login.vue b/pages/login/login.vue index 00954e7..16c0d6b 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -110,8 +110,12 @@ }); onMounted(() => { - loadCaptcha() - loadCache() + try { + loadCaptcha() + loadCache() + } catch (err) { + console.log("login Error === ", err); + } }) // 刷新 @@ -127,14 +131,13 @@ captchaId.value = res.data.captchaId }) } - - const loadCache = () =>{ + + const loadCache = () => { let is_rember = uni.getStorageSync("rember") - if(is_rember){ + if (is_rember) { userLogin.userForm.is_rember = true - let data = JSON.parse(is_rember) - userLogin.userForm.username = data.username - userLogin.userForm.password = data.password + userLogin.userForm.username = is_rember.username + userLogin.userForm.password = is_rember.password } } @@ -175,10 +178,10 @@ // 未激活用户 uni.setStorageSync("token", response.token) if (userLogin.userForm.is_rember) { - uni.setStorageSync("rember", JSON.stringify({ + uni.setStorageSync("rember", { username: userLogin.userForm.username, password: userLogin.userForm.password, - })) + }) } uni.showToast({ title: '登录成功', diff --git a/pages/program/programDetail.vue b/pages/program/programDetail.vue index 628a61f..d42364b 100644 --- a/pages/program/programDetail.vue +++ b/pages/program/programDetail.vue @@ -485,7 +485,6 @@ display: flex; .btn { - height: 24rpx; padding: 4rpx 20rpx; font-family: Work Sans;