|
|
@@ -27,6 +27,9 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import { dualFactorLogin } from '@/api/sigon'
|
|
|
+import { encrypt, decrypt } from '@/utils/jsencrypt'
|
|
|
+
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
@@ -52,12 +55,30 @@ export default {
|
|
|
this.$refs.loginForm.validate((valid) => {
|
|
|
if (valid) {
|
|
|
this.loginLoading = true;
|
|
|
- // 模拟登录请求
|
|
|
- setTimeout(() => {
|
|
|
- sessionStorage.setItem("getInfoName", this.loginForm.username);
|
|
|
- this.$router.push('/SignOn');
|
|
|
+ // 加密账号
|
|
|
+ this.loginForm.username = encrypt(this.loginForm.username)
|
|
|
+ // 加密密码
|
|
|
+ this.loginForm.password = encrypt(this.loginForm.password)
|
|
|
+ // 调用登录接口
|
|
|
+ dualFactorLogin(this.loginForm).then(res => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ sessionStorage.setItem("getInfoName", this.loginForm.username);
|
|
|
+ this.$router.push('/SignOn');
|
|
|
+ this.loginLoading = false;
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.message);
|
|
|
+ this.loginLoading = false;
|
|
|
+ }
|
|
|
+ }).catch(() => {
|
|
|
+ this.$message.error(res.message);
|
|
|
this.loginLoading = false;
|
|
|
- }, 500);
|
|
|
+ });
|
|
|
+ // 模拟登录请求
|
|
|
+ // setTimeout(() => {
|
|
|
+ // sessionStorage.setItem("getInfoName", this.loginForm.username);
|
|
|
+ // this.$router.push('/SignOn');
|
|
|
+ // this.loginLoading = false;
|
|
|
+ // }, 500);
|
|
|
}
|
|
|
});
|
|
|
}
|