diff --git a/src/pages/yyyflogin.vue b/src/pages/yyyflogin.vue index 53f4346..8b28ee4 100644 --- a/src/pages/yyyflogin.vue +++ b/src/pages/yyyflogin.vue @@ -18,7 +18,9 @@ data() { return { - loading: null + loading: null, + tel:null, + pass:null }; }, @@ -51,7 +53,7 @@ }); }, endLoading: function () { //使用Element loading-close 方法 - this.loading.close() + this.loading.close(); }, parseUrl: function () { let params = {}; //定义数组 @@ -84,17 +86,17 @@ }, sign(params) { 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); } }); }, - login(num, pass) { - debugger; + login() { signIn({ - tel: num, - password: pass, + tel: this.tel, + password: this.pass, }).then(res => { // console.log(res); if (res.data.code === 200) { @@ -103,7 +105,6 @@ // Cookie.set('phoneNum',num) // Cookie.set('password',pass) // } - this.loading = false; //保存登录的token到cookie // Cookie.set('token', res.data.data.token); localStorage.setItem('token', res.data.data.token); @@ -128,8 +129,6 @@ }, loginFromYyyf: function (params) { signInYyyf(params).then(res => { - debugger; - // console.log(res); if (res.data.code === 200) { let status = res.data.data.status; if (status == 1) { @@ -138,22 +137,24 @@ localStorage.setItem('yyyfToken', res.data.data.yyyfUserToken); let code = res.data.data.code; - let tel = res.data.data.tel; - let password = res.data.data.password; + this.tel = res.data.data.tel; + this.pass = res.data.data.password; //注册 if (code != undefined && code != '') { let signParams = { - tel: tel, + tel: this.tel, nickName: res.data.data.nickName, code: res.data.data.code, - password: password, + password: this.pass, internationalCode: null, invitationCode: '', } this.sign(signParams); + }else{ + this.login(); } - this.login(tel, password); + } else { this.$message.warning({