Bladeren bron

feat:添加登录,nav的i18n翻译

Mcal 1 week geleden
bovenliggende
commit
36470fa3b3
6 gewijzigde bestanden met toevoegingen van 76 en 34 verwijderingen
  1. 13 9
      src/layout/components/Navbar.vue
  2. 22 2
      src/locales/en.json
  3. 2 2
      src/locales/ru.json
  4. 1 1
      src/locales/sr.json
  5. 22 3
      src/locales/zh.json
  6. 16 17
      src/views/login.vue

+ 13 - 9
src/layout/components/Navbar.vue

@@ -101,15 +101,19 @@ export default {
       this.$store.dispatch('app/toggleSideBar')
     },
     async logout() {
-      this.$confirm('确定注销并退出系统吗?', '提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning'
-      }).then(() => {
-        this.$store.dispatch('LogOut').then(() => {
-          location.href = '/';
-        })
-      }).catch(() => { });
+        this.$confirm(
+            this.$t('nav.confirmLogoutMessage'),
+            this.$t('nav.prompt'),
+            {
+                confirmButtonText: this.$t('nav.confirm'),
+                cancelButtonText: this.$t('nav.cancel'),
+                type: 'warning'
+            }
+        ).then(() => {
+            this.$store.dispatch('LogOut').then(() => {
+                location.href = '/';
+            });
+        }).catch(() => {});
     }
   }
 }

+ 22 - 2
src/locales/en.json

@@ -5,9 +5,29 @@
   "reset": "Reset",
   "phone": "Phone",
   "contact": "Contact",
+  "盼达点餐管理系统": "Panda Ordering Management System",
+  "nav":{
+    "setLayout": "Set Layout",
+    "logout": "Logout",
+    "confirmLogoutMessage": "Are you sure you want to log out of the system?",
+    "prompt": "Prompt",
+    "confirm": "Confirm",
+    "cancel": "Cancel"
+  },
+  "login":{
+      "welcomeMessage": "Welcome to use {systemName}, your small butler for membership marketing such as vouchers, stored-value cards, and punch cards!",
+      "usernamePlaceholder": "Username",
+      "passwordPlaceholder": "Password",
+      "captchaPlaceholder": "Please enter the verification code",
+      "rememberPassword": "Remember password",
+      "loginNow": "Log in now",
+      "loggingIn": "Logging in...",
+      "copyrightMessage": "Copyright © {startYear}-{endYear} <a class=\"link\" href=\"{url}\">{url}</a> All Rights Reserved.",
+      "usernameRequired": "Please enter your username",
+      "passwordRequired": "Please enter your password",
+      "captchaRequired": "Please enter the verification code"
 
-  "nav.setLayout": "Set Layout",
-  "nav.logout": "Logout",
+  },
   "operational": {
     "overview": "Operational Overview",
     "totalTransactionAmount": "Total Transaction Amount (Yuan)",

+ 2 - 2
src/locales/ru.json

@@ -5,7 +5,7 @@
     "nav.logout": "Logout",
     
     "welcome": "Welcome",
-    "greeting": "Hello, {name}!"
-    
+    "greeting": "Hello, {name}!",
+    "盼达点餐管理系统": "Система управления заказами Panda"
     
   }

+ 1 - 1
src/locales/sr.json

@@ -1,3 +1,3 @@
 {
-  
+  "盼达点餐管理系统": "Система управљања нараштанима Panda"
 }

+ 22 - 3
src/locales/zh.json

