|
@@ -16,35 +16,37 @@ export default {
|
|
|
this.loginForm.password = "";
|
|
|
},
|
|
|
handleLogin() {
|
|
|
-
|
|
|
+ console.log(11111);
|
|
|
const params = {
|
|
|
username: this.loginForm.username,
|
|
|
password: this.loginForm.password,
|
|
|
};
|
|
|
if (this.loginForm.username == "") {
|
|
|
- this.$message.error("请输入账号");
|
|
|
- return
|
|
|
+ this.$message.error("请输入账号");
|
|
|
+ return;
|
|
|
}
|
|
|
if (this.loginForm.password == "") {
|
|
|
- this.$message.error("请输入密码");
|
|
|
- return
|
|
|
+ this.$message.error("请输入密码");
|
|
|
+ return;
|
|
|
}
|
|
|
this.loading = true;
|
|
|
- getLogin(params).then((res) => {
|
|
|
- if (res.data.code == 200) {
|
|
|
- this.$message.success("登录成功");
|
|
|
- sessionStorage.setItem("token", res.data.token);
|
|
|
+ getLogin(params)
|
|
|
+ .then((res) => {
|
|
|
+ if (res.data.code == 200) {
|
|
|
+ this.$message.success("登录成功");
|
|
|
+ sessionStorage.setItem("token", res.data.token);
|
|
|
+ this.loading = false;
|
|
|
+ this.$router.push("/home");
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch((error) => {
|
|
|
+ this.$message.error(error.msg);
|
|
|
this.loading = false;
|
|
|
- this.$router.push("/home");
|
|
|
- }
|
|
|
- }).catch(error=>{
|
|
|
- this.$message.error(error.msg);
|
|
|
- this.loading=false
|
|
|
- });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ addClass() {
|
|
|
+ return this.loading ? "active" : "login-btn2 ";
|
|
|
},
|
|
|
- addClass(){
|
|
|
- return this.loading?'login-btn2 active':'login-btn2 '
|
|
|
- }
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
@@ -85,18 +87,16 @@ export default {
|
|
|
</el-input>
|
|
|
</el-form-item>
|
|
|
<!-- <span v-if="!loading">登 录</span> -->
|
|
|
- <!-- <span v-else>登 录 中...</span> -->
|
|
|
+ <!-- <span v-else>登 录 中...</span> -->
|
|
|
<el-form-item style="width: 100%; margin-top: 40px">
|
|
|
<el-button
|
|
|
:loading="loading"
|
|
|
:class="addClass()"
|
|
|
size="medium"
|
|
|
- type="primary"
|
|
|
style="width: 100%"
|
|
|
@click.native.prevent="handleLogin"
|
|
|
>
|
|
|
</el-button>
|
|
|
-
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
</div>
|
|
@@ -155,16 +155,22 @@ export default {
|
|
|
.login-btn2 {
|
|
|
// font-size: 16px;
|
|
|
height: 40px;
|
|
|
- background: url('../../assets/images/login-btn4.png') no-repeat;
|
|
|
+ background: url("../../assets/images/login-btn4.png") no-repeat;
|
|
|
+ background-size: 100% 100%;
|
|
|
+ cursor: pointer;
|
|
|
+}
|
|
|
+.login-btn2:hover {
|
|
|
+ background: url("../../assets/images/login-btn4.png") no-repeat;
|
|
|
background-size: 100% 100%;
|
|
|
}
|
|
|
-.login-btn2:hover{
|
|
|
- background: url('../../assets/images/login-btn4.png') no-repeat;
|
|
|
+.login-btn2:focus {
|
|
|
+ background: url("../../assets/images/login-btn4.png") no-repeat;
|
|
|
background-size: 100% 100%;
|
|
|
}
|
|
|
-.active{
|
|
|
-background: url('../../assets/images/loding.png') no-repeat;
|
|
|
-background-size: 100% 100%;
|
|
|
+.active {
|
|
|
+ background: url("../../assets/images/loding.png") no-repeat;
|
|
|
+ background-size: 100% 100%;
|
|
|
+ cursor: pointer;
|
|
|
}
|
|
|
// /deep/input:-webkit-autofill {
|
|
|
// // -webkit-box-shadow: 0 0 0px 1000px rgba(23, 136, 203, 0.3) !important;
|