|
|
@ -19,6 +19,8 @@ export default { |
|
|
|
loading: null, |
|
|
|
loading: null, |
|
|
|
tel: null, |
|
|
|
tel: null, |
|
|
|
pass: null, |
|
|
|
pass: null, |
|
|
|
|
|
|
|
//0 考试 1 练习 2 不计分 |
|
|
|
|
|
|
|
reqType: null, |
|
|
|
}; |
|
|
|
}; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
@ -26,6 +28,7 @@ export default { |
|
|
|
created() { |
|
|
|
created() { |
|
|
|
this.startLoading(); |
|
|
|
this.startLoading(); |
|
|
|
let params = this.parseUrl(); |
|
|
|
let params = this.parseUrl(); |
|
|
|
|
|
|
|
this.reqType = params.reqType; |
|
|
|
//判断是否来自以渔有方 |
|
|
|
//判断是否来自以渔有方 |
|
|
|
if ( |
|
|
|
if ( |
|
|
|
!$.isEmptyObject(params) && |
|
|
|
!$.isEmptyObject(params) && |
|
|
@ -112,7 +115,8 @@ export default { |
|
|
|
//保存登录的token到cookie |
|
|
|
//保存登录的token到cookie |
|
|
|
// Cookie.set('token', res.data.data.token); |
|
|
|
// Cookie.set('token', res.data.data.token); |
|
|
|
localStorage.setItem('token', res.data.data.token); |
|
|
|
localStorage.setItem('token', res.data.data.token); |
|
|
|
|
|
|
|
//重复提交标识 |
|
|
|
|
|
|
|
localStorage.setItem('isSubmit', JSON.stringify(false)); |
|
|
|
//保存登录的用户信息到cookie |
|
|
|
//保存登录的用户信息到cookie |
|
|
|
// Cookie.set('userData', res.data.data); |
|
|
|
// Cookie.set('userData', res.data.data); |
|
|
|
localStorage.setItem('userData', JSON.stringify(res.data.data)); |
|
|
|
localStorage.setItem('userData', JSON.stringify(res.data.data)); |
|
|
@ -125,43 +129,40 @@ export default { |
|
|
|
// 保存邀请码信息 |
|
|
|
// 保存邀请码信息 |
|
|
|
localStorage.setItem('invitationCode', res.data.data.invitationCode); |
|
|
|
localStorage.setItem('invitationCode', res.data.data.invitationCode); |
|
|
|
this.endLoading(); |
|
|
|
this.endLoading(); |
|
|
|
location.href = '/'; |
|
|
|
location.href = '/entry'; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
this.$message.warning(res.data.msg); |
|
|
|
this.$message.warning(res.data.msg); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
loginFromYyyf: function(params) { |
|
|
|
loginFromYyyf: function(params) { |
|
|
|
|
|
|
|
let self = this; |
|
|
|
signInYyyf(params).then(res => { |
|
|
|
signInYyyf(params).then(res => { |
|
|
|
if (res.data.code === 200) { |
|
|
|
if (res.data.code === 200) { |
|
|
|
let status = res.data.data.status; |
|
|
|
let status = res.data.data.status; |
|
|
|
|
|
|
|
localStorage.setItem('yyyfToken', res.data.data.yyyfUserToken); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//0 考试 1 练习 2 不计分 |
|
|
|
|
|
|
|
localStorage.setItem('reqType', self.reqType); |
|
|
|
|
|
|
|
if (self.reqType == 0) { |
|
|
|
|
|
|
|
//考试 保留考试剩余 |
|
|
|
|
|
|
|
localStorage.setItem('remainingTime', res.data.data.remainingTime); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (status == 1) { |
|
|
|
if (status == 1) { |
|
|
|
//保存登录的token到cookie |
|
|
|
//保存登录的token到cookie |
|
|
|
// Cookie.set('token', res.data.data.token); |
|
|
|
// Cookie.set('token', res.data.data.token); |
|
|
|
localStorage.setItem('yyyfToken', res.data.data.yyyfUserToken); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let code = res.data.data.code; |
|
|
|
self.dealLogin(res); |
|
|
|
this.tel = res.data.data.tel; |
|
|
|
|
|
|
|
this.pass = res.data.data.password; |
|
|
|
|
|
|
|
//注册 |
|
|
|
|
|
|
|
if (code != undefined && code != '') { |
|
|
|
|
|
|
|
let signParams = { |
|
|
|
|
|
|
|
tel: this.tel, |
|
|
|
|
|
|
|
nickName: res.data.data.nickName, |
|
|
|
|
|
|
|
code: res.data.data.code, |
|
|
|
|
|
|
|
password: this.pass, |
|
|
|
|
|
|
|
internationalCode: null, |
|
|
|
|
|
|
|
invitationCode: '', |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
this.sign(signParams); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.login(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
this.$message.warning({ |
|
|
|
this.$message.warning({ |
|
|
|
message: res.data.data.msg, |
|
|
|
message: res.data.data.msg, |
|
|
|
onClose: function() { |
|
|
|
onClose: function() { |
|
|
|
this.closeWindow(); |
|
|
|
if (status == 3) { |
|
|
|
|
|
|
|
self.dealLogin(res); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
self.closeWindow(); |
|
|
|
|
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
@ -169,12 +170,31 @@ export default { |
|
|
|
this.$message.warning({ |
|
|
|
this.$message.warning({ |
|
|
|
message: res.data.msg, |
|
|
|
message: res.data.msg, |
|
|
|
onClose: function() { |
|
|
|
onClose: function() { |
|
|
|
this.closeWindow(); |
|
|
|
self.closeWindow(); |
|
|
|
}, |
|
|
|
}, |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
dealLogin: function(res) { |
|
|
|
|
|
|
|
let code = res.data.data.code; |
|
|
|
|
|
|
|
this.tel = res.data.data.tel; |
|
|
|
|
|
|
|
this.pass = res.data.data.password; |
|
|
|
|
|
|
|
//注册 |
|
|
|
|
|
|
|
if (code != undefined && code != '') { |
|
|
|
|
|
|
|
let signParams = { |
|
|
|
|
|
|
|
tel: this.tel, |
|
|
|
|
|
|
|
nickName: res.data.data.nickName, |
|
|
|
|
|
|
|
code: res.data.data.code, |
|
|
|
|
|
|
|
password: this.pass, |
|
|
|
|
|
|
|
internationalCode: null, |
|
|
|
|
|
|
|
invitationCode: '', |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
this.sign(signParams); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.login(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
closeWindow: function() { |
|
|
|
closeWindow: function() { |
|
|
|
if ( |
|
|
|
if ( |
|
|
|
navigator.userAgent.indexOf('Firefox') != -1 || |
|
|
|
navigator.userAgent.indexOf('Firefox') != -1 || |
|
|
|