first save

This commit is contained in:
2025-11-12 15:08:51 +08:00
commit c66fc54821
2885 changed files with 339178 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
import { BASE_URL } from "./CommonValues";
export async function uploadFile(filePath) {
console.log("文件路径", filePath)
if(!filePath) {
uni.showToast({
title: '未选择文件',
icon: 'error'
})
return;
}
const res = await uni.uploadFile({
url: BASE_URL + "/txy/oss/upload", // 请求的服务器URL
filePath: filePath, // 要上传文件资源的路径
name: "file" // 必须填,是服务器端约定的字段名
});
console.log("上传文件结果1", res)
if(res.statusCode != 200) {
uni.showToast({
title: '文件上传失败:system',
icon: 'error'
})
return;
}
const resData = JSON.parse(res.data);
if(resData.statusCode != 200) {
uni.showToast({
title: '文件上传失败:code',
icon: 'error'
})
return;
}
console.log("上传文件结果", resData)
return resData.data
}