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

157
src/views/Home.vue

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

112
src/views/login/Login.vue

@ -1,46 +1,43 @@
<template> <template>
<div class="bg"> <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="box">
<div class="mainbody"> <div class="mainbody">
<div class="title"> <div class="title">
<img src="@/assets/images/logo1.png"/>
<img src="@/assets/images/logo1.png" />
<div>神豚体检管理系统</div> <div>神豚体检管理系统</div>
</div> </div>
<div class="userform"> <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"> <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>
<el-form-item label="" prop="Password" style="margin-bottom: 5px"> <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-form-item>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item> <el-form-item>
<el-checkbox></el-checkbox> <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-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
@ -87,17 +84,38 @@ export default {
}, },
}; };
}, },
mounted(){
mounted() {
// //
if(this.$peisAPI){
if (this.$peisAPI) {
this.$peisAPI.lazyLoad(); this.$peisAPI.lazyLoad();
} }
}, },
methods: { 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() this.$refs['password'].focus()
}else(
} else (
this.onSubmit() this.onSubmit()
) )
}, },
@ -105,17 +123,17 @@ export default {
this.$refs.form.validate((valid) => { this.$refs.form.validate((valid) => {
if (valid) { if (valid) {
axios.post(`${mm.apiurl}/api/identity/users/login`,{
axios.post(`${mm.apiurl}/api/identity/users/login`, {
userName: this.form.Username, userName: this.form.Username,
passWord: this.form.Password, passWord: this.form.Password,
}).then(ret =>{
}).then(ret => {
let res = ret.data let res = ret.data
if (res.code != -1) { if (res.code != -1) {
window.sessionStorage.setItem("peisid", res.data.peisid); // window.sessionStorage.setItem("peisid", res.data.peisid); //
writetoken(res.data.expires_in); writetoken(res.data.expires_in);
window.sessionStorage.setItem("token", res.data.access_token); 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("tokentype", res.data.token_type);
window.sessionStorage.setItem("user", this.form.Username); window.sessionStorage.setItem("user", this.form.Username);
@ -126,10 +144,10 @@ export default {
this.$message.warning(res.message); this.$message.warning(res.message);
} }
}).then(res => { }).then(res => {
if(res && res.code != -1){
if (res && res.code != -1) {
window.sessionStorage.setItem("userPriv", JSON.stringify(res.data)); window.sessionStorage.setItem("userPriv", JSON.stringify(res.data));
} }
}).catch(err =>{
}).catch(err => {
this.$message.error(err); this.$message.error(err);
}) })
@ -161,7 +179,7 @@ export default {
}); });
}, },
}, },
created() {},
created() { },
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@ -185,12 +203,15 @@ export default {
width: 100%; width: 100%;
min-height: 100vh; min-height: 100vh;
} }
.el-form-item.is-error .el-input__inner { .el-form-item.is-error .el-input__inner {
color: none; color: none;
} }
.inputcolor { .inputcolor {
border: none; border: none;
} }
.box { .box {
position: absolute; position: absolute;
right: 140px; right: 140px;
@ -202,6 +223,7 @@ export default {
justify-content: center; justify-content: center;
align-items: center; align-items: center;
flex-direction: column; flex-direction: column;
.title { .title {
width: 443px; width: 443px;
height: 107px; height: 107px;
@ -209,16 +231,17 @@ export default {
justify-content: center; justify-content: center;
align-items: center; align-items: center;
margin-bottom: 10px; margin-bottom: 10px;
img { img {
width: 45.86px; width: 45.86px;
height: 45.86px; height: 45.86px;
} }
div { div {
font-size: 38px; font-size: 38px;
margin-left: 15px; margin-left: 15px;
color: #232748; color: #232748;
font-weight: 600
;
font-weight: 600;
} }
} }
} }
@ -230,15 +253,17 @@ export default {
border-radius: 12px; border-radius: 12px;
padding: 40px 32px; padding: 40px 32px;
} }
// .btn :hover { // .btn :hover {
// // background-color: rgb(0, 183, 92); // // background-color: rgb(0, 183, 92);
// } // }
::v-deep .el-input__icon { ::v-deep .el-input__icon {
font-size: 18px; font-size: 18px;
} }
.btn { .btn {
background-color: #396FFA; background-color: #396FFA;
;
;
font-size: 16px; font-size: 16px;
// background-color: #ccc; // background-color: #ccc;
border: none; border: none;
@ -247,13 +272,16 @@ export default {
height: 40px; height: 40px;
width: 100%; width: 100%;
} }
:deep .el-input--prefix .el-input__inner { :deep .el-input--prefix .el-input__inner {
padding-left: 30px; padding-left: 30px;
} }
:deep .el-form-item { :deep .el-form-item {
margin-bottom: 22px; margin-bottom: 22px;
} }
:deep .el-button{
:deep .el-button {
color: #fff; color: #fff;
} }
</style> </style>
Loading…
Cancel
Save