|
|
@@ -72,14 +72,14 @@
|
|
|
</el-form>
|
|
|
</div>
|
|
|
|
|
|
- <!-- 微信扫码弹框 -->
|
|
|
- <WechatLoginDialog
|
|
|
- ref="wechatDialog"
|
|
|
- :ticket="loginForm.username"
|
|
|
- :visible.sync="wechatDialogVisible"
|
|
|
- @loginSuccess="handleWechatLoginSuccess"
|
|
|
- :redirect="redirect"
|
|
|
- />
|
|
|
+<!-- <!– 微信扫码弹框 –>-->
|
|
|
+<!-- <WechatLoginDialog-->
|
|
|
+<!-- ref="wechatDialog"-->
|
|
|
+<!-- :ticket="loginForm.username"-->
|
|
|
+<!-- :visible.sync="wechatDialogVisible"-->
|
|
|
+<!-- @loginSuccess="handleWechatLoginSuccess"-->
|
|
|
+<!-- :redirect="redirect"-->
|
|
|
+<!-- />-->
|
|
|
|
|
|
<!-- 底部 -->
|
|
|
<div class="el-login-footer">
|
|
|
@@ -94,14 +94,14 @@ import { getCodeImg } from "@/api/login";
|
|
|
import Cookies from "js-cookie";
|
|
|
import { encrypt, decrypt } from '@/utils/jsencrypt'
|
|
|
import { getFirstLogin } from "@/api/login";
|
|
|
-import WechatLoginDialog from "@/views/WechatLoginDialog";
|
|
|
+// import WechatLoginDialog from "@/views/WechatLoginDialog";
|
|
|
import { setToken } from "@/utils/auth";
|
|
|
import {getConfigByKey} from "@/api/system/config";
|
|
|
import Vue from 'vue'
|
|
|
|
|
|
export default {
|
|
|
name: "Login",
|
|
|
- components: { WechatLoginDialog },
|
|
|
+ // components: { WechatLoginDialog },
|
|
|
data() {
|
|
|
return {
|
|
|
codeUrl: "",
|
|
|
@@ -121,6 +121,9 @@ export default {
|
|
|
tenantCode: "",
|
|
|
},
|
|
|
loginRules: {
|
|
|
+ tenantCode: [
|
|
|
+ { required: true, trigger: "blur", message: "租户编号不能为空" }
|
|
|
+ ],
|
|
|
username: [
|
|
|
{ required: true, trigger: "blur", message: "用户名不能为空" }
|
|
|
],
|
|
|
@@ -178,18 +181,17 @@ export default {
|
|
|
},
|
|
|
checkFirstLogin() {
|
|
|
getFirstLogin().then(res => {
|
|
|
+ this.loading = false;
|
|
|
if (res.code === 200 && res.data) {
|
|
|
- // 将首次登录状态存储到本地
|
|
|
- localStorage.setItem('isFirstLogin', res.data ? 'true' : 'false');
|
|
|
- // 如果是首次登录,跳转到设置密码页面
|
|
|
+ localStorage.setItem('isFirstLogin', 'true');
|
|
|
this.$router.push('/set-password');
|
|
|
} else {
|
|
|
- // 否则进入首页
|
|
|
+ localStorage.setItem('isFirstLogin', 'false');
|
|
|
this.$router.push({ path: this.redirect || "/" });
|
|
|
}
|
|
|
}).catch(() => {
|
|
|
this.loading = false;
|
|
|
- this.getCode();
|
|
|
+ this.$router.push({ path: this.redirect || "/" });
|
|
|
});
|
|
|
},
|
|
|
getCode() {
|
|
|
@@ -241,13 +243,8 @@ export default {
|
|
|
.dispatch("Login", {...this.loginForm, captchaOnOff: this.captchaOnOff})
|
|
|
.then(res => {
|
|
|
if (res.needSms) {
|
|
|
- this.wechatDialogVisible = true;
|
|
|
- // 等 visible 更新后,直接调用弹窗 open()
|
|
|
- this.$nextTick(() => {
|
|
|
- if (this.$refs.wechatDialog) {
|
|
|
- this.$refs.wechatDialog.open(this.loginForm.username);
|
|
|
- }
|
|
|
- });
|
|
|
+ this.loading = false;
|
|
|
+ this.$message.warning('需要短信验证,但验证组件未启用,请联系管理员');
|
|
|
} else {
|
|
|
// 登录成功后检查是否是首次登录
|
|
|
this.checkFirstLogin();
|