tangning 1 рік тому
батько
коміт
47b2172ed6

+ 8 - 2
src/i18n/index.ts

@@ -10,11 +10,17 @@ export function loadLang() {
   }
   return langs;
 }
-
+let current = window.navigator.language || window.navigator.userLanguage || null;
+if (current && !/^zh/.test(current)) {
+  console.log('自动获取浏览器语言:' + current);
+  current = 'en-us';
+} else {
+  current = 'zh-cn';
+}
 export const i18n = createI18n({
   // globalInjection: true,
   legacy: false,
-  locale: 'zh-cn',
+  locale: current,
   fallbackLocale: 'zh-cn',
   messages: loadLang(),
 });

+ 20 - 0
src/i18n/lang/en-us.ts

@@ -17,4 +17,24 @@ export const lang: langType = {
     support: 'support',
     cssMultiLanguage: 'CSS picture multi-language',
   },
+  feedback: {
+    upload: 'Upload',
+    title: 'Feedback',
+    title1: 'Problem description',
+    title2: 'Expected solution',
+    title3: 'Industry',
+    title4: 'Hardware products',
+    title5: 'Software product',
+    title6: 'Name',
+    title61: 'Contact',
+    title7: 'Country and Region',
+    title71: 'City',
+    title8: 'Product rating',
+    title9: 'Reason for rating',
+    Submit: 'Submit',
+    settext: 'Please enter ',
+    setselcet: 'Please select ',
+    success: 'Thank you for your feedback. We attach great importance to your opinions and will deal with them as soon as possible after receiving them. Looking forward to providing you with an excellent product experience!',
+    fileTips: 'Please upload images or videos, supporting JPG and PNG formats, not exceeding 5MB; MP4 should not exceed 50MB;',
+  }
 };

+ 1 - 0
src/i18n/lang/zh-cn.ts

@@ -34,6 +34,7 @@ export const lang: langType = {
     Submit: '提交',
     settext: '请输入',
     setselcet: '请选择',
+    success: '感谢反馈,我们非常重视您的意见,并将在收到反馈后第一时间处理。期待为您提供出色的产品体验!',
     fileTips: '请上传图片或视频,支持jpg、png格式,不大于5MB;mp4不大于50MB;',
   }
 };

+ 5 - 4
src/views/feedback/index.vue

@@ -2,7 +2,7 @@
   <div class="feedback">
     <div class="feedbackTop">
       <img src="/src/assets/image/logo_4dage 1.svg" alt="" />
-      <div class="title">用户反馈</div>
+      <div class="title">{{ t('feedback.title') }}</div>
     </div>
     <div class="submit bg-white">
       <mcSubmit class="submitMc" ref="submitMc" :columns="columns" @submit="onSubmit" />
@@ -18,16 +18,17 @@
   import { showToast, showSuccessToast } from 'vant';
   import mcSubmit from './mcSubmit.vue';
   import pcSubmit from './pcSubmit.vue';
-import { useRouter } from 'vue-router';
+  import { useRouter } from 'vue-router';
   import axios from 'axios';
   // import useAxiosApi from '/@/utils/useAxiosApi';
   // import { Toast } from '@nutui/nutui';
   import { getAllByTypeId, feedbackAdd } from '/@/api/feedback';
   // import { setLang } from '/@/i18n';
-  // import { useI18n } from 'vue-i18n';
+  import { useI18n } from 'vue-i18n';
   const emit = defineEmits(['setActive']);
   const submitPc = ref(null);
   const submitMc = ref(null);
+  const { t } = useI18n();
   const router = useRouter();
   const userStore = useUserStore();
   const wxOpenId = computed(() => {
@@ -52,7 +53,7 @@ import { useRouter } from 'vue-router';
       } ),
     };
     await feedbackAdd(apiData);
-    showSuccessToast('提交成功');
+    // showSuccessToast('提交成功');
     router.push('/feedbacksuccess');
     formData.problemDesc = '';
     formData.problemDescImgs = [];

+ 5 - 5
src/views/feedback/mcSubmit.vue

@@ -160,12 +160,12 @@
         <van-popup v-model:show="showPicker.country" position="bottom">
           <van-picker :columns="columnsCountry" @confirm="(val) => onConfirm(val, 'country')" @cancel="showPicker.country = false" />
         </van-popup>
-        <div class="myTitle" v-if="formData.country == '中国'"
-          ><span class="number">{{ formData.country == '中国' ? '09' : '08' }}</span
+        <div class="myTitle" v-if="formData.country == '中国' || formData.country == 'China'"
+          ><span class="number">{{ formData.country == '中国' || formData.country == 'China' ? '09' : '08' }}</span
           >{{ t('feedback.title71') }}</div
         >
         <van-field
-          v-if="formData.country == '中国'"
+          v-if="formData.country == '中国' || formData.country == 'China'"
           v-model="formData.city"
           class="zdycell"
           is-link
@@ -185,7 +185,7 @@
           />
         </van-popup>
         <div class="myTitle"
-          ><span class="number">{{ formData.country == '中国' ? '10' : '09' }}</span
+          ><span class="number">{{ formData.country == '中国' || formData.country == 'China' ? '10' : '09' }}</span
           >{{ t('feedback.title8') }}</div
         >
         <van-field name="rate" label="">
@@ -194,7 +194,7 @@
           </template>
         </van-field>
         <div class="myTitle"
-          ><span class="number">{{ formData.country == '中国' ? '11' : '10' }}</span
+          ><span class="number">{{ formData.country == '中国' || formData.country == 'China' ? '11' : '10' }}</span
           >{{ t('feedback.title9') }}</div
         >
         <van-field

+ 4 - 4
src/views/feedback/pcSubmit.vue

@@ -79,23 +79,23 @@
         />
         <!-- <a-cascader v-model:value="formData.countries" :options="options" placeholder="Please select" /> -->
       </a-form-item>
-      <a-form-item v-if="formData.country == '中国'">
+      <a-form-item v-if="formData.country == '中国' || formData.country == 'China'">
         <div class="myTitle" slot="label"
-          ><span class="number">{{ formData.country == '中国' ? '09' : '08' }}</span
+          ><span class="number">{{ formData.country == '中国' || formData.country == 'China' ? '09' : '08' }}</span
           >{{ t('feedback.title71') }}</div
         >
         <a-cascader v-model:value="formData.countries" :options="options" :placeholder="t('feedback.setselcet')" />
       </a-form-item>
       <a-form-item>
         <div class="myTitle" slot="label"
-          ><span class="number">{{ formData.country == '中国' ? '10' : '09' }}</span
+          ><span class="number">{{ formData.country == '中国' || formData.country == 'China' ? '10' : '09' }}</span
           >{{ t('feedback.title8') }}</div
         >
         <van-rate color="#FADB14" size="30" void-color="#D9D9D9" :allow-half="true" v-model="formData.score" :placeholder="t('feedback.setselcet')" />
       </a-form-item>
       <a-form-item>
         <div class="myTitle" slot="label"
-          ><span class="number">{{ formData.country == '中国' ? '11' : '10' }}</span
+          ><span class="number">{{ formData.country == '中国' || formData.country == 'China' ? '11' : '10' }}</span
           >{{ t('feedback.title9') }}</div
         >
         <a-input v-model:value="formData.scoreReason" :placeholder="t('feedback.settext')" />