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

@@ -67,7 +67,8 @@
<script setup>
import { ref, reactive, onMounted } from 'vue';
import { baseUrl, getToken, toImageUrl } from '@/request/request.js';
import { toImageUrl } from '@/request/request.js';
import { uploadSingleWithLoading } from '@/utils/upload.js';
import { getProfileDetail, updateProfile } from '@/request/three_one_api/info.js';
const saving = ref(false);
@@ -75,7 +76,7 @@ const defaultAvatar = 'https://ossweb-img.qq.com/images/lol/web201310/skin/big81
const avatarPreview = ref(''); // 用于显示选择的图片临时预览
const userInfo = reactive({
avatar: '', // 保存相对路径,用于提交
avatar: '', // 七牛完整 URL,用于提交
nickName: '',
phonenumber: '',
email: '',
@@ -128,40 +129,20 @@ const chooseAvatar = () => {
});
};
// 上传头像获取链接
const uploadAvatar = (filePath) => {
uni.showLoading({ title: '上传中...' });
uni.uploadFile({
url: baseUrl + '/frontend/attachment/upload',
filePath: filePath,
name: 'file',
header: {
'Authorization': getToken()
},
success: (uploadRes) => {
uni.hideLoading();
try {
const data = JSON.parse(uploadRes.data);
if (data.code === 0 && data.data) {
// 上传成功,保存相对路径(用于提交)
userInfo.avatar = data.data.url || data.data;
uni.showToast({ title: '上传成功', icon: 'success' });
} else {
avatarPreview.value = ''; // 上传失败,清除预览
uni.showToast({ title: data.msg || '上传失败', icon: 'none' });
}
} catch (e) {
avatarPreview.value = '';
uni.showToast({ title: '上传失败', icon: 'none' });
}
},
fail: () => {
uni.hideLoading();
avatarPreview.value = '';
uni.showToast({ title: '上传失败', icon: 'none' });
}
});
// 上传头像(七牛直传)
const uploadAvatar = async (filePath) => {
try {
const { url } = await uploadSingleWithLoading(filePath);
userInfo.avatar = url;
avatarPreview.value = url;
uni.showToast({ title: '上传成功', icon: 'success' });
} catch (e) {
avatarPreview.value = '';
uni.showToast({
title: e?.msg || e?.message || '上传失败',
icon: 'none'
});
}
};
// 保存
@@ -179,7 +160,7 @@ const handleSave = async () => {
phonenumber: userInfo.phonenumber,
email: userInfo.email,
sex: userInfo.sex,
avatar: userInfo.avatar // 提交相对路径
avatar: userInfo.avatar
};
const res = await updateProfile(params);