Commit b8a3b5ee by 张杰

Merge branch 'v1.10.0' into 'develop'

V1.10.0版本需求上线,合并代码到develop

See merge request !21
2 parents 486a9cf5 0852e234
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0"> <!-- <meta name="viewport" content="width=device-width,initial-scale=1.0"> -->
<link rel="icon" href="<%= BASE_URL %>favicon.ico"> <link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= htmlWebpackPlugin.options.title %></title> <title><%= htmlWebpackPlugin.options.title %></title>
</head> </head>
......
<template> <template>
<div class="home-logo-wrapper"> <div class="home-logo-wrapper">
<!-- <img class="home-logo-img" src="@/assets/images/company-logo-sub.png" alt="home-logo" > --> <!-- <img class="home-logo-img" src="https://img01.glsx.com.cn/weapp/resource/drive/xbkj_small.png" alt="home-logo" > -->
<img class="home-logo-img" :src="smallLogo" alt="home-logo" > <img class="home-logo-img" :src="smallLogo" alt="home-logo" >
<!-- <img v-show="collapsed" class="home-logo-img home-thumbnail-logo" src="@/assets/images/logo-thumbnail.png" alt="home-logo" > --> <!-- <img v-show="collapsed" class="home-logo-img home-thumbnail-logo" src="@/assets/images/logo-thumbnail.png" alt="home-logo" > -->
</div> </div>
...@@ -29,7 +29,8 @@ ...@@ -29,7 +29,8 @@
height: 60px; height: 60px;
padding: 5px 0; padding: 5px 0;
.home-logo-img { .home-logo-img {
width: 170px; max-width: 170px;
max-height: 60px;
} }
.home-thumbnail-logo { .home-thumbnail-logo {
width: 80%; width: 80%;
......
<template>
<div class="login-form-wrapper">
<div class="login-content">
<div class="login-card-left">
<login-left-side></login-left-side>
</div>
<div class="login-card">
<!-- <img class="home-logo-img" src="@/assets/images/company-logo.png" alt="company-logo"> -->
<div>
<img class="home-logo-img" :src="logo" :key="logo" alt="company-logo" />
</div>
<h1 class="login-title">{{title}}</h1>
<div v-if="showAlert">
<el-alert v-for="(item, index) in alertArr" :key="index" :title="item" type="error" show-icon />
</div>
<el-form>
<el-form-item class="username-wrapper" prop="name">
<el-input class="login-input username-input" placeholder="请输入用户名" maxLength="50" v-model="formInline.user">
</el-input>
</el-form-item>
<el-form-item class="form-wrapper pwd-wrapper" prop="pass">
<el-input class="login-input" placeholder="请输入密码" v-model="formInline.password" maxLength="20" show-password autocomplete="off">
</el-input>
</el-form-item>
<!-- <a-form-item class="form-wrapper captcha-wrapper">
<a-input class="login-input" size="large" :max="6" v-model:value="formInline.captcha" placeholder="验证码"></a-input>
<div class="captcha-content" @click="updateCaptcha">
<img class="captcha-img" :src="`data:image/jpeg;base64,${captchaUrl}`" alt="验证码" />
</div>
</a-form-item> -->
<el-form-item class="login-button-wrapper" @keyup.enter="handleSubmit" @click.native.prevent="handleSubmit">
<el-button class="login-button" type="primary" html-type="submit">
登录
</el-button>
</el-form-item>
</el-form>
</div>
</div>
</div>
</template>
<script>
import LoginLeftSide from "./LoginLeftSide";
import { trimSpace, validate_username, debounce } from "@/utils/tools/tools";
import LoginService from "@/services/Login";
// import { UserOutlined, LockOutlined } from '@ant-design/icons-vue';
import {
reactive,
toRefs,
getCurrentInstance,
computed,
onBeforeMount,
watch,
ref,
} from "vue";
import { useStore } from "vuex";
import { useRouter } from "vue-router";
export default {
components: {
LoginLeftSide,
// UserOutlined,
// LockOutlined,
},
setup(props, { attrs, emit, slots }) {
const router = useRouter();
const store = useStore();
const state = reactive({
// captchaUrl: '',
// captchaId: '', // 后台需要的字段
alertMsg: "",
showAlert: false,
alertArr: [],
randomVal: "0",
formInline: {
user: "",
password: "",
captcha: "",
},
title: store.state.app.title,
logo: store.state.app.logo,
});
const { ctx: _this } = getCurrentInstance();
const loginService = new LoginService();
onBeforeMount(() => {
document.onkeydown = (e) => {
if (e.keyCode === 13) {
handleSubmit();
}
};
});
const validatePass = (rule, value, callback) => {
if (value === "") {
callback(new Error("请输入密码"));
} else {
if (state.ruleForm.checkPass !== "") {
// this.$refs.ruleForm.validateField('checkPass');
}
callback();
}
};
// const getCaptcha = () => {
// // 初始化获取验证码
// loginService.getCaptchaUrl().then(res => {
// if(res.code == 200) {
// const resData = res.data;
// state.captchaId = resData['Captcha-ID'];
// state.captchaUrl = resData['captcha'];
// }
// }, err => {
// })
// }
// getCaptcha();
// 登录提交验证 用户名只限制长度50 验证码暂时屏蔽
const handleSubmit = async () => {
const value = state.formInline,
captchaId = state.captchaId,
{ user, password, captcha } = value;
state.alertArr = [];
state.showAlert = false;
if (trimSpace(user).length <= 0) {
state.alertArr.push("请输入用户名");
state.showAlert = true;
return false;
}
// if(!validate_username(user)) {
// state.alertArr.push('用户名格式不正确');
// state.showAlert = true;
// return false;
// }
if (trimSpace(password).length <= 0) {
state.alertArr.push("请输入密码");
state.showAlert = true;
return false;
}
// if(trimSpace(captcha).length <= 0) {
// state.alertArr.push('请输入验证码');
// state.showAlert = true;
// return false;
// }
// params: captcha, captchaId 验证码暂时屏蔽
store.dispatch("app/showLoading", true);
const params = { account: user, password };
await loginService.loginAction(params).then(
(res) => {
store.dispatch("app/showLoading", false);
if (res.code === 200) {
const { token, user } = res.data;
store.dispatch("app/setUserInfo", user);
store.dispatch("app/setToken", token);
} else {
const { message } = res;
state.alertArr.push(message);
state.showAlert = true;
store.dispatch("app/showLoading", false);
}
},
(err) => {
store.dispatch("app/showLoading", false);
}
);
};
// 点击刷新验证码
// const updateCaptcha = debounce(() => {
// getCaptcha();
// }, 1000, true);
//const logo = localStorage.getItem("logo");
watch(
() => store.state.app.logo,
(n, o) => {
state.logo = n;
}
);
watch(() => store.state.app.title,(n,o) => {
state.title = n
})
return {
...toRefs(state),
handleSubmit,
//title,
// updateCaptcha
};
},
};
</script>
<style scoped>
.login-form-wrapper >>> .el-input__inner {
border: none;
border-radius: 0;
border-bottom: 1px solid #97979742;
}
.login-form-wrapper >>> .el-input__inner:-webkit-autofill {
-webkit-box-shadow: 0 0 0px 1000px #fff inset;
}
</style>
<style lang="less" scoped>
@import "styles/mixins.less";
.login-form-wrapper {
margin-top: 100px;
.login-content {
display: flex;
justify-content: space-between;
width: 95%;
height: 420px;
}
.login-card {
position: relative;
display: -webkit-box;
display: -ms-flexbox;
.flex-column;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
min-width: 0;
word-wrap: break-word;
background-color: #fff;
background-clip: border-box;
border-left: none;
border-radius: 4px;
max-width: 320px;
min-width: 320px;
padding: 45px;
margin-left: 50px;
.el-alert {
margin-bottom: 15px;
}
.home-logo-img {
max-width: 100%;
height: 50px;
//margin-bottom: 15px;
}
.login-title {
height: 55px;
font-size: 22px;
color: #333;
font-weight: bold;
}
.username-input {
margin-top: 0;
}
.captcha-wrapper {
.v-center;
justify-content: space-between;
.login-input {
width: 200px;
}
.captcha-content {
flex: 1;
margin-top: 30px;
height: 40px;
cursor: pointer;
.captcha-img {
width: 100%;
height: 100%;
}
}
}
.login-button-wrapper {
margin-top: 45px;
.login-button {
width: 100%;
height: 40px;
background-color: #003457;
border-color: transparent;
}
}
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template> <template>
<el-container class="container"> <el-container class="container">
<!-- <home-header></home-header>
<home-content></home-content>
<home-footer></home-footer> -->
<div class="login_page"> <div class="login_page">
<div class="login_header"> <div class="login_header">
<img class="home-logo-img" :src="logoPath" :key="logoPath" alt="company-logo"> <img class="home-logo-img" :src="logoPath" :key="logoPath" alt="company-logo">
...@@ -12,14 +9,11 @@ ...@@ -12,14 +9,11 @@
<div class="left"></div> <div class="left"></div>
<div class="right"> <div class="right">
<div class="login_card"> <div class="login_card">
<div class="login_bg"></div>
<div class="login-content"> <div class="login-content">
<div class="small_logo"> <h2 class="h2">欢迎登录</h2>
<img class="home-logo-img" :src="logo" :key="logo" alt="company-logo" /> <h3 class="h3">车辆管理系统</h3>
</div> <!-- <h1 class="login-title">{{title}}</h1> -->
<h1 class="login-title">{{title}}</h1>
<div v-if="showAlert">
<el-alert v-for="(item, index) in alertArr" :key="index" :title="item" type="error" show-icon />
</div>
<el-form> <el-form>
<el-form-item class="username-wrapper" prop="name"> <el-form-item class="username-wrapper" prop="name">
<el-input class="login-input username-input" placeholder="请输入用户名" maxLength="50" v-model="formInline.user"> <el-input class="login-input username-input" placeholder="请输入用户名" maxLength="50" v-model="formInline.user">
...@@ -48,6 +42,7 @@ ...@@ -48,6 +42,7 @@
</template> </template>
<script> <script>
import { ElMessage } from "element-plus";
import HomeHeader from "components/Header/HomeHeader"; import HomeHeader from "components/Header/HomeHeader";
import HomeContent from "components/HomeContent/HomeContent"; import HomeContent from "components/HomeContent/HomeContent";
import HomeFooter from "components/Footer/HomeFooter"; import HomeFooter from "components/Footer/HomeFooter";
...@@ -105,12 +100,16 @@ export default { ...@@ -105,12 +100,16 @@ export default {
captchaId = state.captchaId, captchaId = state.captchaId,
{ user, password, captcha } = value; { user, password, captcha } = value;
state.alertArr = []; // state.alertArr = [];
state.showAlert = false; // state.showAlert = false;
if (trimSpace(user).length <= 0) { if (trimSpace(user).length <= 0) {
state.alertArr.push("请输入用户名"); // state.alertArr.push("请输入用户名");
state.showAlert = true; // state.showAlert = true;
ElMessage({
message: "请输入用户名",
type: "error",
});
return false; return false;
} }
...@@ -121,8 +120,12 @@ export default { ...@@ -121,8 +120,12 @@ export default {
// } // }
if (trimSpace(password).length <= 0) { if (trimSpace(password).length <= 0) {
state.alertArr.push("请输入密码"); // state.alertArr.push("请输入密码");
state.showAlert = true; // state.showAlert = true;
ElMessage({
message: "请输入密码",
type: "error",
});
return false; return false;
} }
...@@ -143,8 +146,12 @@ export default { ...@@ -143,8 +146,12 @@ export default {
store.dispatch("app/setToken", token); store.dispatch("app/setToken", token);
} else { } else {
const { message } = res; const { message } = res;
state.alertArr.push(message); // state.alertArr.push(message);
state.showAlert = true; // state.showAlert = true;
ElMessage({
message: message,
type: "error",
});
store.dispatch("app/showLoading", false); store.dispatch("app/showLoading", false);
} }
}, },
...@@ -200,50 +207,91 @@ export default { ...@@ -200,50 +207,91 @@ export default {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
overflow: hidden; overflow: hidden;
background: url("../assets/images/bg.jpg") no-repeat center center;
background-size: cover;
.login_header { .login_header {
width: 100%; width: 100%;
height: 60px; height: 56px;
background: #fff;
overflow: hidden;
.home-logo-img { .home-logo-img {
max-width: 100%; max-width: 100%;
max-height: 56px;
margin-left: 24px;
} }
// padding:20px; // padding:20px;
} }
.login_box { .login_box {
width: 100%; width: 100%;
height: calc(100vh - 120px); flex: 1;
//height: calc(100vh - 120px);
//background: url("../../assets/images/car-bg.png") no-repeat; //background: url("../../assets/images/car-bg.png") no-repeat;
background: url("../assets/images/car-bg.png") no-repeat; //background: url("../assets/images/car-bg.png") no-repeat;
background-size: cover; background-size: cover;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
.right{ .right {
flex:2; flex: 2;
display:flex; display: flex;
align-items: center; align-items: center;
justify-content: flex-end; justify-content: flex-end;
padding:0 60px 0 0; padding: 0 120px 0 0;
@media (max-width: 414px) { @media (max-width: 414px) {
padding: 0; padding: 0;
} }
} }
.login_card { .login_card {
background-color: #fff; position: relative;
background-clip: border-box; width: 416px;
border-radius: 4px; height: 480px;
width: 410px;
@media (max-width: 414px) {
width: 100%;
}
padding: 45px 0;
box-sizing: border-box; box-sizing: border-box;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
.login-content{ .login_bg {
width: 320px; position: absolute;
.home-logo-img { width: 416px;
max-width: 100%; height: 480px;
height: 50px; background: linear-gradient(180deg, #335fb8 0%, #142f7a 100%);
box-shadow: 0px 8px 40px 12px rgba(2, 14, 73, 0.35);
border-radius: 2px;
opacity: 0.8;
border: 1px solid;
border-image: linear-gradient(
180deg,
rgba(74, 104, 165, 1),
rgba(54, 78, 135, 0.4),
rgba(36, 55, 108, 1)
)
1 1;
}
.login-content {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
padding: 0 48px;
box-sizing: border-box;
.h2,
.h3 {
color: #ffffff;
line-height: 30px;
text-align: center;
margin: 0;
padding: 0;
}
.h2 {
font-size: 20px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
margin-top: 64px;
}
.h3 {
font-size: 24px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
margin: 12px 0 48px 0;
} }
.login-title { .login-title {
height: 55px; height: 55px;
...@@ -253,42 +301,72 @@ export default { ...@@ -253,42 +301,72 @@ export default {
} }
.login-input { .login-input {
width: 100%; width: 100%;
border:0;
} }
.login-button-wrapper { .login-button-wrapper {
margin-top: 45px; margin-top: 48px;
.login-button { .login-button {
width: 100%; width: 320px;
height: 40px; height: 48px;
background-color: #003457; background: #0077ff;
border-color: transparent; border-radius: 4px;
} }
} }
} }
} }
} }
.login_card:after {
position: absolute;
display: block;
content: "";
background: url("../assets/images/light.png") no-repeat;
background-size: 100% auto;
width: 253px;
height: 17px;
top: -6px;
left: 50%;
transform: translateX(-50%);
}
.login_footer { .login_footer {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
padding: 0 15px; height: 32px;
height: 60px;
// line-height: 60px;
font-size: 12px; font-size: 12px;
text-align: center; text-align: center;
color: #999; color: #999;
background: #fff;
} }
} }
</style> </style>
<style scoped> <style scoped>
.login_box >>> .el-input__inner { .login_box >>> .el-input__inner {
border: none; background: #0f213d;
border-radius: 0; /* box-shadow: 0px 0px 12px 0px rgba(93, 131, 191, 0.4); */
border-bottom: 1px solid #97979742; border-radius: 4px;
/* border: 1px solid #4b68a5; */
border: 1px solid #0f213d;
color: #fff;
}
.login_box >>> .el-input__inner:focus {
box-shadow: 0px 0px 16px 0px rgba(93, 131, 191, 0.8);
border: 1px solid #626a7a;
} }
.login_box >>> .el-input__inner:-webkit-autofill { .login_box >>> .el-input__inner:-webkit-autofill {
-webkit-box-shadow: 0 0 0px 1000px #fff inset; /* -webkit-box-shadow: 0 0 0px 1000px #0f213d inset; */
background: #0f213d !important;
}
.login_box >>> input:-internal-autofill-selected {
/* background: #0f213d !important; */
transition: background-color 5000s ease-in-out s !important;
}
.login_box >>> input::-webkit-input-placeholder {
color: #626a7a;
}
.login_box >>> input::-moz-input-placeholder {
color: #626a7a;
}
.login_box >>> input::-ms-input-placeholder {
color: #626a7a;
} }
</style> </style>
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!