Browse Source

增加验证码

李文 4 years ago
parent
commit
59bf759ed6
2 changed files with 13 additions and 13 deletions
  1. 1 1
      public/index.html
  2. 12 12
      src/views/pages/login.vue

+ 1 - 1
public/index.html

@@ -40,7 +40,7 @@
   <% if (process.env.VUE_APP_NODE_ENV === 'dev') { %>
     <script>window.SITE_CONFIG['apiURL'] = 'http://124.225.17.80:8156/api-idaas';</script>
     <script>window.SITE_CONFIG['apiURL'] = 'http://10.110.35.55:9900/api-idaas';</script>
-    <!-- <script>window.SITE_CONFIG['apiURL'] = '/api';</script> -->
+    <!-- <script>window.SITE_CONFIG['apiURL'] = 'http://172.16.124.90:9900/api-idaas';</script> -->
   <% } %>
   <!-- 集成测试环境 -->
   <% if (process.env.VUE_APP_NODE_ENV === 'prod:sit') { %>

+ 12 - 12
src/views/pages/login.vue

@@ -24,10 +24,10 @@
                   </span>
                 </el-input>
               </el-form-item>
-              <!-- <el-form-item prop="captcha">
+              <el-form-item prop="validCode">
                 <el-row :gutter="20">
                   <el-col :span="14">
-                    <el-input v-model="dataForm.captcha" :placeholder="$t('login.captcha')">
+                    <el-input v-model="dataForm.validCode" :placeholder="$t('login.captcha')">
                       <span slot="prefix" class="el-input__icon">
                         <svg class="icon-svg" aria-hidden="true"><use xlink:href="#icon-safetycertificate"></use></svg>
                       </span>
@@ -37,7 +37,7 @@
                     <img :src="captchaPath" @click="getCaptcha()">
                   </el-col>
                 </el-row>
-              </el-form-item> -->
+              </el-form-item>
               <el-form-item>
                 <el-button type="primary" @click="dataFormSubmitHandle()" class="w-percent-100">{{ $t('login.title') }}</el-button>
               </el-form-item>
@@ -61,9 +61,9 @@ export default {
       captchaPath: '',
       dataForm: {
         username: '',
-        password: ''
-        // uuid: '',
-        // captcha: ''
+        password: '',
+        deviceId: '',
+        validCode: ''
       }
     }
   },
@@ -75,21 +75,21 @@ export default {
         ],
         password: [
           { required: true, message: this.$t('validate.required'), trigger: 'blur' }
+        ],
+        validCode: [
+          { required: true, message: this.$t('validate.required'), trigger: 'blur' }
         ]
-        // captcha: [
-        //   { required: true, message: this.$t('validate.required'), trigger: 'blur' }
-        // ]
       }
     }
   },
   created () {
-    // this.getCaptcha()
+    this.getCaptcha()
   },
   methods: {
     // 获取验证码
     getCaptcha () {
-      this.dataForm.uuid = getUUID()
-      this.captchaPath = `${window.SITE_CONFIG['apiURL']}/captcha?uuid=${this.dataForm.uuid}`
+      this.dataForm.deviceId = getUUID()
+      this.captchaPath = `${window.SITE_CONFIG['apiURL']}/validata/code/${this.dataForm.deviceId}`
     },
     // 表单提交
     dataFormSubmitHandle: debounce(function () {