Browse Source

登录接口

master
mch 2 years ago
parent
commit
a8020967fc
  1. 67
      src/views/login/Login.vue

67
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);

Loading…
Cancel
Save