Kaynağa Gözat

项目代码&内容优化

yankun 1 ay önce
ebeveyn
işleme
bed96f7ca7

+ 40 - 1
index.html

@@ -17,6 +17,45 @@
       a=t.getElementsByTagName(n)[0],a.parentNode.insertBefore(u,a))}(window,document,'script');
       twq('config','prkh1');
     </script>
-  <!-- End Twitter conversion tracking base code -->
+    <!-- End Twitter conversion tracking base code -->
+
+    <!-- Twitter conversion tracking event code -->
+    <script type="text/javascript">
+      // Insert Twitter Event ID
+      twq('event', 'tw-prkh1-prkh3', {
+        contents: [ // use this to pass an array of products or content
+          // add all items to the array
+          // use this for the first item
+          {
+            content_type: null,
+            content_id: null,
+            content_name: null,
+            content_price: null,
+            num_items: null,
+            content_group_id: null
+          },
+          // use this for the second item
+          {
+            content_type: null,
+            content_id: null,
+            content_name: null,
+            content_price: null,
+            num_items: null,
+            content_group_id: null
+          }
+        ] 
+      });
+    </script>
+    <!-- End Twitter conversion tracking event code -->
+
+    <!-- Google tag (gtag.js) -->
+    <script async src="https://www.googletagmanager.com/gtag/js?id=AW-17181521664"></script>
+    <script>
+      window.dataLayer = window.dataLayer || [];
+      function gtag(){dataLayer.push(arguments);}
+      gtag('js', new Date());
+    
+      gtag('config', 'AW-17181521664');
+    </script>
   </body>
 </html>

+ 1 - 1
package.json

