注册登录

master
huan.xu 5 years ago
parent 5e14bf6dd8
commit a970398378
  1. 2
      src/api/yyyf.js
  2. 54
      src/pages/yyyflogin.vue

@ -7,7 +7,7 @@ import {yyyfApi} from './app';
const Host = yyyfApi + '/'; const Host = yyyfApi + '/';
//登录 //登录
export function signIn(data) { export function signInYyyf(data) {
return request({ return request({
method: 'post', method: 'post',
url: Host + 'loginFromYyyf/login', url: Host + 'loginFromYyyf/login',

@ -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) {
//tokencookie let status=res1.data.data.status;
// Cookie.set('token', res.data.data.token); if(status==1){
localStorage.setItem('yyyfToken', res.data.data.yyyfUserToken); //tokencookie
// 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();

Loading…
Cancel
Save