修复
This commit is contained in:
@@ -37,8 +37,8 @@
|
||||
<template slot-scope="scope">
|
||||
<el-image
|
||||
style="width: 60px; height: 60px"
|
||||
:src="baseUrl + scope.row.img"
|
||||
:preview-src-list="[baseUrl + scope.row.img]"
|
||||
:src="getImageDisplayUrl(scope.row.img)"
|
||||
:preview-src-list="[getImageDisplayUrl(scope.row.img)]"
|
||||
fit="cover"
|
||||
v-if="scope.row.img"
|
||||
>
|
||||
@@ -385,22 +385,8 @@ export default {
|
||||
}
|
||||
}
|
||||
|
||||
// 确保图片URL正确处理,用于回显
|
||||
if (this.form.img) {
|
||||
// 如果img不是完整URL,则处理为相对路径
|
||||
if (this.form.img.startsWith('http://') || this.form.img.startsWith('https://')) {
|
||||
// 完整URL保持不变
|
||||
} else {
|
||||
// 确保路径格式正确,移除baseUrl前缀(如果有)
|
||||
if (this.form.img.startsWith(baseUrl)) {
|
||||
this.form.img = this.form.img.substring(baseUrl.length);
|
||||
}
|
||||
// 确保路径不以/开头(因为上传组件期望的是相对路径)
|
||||
if (this.form.img.startsWith('/')) {
|
||||
this.form.img = this.form.img.substring(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 图片路径处理:编辑时直接使用数据库中的路径,上传组件会自动处理显示
|
||||
// 不需要额外的路径处理,保持数据库中存储的原始路径
|
||||
|
||||
console.log('修改活动数据处理后:', this.form);
|
||||
this.open = true;
|
||||
@@ -466,8 +452,8 @@ export default {
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
// 获取图片完整URL的方法
|
||||
getImageUrlMethod(imagePath) {
|
||||
// 获取图片显示URL的方法
|
||||
getImageDisplayUrl(imagePath) {
|
||||
if (!imagePath) {
|
||||
return '';
|
||||
}
|
||||
@@ -477,13 +463,8 @@ export default {
|
||||
return imagePath;
|
||||
}
|
||||
|
||||
// 确保路径以/开头
|
||||
if (!imagePath.startsWith('/')) {
|
||||
imagePath = '/' + imagePath;
|
||||
}
|
||||
|
||||
// 返回完整URL
|
||||
return baseUrl + imagePath;
|
||||
// 添加后台请求路径前缀
|
||||
return this.baseUrl + (imagePath.startsWith('/') ? imagePath : '/' + imagePath);
|
||||
},
|
||||
// 验证活动内容只能输入数字
|
||||
validateNumberInput() {
|
||||
|
||||
@@ -473,7 +473,8 @@ export default {
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
this.$modal.confirm('是否确认删除普通歌曲编号为"' + ids + '"的数据项?').then(function() {
|
||||
const musicName = row.name || '选中的音乐';
|
||||
this.$modal.confirm('是否确认删除音乐"' + musicName + '"?').then(function() {
|
||||
return delNormalSong(ids);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
|
||||
Reference in New Issue
Block a user