|
@@ -152,7 +152,6 @@ import { ref, reactive, onMounted } from 'vue';
|
|
|
import { ElMessage } from 'element-plus';
|
|
import { ElMessage } from 'element-plus';
|
|
|
import { Picture } from '@element-plus/icons-vue';
|
|
import { Picture } from '@element-plus/icons-vue';
|
|
|
import { listAdContent, updateAdContent, addAdContent } from '@/api/ad/content';
|
|
import { listAdContent, updateAdContent, addAdContent } from '@/api/ad/content';
|
|
|
-import { listByIds } from '@/api/system/oss';
|
|
|
|
|
import dayjs from 'dayjs';
|
|
import dayjs from 'dayjs';
|
|
|
|
|
|
|
|
const activeTab = ref('triple');
|
|
const activeTab = ref('triple');
|
|
@@ -192,23 +191,7 @@ const loadAdList = async () => {
|
|
|
try {
|
|
try {
|
|
|
const adType = adTypeMap[activeTab.value];
|
|
const adType = adTypeMap[activeTab.value];
|
|
|
const res = await listAdContent({ adType, pageSize: 100 });
|
|
const res = await listAdContent({ adType, pageSize: 100 });
|
|
|
- const rows = res.rows || [];
|
|
|
|
|
- const ossIds = rows.map((item: any) => item.imageUrl).filter((id: any) => id).join(',');
|
|
|
|
|
- if (ossIds) {
|
|
|
|
|
- try {
|
|
|
|
|
- const ossRes = await listByIds(ossIds);
|
|
|
|
|
- const ossMap = new Map(ossRes.data.map((oss: any) => [String(oss.ossId), oss.url]));
|
|
|
|
|
- rows.forEach((item: any) => {
|
|
|
|
|
- if (item.imageUrl && ossMap.has(String(item.imageUrl))) {
|
|
|
|
|
- item.imageOssId = item.imageUrl;
|
|
|
|
|
- item.imageUrl = ossMap.get(String(item.imageUrl));
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- } catch (e) {
|
|
|
|
|
- console.error('获取图片URL失败', e);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- adList.value = rows;
|
|
|
|
|
|
|
+ adList.value = res.rows || [];
|
|
|
selectedIndex.value = null;
|
|
selectedIndex.value = null;
|
|
|
selectedContactIndex.value = null;
|
|
selectedContactIndex.value = null;
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
@@ -238,7 +221,7 @@ const loadFormData = () => {
|
|
|
title: item.title || '',
|
|
title: item.title || '',
|
|
|
remark: item.remark || '',
|
|
remark: item.remark || '',
|
|
|
link: item.link || '',
|
|
link: item.link || '',
|
|
|
- imageUrl: item.imageOssId || item.imageUrl || '',
|
|
|
|
|
|
|
+ imageUrl: item.imageUrl || '',
|
|
|
sort: item.sort || 0,
|
|
sort: item.sort || 0,
|
|
|
status: item.status ?? 1,
|
|
status: item.status ?? 1,
|
|
|
startTime: item.startTime ? dayjs(item.startTime).format('YYYY-MM-DD') : '',
|
|
startTime: item.startTime ? dayjs(item.startTime).format('YYYY-MM-DD') : '',
|