优化代码
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
function VerifyLogin() {
|
||||
function VerifyLogin(id) {
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
uni.getStorage({
|
||||
@@ -8,19 +8,18 @@ function VerifyLogin() {
|
||||
if (res.data.nickName) {
|
||||
resolve(true);
|
||||
} else {
|
||||
uni.setStorageSync("lastPage", getCurrentPages()[getCurrentPages().length - 1].route);
|
||||
uni.setStorageSync("lastPage", getCurrentPages()[getCurrentPages().length - 1].route+"?inid=" + id);
|
||||
uni.reLaunch({ url: "/pages/UserInformation/UserInformation" });
|
||||
resolve(false);
|
||||
}
|
||||
} else {
|
||||
uni.setStorageSync("lastPage", getCurrentPages()[getCurrentPages().length - 1].route);
|
||||
uni.setStorageSync("lastPage", getCurrentPages()[getCurrentPages().length - 1].route+"?inid=" + id);
|
||||
uni.navigateTo({ url: '/pages/login/login' });
|
||||
resolve(false);
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error("获取用户信息失败", err);
|
||||
uni.setStorageSync("lastPage", getCurrentPages()[getCurrentPages().length - 1].route);
|
||||
uni.setStorageSync("lastPage", getCurrentPages()[getCurrentPages().length - 1].route+"?inid=" + id);
|
||||
uni.navigateTo({ url: '/pages/login/login' });
|
||||
reject(err);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user