diff --git a/src/assets/images/AdminCenter/Policy/policy.png b/src/assets/images/AdminCenter/Policy/policy.png
deleted file mode 100644
index 7f84372..0000000
Binary files a/src/assets/images/AdminCenter/Policy/policy.png and /dev/null differ
diff --git a/src/assets/images/AdminCenter/Policy/policyAr.png b/src/assets/images/AdminCenter/Policy/policyAr.png
deleted file mode 100644
index 0c62b54..0000000
Binary files a/src/assets/images/AdminCenter/Policy/policyAr.png and /dev/null differ
diff --git a/src/views/AdminCenter/policy.vue b/src/views/AdminCenter/policy.vue
index 3e8998a..4e58b0a 100644
--- a/src/views/AdminCenter/policy.vue
+++ b/src/views/AdminCenter/policy.vue
@@ -7,7 +7,30 @@
color="black"
style="box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); z-index: 999"
/>
-
+
+
+
+
@@ -15,9 +38,18 @@
import { computed, onMounted, ref } from 'vue'
import { useI18n } from 'vue-i18n'
import { useLangStore } from '@/stores/lang'
+import { getPngUrl } from '@/config/imagePaths.js'
+import { preloadImages } from '@/utils/imagePreloader.js'
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 { t, locale } = useI18n()
@@ -30,22 +62,31 @@ const policyImgUrl = ref('') //政策图
const imgUrl = new URL('/src/assets/icon/arrowBackBlack.png', import.meta.url).href
-const updateImages = () => {
- if (currentLangType.value === 'en') {
- policyImgUrl.value = new URL(
- '/src/assets/images/AdminCenter/Policy/policy.png',
- import.meta.url
- ).href
- } else if (currentLangType.value === 'ar') {
- policyImgUrl.value = new URL(
- '/src/assets/images/AdminCenter/Policy/policyAr.png',
- import.meta.url
- ).href
+// 预加载关键图片
+const preloadCriticalImages = () => {
+ const criticalImages = [
+ imageUrl('policy0'),
+ imageUrl('policy1'),
+ imageUrl('policy2'),
+ imageUrl('policy3'),
+ ]
+
+ const criticalImages_ar = [
+ 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(() => {
- updateImages()
+ preloadCriticalImages() //预加载关键图片
})