33 lines
1.3 KiB
JavaScript
33 lines
1.3 KiB
JavaScript
"use strict";
|
|
const common_vendor = require("../common/vendor.js");
|
|
function VerifyLogin() {
|
|
return new Promise((resolve, reject) => {
|
|
common_vendor.index.getStorage({
|
|
key: "userinfo",
|
|
success: (res) => {
|
|
if (res.data) {
|
|
if (res.data.nickName) {
|
|
resolve(true);
|
|
} else {
|
|
common_vendor.index.setStorageSync("lastPage", getCurrentPages()[getCurrentPages().length - 1].route);
|
|
common_vendor.index.reLaunch({ url: "/pages/UserInformation/UserInformation" });
|
|
resolve(false);
|
|
}
|
|
} else {
|
|
common_vendor.index.setStorageSync("lastPage", getCurrentPages()[getCurrentPages().length - 1].route);
|
|
common_vendor.index.navigateTo({ url: "/pages/login/login" });
|
|
resolve(false);
|
|
}
|
|
},
|
|
fail: (err) => {
|
|
common_vendor.index.__f__("error", "at components/VerifyLogin.js:22", "获取用户信息失败", err);
|
|
common_vendor.index.setStorageSync("lastPage", getCurrentPages()[getCurrentPages().length - 1].route);
|
|
common_vendor.index.navigateTo({ url: "/pages/login/login" });
|
|
reject(err);
|
|
}
|
|
});
|
|
});
|
|
}
|
|
exports.VerifyLogin = VerifyLogin;
|
|
//# sourceMappingURL=../../.sourcemap/mp-weixin/components/VerifyLogin.js.map
|