From a8020967fc3ba22179d7928835fc5210b81eea95 Mon Sep 17 00:00:00 2001 From: mch <1332099529@qq.com> Date: Thu, 7 Sep 2023 14:34:16 +0800 Subject: [PATCH] =?UTF-8?q?=E7=99=BB=E5=BD=95=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/login/Login.vue | 67 ++++++++++++++++++++++++--------------- 1 file changed, 41 insertions(+), 26 deletions(-) diff --git a/src/views/login/Login.vue b/src/views/login/Login.vue index b306151..64a8bb4 100644 --- a/src/views/login/Login.vue +++ b/src/views/login/Login.vue @@ -75,32 +75,8 @@ export default { }) .then((res) => { msgs = res.data.msg; - this.$message.success(msgs); - if (res.code != -1 && res.data.code == 1) { - window.sessionStorage.setItem("peisid", res.data.peisid); //设置当前人员所属体检中心 - //console.log('res',res); - - return this.$axios.post( - mm.apiurl + "/connect/token", - { - client_id: "Peis_App", - grant_type: "password", - username: this.form.Username, - password: this.form.Password, - scope: "Peis offline_access", - }, - { - headers: { - "Content-Type": "application/x-www-form-urlencoded", - }, - } - ); - } else { - this.$message.warning(ret.data.msg); - } - }) - .then((res) => { - writetoken(res.data.expires_in); + if(res.code==1){ + writetoken(res.data.expires_in); window.localStorage.setItem("token", res.data.access_token); window.localStorage.setItem( "refresh_token", @@ -111,7 +87,46 @@ export default { this.$router.push({ path: "home" }); this.$store.state.changepassword = this.form.Password; + } + this.$message.success(msgs); + + console.log(res,'res'); + // if (res.code != -1 && res.data.code == 1) { + // window.sessionStorage.setItem("peisid", res.data.peisid); //设置当前人员所属体检中心 + + + // return this.$axios.post( + // mm.apiurl + "/connect/token", + // { + // client_id: "Peis_App", + // grant_type: "password", + // username: this.form.Username, + // password: this.form.Password, + // scope: "Peis offline_access", + // }, + // { + // headers: { + // "Content-Type": "application/x-www-form-urlencoded", + // }, + // } + // ); + // } else { + // this.$message.warning(ret.data.msg); + // } }) + // .then((res) => { + // writetoken(res.data.expires_in); + // window.localStorage.setItem("token", res.data.access_token); + // window.localStorage.setItem( + // "refresh_token", + // res.data.refresh_token + // ); + // window.localStorage.setItem("tokentype", res.data.token_type); + // window.localStorage.setItem("user", this.form.Username); + + // this.$router.push({ path: "home" }); + // this.$store.state.changepassword = this.form.Password; + // }) .catch((err) => {}); // console.log(res);