v1.2.1版本,优化调整了很多,整改验收阶段新加字段

This commit is contained in:
王利强
2026-06-13 08:50:51 +08:00
parent 2af9f1fd59
commit 1fe87ec438
591 changed files with 5072 additions and 2706 deletions

View File

@@ -1,6 +1,7 @@
"use strict";
const common_vendor = require("../../common/vendor.js");
const request_request = require("../../request/request.js");
const utils_upload = require("../../utils/upload.js");
const request_three_one_api_info = require("../../request/three_one_api/info.js");
const defaultAvatar = "https://ossweb-img.qq.com/images/lol/web201310/skin/big81005.jpg";
const _sfc_main = {
@@ -10,7 +11,7 @@ const _sfc_main = {
const avatarPreview = common_vendor.ref("");
const userInfo = common_vendor.reactive({
avatar: "",
// 保存相对路径,用于提交
// 七牛完整 URL,用于提交
nickName: "",
phonenumber: "",
email: "",
@@ -39,7 +40,7 @@ const _sfc_main = {
}
} catch (err) {
common_vendor.index.hideLoading();
common_vendor.index.__f__("error", "at pages/personalcenter/edit.vue:111", "获取个人信息失败:", err);
common_vendor.index.__f__("error", "at pages/personalcenter/edit.vue:112", "获取个人信息失败:", err);
}
};
const chooseAvatar = () => {
@@ -54,37 +55,19 @@ const _sfc_main = {
}
});
};
const uploadAvatar = (filePath) => {
common_vendor.index.showLoading({ title: "上传中..." });
common_vendor.index.uploadFile({
url: request_request.baseUrl + "/frontend/attachment/upload",
filePath,
name: "file",
header: {
"Authorization": request_request.getToken()
},
success: (uploadRes) => {
common_vendor.index.hideLoading();
try {
const data = JSON.parse(uploadRes.data);
if (data.code === 0 && data.data) {
userInfo.avatar = data.data.url || data.data;
common_vendor.index.showToast({ title: "上传成功", icon: "success" });
} else {
avatarPreview.value = "";
common_vendor.index.showToast({ title: data.msg || "上传失败", icon: "none" });
}
} catch (e) {
avatarPreview.value = "";
common_vendor.index.showToast({ title: "上传失败", icon: "none" });
}
},
fail: () => {
common_vendor.index.hideLoading();
avatarPreview.value = "";
common_vendor.index.showToast({ title: "上传失败", icon: "none" });
}
});
const uploadAvatar = async (filePath) => {
try {
const { url } = await utils_upload.uploadSingleWithLoading(filePath);
userInfo.avatar = url;
avatarPreview.value = url;
common_vendor.index.showToast({ title: "上传成功", icon: "success" });
} catch (e) {
avatarPreview.value = "";
common_vendor.index.showToast({
title: (e == null ? void 0 : e.msg) || (e == null ? void 0 : e.message) || "上传失败",
icon: "none"
});
}
};
const handleSave = async () => {
if (!userInfo.nickName) {
@@ -99,7 +82,6 @@ const _sfc_main = {
email: userInfo.email,
sex: userInfo.sex,
avatar: userInfo.avatar
// 提交相对路径
};
const res = await request_three_one_api_info.updateProfile(params);
if (res.code === 0) {
@@ -111,7 +93,7 @@ const _sfc_main = {
common_vendor.index.showToast({ title: res.msg || "保存失败", icon: "none" });
}
} catch (err) {
common_vendor.index.__f__("error", "at pages/personalcenter/edit.vue:195", "保存失败:", err);
common_vendor.index.__f__("error", "at pages/personalcenter/edit.vue:176", "保存失败:", err);
common_vendor.index.showToast({ title: "保存失败", icon: "none" });
} finally {
saving.value = false;