浏览代码

🐞 fix(i18n): 翻译按钮展示位置处理

陈雪 3 周之前
父节点
当前提交
1c5437bc54

二进制
src/renderer/assets/earth.png


+ 12 - 9
src/renderer/components/LangTab/index.vue

@@ -1,9 +1,11 @@
 <template>
   <el-dropdown type="primary" @command="handleCommand">
-    <div class="lang-change-btn">
-      <SvgIcon icon-class="earth" class-name="earth"></SvgIcon>
+    <div v-if="size === 'large'" class="lang-change-btn">
+      <img style="width: 24px; height: 24px" src="@/assets/earth.png" alt="" />
+      <SvgIcon icon-class="earth" class-name="svg-icon-earth"></SvgIcon>
       {{ curLang }}
     </div>
+    <img v-else style="width: 20px; height: 20px" src="@/assets/earth.png" alt="" />
     <el-dropdown-menu slot="dropdown">
       <el-dropdown-item v-for="lang in langs" :key="lang.value" :command="lang.value">
         {{ lang.text }}
@@ -21,6 +23,12 @@ export default {
   components: {
     SvgIcon,
   },
+  props: {
+    size: {
+      type: String,
+      default: 'large',
+    },
+  },
   data() {
     return {
       langs: [
@@ -45,7 +53,8 @@ export default {
   },
   computed: {
     curLang() {
-      return localStorage.getItem('lang') || 'zh-CN'
+      const curVal = localStorage.getItem('lang') || 'zh-CN'
+      return this.langs.find(({ value }) => value === curVal).text
     },
   },
   methods: {
@@ -73,14 +82,8 @@ export default {
   height: 54px;
   padding: 0px 16px;
   align-items: center;
-
   flex-shrink: 0;
   border-radius: 8px;
   border: 1px solid var(--e-6-e-6-e-6, #e6e6e6);
 }
-
-.svg-icon-earth {
-  width: 24px;
-  height: 24px;
-}
 </style>

+ 0 - 7
src/renderer/icons/svg/earth.svg

@@ -1,7 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
-  <path fill-rule="evenodd" clip-rule="evenodd" d="M12 22C17.5229 22 22 17.5229 22 12C22 6.47715 17.5229 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5229 6.47715 22 12 22Z" stroke="#333333" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
-  <path d="M2 12H22" stroke="#333333" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
-  <path fill-rule="evenodd" clip-rule="evenodd" d="M12 22C14.2092 22 16 17.5229 16 12C16 6.47715 14.2092 2 12 2C9.79085 2 8 6.47715 8 12C8 17.5229 9.79085 22 12 22Z" stroke="#333333" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
-  <path d="M4.92871 5.07129C6.73836 6.88094 9.23836 8.00024 11.9998 8.00024C14.7612 8.00024 17.2612 6.88094 19.0709 5.07129" stroke="#333333" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
-  <path d="M19.0709 18.9289C17.2612 17.1193 14.7612 16 11.9998 16C9.23836 16 6.73836 17.1193 4.92871 18.9289" stroke="#333333" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
-</svg>

+ 2 - 2
src/renderer/views/cashier/components/settlementDialog.vue

@@ -221,11 +221,11 @@
               </div>
               <div class="item">
                 <div class="head">{{ $t('shou-ji-hao') }}:</div>
-                <div class="value">{{ memberInfo.mobile ? memberInfo.mobile : $('zan-wu') }}</div>
+                <div class="value">{{ memberInfo.mobile ? memberInfo.mobile : $t('zan-wu') }}</div>
               </div>
               <div class="item">
                 <div class="head">{{ $t('hui-yuan-hao') }}:</div>
-                <div class="value">{{ memberInfo.userNo ? memberInfo.userNo : $('zan-wu') }}</div>
+                <div class="value">{{ memberInfo.userNo ? memberInfo.userNo : $t('zan-wu') }}</div>
               </div>
               <div class="item">
                 <div class="head">{{ $t('ke-yong-yu-e') }}:</div>

+ 6 - 1
src/renderer/views/cashier/index.vue

@@ -13,7 +13,9 @@
         <div class="left-side">
           <div class="logo">
             <!-- <i class="logout el-icon-d-arrow-left" @click="logout"></i> -->
-            <div class="title">{{ $t('cashierDesk') }}</div>
+            <div class="title">
+              {{ $t('cashierDesk') }}
+            </div>
             <div class="store" v-if="storeInfo">({{ storeInfo.name }})</div>
             <div class="account">{{ $t('hello') }},{{ accountInfo.realName }}!</div>
           </div>
@@ -54,6 +56,7 @@
                 {{ hangNo }}
               </el-button>
             </div>
+            <LangTab style="position: absolute; right: 10px" size="mini"></LangTab>
           </div>
           <div class="carts">
             <div>
@@ -370,6 +373,7 @@ import memberList from './components/memberList'
 import couponConfirm from './components/couponConfirm'
 import noGoodsCashier from './components/noGoodsCashier'
 import bindStaffDialog from './components/bindStaffDialog'
+import LangTab from '@/components/LangTab/index.vue'
 export default {
   name: 'Cashier',
   components: {
@@ -384,6 +388,7 @@ export default {
     couponConfirm,
     noGoodsCashier,
     bindStaffDialog,
+    LangTab,
   },
   data() {
     return {