自动登录、重新开始练习、各种币种间的交易转换

master
unclekh 5 years ago
parent 3a43e2e937
commit e8b540b57f
  1. 33
      src/pages/yyyflogin.vue

@ -18,7 +18,9 @@
data() { data() {
return { return {
loading: null loading: null,
tel:null,
pass:null
}; };
}, },
@ -51,7 +53,7 @@
}); });
}, },
endLoading: function () { //使Element loading-close endLoading: function () { //使Element loading-close
this.loading.close() this.loading.close();
}, },
parseUrl: function () { parseUrl: function () {
let params = {}; // let params = {}; //
@ -84,17 +86,17 @@
}, },
sign(params) { sign(params) {
signUp(params).then(res => { signUp(params).then(res => {
// console.log(res.data) if (res.data.code === 200) {
if (res.data.code !== 200) { this.login();
}else{
this.$message.warning(res.data.msg); this.$message.warning(res.data.msg);
} }
}); });
}, },
login(num, pass) { login() {
debugger;
signIn({ signIn({
tel: num, tel: this.tel,
password: pass, password: this.pass,
}).then(res => { }).then(res => {
// console.log(res); // console.log(res);
if (res.data.code === 200) { if (res.data.code === 200) {
@ -103,7 +105,6 @@
// Cookie.set('phoneNum',num) // Cookie.set('phoneNum',num)
// Cookie.set('password',pass) // Cookie.set('password',pass)
// } // }
this.loading = false;
//tokencookie //tokencookie
// 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);
@ -128,8 +129,6 @@
}, },
loginFromYyyf: function (params) { loginFromYyyf: function (params) {
signInYyyf(params).then(res => { signInYyyf(params).then(res => {
debugger;
// console.log(res);
if (res.data.code === 200) { if (res.data.code === 200) {
let status = res.data.data.status; let status = res.data.data.status;
if (status == 1) { if (status == 1) {
@ -138,22 +137,24 @@
localStorage.setItem('yyyfToken', res.data.data.yyyfUserToken); localStorage.setItem('yyyfToken', res.data.data.yyyfUserToken);
let code = res.data.data.code; let code = res.data.data.code;
let tel = res.data.data.tel; this.tel = res.data.data.tel;
let password = res.data.data.password; this.pass = res.data.data.password;
// //
if (code != undefined && code != '') { if (code != undefined && code != '') {
let signParams = { let signParams = {
tel: tel, tel: this.tel,
nickName: res.data.data.nickName, nickName: res.data.data.nickName,
code: res.data.data.code, code: res.data.data.code,
password: password, password: this.pass,
internationalCode: null, internationalCode: null,
invitationCode: '', invitationCode: '',
} }
this.sign(signParams); this.sign(signParams);
}else{
this.login();
} }
this.login(tel, password);
} else { } else {
this.$message.warning({ this.$message.warning({

Loading…
Cancel
Save