|
|
@ -8,7 +8,8 @@ |
|
|
|
import {logOut} from '@/api/user'; |
|
|
|
import {logOut} from '@/api/user'; |
|
|
|
import Cookie from '@/common/cookie'; |
|
|
|
import Cookie from '@/common/cookie'; |
|
|
|
import {FILE_URL} from '@/api/app'; |
|
|
|
import {FILE_URL} from '@/api/app'; |
|
|
|
import {signIn} from '@/api/yyyf'; |
|
|
|
import {signInYyyf} from '@/api/yyyf'; |
|
|
|
|
|
|
|
import {signUp,signIn} from '@/api/user'; |
|
|
|
import {Loading} from 'element-ui'; |
|
|
|
import {Loading} from 'element-ui'; |
|
|
|
|
|
|
|
|
|
|
|
export default { |
|
|
|
export default { |
|
|
@ -82,20 +83,49 @@ |
|
|
|
return params; |
|
|
|
return params; |
|
|
|
}, |
|
|
|
}, |
|
|
|
loginFromYyyf: function (params) { |
|
|
|
loginFromYyyf: function (params) { |
|
|
|
signIn(params).then(res => { |
|
|
|
signInYyyf(params).then(res1 => { |
|
|
|
// console.log(res); |
|
|
|
// console.log(res); |
|
|
|
if (res.data.code === 200) { |
|
|
|
if (res1.data.code === 200) { |
|
|
|
//保存登录的token到cookie |
|
|
|
let status=res1.data.data.status; |
|
|
|
// Cookie.set('token', res.data.data.token); |
|
|
|
if(status==1){ |
|
|
|
localStorage.setItem('yyyfToken', res.data.data.yyyfUserToken); |
|
|
|
//保存登录的token到cookie |
|
|
|
|
|
|
|
// Cookie.set('token', res.data.data.token); |
|
|
|
|
|
|
|
localStorage.setItem('yyyfToken', res1.data.data.yyyfUserToken); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let code=res1.data.data.code; |
|
|
|
|
|
|
|
//注册 |
|
|
|
|
|
|
|
if(code!=undefined && code != ''){ |
|
|
|
|
|
|
|
signUp({ |
|
|
|
|
|
|
|
tel: res1.data.data.tel, |
|
|
|
|
|
|
|
nickName: res1.data.data.nickName, |
|
|
|
|
|
|
|
code: res1.data.data.code, |
|
|
|
|
|
|
|
password: res1.data.data.password, |
|
|
|
|
|
|
|
internationalCode: null, |
|
|
|
|
|
|
|
invitationCode: '', |
|
|
|
|
|
|
|
}).then(res => { |
|
|
|
|
|
|
|
// console.log(res.data) |
|
|
|
|
|
|
|
if (res.data.code === 200) { |
|
|
|
|
|
|
|
this.$router.replace('/signIn'); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.loading = false; |
|
|
|
|
|
|
|
this.$message.warning(res.data.msg); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*this.endLoading() |
|
|
|
|
|
|
|
location.href = '/';*/ |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
this.$message.warning({ |
|
|
|
|
|
|
|
message: res.data.data.msg, |
|
|
|
|
|
|
|
onClose: function () { |
|
|
|
|
|
|
|
this.closeWindow(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//保存登录的用户信息到cookie |
|
|
|
|
|
|
|
// Cookie.set('userData', res.data.data); |
|
|
|
|
|
|
|
//localStorage.setItem('userData', JSON.stringify(res.data.data)); |
|
|
|
|
|
|
|
this.endLoading() |
|
|
|
|
|
|
|
location.href = '/'; |
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
self.$message.warning({ |
|
|
|
this.$message.warning({ |
|
|
|
message: res.data.msg, |
|
|
|
message: res.data.msg, |
|
|
|
onClose: function () { |
|
|
|
onClose: function () { |
|
|
|
this.closeWindow(); |
|
|
|
this.closeWindow(); |
|
|
|