|
@@ -5,15 +5,15 @@
|
|
|
<div>环境: {{server}}</div>
|
|
|
</div>
|
|
|
<div class="username">
|
|
|
- <input class="comminput" @keyup.enter="login()" type="text" ref="name" id="accountValue" v-model="loginInfo.accountValue" placeholder="账号" />
|
|
|
+ <input class="comminput" @keyup.enter="login" type="text" ref="name" id="accountValue" v-model="loginInfo.accountValue" placeholder="账号" />
|
|
|
</div>
|
|
|
<div class="password">
|
|
|
- <input class="comminput" @keyup.enter="login()" type="password" id="password" v-model="loginInfo.password" placeholder="密码" />
|
|
|
+ <input class="comminput" @keyup.enter="login" type="password" id="password" v-model="loginInfo.password" placeholder="密码" />
|
|
|
</div>
|
|
|
<div class="domain">
|
|
|
- <input class="comminput" @keyup.enter="login()" type="text" id="domain" v-model="loginInfo.domain" placeholder="机构域名" />
|
|
|
+ <input class="comminput" @keyup.enter="login" type="text" id="domain" v-model="loginInfo.domain" placeholder="机构域名" />
|
|
|
</div>
|
|
|
- <input type="button" value="登 录" class="btn comminput" @click="login()" />
|
|
|
+ <input type="button" value="登 录" class="btn comminput" @click="login" />
|
|
|
<div class="errorInfo">{{errorInfo}}</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -35,6 +35,30 @@ export default {
|
|
|
}
|
|
|
};
|
|
|
},
|
|
|
+ beforeRouteEnter(from, to, next) {
|
|
|
+ next(vm => {
|
|
|
+ if (localStorage.getItem("accountValue")) {
|
|
|
+ vm.loginInfo = {
|
|
|
+ ...vm.loginInfo,
|
|
|
+ ...{ accountValue: localStorage.getItem("accountValue") }
|
|
|
+ };
|
|
|
+ }
|
|
|
+ if (localStorage.getItem("domain")) {
|
|
|
+ vm.loginInfo = {
|
|
|
+ ...vm.loginInfo,
|
|
|
+ ...{ domain: localStorage.getItem("domain") }
|
|
|
+ };
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ beforeDestroy() {
|
|
|
+ if (this.loginInfo.accountValue) {
|
|
|
+ localStorage.setItem("accountValue", this.loginInfo.accountValue);
|
|
|
+ }
|
|
|
+ if (this.loginInfo.domain) {
|
|
|
+ localStorage.setItem("domain", this.loginInfo.domain);
|
|
|
+ }
|
|
|
+ },
|
|
|
methods: {
|
|
|
checkAccountValue() {
|
|
|
this.errorInfo = "";
|
|
@@ -80,16 +104,16 @@ export default {
|
|
|
this.$http
|
|
|
.post("/api/ecs_core/auth/login", this.loginInfo)
|
|
|
.then(response => {
|
|
|
+ this.pending = false;
|
|
|
var user = response.data;
|
|
|
localStorage.setItem("user_token", user.userToken);
|
|
|
localStorage.setItem("rootOrgId", user.rootOrgId);
|
|
|
localStorage.setItem("userName", user.displayName);
|
|
|
this.$router.replace({ path: "/index" });
|
|
|
- this.pending = false;
|
|
|
})
|
|
|
- .catch(response => {
|
|
|
- this.errorInfo += response.body.desc;
|
|
|
+ .catch(error => {
|
|
|
this.pending = false;
|
|
|
+ this.errorInfo += error.response.data.desc;
|
|
|
});
|
|
|
}
|
|
|
},
|