Handy_Cao hai 1 ano
pai
achega
8c4d3933a3

+ 1 - 1
public/locales/zh-CN.json

@@ -31,7 +31,6 @@
         "choice1": "请输入关键字",
         "yes": "是",
         "no": "否",
-        "modifyavatar": "修改头像",
         "submitfailure": "提交失败:",
         "requestfailure": "请求失败,点击重新加载"
     },
@@ -95,6 +94,7 @@
         "Withholding": "代扣签约申请",
         "closeall": "全部收起",
         "openall": "全部展开",
+        "modifyavatar": "修改头像",
         "agree": "同意"
     },
     "chart": {

+ 1 - 0
src/packages/mobile/views/mine/setting/Index.vue

@@ -57,4 +57,5 @@ const changeLuanguage = () => {
     /// 设置语言
     localData.setValue('appLanguage', i18n.global.locale)
 }
+
 </script>

+ 18 - 0
src/packages/pc/components/layouts/header/index.vue

@@ -12,6 +12,7 @@
                 </el-badge>
                 <app-icon icon="Tickets" @click="openComponent('report')" />
                 <app-icon icon="Setting" @click="openComponent('setting')" />
+                <span @click="changeLuanguage">{{ i18n.global.locale === 'zh-CN' ? t('mine.setting.chinese') : t('mine.setting.english') }}</span>
                 <!-- <app-icon icon="g-icon-minimize" @click="exitFullSreen" v-if="fullScreen" />
                 <app-icon icon="g-icon-maximize" @click="setFullSreen" v-else /> -->
             </div>
@@ -39,10 +40,12 @@
 <script lang="ts" setup>
 import { ref, onMounted, computed, defineAsyncComponent } from 'vue'
 import { SwitchButton, Unlock, Avatar } from '@element-plus/icons-vue'
+import { ElMessageBox } from 'element-plus'
 import { getFileUrl, diffDays } from '@/filters'
 import { useComponent } from '@/hooks/component'
 import { useLoginStore, useUserStore, useGlobalStore, useNoticeStore, i18n } from '@/stores'
 import { localData } from '@/stores/storage'
+// import enUS from 'vant/es/locale/lang/en-US'
 import eventBus from '@/services/bus'
 import AppIcon from '@pc/components/base/icon/index.vue'
 
@@ -61,8 +64,23 @@ const globalStore = useGlobalStore()
 const userStore = useUserStore()
 const noticeStore = useNoticeStore()
 const fullScreen = ref(false)
+
 const { t } = i18n.global
 
+const changeLuanguage = () => {
+    ElMessageBox.confirm('切换语言更改需要重新登录才生效', t('common.tips'), { confirmButtonText: t('common.ikonw') }).then(() => {
+        if (i18n.global.locale === 'zh-CN') {
+            i18n.global.locale = 'en-US'
+        } else {
+            i18n.global.locale = 'zh-CN'
+        }
+        /// 设置语言
+        localData.setValue('appLanguage', i18n.global.locale)
+        /// 重新登出
+        eventBus.$emit('LogoutNotify')
+    })
+}
+
 // 用户头像
 const userAvatar = computed(() => {
     const file = userStore.userInfo?.headurl