Handy_Cao 1 سال پیش
والد
کامیت
8edc9668dc

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

@@ -53,6 +53,14 @@
                 </el-form-item>
             </el-form>
         </fieldset>
+        <fieldset class="g-fieldset">
+            <legend class="g-fieldset__legend">其他设置</legend>
+            <el-form ref="formRef" class="el-form--horizontal" label-width="80px">
+                <el-form-item label="语言切换">
+                    <span @click="changeLuanguage">{{ i18n.global.locale === 'zh-CN' ? t('mine.setting.chinese') : t('mine.setting.english') }}</span>
+                </el-form-item>
+            </el-form>
+        </fieldset>
         <template #footer>
             <el-button type="info" @click="resetSettings">{{ t('operation.restore') }}</el-button>
             <el-button type="primary" @click="updateSettings">{{ t('operation.savesetting') }}</el-button>
@@ -65,7 +73,9 @@ import { ref } from 'vue'
 import { ElMessageBox, FormInstance } from 'element-plus'
 import { getBuyOrSellList } from '@/constants/order'
 import { useSettingStore, i18n } from '@/stores'
+import { localData } from '@/stores/storage'
 import AppDrawer from '@pc/components/base/drawer/index.vue'
+import eventBus from '@/services/bus'
 
 const settingStore = useSettingStore()
 const formRef = ref<FormInstance>()
@@ -77,6 +87,20 @@ const onCancel = () => {
     show.value = false
 }
 
+const changeLuanguage = () => {
+    ElMessageBox.confirm(t('user.login.tips6'), 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 updateSettings = () => {
     settingStore.updateSettings(formData.value)
     onCancel()

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

@@ -12,7 +12,6 @@
                 </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>
@@ -40,7 +39,6 @@
 <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'
@@ -67,20 +65,6 @@ const fullScreen = ref(false)
 
 const { t } = i18n.global
 
-const changeLuanguage = () => {
-    ElMessageBox.confirm(t('user.login.tips6'), 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