|
@@ -71,7 +71,7 @@
|
|
</el-input>
|
|
</el-input>
|
|
<div class="PasswordInfoDiv">
|
|
<div class="PasswordInfoDiv">
|
|
<div>
|
|
<div>
|
|
- <el-checkbox v-model="RememberYourPassword">记住密码</el-checkbox>
|
|
|
|
|
|
+ <el-checkbox :checked="RememberYourPassword">记住密码</el-checkbox>
|
|
</div>
|
|
</div>
|
|
<div><el-link type="primary" @click="forgetYouPassword()">忘记密码?</el-link></div>
|
|
<div><el-link type="primary" @click="forgetYouPassword()">忘记密码?</el-link></div>
|
|
</div>
|
|
</div>
|
|
@@ -94,12 +94,11 @@ export default {
|
|
return {
|
|
return {
|
|
userName: "",
|
|
userName: "",
|
|
password: "",
|
|
password: "",
|
|
- RememberYourPassword: localStorage.getItem("RememberYourPassword")
|
|
|
|
|
|
+ RememberYourPassword: localStorage.getItem("RememberYourPassword") === "true"
|
|
};
|
|
};
|
|
},
|
|
},
|
|
mounted() {
|
|
mounted() {
|
|
this.$nextTick(() => {
|
|
this.$nextTick(() => {
|
|
- this.RememberYourPassword = localStorage.getItem("RememberYourPassword");
|
|
|
|
if (this.RememberYourPassword) {
|
|
if (this.RememberYourPassword) {
|
|
if (localStorage.getItem("_USER_NAME") && localStorage.getItem("_PASSWORD")) {
|
|
if (localStorage.getItem("_USER_NAME") && localStorage.getItem("_PASSWORD")) {
|
|
this.userName = localStorage.getItem("_USER_NAME");
|
|
this.userName = localStorage.getItem("_USER_NAME");
|
|
@@ -124,19 +123,22 @@ export default {
|
|
param.append("userName", this.userName);
|
|
param.append("userName", this.userName);
|
|
param.append("password", this.password);
|
|
param.append("password", this.password);
|
|
param.append("clientId", "1");
|
|
param.append("clientId", "1");
|
|
- console.log(param,"paramdata");
|
|
|
|
|
|
+ console.log(param, "paramdata");
|
|
this.$Post(this.urlsCollection.loginUrl, param).then(
|
|
this.$Post(this.urlsCollection.loginUrl, param).then(
|
|
res => {
|
|
res => {
|
|
// 登录成功
|
|
// 登录成功
|
|
if (res.code == 200) {
|
|
if (res.code == 200) {
|
|
// 登录校验成功后
|
|
// 登录校验成功后
|
|
if (this.RememberYourPassword) {
|
|
if (this.RememberYourPassword) {
|
|
|
|
+ // 需要长期缓存的数据使用localStorage
|
|
localStorage.setItem("RememberYourPassword", true);
|
|
localStorage.setItem("RememberYourPassword", true);
|
|
localStorage.setItem("_USER_NAME", this.userName);
|
|
localStorage.setItem("_USER_NAME", this.userName);
|
|
localStorage.setItem("_PASSWORD", publicFun.Encrypt(this.password));
|
|
localStorage.setItem("_PASSWORD", publicFun.Encrypt(this.password));
|
|
}
|
|
}
|
|
localStorage.setItem("TOKEN", res.message);
|
|
localStorage.setItem("TOKEN", res.message);
|
|
- localStorage.setItem("USER_ID",res.content.id)
|
|
|
|
|
|
+ localStorage.setItem("USER_ID", res.content.id);
|
|
|
|
+ // 对于临时缓存的全局数据使用store
|
|
|
|
+ this.$store.commit("changeUserInfo", res.content);
|
|
this.$router.push("/");
|
|
this.$router.push("/");
|
|
const h = this.$createElement;
|
|
const h = this.$createElement;
|
|
this.$notify({
|
|
this.$notify({
|