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