学习页面接口联调
This commit is contained in:
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user