优化代码

This commit is contained in:
pengxiaolong
2025-08-05 22:05:56 +08:00
parent 3eddd94922
commit 40c3282515
86 changed files with 1700 additions and 399 deletions

View File

@@ -40,7 +40,7 @@ const _sfc_main = {
});
},
// 获取手机号
async getPhoneNumber(e) {
getPhoneNumber(e) {
if (e.detail.code == void 0) {
common_vendor.index.showToast({
title: "登录失败",
@@ -52,39 +52,49 @@ const _sfc_main = {
title: "登录中...",
mask: true
});
const res = await components_request.request({
components_request.request({
url: "user/loginWithPhoneNumber",
method: "POST",
data: {
code: e.detail.code
},
userInfo: false
});
this.info = res;
common_vendor.index.setStorageSync("userinfo", this.info.data.info);
const now = Date.now();
common_vendor.index.setStorageSync("last_clean_time", now);
counter.$patch({ myitem: this.info.data.info });
if (this.info.code === 200) {
if (this.info.data.newAccount) {
common_vendor.index.reLaunch({
url: "/pages/UserInformation/UserInformation"
});
common_vendor.index.hideLoading();
}).then((res) => {
common_vendor.index.hideLoading();
this.info = res;
common_vendor.index.setStorageSync("userinfo", this.info.data.info);
const now = Date.now();
common_vendor.index.setStorageSync("last_clean_time", now);
counter.$patch({ myitem: this.info.data.info });
if (this.info.code === 200) {
if (this.info.data.newAccount) {
common_vendor.index.reLaunch({
url: "/pages/UserInformation/UserInformation"
});
common_vendor.index.hideLoading();
} else {
common_vendor.index.setStorageSync("userinfo", this.info.data.info);
common_vendor.index.setStorageSync("token", res.data.info.token);
components_goEasyTool_tool.goEasylogin(
this.$goeasy,
String(this.info.data.info.id),
this.info.data.info.headerIcon,
this.info.data.info.nickName
);
common_vendor.index.hideLoading();
common_vendor.index.reLaunch({
url: this.lastPage
});
}
} else {
common_vendor.index.setStorageSync("userinfo", this.info.data.info);
components_goEasyTool_tool.goEasylogin(this.$goeasy, String(this.info.data.info.id), this.info.data.info.headerIcon, this.info.data.info.nickName);
common_vendor.index.hideLoading();
common_vendor.index.reLaunch({
url: this.lastPage
common_vendor.index.showToast({
title: "登录失败",
icon: "none"
});
}
} else {
common_vendor.index.showToast({
title: "登录失败",
icon: "none"
});
}
}).catch((err) => {
common_vendor.index.__f__("log", "at pages/login/login.vue:116", err);
});
}
}
};