浏览代码

验证码接口调整

FinalYu 2 年之前
父节点
当前提交
ff925dba38
共有 2 个文件被更改,包括 9 次插入5 次删除
  1. 4 2
      chuanyi_client/src/api/user.js
  2. 5 3
      chuanyi_client/src/views/login.vue

+ 4 - 2
chuanyi_client/src/api/user.js

@@ -5,13 +5,15 @@ import request from "@/utils/request";
  * @param userName
  * @param password
  * @param verifyCode
+ * @param uid
  * @returns {AxiosPromise}
  */
-export function login(userName, password, verifyCode) {
+export function login(userName, password, verifyCode, uid) {
     const data = {
         userName,
         password,
-        verifyCode
+        verifyCode,
+        uid
     }
     return request({
         url: '/user/frontUserLogin',

+ 5 - 3
chuanyi_client/src/views/login.vue

@@ -79,7 +79,8 @@ export default {
         username: "",
         password: "",
         rememberMe: false,
-        code: ""
+        code: "",
+        uid: ""
       },
       loginRules: {
         username: [
@@ -122,7 +123,8 @@ export default {
       getCode().then(res => {
         this.captchaEnabled = res.captchaEnabled === undefined ? true : res.captchaEnabled;
         if (this.captchaEnabled) {
-          this.codeUrl = "data:image/gif;base64," + res.data;
+          this.loginForm.uid = res.data.uid;
+          this.codeUrl = "data:image/gif;base64," + res.data.verifyCode;
         }
       });
     },
@@ -166,7 +168,7 @@ export default {
 
           const pwd = encrypt(this.loginForm.password, this.publicKey)
 
-          login(this.loginForm.username.trim(), pwd, this.loginForm.code).then(result => {
+          login(this.loginForm.username.trim(), pwd, this.loginForm.code, this.loginForm.uid).then(result => {
             console.log(result);
             // this.$router.push({ path: this.redirect || "/index" });
             // this.$router.push("/index");