Browse Source

修改了国际化登录页面及json文件

duanxiaoduan 1 year ago
parent
commit
05aa96fec1
5 changed files with 18 additions and 19 deletions
  1. 2 2
      .env.development
  2. 10 2
      src/i18n.js
  3. 0 5
      src/locales/en.json
  4. 0 5
      src/locales/zh.json
  5. 6 5
      src/views/login/index.vue

+ 2 - 2
.env.development

@@ -9,7 +9,7 @@ ENV = 'development'
 # VUE_APP_BASE_API = 'http://kpttestnt.kptyun.com/'
 # VUE_APP_BASE_API = 'http://tmrwatch.cn/'
 # 测试线
-# VUE_APP_BASE_API = 'http://tmrwatch.cn:8081/'
+VUE_APP_BASE_API = 'http://tmrwatch.cn:8081/'
 
 # VUE_APP_BASE_API = 'http://127.0.0.1:8081/'
 
@@ -18,7 +18,7 @@ ENV = 'development'
 
 
 # 白少杰
-VUE_APP_BASE_API = 'http://192.168.1.77:8081/'
+# VUE_APP_BASE_API = 'http://192.168.1.77:8081/'
 
 # vue-cli uses the VUE_CLI_BABEL_TRANSPILE_MODULES environment variable,
 # to control whether the babel-plugin-dynamic-import-node plugin is enabled.

+ 10 - 2
src/i18n.js

@@ -4,14 +4,22 @@ import EN from '@/lang/en'
 import CN from '@/lang/cn'
 import enLocale from 'element-ui/lib/locale/lang/en'
 import zhLocale from 'element-ui/lib/locale/lang/zh-CN'
+import enlogin from './locales/login-en.json'
+import zhlogin from './locales/login-zh.json'
 
 Vue.use(VueI18n)
 
 const i18n = new VueI18n({
   locale: 'CN', // set locale
   messages: {
-    EN: { ...EN, ...enLocale },
-    CN: { ...CN, ...zhLocale }
+    EN: {
+      ...enLocale,
+      ...enlogin,
+    },
+    CN: {
+      ...zhLocale,
+      ...zhlogin,
+    }
   }
 
   // locale: 'ZH', // 设置默认语言

+ 0 - 5
src/locales/en.json

@@ -1,5 +0,0 @@
-{
-  "login": "log in",
-  "world": "World",
-  "button": "Click Me"
-}

+ 0 - 5
src/locales/zh.json

@@ -1,5 +0,0 @@
-{
-  "login": "用户登录",
-  "world": "世界",
-  "button": "点击我"
-}

+ 6 - 5
src/views/login/index.vue

@@ -5,20 +5,20 @@
         <img src="@/assets/images/logo.png" alt="">
       </div>
       <div class="new-login-r">
-        <div class="title">{{$t('用户登录')}}</div>
+        <div class="title">{{$t('log_in')}}</div>
         <el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form" auto-complete="on" label-position="left">
           <el-form-item prop="username">
             <span class="svg-container">
               <svg-icon icon-class="user" />
             </span>
-            <el-input ref="username" v-model="loginForm.username" placeholder="用户名" name="username" type="text" tabindex="1" auto-complete="on" />
+            <el-input ref="username" v-model="loginForm.username" :placeholder="$t('user_name')" name="username" type="text" tabindex="1" auto-complete="on" />
           </el-form-item>
 
           <el-form-item prop="password" class="password">
             <span class="svg-container">
               <svg-icon icon-class="password" />
             </span>
-            <el-input :key="passwordType" ref="password" v-model="loginForm.password" :type="passwordType" placeholder="密码" name="password" tabindex="2" auto-complete="on" @keyup.enter.native="handleLogin" />
+            <el-input :key="passwordType" ref="password" v-model="loginForm.password" :type="passwordType" :placeholder="$t('password')" name="password" tabindex="2" auto-complete="on" @keyup.enter.native="handleLogin" />
             <span class="show-pwd" @click="showPwd">
               <svg-icon :icon-class="passwordType === 'password' ? 'eye' : 'eye-open'" />
             </span>
@@ -26,7 +26,7 @@
           <el-form-item prop="password" class="rememberPassword">
             <input id="remember-password-checkbox" v-model="rememberPassword" type="checkbox" value="remember-me" @click="doRememberPassword($event)">
             <span for="remember-password-checkbox">
-              记住密码
+              {{$t('remember_password')}}
             </span>
             </input>
           </el-form-item>
@@ -48,7 +48,8 @@
 <script>
 import { validUsername } from '@/utils/validate'
 import Cookies from 'js-cookie'
-import { getToken } from '@/utils/auth'
+import { getToken } from '@/utils/auth'
+import axios from 'axios';
 export default {
   name: 'Login',
   data() {