优化代码

This commit is contained in:
pengxiaolong
2025-07-29 14:23:27 +08:00
parent 36005c9604
commit 3eddd94922
38 changed files with 4423 additions and 20192 deletions

View File

@@ -12,7 +12,7 @@ const _sfc_main = {
name: "",
id: "",
info: {},
userSig: ""
useravatar: ""
};
},
onLoad(option) {
@@ -21,13 +21,7 @@ const _sfc_main = {
success: (res) => {
this.id = res.data.id;
this.name = res.data.nickName;
this.userinfo = res.data.headerIcon;
}
});
common_vendor.index.getStorage({
key: "userSig",
success: (res) => {
this.userSig = res.data;
this.userinfo = this.useravatar = res.data.headerIcon;
}
});
},
@@ -53,18 +47,14 @@ const _sfc_main = {
title: "修改中...",
mask: true
});
components_postFile.uploadFile({
path: this.userinfo,
name: components_generateFileName.generateFileName()
}).then((res) => {
if (this.useravatar == this.userinfo) {
components_request.request({
url: "user/updateUserInfo",
method: "POST",
data: {
id: this.id,
headerIcon: res.split("/").pop(),
nickName: this.name,
usersig: this.userSig.userSig
headerIcon: this.userinfo.split("/").pop(),
nickName: this.name
},
userInfo: true
}).then((ress) => {
@@ -86,9 +76,44 @@ const _sfc_main = {
});
}
});
}).catch((err) => {
common_vendor.index.__f__("log", "at pages/Setting/Setting.vue:112", err);
});
} else {
components_postFile.uploadFile({
path: this.userinfo,
name: components_generateFileName.generateFileName()
}).then((res) => {
components_request.request({
url: "user/updateUserInfo",
method: "POST",
data: {
id: this.id,
headerIcon: res.split("/").pop(),
nickName: this.name
},
userInfo: true
}).then((ress) => {
common_vendor.index.__f__("log", "at pages/Setting/Setting.vue:112", "修改调用返回", ress);
if (ress.code === 200) {
common_vendor.index.showToast({
title: "修改成功",
icon: "success"
});
common_vendor.index.setStorageSync("userinfo", ress.data.info);
components_goEasyTool_tool.goEasylogin(this.$goeasy, String(ress.data.info.id), ress.data.info.headerIcon, ress.data.info.nickName);
common_vendor.index.hideLoading();
common_vendor.index.navigateBack({
delta: 1
});
} else {
common_vendor.index.showToast({
title: "修改失败",
icon: "none"
});
}
});
}).catch((err) => {
common_vendor.index.__f__("log", "at pages/Setting/Setting.vue:135", "上传失败", err);
});
}
}
}
};