|
@@ -28,10 +28,49 @@ const _sfc_main = {
|
|
// 存储微信登录code
|
|
// 存储微信登录code
|
|
};
|
|
};
|
|
},
|
|
},
|
|
|
|
+ onLoad() {
|
|
|
|
+ this.checkLogin();
|
|
|
|
+ },
|
|
onShow() {
|
|
onShow() {
|
|
this.checkLoginStatus();
|
|
this.checkLoginStatus();
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ checkLogin() {
|
|
|
|
+ const userInfo = common_vendor.index.getStorageSync("userInfo");
|
|
|
|
+ if (!userInfo) {
|
|
|
|
+ common_vendor.index.reLaunch({
|
|
|
|
+ url: "/pages/login/login",
|
|
|
|
+ success: () => {
|
|
|
|
+ console.log("跳转到身份验证登录页面成功");
|
|
|
|
+ },
|
|
|
|
+ fail: (err) => {
|
|
|
|
+ console.error("跳转到身份验证登录页面失败:", err);
|
|
|
|
+ common_vendor.index.showToast({
|
|
|
|
+ title: "跳转失败,请重试",
|
|
|
|
+ icon: "none"
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ try {
|
|
|
|
+ const parsedUserInfo = JSON.parse(userInfo);
|
|
|
|
+ if (!parsedUserInfo.openid) {
|
|
|
|
+ common_vendor.index.navigateTo({
|
|
|
|
+ url: "/pages/login/login"
|
|
|
|
+ });
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ return true;
|
|
|
|
+ } catch (e) {
|
|
|
|
+ console.error("解析用户信息失败:", e);
|
|
|
|
+ common_vendor.index.removeStorageSync("userInfo");
|
|
|
|
+ common_vendor.index.navigateTo({
|
|
|
|
+ url: "/pages/login/login"
|
|
|
|
+ });
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ },
|
|
// 检查登录状态
|
|
// 检查登录状态
|
|
checkLoginStatus() {
|
|
checkLoginStatus() {
|
|
try {
|
|
try {
|
|
@@ -66,17 +105,8 @@ const _sfc_main = {
|
|
},
|
|
},
|
|
// 前往登录页
|
|
// 前往登录页
|
|
goLogin() {
|
|
goLogin() {
|
|
- common_vendor.index.showActionSheet({
|
|
|
|
- itemList: ["账号密码登录", "微信登录"],
|
|
|
|
- success: (res) => {
|
|
|
|
- if (res.tapIndex === 0) {
|
|
|
|
- common_vendor.index.navigateTo({
|
|
|
|
- url: "/pages/login/login"
|
|
|
|
- });
|
|
|
|
- } else if (res.tapIndex === 1) {
|
|
|
|
- this.wxLogin();
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ common_vendor.index.navigateTo({
|
|
|
|
+ url: "/pages/login/login"
|
|
});
|
|
});
|
|
},
|
|
},
|
|
// 微信登录
|
|
// 微信登录
|
|
@@ -432,7 +462,7 @@ const _sfc_main = {
|
|
icon: "none"
|
|
icon: "none"
|
|
});
|
|
});
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
- this.wxLogin();
|
|
|
|
|
|
+ this.goLogin();
|
|
}, 1500);
|
|
}, 1500);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
@@ -534,7 +564,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
e: common_vendor.t($options.formatPhone($data.userInfo.phone))
|
|
e: common_vendor.t($options.formatPhone($data.userInfo.phone))
|
|
} : {}) : {
|
|
} : {}) : {
|
|
f: common_assets._imports_0$1,
|
|
f: common_assets._imports_0$1,
|
|
- g: common_vendor.o((...args) => $options.wxLogin && $options.wxLogin(...args))
|
|
|
|
|
|
+ g: common_vendor.o((...args) => $options.goLogin && $options.goLogin(...args))
|
|
}, {
|
|
}, {
|
|
h: common_vendor.f($data.menuItems, (item, index, i0) => {
|
|
h: common_vendor.f($data.menuItems, (item, index, i0) => {
|
|
return {
|
|
return {
|