Merge branch 'main' of https://git.nianxx.cn/zoujing/YGChatCS into fix-109

This commit is contained in:
duanshuwen
2025-10-23 17:46:20 +08:00
26 changed files with 397 additions and 455 deletions

View File

@@ -0,0 +1,32 @@
import { BASE_URL } from "@/request/base/baseUrl";
import { getCurrentConfig } from "@/constant/base";
export const updateImageFile = (file) => {
const url = BASE_URL + "/common/upload";
const token = uni.getStorageSync("token");
const clientId = getCurrentConfig().clientId;
return new Promise((resolve, reject) => {
uni.uploadFile({
url,
filePath: file,
name: "file",
header: {
"Content-Type": "multipart/form-data",
Authorization: `Bearer ${token}`,
clientId: clientId,
},
formData: {
file: "file",
},
success: (uploadFileRes) => {
console.log(uploadFileRes.data);
resolve(uploadFileRes.data);
},
fail: (err) => {
console.error("上传图片失败:", err);
reject(err);
},
});
});
};