feat(管理员政策页): 图片转移到oss上获取
This commit is contained in:
parent
25661819e4
commit
71054567b0
Binary file not shown.
|
Before Width: | Height: | Size: 688 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 683 KiB |
@ -7,7 +7,30 @@
|
|||||||
color="black"
|
color="black"
|
||||||
style="box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); z-index: 999"
|
style="box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); z-index: 999"
|
||||||
/>
|
/>
|
||||||
<img :src="policyImgUrl" alt="" style="display: block; width: 100vw; object-fit: cover" />
|
<img
|
||||||
|
v-smart-img
|
||||||
|
:src="imageUrl(getImgName('policy0'))"
|
||||||
|
alt=""
|
||||||
|
style="width: 100%; display: block"
|
||||||
|
/>
|
||||||
|
<img
|
||||||
|
v-smart-img
|
||||||
|
:src="imageUrl(getImgName('policy1'))"
|
||||||
|
alt=""
|
||||||
|
style="width: 100%; display: block"
|
||||||
|
/>
|
||||||
|
<img
|
||||||
|
v-smart-img
|
||||||
|
:src="imageUrl(getImgName('policy2'))"
|
||||||
|
alt=""
|
||||||
|
style="width: 100%; display: block"
|
||||||
|
/>
|
||||||
|
<img
|
||||||
|
v-smart-img
|
||||||
|
:src="imageUrl(getImgName('policy3'))"
|
||||||
|
alt=""
|
||||||
|
style="width: 100%; display: block"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -15,9 +38,18 @@
|
|||||||
import { computed, onMounted, ref } from 'vue'
|
import { computed, onMounted, ref } from 'vue'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
import { useLangStore } from '@/stores/lang'
|
import { useLangStore } from '@/stores/lang'
|
||||||
|
import { getPngUrl } from '@/config/imagePaths.js'
|
||||||
|
import { preloadImages } from '@/utils/imagePreloader.js'
|
||||||
|
|
||||||
import GeneralHeader from '@/components/GeneralHeader.vue'
|
import GeneralHeader from '@/components/GeneralHeader.vue'
|
||||||
|
|
||||||
|
// 获取OSS图片URL的函数
|
||||||
|
const imageUrl = (filename) => getPngUrl('AdminCenter/Policy/', filename)
|
||||||
|
// 根据语言获取图片名
|
||||||
|
const getImgName = (filename) => {
|
||||||
|
return currentLangType.value === 'ar' ? `${filename}_ar` : filename
|
||||||
|
}
|
||||||
|
|
||||||
const langStore = useLangStore()
|
const langStore = useLangStore()
|
||||||
const { t, locale } = useI18n()
|
const { t, locale } = useI18n()
|
||||||
|
|
||||||
@ -30,22 +62,31 @@ const policyImgUrl = ref('') //政策图
|
|||||||
|
|
||||||
const imgUrl = new URL('/src/assets/icon/arrowBackBlack.png', import.meta.url).href
|
const imgUrl = new URL('/src/assets/icon/arrowBackBlack.png', import.meta.url).href
|
||||||
|
|
||||||
const updateImages = () => {
|
// 预加载关键图片
|
||||||
if (currentLangType.value === 'en') {
|
const preloadCriticalImages = () => {
|
||||||
policyImgUrl.value = new URL(
|
const criticalImages = [
|
||||||
'/src/assets/images/AdminCenter/Policy/policy.png',
|
imageUrl('policy0'),
|
||||||
import.meta.url
|
imageUrl('policy1'),
|
||||||
).href
|
imageUrl('policy2'),
|
||||||
} else if (currentLangType.value === 'ar') {
|
imageUrl('policy3'),
|
||||||
policyImgUrl.value = new URL(
|
]
|
||||||
'/src/assets/images/AdminCenter/Policy/policyAr.png',
|
|
||||||
import.meta.url
|
const criticalImages_ar = [
|
||||||
).href
|
imageUrl('policy0_ar'),
|
||||||
|
imageUrl('policy1_ar'),
|
||||||
|
imageUrl('policy2_ar'),
|
||||||
|
imageUrl('policy3_ar'),
|
||||||
|
]
|
||||||
|
|
||||||
|
if (currentLangType.value == 'en') {
|
||||||
|
preloadImages(criticalImages)
|
||||||
|
} else if (currentLangType.value == 'ar') {
|
||||||
|
preloadImages(criticalImages_ar)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
updateImages()
|
preloadCriticalImages() //预加载关键图片
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user