修复前端打包问题
提取基础接口为配置
This commit is contained in:
@@ -341,10 +341,10 @@ const loadImageUrls = async (shops: Shop[]) => {
|
||||
try {
|
||||
// 检查缓存
|
||||
if (!imageIdCache.value[id]) {
|
||||
const response = await adminFileApi.getSignedUrl(Number(id)) as any
|
||||
const response = await adminFileApi.getSignedUrl(Number(id || '0')) as any
|
||||
imageIdCache.value[id] = response
|
||||
}
|
||||
urls.push(imageIdCache.value[id])
|
||||
urls.push(imageIdCache.value[id]!)
|
||||
} catch (error) {
|
||||
console.error('获取签名链接失败:', error)
|
||||
urls.push(DEFAULT_SHOP_IMAGE)
|
||||
@@ -352,9 +352,13 @@ const loadImageUrls = async (shops: Shop[]) => {
|
||||
}
|
||||
}
|
||||
|
||||
shopImageUrls.value[shop.id] = urls
|
||||
if (shop.id !== undefined) {
|
||||
shopImageUrls.value[shop.id] = urls
|
||||
}
|
||||
} else {
|
||||
shopImageUrls.value[shop.id] = []
|
||||
if (shop.id !== undefined) {
|
||||
shopImageUrls.value[shop.id] = []
|
||||
}
|
||||
}
|
||||
|
||||
// 加载Banner图片
|
||||
@@ -367,10 +371,10 @@ const loadImageUrls = async (shops: Shop[]) => {
|
||||
try {
|
||||
// 检查缓存
|
||||
if (!imageIdCache.value[id]) {
|
||||
const response = await adminFileApi.getSignedUrl(Number(id)) as any
|
||||
const response = await adminFileApi.getSignedUrl(Number(id || '0')) as any
|
||||
imageIdCache.value[id] = response
|
||||
}
|
||||
urls.push(imageIdCache.value[id])
|
||||
urls.push(imageIdCache.value[id]!)
|
||||
} catch (error) {
|
||||
console.error('获取签名链接失败:', error)
|
||||
urls.push(DEFAULT_SHOP_IMAGE)
|
||||
@@ -378,21 +382,31 @@ const loadImageUrls = async (shops: Shop[]) => {
|
||||
}
|
||||
}
|
||||
|
||||
shopBannerUrls.value[shop.id] = urls
|
||||
if (shop.id !== undefined) {
|
||||
shopBannerUrls.value[shop.id] = urls
|
||||
}
|
||||
} else {
|
||||
shopBannerUrls.value[shop.id] = []
|
||||
if (shop.id !== undefined) {
|
||||
shopBannerUrls.value[shop.id] = []
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const getShopImages = (shop: Shop | Record<string, any>): string[] => {
|
||||
const shopId = 'id' in shop ? shop.id : (shop as any).id
|
||||
return shopImageUrls.value[shopId] || []
|
||||
if (shopId !== undefined) {
|
||||
return shopImageUrls.value[shopId] || []
|
||||
}
|
||||
return []
|
||||
}
|
||||
|
||||
const getShopBannerImages = (shop: Shop | Record<string, any>): string[] => {
|
||||
const shopId = 'id' in shop ? shop.id : (shop as any).id
|
||||
return shopBannerUrls.value[shopId] || []
|
||||
if (shopId !== undefined) {
|
||||
return shopBannerUrls.value[shopId] || []
|
||||
}
|
||||
return []
|
||||
}
|
||||
|
||||
const fetchShopList = async () => {
|
||||
@@ -567,7 +581,7 @@ const showEditModal = async (record: Shop | Record<string, any>) => {
|
||||
try {
|
||||
// 检查缓存
|
||||
if (!imageIdCache.value[id]) {
|
||||
const response = await adminFileApi.getSignedUrl(Number(id)) as any
|
||||
const response = await adminFileApi.getSignedUrl(Number(id || '0')) as any
|
||||
imageIdCache.value[id] = response
|
||||
}
|
||||
fileList.push({
|
||||
@@ -604,7 +618,7 @@ const showEditModal = async (record: Shop | Record<string, any>) => {
|
||||
try {
|
||||
// 检查缓存
|
||||
if (!imageIdCache.value[id]) {
|
||||
const response = await adminFileApi.getSignedUrl(Number(id)) as any
|
||||
const response = await adminFileApi.getSignedUrl(Number(id || '0')) as any
|
||||
imageIdCache.value[id] = response
|
||||
}
|
||||
fileList.push({
|
||||
@@ -652,10 +666,10 @@ const showViewModal = async (record: Shop | Record<string, any>) => {
|
||||
try {
|
||||
// 检查缓存
|
||||
if (!imageIdCache.value[id]) {
|
||||
const response = await adminFileApi.getSignedUrl(Number(id)) as any
|
||||
const response = await adminFileApi.getSignedUrl(Number(id || '0')) as any
|
||||
imageIdCache.value[id] = response
|
||||
}
|
||||
urls.push(imageIdCache.value[id])
|
||||
urls.push(imageIdCache.value[id]!)
|
||||
} catch (error) {
|
||||
console.error('获取签名链接失败:', error)
|
||||
urls.push(DEFAULT_SHOP_IMAGE)
|
||||
@@ -676,10 +690,10 @@ const showViewModal = async (record: Shop | Record<string, any>) => {
|
||||
try {
|
||||
// 检查缓存
|
||||
if (!imageIdCache.value[id]) {
|
||||
const response = await adminFileApi.getSignedUrl(Number(id)) as any
|
||||
const response = await adminFileApi.getSignedUrl(Number(id || '0')) as any
|
||||
imageIdCache.value[id] = response
|
||||
}
|
||||
urls.push(imageIdCache.value[id])
|
||||
urls.push(imageIdCache.value[id]!)
|
||||
} catch (error) {
|
||||
console.error('获取签名链接失败:', error)
|
||||
urls.push(DEFAULT_SHOP_IMAGE)
|
||||
|
||||
Reference in New Issue
Block a user