feat(admin政策页): 针对南亚地区展示不同的图
This commit is contained in:
parent
cf84789961
commit
717075645f
@ -6,30 +6,17 @@
|
||||
color="black"
|
||||
style="box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); z-index: 999"
|
||||
/>
|
||||
<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 v-if="userRegion">
|
||||
<div v-if="userRegion.regionCode == 'SA'">
|
||||
<img v-smart-img :src="imageUrl('SA_Policy')" alt="Policy Image" class="policy-image" />
|
||||
</div>
|
||||
<div v-else>
|
||||
<img v-smart-img :src="imageUrl(getImgName('policy0'))" alt="" class="policy-image" />
|
||||
<img v-smart-img :src="imageUrl(getImgName('policy1'))" alt="" class="policy-image" />
|
||||
<img v-smart-img :src="imageUrl(getImgName('policy2'))" alt="" class="policy-image" />
|
||||
<img v-smart-img :src="imageUrl(getImgName('policy3'))" alt="" class="policy-image" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -39,6 +26,9 @@ import { useI18n } from 'vue-i18n'
|
||||
import { useLangStore } from '@/stores/lang'
|
||||
import { getPngUrl } from '@/config/imagePaths.js'
|
||||
import { preloadImages } from '@/utils/image/imagePreloader.js'
|
||||
import { getUserId } from '@/utils/userStore.js'
|
||||
|
||||
import { getRegionByUserId } from '@/api/wallet.js'
|
||||
|
||||
import GeneralHeader from '@/components/GeneralHeader.vue'
|
||||
|
||||
@ -57,32 +47,30 @@ const currentLangType = computed(() => {
|
||||
return langStore.selectedLang?.type || 'en'
|
||||
})
|
||||
|
||||
const policyImgUrl = ref('') //政策图
|
||||
const userRegion = ref(null) // 区域代码
|
||||
|
||||
// 预加载关键图片
|
||||
const preloadCriticalImages = () => {
|
||||
const criticalImages = [
|
||||
imageUrl('policy0'),
|
||||
imageUrl('policy1'),
|
||||
imageUrl('policy2'),
|
||||
imageUrl('policy3'),
|
||||
imageUrl(getImgName('policy0')),
|
||||
imageUrl(getImgName('policy1')),
|
||||
imageUrl(getImgName('policy2')),
|
||||
imageUrl(getImgName('policy3')),
|
||||
]
|
||||
|
||||
const criticalImages_ar = [
|
||||
imageUrl('policy0_ar'),
|
||||
imageUrl('policy1_ar'),
|
||||
imageUrl('policy2_ar'),
|
||||
imageUrl('policy3_ar'),
|
||||
]
|
||||
preloadImages(criticalImages)
|
||||
}
|
||||
|
||||
if (currentLangType.value == 'en') {
|
||||
preloadImages(criticalImages)
|
||||
} else if (currentLangType.value == 'ar') {
|
||||
preloadImages(criticalImages_ar)
|
||||
// 获取用户所在的区域信息
|
||||
const apiGetRegionByUserId = async () => {
|
||||
const response = await getRegionByUserId(getUserId())
|
||||
if (response.status) {
|
||||
userRegion.value = response.body
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
apiGetRegionByUserId()
|
||||
preloadCriticalImages() //预加载关键图片
|
||||
})
|
||||
</script>
|
||||
@ -97,4 +85,10 @@ onMounted(() => {
|
||||
.policy-container::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.policy-image {
|
||||
display: block;
|
||||
width: 100vw;
|
||||
object-fit: cover;
|
||||
}
|
||||
</style>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user