@@ -5,7 +5,7 @@
   "type": "module",
   "scripts": {
     "dev": "vite",
-    "build": "run-p type-check \"build-only {@}\" --",
+    "build": "vite build",
     "preview": "vite preview",
     "build-only": "vite build",
     "type-check": "vue-tsc --build",

+ 3 - 1
src/App.vue

@@ -4,7 +4,9 @@ import { RouterView } from 'vue-router'
 import useSystemStore from '@/stores/useSystemStore'
 
 const systemStore = useSystemStore()
-const { updateScreenWidth } = systemStore
+const { updateScreenWidth, fetchLocaleList } = systemStore
+
+fetchLocaleList()
 
 onMounted(() => {
   window.addEventListener('resize', onWindowResize)

+ 9 - 0
src/apis/system.ts

@@ -0,0 +1,9 @@
+import request from '@/utils/request'
+
+
+
+export const getLocaleListApi = (params: Object) => request({
+  url: '/third/rate/list',
+  method: 'get',
+  params: params
+})

+ 1 - 1
src/locale/index.ts

@@ -16,7 +16,7 @@ const i18n = createI18n({
   fallbackLocale: 'en',
   messages: {
     en: en,
-    "zh-CN": zh,
+    zh: zh,
   },
 });
 

+ 1 - 1
src/locale/lang/en.ts

@@ -47,7 +47,7 @@ export default {
     "如何运作": "How it works",
     "为什么选择 VAVA BUY": "Why Choose VAVA BUY",
     "优势": "Advantage",
-    "在 VAVA BUY 购物": "Shopping at VAVA BUY",
+    "开始在 VAVA BUY 购物": "Start shopping at VAVA BUY",
     "VAVA BUY 是如何工作的": "How VAVA BUY Works",
     "您所在国家/地区的运费和价格": "Shipping & Pricing for your Country",
     "报名": "Sign Up",

+ 1 - 1
src/locale/lang/zh.ts

@@ -47,7 +47,7 @@ export default {
     "如何运作": "如何运作",
     "为什么选择 VAVA BUY": "为什么选择 VAVA BUY",
     "优势": "优势",
-    "在 VAVA BUY 购物": "在 VAVA BUY 购物",
+    "开始在 VAVA BUY 购物": "开始在 VAVA BUY 购物",
     "VAVA BUY 是如何工作的": "VAVA BUY 是如何工作的",
     "您所在国家/地区的运费和价格": "您所在国家/地区的运费和价格",
     "报名": "报名",

+ 0 - 7
src/stores/useFooterStore.ts

@@ -55,13 +55,6 @@ const useFooterStores = defineStore('footer', {
       const route = useRoute()
       const cateId = route.query.cateId ? route.query.cateId : ''
       const id = route.query.id ? route.query.id : ''
-
-      switch(lang) {
-        case 'zh-CN':
-          lang = 'zh'; break;
-        default:
-          break;
-      }
   
       getContentHelpApi({ lang })
         .then((result) => {

+ 32 - 13
src/stores/useSystemStore.ts

@@ -1,20 +1,25 @@
 import { defineStore } from 'pinia'
 import { getCurrentLang } from '@/locale/index'
-
+import { getLocaleListApi } from '@/apis/system'
 
 
 export interface ISystemState {
   locale: string;
-  localeList: ILocale[];
+  localeList: ILangs[];
   screenWidth: number;
 }
 
-
-export interface ILocale {
-  name: string;
-  value: string;
+export interface ILangs {
+  code: string;
+  title: string; 
 }
 
+export interface ICurrencys {
+  code: string;
+  title: string;
+  symbol: string;
+  rate: string | number; 
+}
 
 
 
@@ -22,24 +27,24 @@ const useSystemStore = defineStore('system', {
   state: (): ISystemState => ({
     locale: getCurrentLang() as string,
     localeList: [
-      { name: '简体中文', value: 'zh-CN' },
-      { name: 'English', value: 'en' },
+      { title: '中文(简体)', code: 'zh' },
+      { title: 'English', code: 'en' },
     ],
     screenWidth: 1920
   }),
 
   getters: {
-    localeInfo: function (): ILocale {
-      const result = this.localeList.find((item: ILocale) => (item.value == this.locale))
+    localeInfo: function (): ILangs {
+      const result = this.localeList.find((item: ILangs) => (item.code == this.locale))
       return result ? result : this.localeList[1]
     }
   },
 
   actions: {
-    toggleLocale(localeInfo: ILocale) {
+    toggleLocale(localeInfo: ILangs) {
       if (localeInfo) {
-        this.locale = localeInfo.value
-        localStorage.setItem('locale', localeInfo.value)
+        this.locale = localeInfo.code
+        localStorage.setItem('locale', localeInfo.code)
       }
     },
 
@@ -50,6 +55,20 @@ const useSystemStore = defineStore('system', {
       else {
         this.screenWidth = width
       }
+    },
+
+    fetchLocaleList() {
+      type resultType = Object & {
+        data: { langs: ILangs[] }
+      }
+      getLocaleListApi({})
+        .then((result: resultType) => {
+          console.log('---- result -----', result)
+          this.localeList = result.data.langs && result.data.langs.length > 0 ? result.data.langs : this.localeList
+        })
+        .catch((err: Error) => {
+
+        })
     }
   }
 })

+ 1 - 1
src/utils/request.ts

@@ -22,7 +22,7 @@ http.interceptors.request.use(
       config.headers.token = token
     }
     let lang = localStorage.getItem('locale')
-    lang = lang && lang == 'zh-CN' ? 'zh' : lang
+    lang = lang
     config.headers.lang = lang ? lang : 'en'
     return config
   },

+ 1 - 1
src/views/Layout/modules/Footer/index.vue

@@ -19,7 +19,7 @@
               <span class="footer-friendlink__baseinfo-label"
                 >{{ $t('system.hongkongEmailLabel') }}:
               </span>
-              <span class="footer-friendlink__baseinfo-content">296635202@qq.com </span>
+              <span class="footer-friendlink__baseinfo-content">cbtplatform@vavabuy.com</span>
             </div>
             <div class="footer-friendlink__baseinfo-item">
               <span class="footer-friendlink__baseinfo-label"

+ 11 - 5
src/views/Layout/modules/Header/hooks/useLinkList.ts

@@ -1,6 +1,8 @@
 
 import { reactive, ref, watch } from 'vue'
 import { useRoute, useRouter } from 'vue-router'
+import { storeToRefs } from 'pinia'
+import useSystemStore from '@/stores/useSystemStore'
 
 
 
@@ -9,6 +11,7 @@ export interface ITextLink {
   id?: string | number;
   path?: string;
   url?: string;
+  textColor?: string;
 }
 
 
@@ -24,6 +27,11 @@ function useLinkList() {
 
   const textLinkList2 = reactive<Array<ITextLink>>([
     {
+      text: '开始在 VAVA BUY 购物',
+      url: 'https://vavabuy.net/#/',
+      textColor: '#FF0F23'
+    },
+    {
       text: '如何运作',
       path: '/article/article_details',
       id: 'works',
@@ -38,10 +46,6 @@ function useLinkList() {
       path: '/article/article_details',
       id: 'superiority',
     },
-    {
-      text: '在 VAVA BUY 购物',
-      url: 'https://vavabuy.net'
-    },
   ])
 
   const route = useRoute()
@@ -67,7 +71,9 @@ function useLinkList() {
     if (!linkInfo || (!linkInfo.path && !linkInfo.url)) return
 
     if (linkInfo.url) {
-      window.open(linkInfo.url, '_blank')
+      const systemStore = useSystemStore()
+      const { locale } = storeToRefs(systemStore)
+      window.open(`${linkInfo.url}?lang=${locale.value}`, '_blank')
     }
     else if (linkInfo.id) {
       router.push({

+ 16 - 7
src/views/Layout/modules/Header/index.vue

@@ -31,13 +31,13 @@
           <a-dropdown>
             <div class="language-toggle">
               <img src="@/public/images/icons/language-toggle__icon.png" />
-              <span>{{ localeInfo && localeInfo.name }}</span>
+              <span>{{ localeInfo && localeInfo.title }}</span>
             </div>
             <template #overlay>
               <a-menu>
                 <a-menu-item v-for="(item, index) in systemStore.localeList" :key="index">
                   <div @click="onLocaleChange(item)">
-                    <span class="text_hover_underline">{{ item.name }}</span>
+                    <span class="text_hover_underline">{{ item.title }}</span>
                   </div>
                 </a-menu-item>
               </a-menu>
@@ -47,7 +47,7 @@
             <span>{{ $t('system["登录"]') }}</span>
           </div>
           <div class="download-btn-normal">
-            <a-popconfirm :showCancel="false">
+            <a-popconfirm placement="bottom" :showCancel="false">
               <template #okButton></template>
               <template #icon><question-circle-outlined style="color: red" /></template>
               <template #title>
@@ -101,6 +101,9 @@
                     ? 'text_hover_underline--active'
                     : '',
                 ]"
+                :style="{
+                  color: item.textColor ? item.textColor : '',
+                }"
                 >{{ $t(`textLink["${item.text}"]`) }}</span
               >
             </li>
@@ -169,22 +172,22 @@ import { useI18n } from 'vue-i18n'
 import { storeToRefs } from 'pinia'
 import { MenuOutlined, HomeOutlined } from '@ant-design/icons-vue'
 import useSystemStore from '@/stores/useSystemStore'
-import type { ILocale } from '@/stores/useSystemStore'
+import type { ILangs } from '@/stores/useSystemStore'
 import useLinkList from './hooks/useLinkList'
 
 // 国际化
 const i18n = useI18n()
 const systemStore = useSystemStore()
-const { localeInfo, localeList } = storeToRefs(systemStore)
+const { localeInfo, localeList, locale } = storeToRefs(systemStore)
 
 // 文本链接
 const { textLinkList, textLinkList2, route, router, currentPath, currentId, handleTextLinkClick } =
   useLinkList()
 
 // 语言切换回调
-const onLocaleChange = function (info: ILocale) {
+const onLocaleChange = function (info: ILangs) {
   systemStore.toggleLocale(info)
-  i18n.locale.value = info.value
+  i18n.locale.value = info.code
   const historyLength = window.history.length
   if (historyLength > 1) {
     window.history.go(-historyLength + 2)
@@ -377,6 +380,12 @@ function handleDownload() {
 }
 </style>
 
+<style>
+:where(.css-dev-only-do-not-override-1p3hq3p).ant-popconfirm .ant-popconfirm-message-title {
+  margin-inline-start: 0;
+}
+</style>
+
 <style lang="less" scoped>
 @import url(./css/header@1200.less);
 @import url(./css/header@1024.less);