|
@@ -99,10 +99,11 @@
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
<script type="text/ecmascript-6">
|
|
<script type="text/ecmascript-6">
|
|
-import { init, sendSMS, phoneLogin, dingLogin, bindDing } from "../api/loginMG";
|
|
|
|
|
|
+import { init, sendSMS, phoneLogin, accountLogin , dingLogin, bindDing } from "../api/loginMG";
|
|
import { setCookie, getCookie, delCookie } from "../utils/util";
|
|
import { setCookie, getCookie, delCookie } from "../utils/util";
|
|
import BaseRegister from "../components/BaseRegister";
|
|
import BaseRegister from "../components/BaseRegister";
|
|
import md5 from "js-md5";
|
|
import md5 from "js-md5";
|
|
|
|
+
|
|
export default {
|
|
export default {
|
|
name: "login",
|
|
name: "login",
|
|
components: { BaseRegister },
|
|
components: { BaseRegister },
|
|
@@ -140,13 +141,13 @@ export default {
|
|
trigger: "blur"
|
|
trigger: "blur"
|
|
}
|
|
}
|
|
],
|
|
],
|
|
- smsCode: [
|
|
|
|
- {
|
|
|
|
- required: !this.isLoginByPsw,
|
|
|
|
- message: "请输入验证码",
|
|
|
|
- trigger: "blur"
|
|
|
|
- }
|
|
|
|
- ]
|
|
|
|
|
|
+ // smsCode: [
|
|
|
|
+ // {
|
|
|
|
+ // required: !this.isLoginByPsw,
|
|
|
|
+ // message: "请输入验证码",
|
|
|
|
+ // trigger: "blur"
|
|
|
|
+ // }
|
|
|
|
+ // ]
|
|
}
|
|
}
|
|
};
|
|
};
|
|
},
|
|
},
|
|
@@ -157,8 +158,10 @@ export default {
|
|
this.getCode();
|
|
this.getCode();
|
|
|
|
|
|
this.getScanCode();
|
|
this.getScanCode();
|
|
|
|
+
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+
|
|
getScanCode() {
|
|
getScanCode() {
|
|
// 获取钉钉扫码登录后返回的CODE
|
|
// 获取钉钉扫码登录后返回的CODE
|
|
this.dingLoginCode = this.getQueryVariable("code");
|
|
this.dingLoginCode = this.getQueryVariable("code");
|
|
@@ -284,13 +287,35 @@ export default {
|
|
confirmButtonText: "确定"
|
|
confirmButtonText: "确定"
|
|
}
|
|
}
|
|
);
|
|
);
|
|
- this.isLoginLoading = false;
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
});
|
|
} else {
|
|
} else {
|
|
this.$message.error("手机号与验证码不能为空!");
|
|
this.$message.error("手机号与验证码不能为空!");
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ this.isLoginLoading = false
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ /** 访问登录接口 */
|
|
|
|
+ onAccountLogin() {
|
|
|
|
+ let account = this.loginForm.username
|
|
|
|
+ let password = this.loginForm.password
|
|
|
|
+ let captcha = this.loginForm.captcha
|
|
|
|
+ let randCode = this.randomUUID
|
|
|
|
+ if (account && password && captcha) {
|
|
|
|
+ accountLogin({ account:account,password:password,captcha:captcha,randCode:randCode }).then(res => {
|
|
|
|
+ if(res.error){
|
|
|
|
+ this.$message.error(res.error.message)
|
|
|
|
+ }else{
|
|
|
|
+ this.onLoginSuccess(res.result.data)
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ this.$message.error("请将信息填写完整!");
|
|
|
|
+ }
|
|
|
|
+ this.isLoginLoading = false
|
|
},
|
|
},
|
|
|
|
|
|
onLoginSuccess(data) {
|
|
onLoginSuccess(data) {
|
|
@@ -350,8 +375,9 @@ export default {
|
|
submitForm(formName) {
|
|
submitForm(formName) {
|
|
this.$refs[formName].validate(valid => {
|
|
this.$refs[formName].validate(valid => {
|
|
if (valid) {
|
|
if (valid) {
|
|
|
|
+ console.log(this.isLoginByPsw);
|
|
this.isLoginLoading = true;
|
|
this.isLoginLoading = true;
|
|
- this.onPhoneLogin();
|
|
|
|
|
|
+ this.isLoginByPsw ? this.onAccountLogin() : this.onPhoneLogin();
|
|
} else {
|
|
} else {
|
|
// 获取图形验证码
|
|
// 获取图形验证码
|
|
this.getCode();
|
|
this.getCode();
|