From e2ffe9683ef007a45afbcdd897985d64cdcc7391 Mon Sep 17 00:00:00 2001
From: wl <173@qq.com>
Date: 星期四, 24 十一月 2022 11:26:31 +0800
Subject: [PATCH] 修改
---
src/views/login/index.vue | 42 ++++++++++++++++++++++++++----------------
1 files changed, 26 insertions(+), 16 deletions(-)
diff --git a/src/views/login/index.vue b/src/views/login/index.vue
index 81992e8..3448171 100644
--- a/src/views/login/index.vue
+++ b/src/views/login/index.vue
@@ -55,6 +55,8 @@
<script>
import { isvalidUsername } from "@/utils/validate";
import { createNamespacedHelpers } from "vuex";
+import users from "@/api/users";
+
const { mapActions } = createNamespacedHelpers("users");
export default {
name: "login",
@@ -77,8 +79,6 @@
loginForm: {
username:"",
password:"",
- // username: "admin",
- // password: "macro123",
},
imgUrl:'',
loginRules: {
@@ -94,22 +94,24 @@
};
},
created() {
- const pic = JSON.parse(localStorage.getItem('pic'));
+ const pic = JSON.parse(sessionStorage.getItem('pic'));
if(pic){
this.imgUrl = pic.loginPageIconUrl
+ }else{
+ this.$axios({
+ method: 'get',
+ url: 'sccg/system/portal/logo/search',
+ }).then(res => {
+ this.imgUrl = res.data.loginPageIconUrl
+ })
}
},
methods: {
showPwd() {
- if (!this.pwdType) {
- this.pwdType = true;
- } else {
- this.pwdType = false;
- }
+ this.pwdType = !this.pwdType;
},
...mapActions(["login"]),
handleLogin() {
- console.log("in login");
const { username, password } = this.loginForm;
const that = this;
this.$axios
@@ -119,26 +121,29 @@
})
.then(function (response) {
if (response.code === 200) {
+ // 璁剧疆toke鏃堕棿
// 淇濆瓨token
- console.log(response);
- localStorage.setItem('token',response.data.token);
+ sessionStorage.setItem('token',response.data.token);
// 淇濆瓨token
- localStorage.setItem('tokenHead',response.data.tokenHead)
+ sessionStorage.setItem('tokenHead',response.data.tokenHead);
+ // 淇濆瓨鐢ㄦ埛鐧诲綍鍚�
+ sessionStorage.setItem('name',username);
// 璺宠浆鍒伴椤�
that.$router.push("/home");
}else{
that.$refs.loginForm.validate((valid)=>{
if(valid){
- that.$message.error(response.data.message);
+ that.$message({
+ type:'warning',
+ message:response.message
+ })
}
})
}
- // console.log(response);
})
.catch(function (error) {
- console.log(error);
});
- },
+ }
},
};
</script>
@@ -163,6 +168,10 @@
top: 20%;
right: 5%;
width: 360px;
+ &:deep(.el-input__inner){
+ background-color: #fff !important;
+ border: 1px solid #dcdfe6 !important;
+ }
}
.text {
@@ -177,6 +186,7 @@
.logo>img {
width: 75px;
height: 75px;
+ border-radius: 4px;
}
.text-r {
--
Gitblit v1.8.0