2025-09-17

修改登录
This commit is contained in:
2025-09-17 16:59:23 +08:00
parent 7423e1ff56
commit 3c8da5e9dc
5 changed files with 36 additions and 24 deletions

11
App.vue
View File

@@ -2,6 +2,17 @@
export default { export default {
onLaunch: function() { onLaunch: function() {
console.log('App Launch') 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() { onShow: function() {
console.log('App Show') console.log('App Show')

View File

@@ -11,9 +11,9 @@
"nvueStyleCompiler" : "uni-app", "nvueStyleCompiler" : "uni-app",
"compilerVersion" : 3, "compilerVersion" : 3,
"splashscreen" : { "splashscreen" : {
"alwaysShowBeforeRender" : true, "alwaysShowBeforeRender" : false, // 登录修改
"waiting" : true, "waiting" : true,
"autoclose" : true, "autoclose" : false, // 登录修改
"delay" : 0 "delay" : 0
}, },
/* */ /* */

View File

@@ -1,12 +1,5 @@
{ {
"pages": [ //pages数组中第一项表示应用启动页参考https://uniapp.dcloud.io/collocation/pages "pages": [ //pages数组中第一项表示应用启动页参考https://uniapp.dcloud.io/collocation/pages
{
"path": "pages/login/login",
"style": {
"navigationBarTitleText": "登录",
"navigationStyle": "custom"
}
},
{ {
"path": "pages/home/index", "path": "pages/home/index",
"style": { "style": {
@@ -14,6 +7,13 @@
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, },
{
"path": "pages/login/login",
"style": {
"navigationBarTitleText": "登录",
"navigationStyle": "custom"
}
},
{ {
"path": "pages/my/my", "path": "pages/my/my",
"style": { "style": {
@@ -41,10 +41,9 @@
} }
}, },
{ {
"path" : "pages/register/register", "path": "pages/register/register",
"style" : "style": {
{ "navigationBarTitleText": "注册",
"navigationBarTitleText" : "注册",
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, },

View File

@@ -110,8 +110,12 @@
}); });
onMounted(() => { onMounted(() => {
try {
loadCaptcha() loadCaptcha()
loadCache() loadCache()
} catch (err) {
console.log("login Error === ", err);
}
}) })
// 刷新 // 刷新
@@ -128,13 +132,12 @@
}) })
} }
const loadCache = () =>{ const loadCache = () => {
let is_rember = uni.getStorageSync("rember") let is_rember = uni.getStorageSync("rember")
if(is_rember){ if (is_rember) {
userLogin.userForm.is_rember = true userLogin.userForm.is_rember = true
let data = JSON.parse(is_rember) userLogin.userForm.username = is_rember.username
userLogin.userForm.username = data.username userLogin.userForm.password = is_rember.password
userLogin.userForm.password = data.password
} }
} }
@@ -175,10 +178,10 @@
// 未激活用户 // 未激活用户
uni.setStorageSync("token", response.token) uni.setStorageSync("token", response.token)
if (userLogin.userForm.is_rember) { if (userLogin.userForm.is_rember) {
uni.setStorageSync("rember", JSON.stringify({ uni.setStorageSync("rember", {
username: userLogin.userForm.username, username: userLogin.userForm.username,
password: userLogin.userForm.password, password: userLogin.userForm.password,
})) })
} }
uni.showToast({ uni.showToast({
title: '登录成功', title: '登录成功',

View File

@@ -485,7 +485,6 @@
display: flex; display: flex;
.btn { .btn {
height: 24rpx;
padding: 4rpx 20rpx; padding: 4rpx 20rpx;
font-family: Work Sans; font-family: Work Sans;