|
@@ -48,7 +48,7 @@
|
|
<el-form-item prop="account">
|
|
<el-form-item prop="account">
|
|
<el-input
|
|
<el-input
|
|
autocomplete="new-password"
|
|
autocomplete="new-password"
|
|
- placeholder="手机号/身份证号"
|
|
|
|
|
|
+ :placeholder="dualStatus ? '手机号' :'手机号/身份证号'"
|
|
v-model="loginForm.account"
|
|
v-model="loginForm.account"
|
|
@keyup.enter.native="login"
|
|
@keyup.enter.native="login"
|
|
></el-input>
|
|
></el-input>
|
|
@@ -71,6 +71,26 @@
|
|
></i> </el-input
|
|
></i> </el-input
|
|
></el-form-item>
|
|
></el-form-item>
|
|
</div>
|
|
</div>
|
|
|
|
+ <div class="input" v-if="dualStatus">
|
|
|
|
+ <el-form-item prop="code"
|
|
|
|
+ ><el-input
|
|
|
|
+ autocomplete="new-password"
|
|
|
|
+ placeholder="短信验证码"
|
|
|
|
+ v-model="loginForm.code"
|
|
|
|
+ >
|
|
|
|
+ <span
|
|
|
|
+ slot="suffix"
|
|
|
|
+ @click="getLoginSms(1)"
|
|
|
|
+ class="btn"
|
|
|
|
+ >{{
|
|
|
|
+ countDown == 0
|
|
|
|
+ ? "获取验证码"
|
|
|
|
+ : `${countDown}秒重新获取`
|
|
|
|
+ }}</span
|
|
|
|
+ >
|
|
|
|
+ </el-input></el-form-item
|
|
|
|
+ >
|
|
|
|
+ </div>
|
|
<div class="text">
|
|
<div class="text">
|
|
<a @click="state = 2">立即注册</a>
|
|
<a @click="state = 2">立即注册</a>
|
|
<a @click="state = 3">找回密码</a>
|
|
<a @click="state = 3">找回密码</a>
|
|
@@ -109,7 +129,7 @@
|
|
>
|
|
>
|
|
<span
|
|
<span
|
|
slot="suffix"
|
|
slot="suffix"
|
|
- @click="getLoginSms"
|
|
|
|
|
|
+ @click="getLoginSms(2)"
|
|
class="btn"
|
|
class="btn"
|
|
>{{
|
|
>{{
|
|
countDown == 0
|
|
countDown == 0
|
|
@@ -202,7 +222,9 @@
|
|
<div class="checkbox">
|
|
<div class="checkbox">
|
|
<el-form-item prop="read">
|
|
<el-form-item prop="read">
|
|
<div>
|
|
<div>
|
|
- <el-checkbox v-model="registerForm.read">我已认真阅读并同意</el-checkbox>
|
|
|
|
|
|
+ <el-checkbox v-model="registerForm.read"
|
|
|
|
+ >我已认真阅读并同意</el-checkbox
|
|
|
|
+ >
|
|
<!-- <input type="checkbox" v-model="registerForm.read" /> -->
|
|
<!-- <input type="checkbox" v-model="registerForm.read" /> -->
|
|
</div>
|
|
</div>
|
|
|
|
|
|
@@ -869,20 +891,20 @@ export default {
|
|
};
|
|
};
|
|
var validateAccept = (rule, value, callback) => {
|
|
var validateAccept = (rule, value, callback) => {
|
|
if (!value) {
|
|
if (!value) {
|
|
- callback(new Error('请勾选服务协议'))
|
|
|
|
|
|
+ callback(new Error("请勾选服务协议"));
|
|
} else {
|
|
} else {
|
|
callback();
|
|
callback();
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
+ };
|
|
return {
|
|
return {
|
|
state: 1, //1登录 2注册 3找回密码 4绑定学员身份
|
|
state: 1, //1登录 2注册 3找回密码 4绑定学员身份
|
|
tabIndex: 1,
|
|
tabIndex: 1,
|
|
loginForm: {},
|
|
loginForm: {},
|
|
loginSmsForm: {},
|
|
loginSmsForm: {},
|
|
registerForm: {
|
|
registerForm: {
|
|
- tel: '',
|
|
|
|
- code: '',
|
|
|
|
- pwd: '',
|
|
|
|
|
|
+ tel: "",
|
|
|
|
+ code: "",
|
|
|
|
+ pwd: "",
|
|
read: false,
|
|
read: false,
|
|
},
|
|
},
|
|
forgetForm: {},
|
|
forgetForm: {},
|
|
@@ -932,7 +954,13 @@ export default {
|
|
],
|
|
],
|
|
code: [{ required: true, trigger: "blur", message: "请输入验证码" }],
|
|
code: [{ required: true, trigger: "blur", message: "请输入验证码" }],
|
|
pwd: [{ required: true, trigger: "blur", message: "请输入密码" }],
|
|
pwd: [{ required: true, trigger: "blur", message: "请输入密码" }],
|
|
- read: [{ required: true, trigger: ["blur", 'change'], validator: validateAccept },],
|
|
|
|
|
|
+ read: [
|
|
|
|
+ {
|
|
|
|
+ required: true,
|
|
|
|
+ trigger: ["blur", "change"],
|
|
|
|
+ validator: validateAccept,
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
},
|
|
},
|
|
|
|
|
|
bindRules: {
|
|
bindRules: {
|
|
@@ -954,6 +982,7 @@ export default {
|
|
registerPwdShow: false,
|
|
registerPwdShow: false,
|
|
forgetPwdShow: false,
|
|
forgetPwdShow: false,
|
|
showAgreementModal: false,
|
|
showAgreementModal: false,
|
|
|
|
+ dualStatus: false, //是否需要双重校验
|
|
};
|
|
};
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
@@ -961,6 +990,13 @@ export default {
|
|
},
|
|
},
|
|
mounted() {
|
|
mounted() {
|
|
this.state = this.$route.query.state || 1;
|
|
this.state = this.$route.query.state || 1;
|
|
|
|
+ //双重校验
|
|
|
|
+ this.$request.dualAuth().then((res) => {
|
|
|
|
+ this.dualStatus = res.data === "1" ? true : false;
|
|
|
|
+ if(this.dualStatus){
|
|
|
|
+ this.loginRules["account"][0].message = "请输入手机号"
|
|
|
|
+ }
|
|
|
|
+ });
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
...mapMutations(["setUserInfo", "setCurrentRouter"]),
|
|
...mapMutations(["setUserInfo", "setCurrentRouter"]),
|
|
@@ -978,7 +1014,6 @@ export default {
|
|
localStorage.setItem("token", res.data.token);
|
|
localStorage.setItem("token", res.data.token);
|
|
this.$tools.setUuid(new Date().valueOf() + "");
|
|
this.$tools.setUuid(new Date().valueOf() + "");
|
|
if (res.data.full_info) {
|
|
if (res.data.full_info) {
|
|
-
|
|
|
|
this.getInfo();
|
|
this.getInfo();
|
|
} else {
|
|
} else {
|
|
this.user_account = res.data.user_account;
|
|
this.user_account = res.data.user_account;
|
|
@@ -999,6 +1034,9 @@ export default {
|
|
this.islogin = true;
|
|
this.islogin = true;
|
|
let loginForm = JSON.parse(JSON.stringify(this.loginForm));
|
|
let loginForm = JSON.parse(JSON.stringify(this.loginForm));
|
|
loginForm.pwd = this.$tools.encryptor(loginForm.pwd);
|
|
loginForm.pwd = this.$tools.encryptor(loginForm.pwd);
|
|
|
|
+ if(this.dualStatus){
|
|
|
|
+ loginForm.tel = loginForm.account
|
|
|
|
+ }
|
|
this.$request
|
|
this.$request
|
|
.login(loginForm)
|
|
.login(loginForm)
|
|
.then((res) => {
|
|
.then((res) => {
|
|
@@ -1006,7 +1044,6 @@ export default {
|
|
localStorage.setItem("token", res.data.token);
|
|
localStorage.setItem("token", res.data.token);
|
|
this.$tools.setUuid(new Date().valueOf() + "");
|
|
this.$tools.setUuid(new Date().valueOf() + "");
|
|
if (res.data.full_info) {
|
|
if (res.data.full_info) {
|
|
-
|
|
|
|
this.getInfo();
|
|
this.getInfo();
|
|
} else {
|
|
} else {
|
|
this.user_account = res.data.user_account;
|
|
this.user_account = res.data.user_account;
|
|
@@ -1030,8 +1067,8 @@ export default {
|
|
/**
|
|
/**
|
|
* 获取登录短信
|
|
* 获取登录短信
|
|
*/
|
|
*/
|
|
- getLoginSms() {
|
|
|
|
- this.$refs.loginSmsForm.validateField("tel", (valid) => {
|
|
|
|
|
|
+ getLoginSms(int) {
|
|
|
|
+ this.$refs[int === 1 ? 'loginForm' :'loginSmsForm'].validateField(int === 1 ? "account" :"tel", (valid) => {
|
|
if (!valid) {
|
|
if (!valid) {
|
|
if (this.countDown == 0) {
|
|
if (this.countDown == 0) {
|
|
if (this.getLoginCodeLock) {
|
|
if (this.getLoginCodeLock) {
|
|
@@ -1039,7 +1076,7 @@ export default {
|
|
}
|
|
}
|
|
this.getLoginCodeLock = true;
|
|
this.getLoginCodeLock = true;
|
|
this.$request
|
|
this.$request
|
|
- .getLoginSms({ tel: this.loginSmsForm.tel })
|
|
|
|
|
|
+ .getLoginSms({ tel: int === 1 ? this.loginForm.account : this.loginSmsForm.tel })
|
|
.then((res) => {
|
|
.then((res) => {
|
|
this.getLoginCodeLock = false;
|
|
this.getLoginCodeLock = false;
|
|
this.$message({
|
|
this.$message({
|
|
@@ -1056,7 +1093,7 @@ export default {
|
|
}, 1000);
|
|
}, 1000);
|
|
})
|
|
})
|
|
.catch((err) => {
|
|
.catch((err) => {
|
|
- this.$message.error(err.msg)
|
|
|
|
|
|
+ this.$message.error(err.msg);
|
|
this.getLoginCodeLock = false;
|
|
this.getLoginCodeLock = false;
|
|
});
|
|
});
|
|
}
|
|
}
|
|
@@ -1116,7 +1153,6 @@ export default {
|
|
localStorage.setItem("token", res.data.token);
|
|
localStorage.setItem("token", res.data.token);
|
|
this.$tools.setUuid(new Date().valueOf() + "");
|
|
this.$tools.setUuid(new Date().valueOf() + "");
|
|
if (res.data.full_info) {
|
|
if (res.data.full_info) {
|
|
-
|
|
|
|
this.getInfo();
|
|
this.getInfo();
|
|
} else {
|
|
} else {
|
|
this.user_account = res.data.user_account;
|
|
this.user_account = res.data.user_account;
|
|
@@ -1140,15 +1176,15 @@ export default {
|
|
*/
|
|
*/
|
|
getInfo() {
|
|
getInfo() {
|
|
this.$request
|
|
this.$request
|
|
- .getInfo({fromPlat: 2})
|
|
|
|
|
|
+ .getInfo({ fromPlat: 2 })
|
|
.then((res) => {
|
|
.then((res) => {
|
|
this.isRegister = false;
|
|
this.isRegister = false;
|
|
this.islogin = false;
|
|
this.islogin = false;
|
|
this.isloginSms = false;
|
|
this.isloginSms = false;
|
|
this.setUserInfo(res.data);
|
|
this.setUserInfo(res.data);
|
|
- console.log('=========',this.currentRouter);
|
|
|
|
|
|
+ console.log("=========", this.currentRouter);
|
|
if (JSON.stringify(this.currentRouter) != "{}") {
|
|
if (JSON.stringify(this.currentRouter) != "{}") {
|
|
- console.log('zhelisafhsdifgsdiufg')
|
|
|
|
|
|
+ console.log("zhelisafhsdifgsdiufg");
|
|
this.$router.push(this.currentRouter);
|
|
this.$router.push(this.currentRouter);
|
|
this.setCurrentRouter({});
|
|
this.setCurrentRouter({});
|
|
} else {
|
|
} else {
|
|
@@ -1241,7 +1277,7 @@ export default {
|
|
this.$tools.setUuid(new Date().valueOf() + "");
|
|
this.$tools.setUuid(new Date().valueOf() + "");
|
|
if (res.data.full_info) {
|
|
if (res.data.full_info) {
|
|
//信息完善,获取用户信息
|
|
//信息完善,获取用户信息
|
|
-
|
|
|
|
|
|
+
|
|
this.getInfo();
|
|
this.getInfo();
|
|
} else {
|
|
} else {
|
|
//不完善,跳转完善信息页面
|
|
//不完善,跳转完善信息页面
|