页面修改

1.0.0
黄崇栋 6 years ago
parent 3e47cfe093
commit 356baa8785

13423
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -6,12 +6,12 @@
<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>用户中心</title> <title>垛机监控系统</title>
</head> </head>
<body> <body>
<noscript> <noscript>
<strong>We're sorry but 用户中心 doesn't work properly without JavaScript enabled. Please enable it to <strong>We're sorry but 垛机监控系统 doesn't work properly without JavaScript enabled. Please enable it to
continue.</strong> continue.</strong>
</noscript> </noscript>
<div id="app"></div> <div id="app"></div>

@ -1,8 +1,10 @@
<template> <template>
<div class="aside"> <div class="aside">
<transition name="slide">
<div class="aside-logo" v-show="!aside_collapsed"> <div class="aside-logo" v-show="!aside_collapsed">
<span>昆船随行式垛机监测系统</span> <span>昆船随行式垛机监测系统</span>
</div> </div>
</transition>
<a-menu <a-menu
:selectedKeys="selectedKeys" :selectedKeys="selectedKeys"
:openKeys.sync="openKeys" :openKeys.sync="openKeys"
@ -52,13 +54,9 @@ export default {
}, },
// //
setRoute() { setRoute() {
console.log( let parents = [];
"this.$router.options.routes[0].children", if (this.userInfo.id) {
this.$router.options.routes[0].children parents = this.$router.options.routes[0].children.filter(
);
// level
//
let parents = this.$router.options.routes[0].children.filter(
ele => { ele => {
if ( if (
this.userInfo.permissionList.some(item => { this.userInfo.permissionList.some(item => {
@ -85,13 +83,13 @@ export default {
} }
}; };
recursionRoute(parents); recursionRoute(parents);
} else {
// parents = this.$router.options.routes[0].children.filter(
// let parents = this.$router.options.routes[0].children.filter( item => {
// item => { return !item.name.startsWith("center");
// return !item.name.startsWith("center"); }
// } );
// ); }
this.routes = parents; this.routes = parents;
this.initialKeys(); this.initialKeys();
@ -134,12 +132,19 @@ export default {
position: relative; position: relative;
box-shadow: 2px 0px 6px 0px rgba(0, 21, 41, 0.35); box-shadow: 2px 0px 6px 0px rgba(0, 21, 41, 0.35);
z-index: 1000; z-index: 1000;
.slide-enter-active {
transition: all 1s;
}
.slide-enter,
.slide-leave-to {
width: 0;
opacity: 0;
}
&-logo { &-logo {
height: 65px; height: 65px;
display: flex; display: flex;
align-items: center; align-items: center;
background-color: #00284d; background-color: #00284d;
padding-left: 24px;
span { span {
font-size: 18px; font-size: 18px;
font-weight: bold; font-weight: bold;
@ -149,5 +154,8 @@ export default {
.ant-menu-inline { .ant-menu-inline {
width: 256px; width: 256px;
} }
.ant-menu-inline-collapsed {
width: 80px;
}
} }
</style> </style>

@ -25,17 +25,38 @@ VueRouter.prototype.push = function push(location) {
const routes = [{ const routes = [{
path: '/', path: '/',
redirect: { redirect: {
name: 'login' name: 'guide'
}, },
component: () => import('../views/main.vue'), component: () => import('@/views/main'),
children: [ children: [{
...allRouter path: 'realTime',
] name: 'realTime',
meta: {
icon: 'global',
name: '实时监控'
},
component: () => import('@/views/realTime/index')
}, {
path: 'history',
name: 'history',
meta: {
icon: 'cloud',
name: '历史监控'
},
component: () => import('@/views/history/index')
}, {
path: 'center',
name: 'center',
meta: {
name: '个人中心'
},
component: () => import('@/views/center')
}]
}, },
{ {
path: '/login', path: '/guide',
name: 'login', name: 'guide',
component: () => import('../views/login.vue') component: () => import('../views/guide.vue')
}, },
{ {
path: '*', path: '*',
@ -49,34 +70,35 @@ const router = new VueRouter({
}) })
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
let userInfo = JSON.parse(sessionStorage.getItem('userInfo') || '{}')
// 校验是否登录
if (userInfo.id) {
// 匹配不到 404
if (!to.name) next();
// 权限
if (userInfo.permissionList.some((item) => {
return item.rights === to.name
})) {
next()
} else {
if (to.name === 'login') {
next() next()
} else { // let userInfo = JSON.parse(sessionStorage.getItem('userInfo') || '{}')
Vue.prototype.$message.info('没有权限') // // 校验是否登录
next(false) // if (userInfo.id) {
} // // 匹配不到 404
} // if (!to.name) next();
} else { // // 权限
if (to.name === 'login') { // if (userInfo.permissionList.some((item) => {
next() // return item.rights === to.name
} else if (to.name !== 'login') { // })) {
Vue.prototype.$message.info('请先登录') // next()
next('/login') // } else {
} else { // if (to.name === 'login') {
next('/login') // next()
} // } else {
} // Vue.prototype.$message.info('没有权限')
// next(false)
// }
// }
// } else {
// if (to.name === 'login') {
// next()
// } else if (to.name !== 'login') {
// Vue.prototype.$message.info('请先登录')
// next('/login')
// } else {
// next('/login')
// }
// }
}) })
export default router export default router

@ -74,6 +74,11 @@
} }
} }
.bg {
&-white {
background-color: #ffffff;
}
}
.no-margin { .no-margin {
margin: 0 !important; margin: 0 !important;

@ -1,12 +1,49 @@
<template> <template>
<div class="guide"></div> <div class="guide">
<div
class="guide-box mr64"
v-for="(item, index) in list"
:key="index"
@click="go(index)"
>{{item.label}}</div>
</div>
</template> </template>
<script> <script>
export default { export default {
name: "guide" name: "guide",
data() {
return {
list: [
{
label: "随行监控系统"
},
{
label: "盘点任务模式"
}
]
};
},
methods: {
go(index) {
if (index === 0) {
this.$router.push({ name: "realTime" });
} else {
this.$message.info("暂未开放");
}
}
}
}; };
</script> </script>
<style> <style lang='scss'>
.guide {
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
&-box {
cursor: pointer;
}
}
</style> </style>

@ -1,4 +1,6 @@
<template></template> <template>
<div class="history"></div>
</template>
<script> <script>
export default { export default {

@ -19,70 +19,17 @@
<div class="login-cover-logo"> <div class="login-cover-logo">
<img src="@/assets/logo.png" alt="logo" /> <img src="@/assets/logo.png" alt="logo" />
</div> </div>
<div class="login-cover-title">用户中心</div> <div class="login-cover-title">垛机监控系统</div>
<a-form :form="form">
<a-form-item>
<a-input
ref="accountRef"
v-decorator="['account', { rules: [{ required: true, message: '请输入手机号' }] }]"
size="large"
autocomplete="off"
placeholder="请输入手机号"
>
<a-icon slot="prefix" type="user" style="color:rgba(0,0,0,.25)" />
</a-input>
</a-form-item>
<a-form-item>
<a-input
v-decorator="['password', { rules: [{ required: true, message: '请输入密码' }] }]"
type="password"
size="large"
autocomplete="off"
placeholder="请输入密码"
:style="{ display: 'none' }"
>
<a-icon slot="prefix" type="lock" />
</a-input>
<a-input
v-decorator="['password', { rules: [{ required: true, message: '请输入密码' }] }]"
type="password"
size="large"
autocomplete="off"
placeholder="请输入密码"
@keypress.enter.native="handleSubmit"
>
<a-icon slot="prefix" type="lock" style="color:rgba(0,0,0,.25)" />
</a-input>
</a-form-item>
</a-form>
<div class="login-other">
<div class="login-forget">
<a href="javascript:;" @click="forget"></a>
</div>
<a-button
type="primary"
@click="handleSubmit"
class="login-submit"
size="large"
:loading="isLoading"
:disabled="!(form.getFieldValue('account') && form.getFieldValue('password'))"
>登录</a-button>
</div>
</div> </div>
<!-- <div class="login-footer">Copyright © 2020 ZheHe technology CO., LTD.</div> --> <!-- <div class="login-footer">Copyright © 2020 ZheHe technology CO., LTD.</div> -->
</div> </div>
</template> </template>
<script type="text/javascript"> <script type="text/javascript">
import { mapMutations } from "vuex";
export default { export default {
name: "login", name: "login",
data() { data() {
return { return {
// form
form: this.$form.createForm(this),
// btn loading // btn loading
isLoading: false, isLoading: false,
@ -91,7 +38,6 @@ export default {
}; };
}, },
methods: { methods: {
...mapMutations(["setState"]),
// //
existsAccount() { existsAccount() {
if (!this.form.getFieldValue("account")) return; if (!this.form.getFieldValue("account")) return;
@ -128,44 +74,9 @@ export default {
.name; .name;
this.$router.push({ name: routerName }); this.$router.push({ name: routerName });
} }
},
//
handleSubmit() {
this.isLoading = true;
this.form.validateFields((err, values) => {
console.log(values);
if (values.account && values.password) {
this.$api.userApi
.login({
data: {
account: values.account,
password: values.password
}
})
.then(res => {
this.permissionCheck(res.data);
this.isLoading = false;
})
.catch(err => {
console.log(err);
this.isLoading = false;
});
}
});
},
//
forget() {
const h = this.$createElement;
this.$info({
title: "忘记密码",
content: h("div", {}, [h("p", "如需重置密码,请联系管理员")]),
onOk() {}
});
} }
}, },
mounted() { mounted() {}
this.$refs.accountRef.focus();
}
}; };
</script> </script>
<style lang="scss"> <style lang="scss">

@ -33,6 +33,7 @@ export default {
&-content { &-content {
background-color: #eeeeee; background-color: #eeeeee;
flex: 1; flex: 1;
padding: 24px;
} }
} }
} }

@ -1,4 +1,6 @@
<template></template> <template>
<div class="realTime bg-white"></div>
</template>
<script> <script>
export default { export default {
@ -6,5 +8,5 @@ export default {
}; };
</script> </script>
<style> <style lang='scss'>
</style> </style>
Loading…
Cancel
Save