Browse Source

【接口看板】404页面跳转及404页面开发,所有菜单页面调整开发

faster_AG_grid
安虹睿 1 year ago
parent
commit
74da138e28
  1. 10
      PC/InterFace.Dash/src/router/index.js
  2. 222
      PC/InterFace.Dash/src/views/dashboard/index copy.vue
  3. 23
      PC/InterFace.Dash/src/views/error-page/404.vue
  4. 33
      PC/InterFace.Dash/src/views/menuAll/index.vue

10
PC/InterFace.Dash/src/router/index.js

@ -145,11 +145,11 @@ export let constantRoutes = [
export let asyncRoutes = [
/** when your routing map is too long, you can split it into small modules **/
// 404 page must be placed at the end !!!
// {
// path: '*',
// redirect: '/404',
// hidden: true
// }
{
path: '*',
redirect: '/404',
hidden: true
}
]
const createRouter = () => new Router({

222
PC/InterFace.Dash/src/views/dashboard/index copy.vue

@ -1,222 +0,0 @@
<template>
<!-- 瀑布流版本布局 + 高度随宽度调整变化 -->
<el-card class="homeMenuPage" v-resize="setMaxHeight" v-loading="loading">
<div class="firstMenuContain homeMenuPage-List">
<div
class="firstMenuItem menuItem"
v-for="(item,index) in navList"
:key="index"
>
<div class="firstTitle" v-if="item.meta">
<div class="icon"><svg-icon :icon-class="item.meta.icon" style="fill:currentColor; color:#fff;"/></div>
<div>{{item.meta.title}}</div>
</div>
<ul class="menuInfo" v-if="item.children && item.children.length > 0">
<li
v-for="(item2,index2) in item.children"
:key="index2"
>
<div class="title">
{{item2.meta.title}}
<i class="el-icon-arrow-right"></i>
</div>
<!-- 有下级菜单 -->
<div class="lastList" v-if="item2.children && item2.children.length > 0">
<div
v-for="(item3,index3) in item2.children"
:key="index3"
class="item"
>
<span @click="goPage(item3)">{{item3.meta.title}}</span>
</div>
</div>
<!-- 如果二级为最后一级统一格式补充到children中 -->
<div class="lastList" v-else>
<div class="item">
<span @click="goPage(item2)">{{item2.meta.title}}</span>
</div>
</div>
</li>
</ul>
</div>
<span class="firstMenuItem break"></span>
<span class="firstMenuItem break"></span>
<span class="firstMenuItem break"></span>
</div>
</el-card>
</template>
<script>
import { mapGetters } from 'vuex'
export default {
directives: {
//
resize: { //
bind(el, binding) { // elbinding
let width = '', height = '';
function isReize() {
const style = document.defaultView.getComputedStyle(el);
if (width !== style.width || height !== style.height) {
binding.value(); //
}
width = style.width;
height = style.height;
}
el.__vueSetInterval__ = setInterval(isReize, 300);
},
unbind(el) {
clearInterval(el.__vueSetInterval__);
}
}
},
name: 'Dashboard',
data() {
return {
loading:true,
navList:[],
}
},
watch: {
permission_routes(val, oldVal) {
this.initData(val)
}
},
computed: {
...mapGetters([
'permission_routes'
])
},
mounted(){
console.log(90,this.permission_routes)
this.initData(this.permission_routes)
},
methods:{
initData(data){
data.forEach(item => {
if(!item.hidden && item.path !== '/') {
this.navList.push(item)
}
})
this.$nextTick(()=>{
this.setMaxHeight()
})
},
goPage(item){
this.$router.push({name: item.name})
},
setMaxHeight(){
// todothis.$route.path != /dashboard
console.log("setMaxHeight",this.$route.path)
if(document.getElementsByClassName("homeMenuPage-List").length <= 0){
return
}
let _items = document.getElementsByClassName("menuItem")
let _left = [];
let _right = [];
let _left_num = 0;
let _right_num = 0;
_items.forEach((item,key)=>{
//
if(key % 2 == 0){
_left.push(item.offsetHeight)
_left_num += Number(item.offsetHeight)
}
//
else{
_right.push(item.offsetHeight)
_right_num += Number(item.offsetHeight)
}
})
let _max = _left_num > _right_num ? _left_num : _right_num
_max += 20 * _items.length
document.getElementsByClassName("homeMenuPage-List")[0].style.height = _max + 'px'
this.loading = false
}
}
}
</script>
<style lang="scss" scoped>
$iconSize:26px;
.homeMenuPage{
height: 100%;
overflow: auto;
// padding: 20px 0;
}
.firstMenuContain {
display: flex;
flex-flow: column wrap;
align-content: space-between;
/*
* 且高度大于最高的列高 */
// height: 2500px;
.firstMenuItem {
width: calc(50% - 20px);
margin-bottom: 20px;
.firstTitle{
display: flex;
font-weight: bold;
font-size: 18px;
.icon{
background: #409eff;
color: #fff;
border-radius: 4px;
width: $iconSize;
height: $iconSize;
line-height: $iconSize;
overflow: hidden;
text-align: center;
margin-right: 10px;
}
}
.menuInfo{
background: #f9fafb;
margin: 20px 0;
padding: 5px 0;
li{
list-style: none;
display: flex;
padding-top: 10px;
.title{
width: 240px;
text-align: right;
font-weight: bold;
flex-shrink: 0;
.el-icon-arrow-right{
font-weight: bold;
font-size: 14px;
}
}
.lastList{
display: flex;
flex-wrap: wrap;
margin-left: 15px;
.item{
margin-right: 25px;
margin-bottom: 10px;
cursor: pointer;
&:hover{
color: #409eff;
}
}
}
}
}
/* 将内容块重排为4列 */
&:nth-of-type(2n+1) { order: 1; }
&:nth-of-type(2n) { order: 2; }
/* 强制换列 */
&.break {
flex-basis: 100%;
width: 0;
margin: 0;
content: "";
padding: 0;
}
}
}
</style>

23
PC/InterFace.Dash/src/views/error-page/404.vue

@ -8,13 +8,10 @@
<img class="pic-404__child right" src="@/assets/404_images/404_cloud.png" alt="404">
</div>
<div class="bullshit">
<div class="bullshit__oops">OOPS!</div>
<div class="bullshit__info">All rights reserved
<a style="color:#20a0ff" href="https://wallstreetcn.com" target="_blank">wallstreetcn</a>
</div>
<div class="bullshit__headline">{{ message }}</div>
<div class="bullshit__info">Please check that the URL you entered is correct, or click the button below to return to the homepage.</div>
<a href="" class="bullshit__return-home">Back to home</a>
<div class="bullshit__oops">访问发生错误!</div>
<div class="bullshit__headline">暂无该页面或者您没有访问权限</div>
<div class="bullshit__info">请检查您输入的地址是否正确<br/>以及是否有该权限<br/>或者单击下面的按钮返回主页</div>
<a href="/home" class="bullshit__return-home">返回主页</a>
</div>
</div>
</div>
@ -24,11 +21,6 @@
export default {
name: 'Page404',
computed: {
message() {
return 'The webmaster said that you can not enter this page...'
}
}
}
</script>
@ -167,10 +159,11 @@ export default {
line-height: 40px;
color: #1482f0;
opacity: 0;
margin-bottom: 20px;
margin-bottom: 30px;
animation-name: slideUp;
animation-duration: 0.5s;
animation-fill-mode: forwards;
padding-top: 20px;
}
&__headline {
font-size: 20px;
@ -185,11 +178,11 @@ export default {
animation-fill-mode: forwards;
}
&__info {
font-size: 13px;
font-size: 16px;
line-height: 21px;
color: grey;
opacity: 0;
margin-bottom: 30px;
margin-bottom: 40px;
animation-name: slideUp;
animation-duration: 0.5s;
animation-delay: 0.2s;

33
PC/InterFace.Dash/src/views/menuAll/index.vue

@ -27,24 +27,31 @@ export default {
])
},
mounted(){
this.initData(this.permission_routes)
let _menus = JSON.parse(JSON.stringify(this.permission_routes))
// let _showList = _menus.filter(item=>{
// return !item.hidden
// })
this.navList = this.initData(_menus,true)
},
methods:{
initData(data){
initData(data,first){
let _list = []
data.forEach(item => {
if(item.path !== '/' && item.meta) {
let _item = {
title:item.meta.title,
name:item.name,
path:item.path,
children:item.children
}
this.navList.push(_item)
//
if(item.meta){
item.title = item.meta.title
_list.push(item)
}
if(item.children){
this.initData(item.children)
//
else{
if(item.children && item.children.length > 0)_list.push(item.children[0])
}
})
if(item.children && item.children.length > 0)item.children = this.initData(item.children)
});
// _list = _list.filter(item=>{
// return !item.hidden
// })
return _list
},
goPage(item){
this.$router.push({name: item.name})

Loading…
Cancel
Save