1
0
forked from dyf/APP

650完成,670完成部分

This commit is contained in:
liub
2025-08-25 17:13:13 +08:00
parent 793fe7132b
commit bbf55c58f0
23 changed files with 16897 additions and 221 deletions

View File

@ -146,10 +146,31 @@
}
try {
console.log('44444');
if(uni.getStorageSync("token") && uni.getStorageSync("clientID")){//免登陆
let time=uni.getStorageSync("tokenTime");
if(!time){
time=0;
}
let currTime=new Date().getTime();
if(currTime<time){
uni.switchTab({
url: '/pages/common/index/index'
});
return;
}else{
//token过期了
uni.removeStorageSync("token")
uni.removeStorageSync("clientID")
uni.removeStorageSync("tokenTime")
}
}
uni.showLoading({
title: '登录中...'
})
console.log('44444');
// 调用登录接口
const res = await login({
phonenumber: this.phone,
@ -158,16 +179,21 @@
})
if (res.code == 200) {
console.log(res, 'ressss');
uni.hideLoading()
uni.setStorageSync('token', res.data.access_token) // 缓存token
uni.setStorageSync('clientID', res.data.client_id) // 缓存token
uni.hideLoading();
uni.setStorageSync('token', res.data.access_token); // 缓存token
uni.setStorageSync('clientID', res.data.client_id); // 缓存token
uni.setStorageSync('tokenTime',new Date().getTime()+86400000);//过期时间
uni.showToast({
title: '登录成功',
icon: 'success'
})
uni.switchTab({
url: '/pages/common/index/index'
})
});
// uni.navigateTo({
// url:"/pages/BlueTooth/ModeSetting/index"
// });
} else {
uni.showToast({
title: res.msg,