学习页面接口联调

This commit is contained in:
yanghang
2025-06-30 20:28:15 +08:00
parent bb821fed27
commit 67bf8f945d
5 changed files with 359 additions and 81 deletions
+25
View File
@@ -62,6 +62,31 @@ export function downloadFile(id) {
});
});
}
// 上传音频 通用
export const commonUploadVoiceFile = (file, url, data = {}, fileKey='voice') => {
const base_url = get_base_url(url);
const token = getToken();
const header = {
"Content-Type": "multipart/form-data; charset=UTF-8",
};
if (token)
header['summary'] = token
return new Promise((resolve, reject) => {
uni.uploadFile({
url: `${base_url}${url}`,
header: header,
filePath: file,
name: fileKey,
formData: data,
success(result) {
resolve(result)
},
fail(error) {
reject(new Error('Upload failed'));
}
});
});
};
// 上传音频 翻译文本
export const uploadVoiceFile = (file) => {
const url = '/trastudy/traStdyInfo/audioTranscriptions';