@@ -90,6 +90,11 @@ export default {
drag: {
type: Boolean,
default: true
+ },
+ // 是否为单图片模式
+ single: {
+ type: Boolean,
+ default: false
}
},
data() {
@@ -115,7 +120,14 @@ export default {
onEnd: (evt) => {
const movedItem = this.fileList.splice(evt.oldIndex, 1)[0]
this.fileList.splice(evt.newIndex, 0, movedItem)
- this.$emit("input", this.fileList.map(f => this.getPureUrl(f.url)))
+
+ // 如果是单图片模式,只发送第一个图片的URL
+ if (this.single) {
+ const firstImage = this.fileList[0];
+ this.$emit("input", firstImage ? this.getPureUrl(firstImage.url) : "");
+ } else {
+ this.$emit("input", this.fileList.map(f => this.getPureUrl(f.url)))
+ }
}
})
})
@@ -126,26 +138,29 @@ export default {
handler(val) {
if (val) {
// 首先将值转为数组
- const list = Array.isArray(val) ? val : this.value.split(',')
+ const list = Array.isArray(val) ? val : (typeof val === 'string' && val.includes(',') ? val.split(',') : [val])
// 然后将数组转为对象数组
- this.fileList = list.map(item => {
+ this.fileList = list.filter(item => item && item.trim()).map(item => {
if (typeof item === "string") {
+ let cleanItem = item.trim()
+ // 清理URL中的多余前缀和字符
+ cleanItem = this.cleanImageUrl(cleanItem)
+
// 如果是完整URL(七牛云或外部链接),直接使用
- if (isExternal(item) || item.startsWith('http://') || item.startsWith('https://')) {
- item = { name: item, url: item }
- } else if (item.indexOf(this.baseUrl) === -1) {
+ if (isExternal(cleanItem) || cleanItem.startsWith('http://') || cleanItem.startsWith('https://')) {
+ return { name: cleanItem, url: cleanItem }
+ } else if (cleanItem && cleanItem.indexOf(this.baseUrl) === -1) {
// 本地相对路径,需要拼接baseUrl
- item = { name: this.baseUrl + item, url: this.baseUrl + item }
+ return { name: this.baseUrl + cleanItem, url: this.baseUrl + cleanItem }
} else {
// 已经是完整路径
- item = { name: item, url: item }
+ return { name: cleanItem, url: cleanItem }
}
}
return item
})
} else {
this.fileList = []
- return []
}
},
deep: true,
@@ -205,6 +220,14 @@ export default {
let fileUrl = res.url || res.fileName;
let fileName = res.fileName;
+ // 清理URL中的多余字符
+ if (fileUrl) {
+ fileUrl = this.cleanImageUrl(fileUrl);
+ }
+ if (fileName) {
+ fileName = this.cleanImageUrl(fileName);
+ }
+
// 如果是七牛云完整URL,直接使用
if (fileUrl && (fileUrl.startsWith('http://') || fileUrl.startsWith('https://'))) {
this.uploadList.push({ name: fileUrl, url: fileUrl })
@@ -240,7 +263,15 @@ export default {
this.fileList = this.fileList.concat(this.uploadList)
this.uploadList = []
this.number = 0
- this.$emit("input", this.fileList.map(f => this.getPureUrl(f.url)))
+
+ // 如果是单图片模式,只发送第一个图片的URL
+ if (this.single) {
+ const firstImage = this.fileList[0];
+ this.$emit("input", firstImage ? this.getPureUrl(firstImage.url) : "");
+ } else {
+ this.$emit("input", this.fileList.map(f => this.getPureUrl(f.url)))
+ }
+
this.$modal.closeLoading()
}
},
@@ -256,6 +287,8 @@ export default {
for (let i in list) {
if (list[i].url) {
let url = list[i].url
+ // 清理URL
+ url = this.cleanImageUrl(url)
// 如果是七牛云完整URL,直接使用;如果是本地URL,去掉baseUrl前缀
if (url.startsWith('http://') || url.startsWith('https://')) {
strs += url + separator
@@ -266,6 +299,37 @@ export default {
}
return strs != '' ? strs.substr(0, strs.length - 1) : ''
},
+ // 清理图片URL,移除多余的前缀和字符
+ cleanImageUrl(url) {
+ if (!url || typeof url !== 'string') return '';
+
+ let cleanUrl = url.trim();
+
+ // 移除/dev-api前缀
+ if (cleanUrl.startsWith('/dev-api')) {
+ cleanUrl = cleanUrl.replace('/dev-api', '');
+ }
+
+ // 移除baseUrl前缀
+ if (cleanUrl.startsWith(this.baseUrl)) {
+ cleanUrl = cleanUrl.replace(this.baseUrl, '');
+ }
+
+ // 清理HTML实体编码
+ cleanUrl = cleanUrl.replace(/"/g, '"');
+ cleanUrl = cleanUrl.replace(/&/g, '&');
+ cleanUrl = cleanUrl.replace(/</g, '<');
+ cleanUrl = cleanUrl.replace(/>/g, '>');
+
+ // 清理多余的引号和方括号
+ cleanUrl = cleanUrl.replace(/^["\[]+|["\]]+$/g, '');
+
+ // 清理多余的斜杠
+ cleanUrl = cleanUrl.replace(/^\/+/, '');
+
+ return cleanUrl;
+ },
+
// 去除baseUrl和/dev-api前缀,返回纯相对路径或外链
getPureUrl(url) {
if (!url) return '';
diff --git a/ruoyi-ui/src/views/system/IntegralProduct/index.vue b/ruoyi-ui/src/views/system/IntegralProduct/index.vue
index 70d69af..9559edc 100644
--- a/ruoyi-ui/src/views/system/IntegralProduct/index.vue
+++ b/ruoyi-ui/src/views/system/IntegralProduct/index.vue
@@ -376,13 +376,37 @@
-
+
-
+
@@ -567,6 +591,8 @@ export default {
skuList: [{ name: "", value: "" }],
specList: [{ name: "", values: [""] }],
skuTable: [],
+ // 标签相关
+ tagInputValue: "",
};
},
created() {
@@ -601,7 +627,8 @@ export default {
sales: null,
stock: null,
status: null,
- tags: null,
+ tags: "[]",
+ tagsArray: [],
cateId: null,
skuType: 1,
sku: "{}",
@@ -698,6 +725,25 @@ export default {
console.warn('解析单规格数据失败:', e);
}
}
+
+ // 处理标签数据
+ if (this.form.tags) {
+ try {
+ // 尝试解析JSON格式的标签
+ if (this.form.tags.startsWith('[') && this.form.tags.endsWith(']')) {
+ this.form.tagsArray = JSON.parse(this.form.tags);
+ } else {
+ // 兼容旧的逗号分隔格式
+ this.form.tagsArray = this.form.tags.split(',').filter(tag => tag.trim());
+ }
+ } catch (e) {
+ console.warn('解析标签数据失败:', e);
+ this.form.tagsArray = [];
+ }
+ } else {
+ this.form.tagsArray = [];
+ }
+
this.open = true;
this.title = "修改积分商品";
});
@@ -707,6 +753,21 @@ export default {
// 设置规格类型
this.form.skuType = this.skuType;
+ // 确保图片字段是字符串格式
+ if (Array.isArray(this.form.image)) {
+ this.form.image = this.form.image.length > 0 ? this.form.image[0] : "";
+ }
+ if (Array.isArray(this.form.images)) {
+ this.form.images = this.form.images.join(',');
+ }
+
+ // 将标签数组转换为JSON字符串格式
+ if (this.form.tagsArray && this.form.tagsArray.length > 0) {
+ this.form.tags = JSON.stringify(this.form.tagsArray);
+ } else {
+ this.form.tags = "[]";
+ }
+ console.log(this.skuType);
// 处理规格信息
if (this.skuType === 2) {
// 多规格模式
@@ -721,25 +782,7 @@ export default {
this.$modal.msgError("规格信息不能为空");
return;
}
- } else {
- // 单规格模式
- if (!this.form.skuName || !this.form.skuValue) {
- this.$modal.msgError("请完善单规格信息");
- return;
- }
- const singleSku = {
- name: this.form.skuName,
- value: this.form.skuValue
- };
- this.form.sku = JSON.stringify(singleSku);
}
-
- // 验证sku不能为空
- if (!this.form.sku || this.form.sku === '{}') {
- this.$modal.msgError("规格信息不能为空");
- return;
- }
-
this.$refs["form"].validate((valid) => {
if (valid) {
if (this.form.id != null) {
@@ -809,6 +852,23 @@ export default {
this.$message.error("修改失败");
}
},
+
+ // 添加标签
+ addTag() {
+ if (this.tagInputValue && this.tagInputValue.trim()) {
+ const tag = this.tagInputValue.trim();
+ // 检查标签是否已存在
+ if (!this.form.tagsArray.includes(tag)) {
+ this.form.tagsArray.push(tag);
+ }
+ this.tagInputValue = "";
+ }
+ },
+
+ // 删除标签
+ removeTag(index) {
+ this.form.tagsArray.splice(index, 1);
+ },
},
};
@@ -822,4 +882,18 @@ export default {
-webkit-appearance: none;
margin: 0;
}
+
+.tags-container {
+ width: 100%;
+}
+
+.tags-list {
+ margin-bottom: 10px;
+ min-height: 32px;
+}
+
+.tag-input-container {
+ display: flex;
+ align-items: center;
+}
diff --git a/ruoyi-ui/src/views/system/Order/components/OrderDetailDialog.vue b/ruoyi-ui/src/views/system/Order/components/OrderDetailDialog.vue
index 1294147..10b743d 100644
--- a/ruoyi-ui/src/views/system/Order/components/OrderDetailDialog.vue
+++ b/ruoyi-ui/src/views/system/Order/components/OrderDetailDialog.vue
@@ -1595,8 +1595,8 @@ export default {
this.$message.success("完成服务成功!");
this.completeServiceDialogVisible = false;
this.completeServiceImages = [];
- // 不关闭页面,刷新数据
- await this.refreshOrderData();
+ // 操作完成后关闭页面
+ this.handleClose();
} else {
this.$message.error("完成服务失败:" + (response.msg || "未知错误"));
}
@@ -1631,8 +1631,8 @@ export default {
if (response.code === 200) {
this.$message.success("接单成功!");
- // 不关闭页面,刷新数据
- await this.refreshOrderData();
+ // 操作完成后关闭页面
+ this.handleClose();
} else {
this.$message.error("接单失败:" + response.msg);
}
@@ -1663,8 +1663,8 @@ export default {
if (response.code === 200) {
this.$message.success("确认到达成功!");
- // 不关闭页面,刷新数据
- await this.refreshOrderData();
+ // 操作完成后关闭页面
+ this.handleClose();
} else {
this.$message.error("确认到达失败:" + response.msg);
}
@@ -1709,8 +1709,8 @@ export default {
this.$message.success("开始服务成功!");
this.startServiceDialogVisible = false;
this.startServiceImages = [];
- // 不关闭页面,刷新数据
- await this.refreshOrderData();
+ // 操作完成后关闭页面
+ this.handleClose();
} else {
this.$message.error("开始服务失败:" + (response.msg || "未知错误"));
}
@@ -1814,8 +1814,8 @@ export default {
this.$message.success("订单已结束");
this.endOrderDialogVisible = false;
this.resetEndOrderForm();
- // 不关闭页面,刷新数据
- await this.refreshOrderData();
+ // 操作完成后关闭页面
+ this.handleClose();
} else {
this.$message.error(
"结束订单失败:" + (response.msg || "未知错误")
@@ -1944,13 +1944,8 @@ export default {
this.changeWorkerDialogVisible = false;
this.selectedWorker = null;
- // 刷新师傅信息
- if (this.orderInfo.workerId) {
- this.loadWorkerInfo();
- }
-
- // 不关闭页面,刷新数据
- await this.refreshOrderData();
+ // 操作完成后关闭页面
+ this.handleClose();
} catch (error) {
console.error("更换师傅失败:", error);
this.$message.error("更换师傅失败:" + (error.message || "未知错误"));
diff --git a/ruoyi-ui/src/views/system/ServiceGoods/index.vue b/ruoyi-ui/src/views/system/ServiceGoods/index.vue
index 3f19a29..4e3107a 100644
--- a/ruoyi-ui/src/views/system/ServiceGoods/index.vue
+++ b/ruoyi-ui/src/views/system/ServiceGoods/index.vue
@@ -1,5 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 组件错误: {{ errorMessage }}
+ 重试
+
+
@@ -9,7 +29,7 @@
:label="group.label"
>
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
@@ -311,10 +331,21 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
@@ -341,7 +372,7 @@
:label="group.label"
>
暂无城市数据
-
-
- 城市列表状态: {{ cityLoading ? '加载中...' : `已加载 ${cityList.length} 个城市` }}
-
- 重新加载
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
可多选城市,不选择则适用于所有城市
@@ -463,7 +501,7 @@
@change="handleSkillChange"
>
{
+ this.$forceUpdate();
+ });
},
watch: {
// 监听技能数组变化,确保UI同步
@@ -987,6 +1037,62 @@ export default {
}
},
methods: {
+ // 获取有效的子分类
+ getValidChildren(children) {
+ console.log('getValidChildren 输入:', children);
+ if (!children || !Array.isArray(children)) {
+ console.log('getValidChildren 返回空数组,原因:', !children ? 'children为空' : 'children不是数组');
+ return [];
+ }
+ const validChildren = children.filter(cate => cate && cate.id);
+ console.log('getValidChildren 输出:', validChildren);
+ return validChildren;
+ },
+ // 获取有效的城市列表
+ getValidCities(cities) {
+ console.log('=== getValidCities 调用 ===');
+ console.log('输入参数:', cities);
+ console.log('输入类型:', typeof cities);
+ console.log('是否为数组:', Array.isArray(cities));
+
+ if (!cities || !Array.isArray(cities)) {
+ console.log('getValidCities 返回空数组,原因:', !cities ? 'cities为空' : 'cities不是数组');
+ return [];
+ }
+
+ console.log('输入数组长度:', cities.length);
+ console.log('输入数组前3项:', cities.slice(0, 3));
+
+ const validCities = cities.filter(city => city && city.id);
+ console.log('过滤后的有效城市:', validCities);
+ console.log('有效城市数量:', validCities.length);
+
+ if (validCities.length > 0) {
+ console.log('有效城市示例:', validCities.slice(0, 3).map(city => ({ id: city.id, title: city.title })));
+ }
+
+ console.log('=== getValidCities 完成 ===');
+ return validCities;
+ },
+ // 获取有效的技能列表
+ getValidSkills(skills) {
+ if (!skills || !Array.isArray(skills)) {
+ return [];
+ }
+ return skills.filter(skill => skill && skill.id);
+ },
+ // 获取有效的工人列表
+ getValidWorkers(workers) {
+ if (!workers || !Array.isArray(workers)) {
+ return [];
+ }
+ return workers.filter(worker => worker && worker.id);
+ },
+ // 处理全局错误
+ handleGlobalError(error) {
+ console.error('全局错误:', error);
+ // 可以在这里添加错误上报逻辑
+ },
/** 查询服务内容列表 */
getList() {
this.loading = true
@@ -994,7 +1100,12 @@ export default {
this.ServiceGoodsList = response.rows
this.total = response.total
this.loading = false
- })
+ }).catch(error => {
+ console.error('获取服务内容列表失败:', error);
+ this.hasError = true;
+ this.errorMessage = '获取服务内容列表失败,请稍后重试';
+ this.loading = false;
+ });
},
// 取消按钮
cancel() {
@@ -1134,9 +1245,18 @@ export default {
this.$set(this.form, 'firstCateId', null);
this.$set(this.form, 'secondCateId', null);
this.$set(this.form, 'cityArray', []); // 初始化城市数组
+
+ // 确保分类和城市数据已加载
+ if (this.serviceCateList.length === 0) {
+ this.getserviceCateList();
+ }
+ if (this.cityList.length === 0) {
+ this.getCityList();
+ }
if (this.siteSkillList.length === 0) {
this.getSiteSkillList();
}
+
this.open = true
this.title = "添加服务内容"
this.handleServiceTypeChange(this.form.servicetype);
@@ -1188,15 +1308,33 @@ export default {
this.reset()
const id = row.id || this.ids
this.getlistworkerdatalist();
+
+ // 确保分类和城市数据已加载
+ if (this.serviceCateList.length === 0) {
+ this.getserviceCateList();
+ }
+ if (this.cityList.length === 0) {
+ this.getCityList();
+ }
+
const skillPromise = this.siteSkillList.length > 0 ?
Promise.resolve(this.siteSkillList) :
this.getSiteSkillList();
+
+ // 确保城市数据已加载完成
+ const cityPromise = this.cityList.length > 0 ?
+ Promise.resolve(this.cityList) :
+ this.getCityList().then(() => this.cityList);
+
Promise.all([
getServiceGoods(id),
skillPromise
]).then(([serviceResponse, skillData]) => {
this.form = serviceResponse.data
console.log('编辑数据:', this.form);
+ console.log('原始城市字段值:', this.form.city);
+ console.log('原始城市字段类型:', typeof this.form.city);
+ console.log('原始城市字段内容:', JSON.stringify(this.form.city));
// 处理问答数据
if (this.form.questions) {
@@ -1305,40 +1443,59 @@ export default {
if (this.form.city) {
try {
let cityArray = [];
+ console.log('=== 城市数据处理开始 ===');
console.log('原始城市数据:', this.form.city, '类型:', typeof this.form.city);
+ console.log('城市数据内容:', JSON.stringify(this.form.city));
if (typeof this.form.city === 'string') {
// 尝试解析JSON格式
try {
const parsedCity = JSON.parse(this.form.city);
+ console.log('JSON解析成功:', parsedCity);
if (Array.isArray(parsedCity)) {
cityArray = parsedCity.map(id => parseInt(id)).filter(id => !isNaN(id));
+ console.log('JSON数组转换成功:', cityArray);
} else {
// 如果不是JSON数组,尝试逗号分隔的字符串
cityArray = this.form.city.split(',').map(id => {
const numId = parseInt(id.trim());
return isNaN(numId) ? null : numId;
}).filter(id => id !== null);
+ console.log('逗号分隔转换成功:', cityArray);
}
} catch (jsonError) {
+ console.log('JSON解析失败,尝试逗号分隔:', jsonError);
// JSON解析失败,尝试逗号分隔的字符串
cityArray = this.form.city.split(',').map(id => {
const numId = parseInt(id.trim());
return isNaN(numId) ? null : numId;
}).filter(id => id !== null);
+ console.log('逗号分隔转换成功:', cityArray);
}
} else if (Array.isArray(this.form.city)) {
// 如果已经是数组,直接使用
cityArray = this.form.city.map(id => parseInt(id)).filter(id => !isNaN(id));
+ console.log('直接数组转换成功:', cityArray);
}
this.$set(this.form, 'cityArray', cityArray);
- console.log('转换后的城市数组:', this.form.cityArray);
+ console.log('最终设置的城市数组:', this.form.cityArray);
+ console.log('=== 城市数据处理完成 ===');
+
+ // 延迟设置城市数组,确保数据绑定正确
+ setTimeout(() => {
+ console.log('延迟后的城市数组:', this.form.cityArray);
+ if (this.form.cityArray && this.form.cityArray.length > 0) {
+ console.log('城市数组已设置,长度:', this.form.cityArray.length);
+ this.$forceUpdate();
+ }
+ }, 100);
} catch (e) {
console.error('城市数据转换错误:', e);
this.$set(this.form, 'cityArray', []);
}
} else {
+ console.log('城市数据为空,设置空数组');
this.$set(this.form, 'cityArray', []);
}
@@ -1451,6 +1608,32 @@ export default {
} else if (!Array.isArray(this.form.imgs)) {
this.form.imgs = [];
}
+
+ // 清理图片URL中的多余前缀和字符
+ if (this.form.icon && typeof this.form.icon === 'string') {
+ this.form.icon = this.cleanImageUrl(this.form.icon);
+ }
+ if (this.form.imgs && Array.isArray(this.form.imgs)) {
+ this.form.imgs = this.form.imgs.map(img => {
+ if (typeof img === 'string') {
+ return this.cleanImageUrl(img);
+ }
+ return img;
+ }).filter(Boolean);
+ }
+
+ // 添加调试信息:检查所有相关数据
+ console.log('=== 编辑表单数据加载完成 ===');
+ console.log('表单城市数组:', this.form.cityArray);
+ console.log('城市列表长度:', this.cityList.length);
+ console.log('城市列表前5项:', this.cityList.slice(0, 5));
+ console.log('getValidCities结果:', this.getValidCities(this.cityList));
+
+ // 强制更新组件以确保数据绑定
+ this.$nextTick(() => {
+ console.log('nextTick后的城市数组:', this.form.cityArray);
+ this.$forceUpdate();
+ });
}).catch(error => {
console.error('编辑数据加载失败:', error);
this.$message.error('编辑数据加载失败,请重试');
@@ -1560,6 +1743,14 @@ export default {
this.form.imgs = this.form.imgs.filter(Boolean).join(',');
}
+ // 清理图片URL中的多余前缀和字符
+ if (this.form.icon && typeof this.form.icon === 'string') {
+ this.form.icon = this.cleanImageUrl(this.form.icon);
+ }
+ if (this.form.imgs && typeof this.form.imgs === 'string') {
+ this.form.imgs = this.cleanImageUrl(this.form.imgs);
+ }
+
// 构造提交数据,避免直接修改 this.form
const submitData = { ...this.form };
// workerids 处理,直接以字符串方式存储
@@ -1616,15 +1807,22 @@ export default {
});
},
getserviceCateList(){
+ console.log('开始获取分类列表...');
// 获取所有分类数据
getAllServiceCateList(1).then(response => {
+ console.log('分类API响应:', response);
this.serviceCateList = response.rows || []
+ console.log('设置分类列表:', this.serviceCateList);
+ console.log('分类列表长度:', this.serviceCateList.length);
this.processServiceCateList()
}).catch(error => {
console.error('获取分类列表失败:', error)
// 降级处理:使用原有接口
selectServiceCateList(1).then(response => {
+ console.log('降级分类API响应:', response);
this.serviceCateList = response.data || []
+ console.log('降级设置分类列表:', this.serviceCateList);
+ console.log('降级分类列表长度:', this.serviceCateList.length);
this.processServiceCateList()
}).catch(err => {
console.error('降级获取分类列表也失败:', err)
@@ -1687,6 +1885,10 @@ export default {
分组数: this.groupedServiceCateList.length,
分组详情: this.groupedServiceCateList
})
+
+ // 添加更多调试信息
+ console.log('groupedServiceCateList 设置完成:', this.groupedServiceCateList);
+ console.log('firstLevelCateList 设置完成:', this.firstLevelCateList);
},
/** 导出按钮操作 */
handleExport() {
@@ -2256,13 +2458,27 @@ export default {
/** 获取城市列表 */
getCityList() {
- console.log('开始获取城市列表...');
+ console.log('=== 开始获取城市列表 ===');
this.cityLoading = true;
getFirstLevelCities().then(response => {
console.log('城市API响应:', response);
+ console.log('响应数据类型:', typeof response);
+ console.log('响应结构:', Object.keys(response));
+
this.cityList = response.rows || [];
console.log('设置城市列表:', this.cityList);
+ console.log('城市列表长度:', this.cityList.length);
+ console.log('城市列表前5项:', this.cityList.slice(0, 5));
+
+ // 验证城市数据的有效性
+ if (this.cityList.length > 0) {
+ const validCities = this.cityList.filter(city => city && city.id && city.title);
+ console.log('有效城市数量:', validCities.length);
+ console.log('有效城市示例:', validCities.slice(0, 3));
+ }
+
this.cityLoading = false;
+ console.log('=== 城市列表获取完成 ===');
}).catch(error => {
console.error("获取城市列表失败:", error);
this.cityLoading = false;
@@ -2320,7 +2536,80 @@ export default {
console.log('删除城市:', cityId, '剩余:', this.form.cityArray);
}
},
- }
+
+ /** 清理图片URL,移除多余的前缀和字符 */
+ cleanImageUrl(url) {
+ if (!url || typeof url !== 'string') return '';
+
+ let cleanUrl = url.trim();
+
+ // 移除/dev-api前缀
+ if (cleanUrl.startsWith('/dev-api')) {
+ cleanUrl = cleanUrl.replace('/dev-api', '');
+ }
+
+ // 移除baseUrl前缀(如果存在)
+ const baseUrl = process.env.VUE_APP_BASE_API;
+ if (baseUrl && cleanUrl.startsWith(baseUrl)) {
+ cleanUrl = cleanUrl.replace(baseUrl, '');
+ }
+
+ // 清理HTML实体编码
+ cleanUrl = cleanUrl.replace(/"/g, '"');
+ cleanUrl = cleanUrl.replace(/&/g, '&');
+ cleanUrl = cleanUrl.replace(/</g, '<');
+ cleanUrl = cleanUrl.replace(/>/g, '>');
+
+ // 清理多余的引号和方括号
+ cleanUrl = cleanUrl.replace(/^["\[]+|["\]]+$/g, '');
+
+ // 清理多余的斜杠
+ cleanUrl = cleanUrl.replace(/^\/+/, '');
+
+ console.log('清理图片URL:', { 原始: url, 清理后: cleanUrl });
+
+ return cleanUrl;
+ },
+ retryLoad() {
+ this.hasError = false;
+ this.errorMessage = '';
+ this.getList();
+ },
+ },
+ mounted() {
+ // 添加错误处理
+ this.$nextTick(() => {
+ try {
+ // 尝试重新注册 Element UI 组件
+ if (this.$options.components) {
+ console.log('组件已正确注册:', Object.keys(this.$options.components));
+ }
+
+ // 检查 el-option 组件是否可用
+ if (this.$options.components['el-option']) {
+ console.log('el-option 组件已注册');
+ } else {
+ console.warn('el-option 组件未注册,尝试手动注册');
+ // 这里可以尝试手动注册组件
+ }
+
+ // 添加全局错误处理器
+ this.$root.$on('error', this.handleGlobalError);
+
+ // 强制刷新组件
+ this.$forceUpdate();
+ } catch (error) {
+ console.error('组件注册检查失败:', error);
+ }
+ });
+ },
+
+ beforeDestroy() {
+ // 移除全局错误处理器
+ if (this.$root) {
+ this.$root.$off('error', this.handleGlobalError);
+ }
+ },
}