pengjun 2 years ago
parent
commit
a33ae4cbb6
  1. 165
      src/views/Home.vue
  2. 144
      src/views/login/Login.vue

165
src/views/Home.vue

@ -1,22 +1,15 @@
<template>
<div style="background: #F4F8FF">
<el-container>
<el-header
style="height:50px; line-height: 40px"
class="principalheader"
>
<el-header style="height:50px; line-height: 40px" class="principalheader">
<div class="navs">
<img
src="@/assets/images/logo2.png"
alt=""
style="width: 24px; height: 24px"
/>
<img src="@/assets/images/logo2.png" alt="" style="width: 24px; height: 24px" />
<div class="maintitle">神豚体检管理系统</div>
<!--动态生成菜单 add by pengj 'text-align: center;width:' + (window.pageWidth - 280) + 'px;display:flex;'-->
<div :style="'display:flex;justify-content:center;width:' + (window.pageWidth - 300) + 'px;'">
<div v-for="menu in menuPriv" :key="menu.id"
:class="className == menu.displayName ? `actived ${menu.displayName}`:menu.displayName">
:class="className == menu.displayName ? `actived ${menu.displayName}` : menu.displayName">
<el-dropdown @command="handleCommand" class="">
<span class="el-dropdown-link" style="margin:0 5px;">{{ menu.displayName }}</span>
<el-dropdown-menu slot="dropdown" class="project-dropdown">
@ -30,11 +23,7 @@
</div>
<!-- -->
<div class="btn">
<img
src="@/assets/images/me.png"
alt=""
class="currentuser"
/>
<img src="@/assets/images/me.png" alt="" class="currentuser" />
<!-- <i class="el-icon-arrow-down el-icon--right"></i> -->
<el-dropdown>
<span class="el-dropdown-link" style="color:#222531;font-weight: 700;">
@ -47,54 +36,28 @@
{{ user }} <i class="el-icon-arrow-down el-icon--right"></i>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="logout"
>退出登录</el-dropdown-item
>
<el-dropdown-item @click.native="editpassword"
>修改密码</el-dropdown-item
>
<el-dropdown-item @click.native="toggleDevTools"
>调试工具</el-dropdown-item
>
<el-dropdown-item @click.native="logout">退出登录</el-dropdown-item>
<el-dropdown-item @click.native="editpassword">修改密码</el-dropdown-item>
<el-dropdown-item @click.native="toggleDevTools">调试工具</el-dropdown-item>
<el-dropdown-item @click.native="windowMin">最小化</el-dropdown-item>
<el-dropdown-item @click.native="windowMax">最大化</el-dropdown-item>
<el-dropdown-item @click.native="windowClose">关闭</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
</div>
</el-header>
<!-- 修改密码弹框 -->
<el-dialog
title="修改密码"
:visible.sync="dialogVisible"
width="30%"
:close-on-click-modal="false"
>
<el-form
:model="form"
:rules="rules"
ref="ruleForm"
label-width="100px"
>
<el-dialog title="修改密码" :visible.sync="dialogVisible" width="30%" :close-on-click-modal="false">
<el-form :model="form" :rules="rules" ref="ruleForm" label-width="100px">
<el-form-item label="旧密码" prop="oldPassWord">
<el-input
v-model="form.oldPassWord"
autocomplete="new-password"
show-password
></el-input>
<el-input v-model="form.oldPassWord" autocomplete="new-password" show-password></el-input>
</el-form-item>
<el-form-item label="新密码" prop="newPassWord">
<el-input
v-model="form.newPassWord"
autocomplete="new-password"
show-password
></el-input>
<el-input v-model="form.newPassWord" autocomplete="new-password" show-password></el-input>
</el-form-item>
<el-form-item label="确认密码" prop="newPassWord">
<el-input
v-model="confirmpassword"
type="password"
autocomplete="new-password"
show-password
></el-input>
<el-input v-model="confirmpassword" type="password" autocomplete="new-password" show-password></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
@ -325,8 +288,8 @@ import { mapState } from "vuex";
export default {
data() {
return {
menuPriv:[], //
className:'',
menuPriv: [], //
className: '',
index: 1,
isCollapse: false,
user: "",
@ -348,12 +311,12 @@ export default {
};
},
computed: {
...mapState(["changepassword", "router","window"]),
...mapState(["changepassword", "router", "window"]),
},
created() {
let expires_in = parseInt(window.sessionStorage.getItem("expires_in"))
//console.log("dqtime / expires_in",dqtime,expires_in)
if(!expires_in){
if (!expires_in) {
router.push({ path: "/Login" });
return;
}
@ -368,11 +331,11 @@ export default {
},
methods: {
getUserMenuPriv(){
getUserMenuPriv() {
getapi('/api/app/menuinfo/getmymenuinfotreelist').then(res => {
if(res.code != -1){
if (res.code != -1) {
this.menuPriv = res.data
this.menuPriv = this.menuPriv.filter(e =>{
this.menuPriv = this.menuPriv.filter(e => {
return e.menuType == '0' || e.menuType == '1'
})
}
@ -380,21 +343,21 @@ export default {
},
handleCommand(val) {
this.className=val.flag
this.className = val.flag
if (this.router.path != val.command) {
this.router.path = val.command;
this.$router.push({ path: val.command }).catch(() => {});
this.$router.push({ path: val.command }).catch(() => { });
}
// let menuId = arguments[1].$parent.$el.id
// let menuList = document.getElementById(menuId)
// console.log(menuList)
},
beforeHandleCommand(flag, command) {
return {
'flag': flag,
'command': command
}
},
return {
'flag': flag,
'command': command
}
},
//
determine() {
this.$refs.ruleForm.validate((valid) => {
@ -432,24 +395,50 @@ export default {
},
//
toggleDevTools() {
if(!this.$peisAPI) {
if (!this.$peisAPI) {
this.$message.info("此功能,需要在壳客户端才可运行!")
return
}
this.$peisAPI.toggleDevTools();
},
//
windowMin() {
if (!this.$peisAPI) {
this.$message.info("此功能,需要在壳客户端才可运行!")
return
}
this.$peisAPI.windowMin();
},
//
windowMax() {
if (!this.$peisAPI) {
this.$message.info("此功能,需要在壳客户端才可运行!")
return
}
this.$peisAPI.windowMax();
},
windowClose() {
if (!this.$peisAPI) {
this.$message.info("此功能,需要在壳客户端才可运行!")
return
}
this.$peisAPI.windowClose();
},
},
components: { router },
};
</script>
<style scoped>
@import '../assets/css/global_card.css';
:deep .el-dropdown-menu__item{
:deep .el-dropdown-menu__item {
color: #52555F;
font-size: 14px;
font-weight: 400;
font-family: "NotoSansSC-Regular";
}
.dropdownmain:hover,
.el-dropdown-menu__item:not(.is-disabled):hover {
background-color: rgba(20, 96, 243, 0.1);
@ -459,11 +448,13 @@ export default {
font-size: 14px;
font-family: "NotoSansSC-Bold";
}
.titleimg :hover {
width: 30px;
background-color: rgb(34, 149, 98);
z-index: 99;
}
.el-dropdown-link:hover {
/* background-color: rgb(202, 249, 203); */
color: #396FFA;
@ -473,16 +464,20 @@ export default {
border-top-right-radius: 5px; */
font-family: "NotoSansSC-Bold";
}
::v-deep .el-menu--horizontal > .el-submenu .el-submenu__title {
::v-deep .el-menu--horizontal>.el-submenu .el-submenu__title {
font-size: 16px;
}
.dropdowncolor {
font-size: 12px;
}
.el-dropdown {
color: rgb(140, 135, 134);
font-size: 12px;
}
.currentuser {
width: 32px;
height: 32px;
@ -493,6 +488,7 @@ export default {
font-size: 18px;
z-index: 99;
}
.registrationimgimges {
width: 20px;
height: 20px;
@ -500,6 +496,7 @@ export default {
left: -15px;
top: 15px;
}
.commonsettingimg {
width: 20px;
height: 20px;
@ -507,21 +504,25 @@ export default {
left: -15px;
top: 15px;
}
.chargeimg {
position: absolute;
left: -15px;
top: 15px;
}
.basicimg {
position: absolute;
left: -17px;
top: 15px;
}
.iconimg {
position: absolute;
left: 0px;
top: 10px;
}
.el-dropdown-link {
font-size: 14px;
margin: 0;
@ -529,6 +530,7 @@ export default {
color: #52555F;
font-family: "NotoSansSC-Regular";
}
.principalheader {
background-color: #fff;
opacity: 1;
@ -580,19 +582,22 @@ export default {
/* justify-content: space-between; */
flex-flow: 1;
}
::v-deep .el-card__body {
/* height: 90vh; */
height: 100%;
overflow-y: auto;
}
.maintitle {
width:180px;
width: 180px;
font-size: 20px;
font-weight: 600;
color: #232748;
margin-left: 10px;
font-family: "NotoSansSC-Bold";
}
::v-deep .el-dropdown-menu item:not(.is-disabled) {
color: #fff;
}
@ -600,14 +605,17 @@ export default {
.el-header {
height: 40px;
}
::v-deep .el-select-dropdown {
background: #ccc;
}
.operateimg {
position: relative;
left: 0;
top: 5px;
}
.el-aside {
/* height: calc(100vh, -70px); */
height: calc(100vh - 0px);
@ -628,7 +636,7 @@ export default {
}
.btn {
width:120px;
width: 120px;
color: #000;
font-weight: 700;
/* margin-left: 60%; */
@ -645,25 +653,28 @@ export default {
font-weight: 700;
color: #fff;
}
/* .actived {
color: #396FFA!important;
border-bottom: 4px solid #396FFA;
font-weight: 700;
} */
.actived .el-dropdown-link{
color: #396FFA!important;
.actived .el-dropdown-link {
color: #396FFA !important;
font-weight: 700;
font-family: "NotoSansSC-Bold";
}
.actived .el-dropdown-link:after{
content:'';
.actived .el-dropdown-link:after {
content: '';
width: 100%;
height: 3px;
background-color: #396FFA;
position: absolute;
bottom:4px;
left:0;
bottom: 4px;
left: 0;
}
/* .project-dropdown{
max-height:300px;
overflow: auto;

144
src/views/login/Login.vue

@ -1,46 +1,43 @@
<template>
<div class="bg">
<div style="display: flex;justify-content: space-between;padding-top: 5px;">
<div></div>
<div style="display: flex;">
<i class="el-icon-minus" @click="btnMin" style="padding-right: 5px;"></i>
<i class="el-icon-copy-document" @click="btnMax" style="padding-right: 5px;"></i>
<i class="el-icon-close" @click="btnClose" style="padding-right: 5px;"></i>
</div>
</div>
<div class="box">
<div class="mainbody">
<div class="title">
<img src="@/assets/images/logo1.png"/>
<img src="@/assets/images/logo1.png" />
<div>神豚体检管理系统</div>
</div>
<div class="userform">
<div style="color: #232748;font-size: 24px;font-weight: 700;margin-bottom: 20px;font-family: NotoSansSC-Bold;">登录账号</div>
<el-form
:model="form"
:rules="rules"
ref="form"
class="demo-ruleForm"
>
<div style="color: #232748;font-size: 24px;font-weight: 700;margin-bottom: 20px;font-family: NotoSansSC-Bold;">
登录账号</div>
<el-form :model="form" :rules="rules" ref="form" class="demo-ruleForm">
<el-form-item label="" prop="Username" style="margin-bottom: 20px">
<div style="font-size:16px;font-weight: 400;color: #232748; line-height: 22px;margin-bottom: 10px;font-family: NotoSansSC-Regular;">用户名</div>
<el-input
class="inputcolor"
v-model="form.Username"
placeholder="请输入用户名"
prefix-icon="el-icon-s-custom"
style="color: #fff"
@keyup.native.enter="nextFocus('Username')"
></el-input>
<div
style="font-size:16px;font-weight: 400;color: #232748; line-height: 22px;margin-bottom: 10px;font-family: NotoSansSC-Regular;">
用户名</div>
<el-input class="inputcolor" v-model="form.Username" placeholder="请输入用户名" prefix-icon="el-icon-s-custom"
style="color: #fff" @keyup.native.enter="nextFocus('Username')"></el-input>
</el-form-item>
<el-form-item label="" prop="Password" style="margin-bottom: 5px">
<div style="font-size:16px;font-weight: 400;color: #232748;line-height: 22px;margin-bottom: 10px;font-family: NotoSansSC-Regular;">密码</div>
<el-input
v-model="form.Password"
placeholder="请输入密码"
type="password"
prefix-icon="el-icon-unlock"
@keyup.native.enter="nextFocus('Password')"
ref="password"
></el-input>
<div
style="font-size:16px;font-weight: 400;color: #232748;line-height: 22px;margin-bottom: 10px;font-family: NotoSansSC-Regular;">
密码</div>
<el-input v-model="form.Password" placeholder="请输入密码" type="password" prefix-icon="el-icon-unlock"
@keyup.native.enter="nextFocus('Password')" ref="password"></el-input>
</el-form-item>
<el-row>
<el-col :span="12">
<el-form-item>
<el-checkbox></el-checkbox>
<span style=" font-family: NotoSansSC-Regular;color: #232748;font-weight: 400;font-size: 14px;margin-left: 5px;">记住密码</span>
<span
style=" font-family: NotoSansSC-Regular;color: #232748;font-weight: 400;font-size: 14px;margin-left: 5px;">记住密码</span>
</el-form-item>
</el-col>
<el-col :span="12">
@ -87,17 +84,38 @@ export default {
},
};
},
mounted(){
mounted() {
//
if(this.$peisAPI){
if (this.$peisAPI) {
this.$peisAPI.lazyLoad();
}
},
methods: {
nextFocus(e){
if(e=='Username'){
btnMin(){
if(!this.$peisAPI) {
this.$message.info("此功能,需要在壳客户端才可运行!")
return
}
this.$peisAPI.windowMin();
},
btnMax(){
if(!this.$peisAPI) {
this.$message.info("此功能,需要在壳客户端才可运行!")
return
}
this.$peisAPI.windowMax();
},
btnClose(){
if(!this.$peisAPI) {
this.$message.info("此功能,需要在壳客户端才可运行!")
return
}
this.$peisAPI.windowClose();
},
nextFocus(e) {
if (e == 'Username') {
this.$refs['password'].focus()
}else(
} else (
this.onSubmit()
)
},
@ -105,17 +123,17 @@ export default {
this.$refs.form.validate((valid) => {
if (valid) {
axios.post(`${mm.apiurl}/api/identity/users/login`,{
axios.post(`${mm.apiurl}/api/identity/users/login`, {
userName: this.form.Username,
passWord: this.form.Password,
}).then(ret =>{
}).then(ret => {
let res = ret.data
if (res.code != -1) {
window.sessionStorage.setItem("peisid", res.data.peisid); //
writetoken(res.data.expires_in);
window.sessionStorage.setItem("token", res.data.access_token);
window.sessionStorage.setItem("refresh_token",res.data.refresh_token);
window.sessionStorage.setItem("refresh_token", res.data.refresh_token);
window.sessionStorage.setItem("tokentype", res.data.token_type);
window.sessionStorage.setItem("user", this.form.Username);
@ -126,10 +144,10 @@ export default {
this.$message.warning(res.message);
}
}).then(res => {
if(res && res.code != -1){
if (res && res.code != -1) {
window.sessionStorage.setItem("userPriv", JSON.stringify(res.data));
}
}).catch(err =>{
}).catch(err => {
this.$message.error(err);
})
@ -161,7 +179,7 @@ export default {
});
},
},
created() {},
created() { },
};
</script>
<style lang="scss" scoped>
@ -185,60 +203,67 @@ export default {
width: 100%;
min-height: 100vh;
}
.el-form-item.is-error .el-input__inner {
color: none;
}
.inputcolor {
border: none;
}
.box {
position: absolute;
right: 140px;
top: 119px;
right: 140px;
top: 119px;
}
.mainbody {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
justify-content: center;
align-items: center;
flex-direction: column;
.title {
width: 443px;
width: 443px;
height: 107px;
display: flex;
justify-content: center;
align-items: center;
margin-bottom: 10px;
img {
width: 45.86px;
height: 45.86px;
width: 45.86px;
height: 45.86px;
}
div {
font-size: 38px;
margin-left: 15px;
color: #232748;
font-weight: 600
;
margin-left: 15px;
color: #232748;
font-weight: 600;
}
}
}
.userform {
width: 356px;
height: 366px;
background-color: #fff;
border-radius: 12px;
padding: 40px 32px;
height: 366px;
background-color: #fff;
border-radius: 12px;
padding: 40px 32px;
}
// .btn :hover {
// // background-color: rgb(0, 183, 92);
// }
::v-deep .el-input__icon {
font-size: 18px;
}
.btn {
background-color: #396FFA;
;
;
font-size: 16px;
// background-color: #ccc;
border: none;
@ -247,13 +272,16 @@ export default {
height: 40px;
width: 100%;
}
:deep .el-input--prefix .el-input__inner {
padding-left: 30px;
padding-left: 30px;
}
:deep .el-form-item {
margin-bottom: 22px;
margin-bottom: 22px;
}
:deep .el-button{
:deep .el-button {
color: #fff;
}
</style>
Loading…
Cancel
Save