@@ -1,9 +1,28 @@
 {
   "lang": "中文",
   "curency": "人民币",
-
-  "nav.setLayout": "布局设置",
-  "nav.logout": "退出登录",
+  "盼达点餐管理系统": "盼达点餐管理系统",
+  "nav":{
+    "setLayout": "布局设置",
+    "logout": "退出登录",
+    "confirmLogoutMessage": "确定注销并退出系统吗?",
+    "prompt": "提示",
+    "confirm": "确定",
+    "cancel": "取消"
+  },
+  "login": {
+      "welcomeMessage": "欢迎使用 {systemName},您的卡券、储值卡、计次卡等会员营销小管家!",
+      "usernamePlaceholder": "账号",
+      "passwordPlaceholder": "密码",
+      "captchaPlaceholder": "请输入验证码",
+      "rememberPassword": "记住密码",
+      "loginNow": "立即登录",
+      "loggingIn": "登 录 中...",
+      "copyrightMessage": "Copyright © {startYear}-{endYear} <a class=\"link\" href=\"{url}\">{url}</a> All Rights Reserved.",
+      "usernameRequired": "请输入您的账号",
+      "passwordRequired": "请输入您的密码",
+      "captchaRequired": "请输入验证码"
+  },
   "operational": {
     "overview": "运营概况",
     "totalTransactionAmount": "总交易金额(元)",

+ 16 - 17
src/views/login.vue

@@ -4,7 +4,7 @@
       <div class="caption">
         <h4 class="caption-title">{{ systemName }}</h4>
         <p class="caption-remark">
-          欢迎使用 {{ systemName }},您的卡券、储值卡、计次卡等会员营销小管家!
+          {{ $t('login.welcomeMessage', { systemName: systemName }) }}
         </p>
       </div>
     </div>
@@ -20,7 +20,7 @@
             type="text"
             auto-complete="off"
             clearable
-            placeholder="账号"
+            :placeholder="$t('login.usernamePlaceholder')"
           >
             <svg-icon
               slot="prefix"
@@ -34,7 +34,7 @@
             v-model="loginForm.password"
             type="password"
             auto-complete="off"
-            placeholder="密码"
+            :placeholder="$t('login.passwordPlaceholder')"
             clearable
             @keyup.enter.native="handleLogin"
           >
@@ -49,7 +49,7 @@
           <el-input
             v-model="loginForm.captchaCode"
             auto-complete="off"
-            placeholder="请输入验证码"
+            :placeholder="$t('login.captchaPlaceholder')"
             style="width: 63%"
             clearable
             @keyup.enter.native="handleLogin"
@@ -67,8 +67,9 @@
         <el-checkbox
           v-model="loginForm.rememberMe"
           style="margin: 0px 0px 25px 0px"
-          >记住密码</el-checkbox
         >
+          {{ $t('login.rememberPassword') }}
+        </el-checkbox>
         <el-form-item style="width: 100%">
           <el-button
             :loading="loading"
@@ -77,17 +78,15 @@
             style="width: 100%; line-height: 24px; font-size: 16px"
             @click.native.prevent="handleLogin"
           >
-            <span v-if="!loading">立即登录</span>
-            <span v-else>登 录 中...</span>
+            <span v-if="!loading">{{ $t('login.loginNow') }}</span>
+            <span v-else>{{ $t('login.loggingIn') }}</span>
           </el-button>
         </el-form-item>
       </el-form>
       <div class="copy-right">
-        <span
-          >Copyright © 2022-2024
-          <a class="link" href="https://www.fuint.cn">fuint.cn</a> All Rights
-          Reserved.</span
-        >
+        <span>
+          {{ $t('login.copyrightMessage', { startYear: 2022, endYear: 2024, url: 'https://www.fuint.cn' }) }}
+        </span>
       </div>
     </div>
   </div>
@@ -103,7 +102,7 @@ export default {
   data() {
     return {
       codeUrl: "",
-      systemName: process.env.VUE_APP_TITLE,
+      systemName: this.$t(process.env.VUE_APP_TITLE),
       loginForm: {
         username: "admin",
         password: "123456",
@@ -113,14 +112,14 @@ export default {
       },
       loginRules: {
         username: [
-          { required: true, trigger: "blur", message: "请输入您的账号" },
+          { required: true, trigger: "blur", message: this.$t('login.usernameRequired') },
         ],
         password: [
-          { required: true, trigger: "blur", message: "请输入您的密码" },
+          { required: true, trigger: "blur", message: this.$t('login.passwordRequired') },
         ],
         captchaCode: [
-          { required: true, trigger: "change", message: "请输入验证码" },
-          { min: 4, max: 6, message: "请输入验证码", trigger: "blur" },
+          { required: true, trigger: "change", message: this.$t('login.captchaRequired') },
+          { min: 4, max: 6, message: this.$t('login.captchaRequired'), trigger: "blur" },
         ],
       },
       loading: false,