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 {
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')

View File

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

View File

@@ -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"
}
},

View File

@@ -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: '登录成功',

View File

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