获取音色数据的接口实现,优化AudioPlayer警告

This commit is contained in:
Ran_Chen
2025-04-09 11:00:10 +08:00
parent fe0fb9a884
commit a42ed5c388
5 changed files with 106 additions and 38 deletions
@@ -0,0 +1,28 @@
// timbre.js
import { getServiceUrl } from '../api';
import RequestService from '../httpRequest';
export default {
getVoiceList(params, callback) {
const queryParams = new URLSearchParams({
ttsModelId: params.ttsModelId,
page: params.page || 1,
limit: params.limit || 10,
name: params.name || ''
}).toString();
RequestService.sendRequest()
.url(`${getServiceUrl()}/ttsVoice?${queryParams}`)
.method('GET')
.success((res) => {
RequestService.clearRequestTime();
callback(res.data || []);
})
.fail((err) => {
console.error('获取音色列表失败:', err);
RequestService.reAjaxFun(() => {
this.getVoiceList(params, callback);
});
}).send();
},
}