注册登录

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 + '/';
//登录
export function signIn(data) {
export function signInYyyf(data) {
return request({
method: 'post',
url: Host + 'loginFromYyyf/login',

@ -8,7 +8,8 @@
import {logOut} from '@/api/user';
import Cookie from '@/common/cookie';
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';
export default {
@ -82,20 +83,49 @@
return params;
},
loginFromYyyf: function (params) {
signIn(params).then(res => {
signInYyyf(params).then(res1 => {
// console.log(res);
if (res.data.code === 200) {
//tokencookie
// Cookie.set('token', res.data.data.token);
localStorage.setItem('yyyfToken', res.data.data.yyyfUserToken);
if (res1.data.code === 200) {
let status=res1.data.data.status;
if(status==1){
//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 {
self.$message.warning({
this.$message.warning({
message: res.data.msg,
onClose: function () {
this.closeWindow();

Loading…
Cancel
Save