feat:优化混音歌曲管理功能,更新接口调用方式,简化新增和修改混音歌曲的表单字段,增强音乐选择和场景管理功能,改善用户体验。
This commit is contained in:
@@ -189,7 +189,13 @@ export default {
|
||||
// 上传成功回调
|
||||
handleUploadSuccess(res, file) {
|
||||
if (res.code === 200) {
|
||||
this.uploadList.push({ name: res.fileName, url: res.fileName })
|
||||
// 根据新的接口返回格式,data字段包含文件路径
|
||||
let filePath = res.data || res.fileName;
|
||||
// 如果路径不是以http开头,则拼接域名前缀
|
||||
if (filePath && !filePath.startsWith('http://') && !filePath.startsWith('https://')) {
|
||||
filePath = this.baseUrl + filePath;
|
||||
}
|
||||
this.uploadList.push({ name: filePath, url: filePath })
|
||||
this.uploadedSuccessfully()
|
||||
} else {
|
||||
this.number--
|
||||
@@ -228,7 +234,14 @@ export default {
|
||||
let strs = ""
|
||||
separator = separator || ","
|
||||
for (let i in list) {
|
||||
strs += list[i].url + separator
|
||||
if (list[i].url) {
|
||||
// 移除baseUrl前缀,只返回相对路径
|
||||
let url = list[i].url;
|
||||
if (url.startsWith(this.baseUrl)) {
|
||||
url = url.substring(this.baseUrl.length);
|
||||
}
|
||||
strs += url + separator
|
||||
}
|
||||
}
|
||||
return strs != '' ? strs.substr(0, strs.length - 1) : ''
|
||||
}
|
||||
|
||||
@@ -196,7 +196,13 @@ export default {
|
||||
// 上传成功回调
|
||||
handleUploadSuccess(res, file) {
|
||||
if (res.code === 200) {
|
||||
this.uploadList.push({ name: res.fileName, url: res.fileName })
|
||||
// 根据新的接口返回格式,data字段包含图片路径
|
||||
let imagePath = res.data || res.fileName;
|
||||
// 如果路径不是以http开头,则拼接域名前缀
|
||||
if (imagePath && !imagePath.startsWith('http://') && !imagePath.startsWith('https://')) {
|
||||
imagePath = this.baseUrl + imagePath;
|
||||
}
|
||||
this.uploadList.push({ name: imagePath, url: imagePath })
|
||||
this.uploadedSuccessfully()
|
||||
} else {
|
||||
this.number--
|
||||
@@ -240,7 +246,12 @@ export default {
|
||||
separator = separator || ","
|
||||
for (let i in list) {
|
||||
if (list[i].url) {
|
||||
strs += list[i].url.replace(this.baseUrl, "") + separator
|
||||
// 移除baseUrl前缀,只返回相对路径
|
||||
let url = list[i].url;
|
||||
if (url.startsWith(this.baseUrl)) {
|
||||
url = url.substring(this.baseUrl.length);
|
||||
}
|
||||
strs += url + separator
|
||||
}
|
||||
}
|
||||
return strs != '' ? strs.substr(0, strs.length - 1) : ''
|
||||
|
||||
Reference in New Issue
Block a user