Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
lls_program
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
hookehuyr
2026-05-21 20:09:10 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
1e4463d56ee756d0d114cae3ff7c2ea52d2bce00
1e4463d5
1 parent
33dd67a4
filter invalid booth gallery images
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
3 deletions
src/pages/BoothMapGallery/index.vue
src/pages/BoothMapGallery/index.vue
View file @
1e4463d
...
...
@@ -29,14 +29,34 @@ const activityId = ref('')
const isApiSuccess = code => Number(code) === 1
const
mapBoothImage
s = boothImages =>
const
normalizeBoothImageUrl
s = boothImages =>
boothImages
.filter(item => typeof item === 'string' && item.trim() !== '')
.filter(item => typeof item === 'string')
.map(item => item.trim())
.filter(url => url !== '')
const isValidImageUrl = async url => {
try {
await Taro.getImageInfo({ src: url })
return true
} catch (error) {
console.warn('[BoothMapGallery] 过滤非图片展位资源:', url, error)
return false
}
}
const mapBoothImages = async boothImages => {
const normalizedUrls = normalizeBoothImageUrls(boothImages)
const validityList = await Promise.all(normalizedUrls.map(url => isValidImageUrl(url)))
return normalizedUrls
.filter((_, index) => validityList[index])
.map((url, index) => ({
id: `booth-${index}`,
url,
mode: 'widthFix',
}))
}
const fetchBoothImages = async () => {
if (!activityId.value) {
...
...
@@ -62,7 +82,7 @@ const fetchBoothImages = async () => {
return
}
imageList.value = mapBoothImages(result?.data?.booth_images || [])
imageList.value =
await
mapBoothImages(result?.data?.booth_images || [])
} catch (error) {
console.error('[BoothMapGallery] 获取展位图失败:', error)
imageList.value = []
...
...
Please
register
or
login
to post a comment