From e8b540b57fd037d41be19d66ee748987e7163e75 Mon Sep 17 00:00:00 2001 From: unclekh <5177787+unclekh@user.noreply.gitee.com> Date: Tue, 26 May 2020 23:10:18 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E7=99=BB=E5=BD=95=E3=80=81?= =?UTF-8?q?=E9=87=8D=E6=96=B0=E5=BC=80=E5=A7=8B=E7=BB=83=E4=B9=A0=E3=80=81?= =?UTF-8?q?=E5=90=84=E7=A7=8D=E5=B8=81=E7=A7=8D=E9=97=B4=E7=9A=84=E4=BA=A4?= =?UTF-8?q?=E6=98=93=E8=BD=AC=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/yyyflogin.vue | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) 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({