解决报错
This commit is contained in:
parent
70228f96fb
commit
22f2aeedf9
|
@ -1,72 +1,93 @@
|
||||||
import React from "react"
|
/*
|
||||||
import ReactDOM from "react-dom"
|
* @Author: Wind
|
||||||
import "./main.less"
|
* @Date: 2022-08-17 12:09:24
|
||||||
import { Icon } from "zent"
|
* @LastEditors: Wind
|
||||||
import { HashRouter as Router, Route, Link } from "react-router-dom";
|
* @LastEditTime: 2022-08-17 15:55:08
|
||||||
import Bus from "../../assets/eventBus.js";
|
* @Description:
|
||||||
|
* @FilePath: \frontend\src\components\mouseMenu\main.js
|
||||||
|
*/
|
||||||
|
import React from 'react'
|
||||||
|
import ReactDOM from 'react-dom'
|
||||||
|
import './main.less'
|
||||||
|
import { Icon } from 'zent'
|
||||||
|
import { HashRouter as Router, Route, Link } from 'react-router-dom'
|
||||||
|
import Bus from '../../assets/eventBus.js'
|
||||||
export default class MouseMenu extends React.Component {
|
export default class MouseMenu extends React.Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props)
|
||||||
this.state = {
|
this.state = {
|
||||||
activeMenuList: [] //总动态路由数据
|
activeMenuList: [] //总动态路由数据
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
let activeMenuList = JSON.parse(sessionStorage.getItem("activeMenu"));
|
let activeMenuList = JSON.parse(sessionStorage.getItem('activeMenu'))
|
||||||
this.setState({ activeMenuList });
|
this.setState({ activeMenuList })
|
||||||
}
|
}
|
||||||
closeMenuMask() {
|
closeMenuMask() {
|
||||||
this.props.mouseLeaveFn();
|
this.props.mouseLeaveFn()
|
||||||
}
|
}
|
||||||
//点击菜单
|
//点击菜单
|
||||||
clickMenuItem(e, it) {
|
clickMenuItem(e, it) {
|
||||||
if (it.router == '/home/distributor-add') {
|
if (it.router == '/home/distributor-add') {
|
||||||
sessionStorage.setItem('pathname2', '/home/system/distributor-add')
|
sessionStorage.setItem('pathname2', '/home/system/distributor-add')
|
||||||
let activerou = [{
|
let activerou = [
|
||||||
'pagetitle': '新建', items: [
|
|
||||||
{
|
{
|
||||||
"path": "distributor-list",
|
pagetitle: '新建',
|
||||||
"name": "分销商管理"
|
items: [
|
||||||
|
{
|
||||||
|
path: 'distributor-list',
|
||||||
|
name: '分销商管理'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "distributor-add",
|
path: 'distributor-add',
|
||||||
"name": "新建分销商"
|
name: '新建分销商'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}]
|
|
||||||
sessionStorage.setItem('breaknav', JSON.stringify(activerou));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
this.props.mouseLeaveFn();
|
]
|
||||||
|
sessionStorage.setItem('breaknav', JSON.stringify(activerou))
|
||||||
|
}
|
||||||
|
this.props.mouseLeaveFn()
|
||||||
}
|
}
|
||||||
render() {
|
render() {
|
||||||
let menuList = this.state.activeMenuList;//路由表
|
let menuList = this.state.activeMenuList //路由表
|
||||||
let urlHref=(window.location.href).replace(/^\/|\/$/g, '');
|
let urlHref = window.location.href.replace(/^\/|\/$/g, '')
|
||||||
const pathname = urlHref.lastIndexOf("/");
|
const pathname = urlHref.lastIndexOf('/')
|
||||||
const pathnamestr = urlHref.substr(pathname);
|
const pathnamestr = urlHref.substr(pathname)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="mouseMenu" onMouseLeave={this.closeMenuMask.bind(this)} onMouseEnter={this.props.mouseEnter}>
|
<div
|
||||||
<div className="menuBody">
|
className='mouseMenu'
|
||||||
<div className="first_menu">
|
onMouseLeave={this.closeMenuMask.bind(this)}
|
||||||
{
|
onMouseEnter={this.props.mouseEnter}>
|
||||||
menuList.map((item, i) => {
|
<div className='menuBody'>
|
||||||
|
<div className='first_menu'>
|
||||||
|
{menuList?.map((item, i) => {
|
||||||
return (
|
return (
|
||||||
<div key={i}>
|
<div key={i}>
|
||||||
{
|
{item.children.map((childItem, childI) => {
|
||||||
item.children.map((childItem, childI) => {
|
return childItem.level == 5 ? (
|
||||||
return (
|
<Link
|
||||||
childItem.level == 5 ? <Link key={childI} to={childItem.router} className={childItem.router.includes(pathnamestr) && item.children.length >= 1 ? 'mouse_menuactive menu_items' : 'menu_items'} onClick={(e) => this.clickMenuItem(e, childItem)}>{childItem.title}</Link> : null
|
key={childI}
|
||||||
)
|
to={childItem.router}
|
||||||
})
|
className={
|
||||||
|
childItem.router.includes(pathnamestr) &&
|
||||||
|
item.children.length >= 1
|
||||||
|
? 'mouse_menuactive menu_items'
|
||||||
|
: 'menu_items'
|
||||||
}
|
}
|
||||||
|
onClick={(e) => this.clickMenuItem(e, childItem)}>
|
||||||
|
{childItem.title}
|
||||||
|
</Link>
|
||||||
|
) : null
|
||||||
|
})}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
})
|
})}
|
||||||
}
|
|
||||||
</div>
|
</div>
|
||||||
{/* <Icon type="close" className="closeMenu" onClick={this.closeMenuMask.bind(this)} /> */}
|
{/* <Icon type="close" className="closeMenu" onClick={this.closeMenuMask.bind(this)} /> */}
|
||||||
</div>
|
</div>
|
||||||
</div>)
|
</div>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,165 +1,164 @@
|
||||||
import React from "react";
|
import React from 'react'
|
||||||
import ReactDOM from "react-dom";
|
import ReactDOM from 'react-dom'
|
||||||
import "./main.less";
|
import './main.less'
|
||||||
import { Pop } from "zent";
|
import { Pop } from 'zent'
|
||||||
import MouseMenu from "../mouseMenu/main.js";
|
import MouseMenu from '../mouseMenu/main.js'
|
||||||
import Bus from "../../assets/eventBus.js";
|
import Bus from '../../assets/eventBus.js'
|
||||||
import { HashRouter as Router, Route, Link } from "react-router-dom";
|
import { HashRouter as Router, Route, Link } from 'react-router-dom'
|
||||||
export default class topNav extends React.Component {
|
export default class topNav extends React.Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props)
|
||||||
this.state = {
|
this.state = {
|
||||||
pathname: "",
|
pathname: '',
|
||||||
pathname2: sessionStorage.getItem("pathname2"),
|
pathname2: sessionStorage.getItem('pathname2'),
|
||||||
navlists: this.props.listnav,
|
navlists: this.props.listnav,
|
||||||
menulinklist: JSON.parse(sessionStorage.getItem("menulinklist"))
|
menulinklist: JSON.parse(sessionStorage.getItem('menulinklist'))
|
||||||
? JSON.parse(sessionStorage.getItem("menulinklist"))
|
? JSON.parse(sessionStorage.getItem('menulinklist'))
|
||||||
: [],
|
: [],
|
||||||
linkshowname: sessionStorage.getItem("linkshowname"),
|
linkshowname: sessionStorage.getItem('linkshowname'),
|
||||||
showflag: JSON.parse(sessionStorage.getItem("showflag")),
|
showflag: JSON.parse(sessionStorage.getItem('showflag')),
|
||||||
mouseMenuFlag: false, //控制菜单移入效果
|
mouseMenuFlag: false //控制菜单移入效果
|
||||||
};
|
}
|
||||||
this.backFn = this.backFn.bind(this);
|
this.backFn = this.backFn.bind(this)
|
||||||
}
|
}
|
||||||
//点击一级菜单
|
//点击一级菜单
|
||||||
showlinkmenu(e, item) {
|
showlinkmenu(e, item) {
|
||||||
let self = this;
|
let self = this
|
||||||
try {
|
try {
|
||||||
item.children.forEach((it) => {
|
item.children.forEach((it) => {
|
||||||
if (it.level === 5) {
|
if (it.level === 5) {
|
||||||
sessionStorage.setItem("pathname2", it.router);
|
sessionStorage.setItem('pathname2', it.router)
|
||||||
throw "终止循环";
|
throw '终止循环'
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
self.setState({ linkshowname: item.title });
|
self.setState({ linkshowname: item.title })
|
||||||
self.setState({ menulinklist: item.children });
|
self.setState({ menulinklist: item.children })
|
||||||
|
|
||||||
// 防止刷新页面,导航签清空
|
// 防止刷新页面,导航签清空
|
||||||
sessionStorage.setItem("menulinklist", JSON.stringify(item.children));
|
sessionStorage.setItem('menulinklist', JSON.stringify(item.children))
|
||||||
sessionStorage.setItem("showflag", true);
|
sessionStorage.setItem('showflag', true)
|
||||||
sessionStorage.setItem("linkshowname", item.title);
|
sessionStorage.setItem('linkshowname', item.title)
|
||||||
Bus.emit("closeMask", false); //中介传参,关闭弹出框
|
Bus.emit('closeMask', false) //中介传参,关闭弹出框
|
||||||
this.setState({ mouseMenuFlag: false });
|
this.setState({ mouseMenuFlag: false })
|
||||||
}
|
}
|
||||||
//鼠标移入
|
//鼠标移入
|
||||||
mouseMenuFn() {
|
mouseMenuFn() {
|
||||||
this.setState({ mouseMenuFlag: true });
|
this.setState({ mouseMenuFlag: true })
|
||||||
this.props.openMouseMask();
|
this.props.openMouseMask()
|
||||||
}
|
}
|
||||||
mouseLeaveFn() {
|
mouseLeaveFn() {
|
||||||
//鼠标移出
|
//鼠标移出
|
||||||
this.setState({ mouseMenuFlag: false });
|
this.setState({ mouseMenuFlag: false })
|
||||||
Bus.emit("closeMask", false); //中介传参,关闭弹出框
|
Bus.emit('closeMask', false) //中介传参,关闭弹出框
|
||||||
}
|
}
|
||||||
btnfn(item2) {
|
btnfn(item2) {
|
||||||
this.setState({ pathname2: item2.router });
|
this.setState({ pathname2: item2.router })
|
||||||
this.setState({ showflag: true });
|
this.setState({ showflag: true })
|
||||||
sessionStorage.setItem("showflag", true);
|
sessionStorage.setItem('showflag', true)
|
||||||
sessionStorage.setItem("pathname2", item2.router);
|
sessionStorage.setItem('pathname2', item2.router)
|
||||||
}
|
}
|
||||||
//返回
|
//返回
|
||||||
backFn(items) {
|
backFn(items) {
|
||||||
this.setState({ pathname2: items.router });
|
this.setState({ pathname2: items.router })
|
||||||
sessionStorage.setItem("showflag", true);
|
sessionStorage.setItem('showflag', true)
|
||||||
sessionStorage.setItem("pathname2", items.router);
|
sessionStorage.setItem('pathname2', items.router)
|
||||||
window.history.go(-1);
|
window.history.go(-1)
|
||||||
if (items.length > 1) {
|
if (items.length > 1) {
|
||||||
sessionStorage.setItem("pathname2", items[0].path);
|
sessionStorage.setItem('pathname2', items[0].path)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
componentDidUpdate(nextProps, nextState) {
|
componentDidUpdate(nextProps, nextState) {
|
||||||
if (this.props.setrender !== nextProps.setrender) {
|
if (this.props.setrender !== nextProps.setrender) {
|
||||||
this.setState({
|
this.setState({
|
||||||
linkshowname: sessionStorage.getItem("linkshowname"),
|
linkshowname: sessionStorage.getItem('linkshowname'),
|
||||||
menulinklist: JSON.parse(sessionStorage.getItem("menulinklist"))
|
menulinklist: JSON.parse(sessionStorage.getItem('menulinklist'))
|
||||||
? JSON.parse(sessionStorage.getItem("menulinklist"))
|
? JSON.parse(sessionStorage.getItem('menulinklist'))
|
||||||
: [],
|
: []
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
let history0 = window.history.length <= 1;
|
let history0 = window.history.length <= 1
|
||||||
let routeflag = sessionStorage.getItem("showflag");
|
let routeflag = sessionStorage.getItem('showflag')
|
||||||
let breaknav = JSON.parse(sessionStorage.getItem("breaknav"));
|
let breaknav = JSON.parse(sessionStorage.getItem('breaknav'))
|
||||||
let urlHref=(window.location.href).replace(/^\/|\/$/g, '');
|
let urlHref = window.location.href.replace(/^\/|\/$/g, '')
|
||||||
const pathname = urlHref.lastIndexOf("/");
|
const pathname = urlHref.lastIndexOf('/')
|
||||||
const pathnamestr = urlHref.substr(pathname);
|
const pathnamestr = urlHref.substr(pathname)
|
||||||
let breakflag =
|
let breakflag =
|
||||||
pathnamestr.includes("add") ||
|
pathnamestr.includes('add') ||
|
||||||
pathnamestr.includes("aid") ||
|
pathnamestr.includes('aid') ||
|
||||||
pathnamestr.includes("exchangecode-copyCode") ||
|
pathnamestr.includes('exchangecode-copyCode') ||
|
||||||
pathnamestr.includes("distributor-edit") ||
|
pathnamestr.includes('distributor-edit') ||
|
||||||
pathnamestr.includes("key-list") ||
|
pathnamestr.includes('key-list') ||
|
||||||
pathnamestr.includes("key-detail") ||
|
pathnamestr.includes('key-detail') ||
|
||||||
pathnamestr.includes("key-edit") ||
|
pathnamestr.includes('key-edit') ||
|
||||||
pathnamestr.includes("exchangecode-edit") ||
|
pathnamestr.includes('exchangecode-edit') ||
|
||||||
pathnamestr.includes("plan-edit") ||
|
pathnamestr.includes('plan-edit') ||
|
||||||
pathnamestr.includes("product-edit");
|
pathnamestr.includes('product-edit')
|
||||||
let sedcbreakflag = pathnamestr.includes("plan-create");
|
let sedcbreakflag = pathnamestr.includes('plan-create')
|
||||||
let planbreakflag = pathnamestr.includes("mytempMould");
|
let planbreakflag = pathnamestr.includes('mytempMould')
|
||||||
let editbreakflag = pathnamestr.includes("edittemplate");
|
let editbreakflag = pathnamestr.includes('edittemplate')
|
||||||
let backshow =
|
let backshow =
|
||||||
pathnamestr.includes("account-add") ||
|
pathnamestr.includes('account-add') ||
|
||||||
pathnamestr.includes("role-add") ||
|
pathnamestr.includes('role-add') ||
|
||||||
pathnamestr.includes("distributor-add") ||
|
pathnamestr.includes('distributor-add') ||
|
||||||
pathnamestr.includes("subaccount-add") ||
|
pathnamestr.includes('subaccount-add') ||
|
||||||
pathnamestr.includes("exchangecode-edit") ||
|
pathnamestr.includes('exchangecode-edit') ||
|
||||||
pathnamestr.includes("plan-edit") ||
|
pathnamestr.includes('plan-edit') ||
|
||||||
pathnamestr.includes("key-list") ||
|
pathnamestr.includes('key-list') ||
|
||||||
pathnamestr.includes("exchange-addcommodity");
|
pathnamestr.includes('exchange-addcommodity')
|
||||||
let breakchange =
|
let breakchange =
|
||||||
pathnamestr.includes("exchangecode-add") ||
|
pathnamestr.includes('exchangecode-add') ||
|
||||||
pathnamestr.includes("key-edit") ||
|
pathnamestr.includes('key-edit') ||
|
||||||
pathnamestr.includes("key-detail") ||
|
pathnamestr.includes('key-detail') ||
|
||||||
pathnamestr.includes("product-edit") ||
|
pathnamestr.includes('product-edit') ||
|
||||||
pathnamestr.includes("plan-edit");
|
pathnamestr.includes('plan-edit')
|
||||||
if (breakchange) {
|
if (breakchange) {
|
||||||
breaknav = JSON.parse(sessionStorage.getItem("breakchangenav"));
|
breaknav = JSON.parse(sessionStorage.getItem('breakchangenav'))
|
||||||
}
|
}
|
||||||
if (pathnamestr.includes("aid")) {
|
if (pathnamestr.includes('aid')) {
|
||||||
breaknav = JSON.parse(sessionStorage.getItem("subbreaknav"));
|
breaknav = JSON.parse(sessionStorage.getItem('subbreaknav'))
|
||||||
}
|
}
|
||||||
let accPath = null;
|
let accPath = null
|
||||||
return (
|
return (
|
||||||
<div className="topheader">
|
<div className='topheader'>
|
||||||
<div className="nava">
|
<div className='nava'>
|
||||||
{this.state.navlists.map((item, i) => {
|
{this.state.navlists?.map((item, i) => {
|
||||||
try {
|
try {
|
||||||
item.children.forEach((it) => {
|
item.children.forEach((it) => {
|
||||||
if (it.level === 5) {
|
if (it.level === 5) {
|
||||||
accPath = it.router;
|
accPath = it.router
|
||||||
throw "终止循环";
|
throw '终止循环'
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
return item.children && item.children.length > 0 ? (
|
return item.children && item.children.length > 0 ? (
|
||||||
<Link
|
<Link
|
||||||
key={i}
|
key={i}
|
||||||
to={item.router == "/system" ? accPath : item.router}
|
to={item.router == '/system' ? accPath : item.router}
|
||||||
style={
|
style={
|
||||||
this.state.linkshowname == item.title
|
this.state.linkshowname == item.title
|
||||||
? {
|
? {
|
||||||
width: "#100%",
|
width: '#100%',
|
||||||
background: "#f2f4f7",
|
background: '#f2f4f7',
|
||||||
color: "#296bef",
|
color: '#296bef'
|
||||||
}
|
}
|
||||||
: null
|
: null
|
||||||
}
|
}
|
||||||
className={
|
className={
|
||||||
this.state.linkshowname == item.title ? "active" : ""
|
this.state.linkshowname == item.title ? 'active' : ''
|
||||||
}
|
}
|
||||||
onClick={(e) => this.showlinkmenu(e, item)}
|
onClick={(e) => this.showlinkmenu(e, item)}
|
||||||
onMouseEnter={this.mouseMenuFn.bind(this)}
|
onMouseEnter={this.mouseMenuFn.bind(this)}
|
||||||
onMouseLeave={this.mouseLeaveFn.bind(this)}
|
onMouseLeave={this.mouseLeaveFn.bind(this)}>
|
||||||
>
|
|
||||||
{item.title}
|
{item.title}
|
||||||
</Link>
|
</Link>
|
||||||
) : null;
|
) : null
|
||||||
})}
|
})}
|
||||||
{this.state.mouseMenuFlag ? (
|
{this.state.mouseMenuFlag ? (
|
||||||
<div className="moveMenu">
|
<div className='moveMenu'>
|
||||||
<MouseMenu
|
<MouseMenu
|
||||||
mouseEnter={this.mouseMenuFn.bind(this)}
|
mouseEnter={this.mouseMenuFn.bind(this)}
|
||||||
mouseLeaveFn={this.mouseLeaveFn.bind(this)}
|
mouseLeaveFn={this.mouseLeaveFn.bind(this)}
|
||||||
|
@ -171,12 +170,12 @@ export default class topNav extends React.Component {
|
||||||
{editbreakflag == false &&
|
{editbreakflag == false &&
|
||||||
planbreakflag == false &&
|
planbreakflag == false &&
|
||||||
sedcbreakflag == false &&
|
sedcbreakflag == false &&
|
||||||
this.state.menulinklist != "" &&
|
this.state.menulinklist != '' &&
|
||||||
breakflag == false &&
|
breakflag == false &&
|
||||||
routeflag == "true" ? (
|
routeflag == 'true' ? (
|
||||||
<div className="linkmenu">
|
<div className='linkmenu'>
|
||||||
<div className="dflexaj navshow">
|
<div className='dflexaj navshow'>
|
||||||
<div className="linkmenu-row">
|
<div className='linkmenu-row'>
|
||||||
{this.state.menulinklist.map((item, key) => {
|
{this.state.menulinklist.map((item, key) => {
|
||||||
return item.level == 5 ? (
|
return item.level == 5 ? (
|
||||||
<Link
|
<Link
|
||||||
|
@ -187,13 +186,12 @@ export default class topNav extends React.Component {
|
||||||
item.router.includes(pathnamestr) &&
|
item.router.includes(pathnamestr) &&
|
||||||
this.state.menulinklist.filter((it) => it.level == 5)
|
this.state.menulinklist.filter((it) => it.level == 5)
|
||||||
.length > 1
|
.length > 1
|
||||||
? "menuactive"
|
? 'menuactive'
|
||||||
: ""
|
: ''
|
||||||
}
|
}>
|
||||||
>
|
|
||||||
{item.title}
|
{item.title}
|
||||||
</Link>
|
</Link>
|
||||||
) : null;
|
) : null
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
<span>数据最后更新时间:{window.timeshow}</span>
|
<span>数据最后更新时间:{window.timeshow}</span>
|
||||||
|
@ -204,56 +202,53 @@ export default class topNav extends React.Component {
|
||||||
sedcbreakflag == false &&
|
sedcbreakflag == false &&
|
||||||
breakflag == true &&
|
breakflag == true &&
|
||||||
breaknav != null &&
|
breaknav != null &&
|
||||||
routeflag == "true" ? (
|
routeflag == 'true' ? (
|
||||||
<div className="linkmenu">
|
<div className='linkmenu'>
|
||||||
{breaknav.map((item, key) => {
|
{breaknav.map((item, key) => {
|
||||||
return (
|
return (
|
||||||
<div className="nolinkmenu-row" key={key}>
|
<div className='nolinkmenu-row' key={key}>
|
||||||
{!history0 && !backshow ? (
|
{!history0 && !backshow ? (
|
||||||
<Pop
|
<Pop
|
||||||
trigger="hover"
|
trigger='hover'
|
||||||
position="bottom-center"
|
position='bottom-center'
|
||||||
content="返回"
|
content='返回'>
|
||||||
>
|
|
||||||
<img
|
<img
|
||||||
onClick={() => this.backFn(item.items)}
|
onClick={() => this.backFn(item.items)}
|
||||||
src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/Marketing/back.svg"
|
src='https://lsxdemall.oss-cn-beijing.aliyuncs.com/Marketing/back.svg'
|
||||||
alt=""
|
alt=''
|
||||||
/>
|
/>
|
||||||
</Pop>
|
</Pop>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
<div
|
<div
|
||||||
className="nonav"
|
className='nonav'
|
||||||
style={{
|
style={{
|
||||||
borderLeft:
|
borderLeft:
|
||||||
!history0 && !backshow ? "1px solid #d1cfcf" : "none",
|
!history0 && !backshow ? '1px solid #d1cfcf' : 'none'
|
||||||
}}
|
}}>
|
||||||
>
|
|
||||||
{item.items.map((item2, key2) => {
|
{item.items.map((item2, key2) => {
|
||||||
return (
|
return (
|
||||||
<div className="dflexa" key={key2}>
|
<div className='dflexa' key={key2}>
|
||||||
{key2 != 0 ? <span>></span> : null}
|
{key2 != 0 ? <span>></span> : null}
|
||||||
<font
|
<font
|
||||||
className={
|
className={
|
||||||
key2 + 1 == breaknav[0].items.length
|
key2 + 1 == breaknav[0].items.length
|
||||||
? "nomenuactive"
|
? 'nomenuactive'
|
||||||
: ""
|
: ''
|
||||||
}
|
}>
|
||||||
>
|
{' '}
|
||||||
{" "}
|
|
||||||
{item2.name}
|
{item2.name}
|
||||||
</font>
|
</font>
|
||||||
</div>
|
</div>
|
||||||
);
|
)
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
)
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
);
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ import Bus from '@/assets/eventBus.js'
|
||||||
import Subnav from '@/components/subnav/main'
|
import Subnav from '@/components/subnav/main'
|
||||||
import { Avatar, Pop, Sweetalert, Dialog, Icon, Notify } from 'zent'
|
import { Avatar, Pop, Sweetalert, Dialog, Icon, Notify } from 'zent'
|
||||||
import ModifySelfpwd from './ModifySelfpwd'
|
import ModifySelfpwd from './ModifySelfpwd'
|
||||||
import router from '@/router/index'
|
import { router, navRoute } from '@/router/index'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
getUserinfo,
|
getUserinfo,
|
||||||
|
@ -33,81 +33,7 @@ export default class App extends Component {
|
||||||
],
|
],
|
||||||
pathname: '',
|
pathname: '',
|
||||||
userInfo: {},
|
userInfo: {},
|
||||||
navlist: [
|
navlist: navRoute
|
||||||
{
|
|
||||||
name: '系统管理',
|
|
||||||
childmenu: [
|
|
||||||
{
|
|
||||||
group: '账号管理',
|
|
||||||
items: [
|
|
||||||
{ path: '/home/system/account-list', name: '账号管理' },
|
|
||||||
{ path: '/home/system/role-list', name: '角色管理' },
|
|
||||||
{ path: '/home/system/station', name: '岗位管理' },
|
|
||||||
{ path: '/home/system/menu', name: '菜单管理' },
|
|
||||||
{ path: '/home/system/customize', name: '定制化模板' },
|
|
||||||
{ path: '/home/system/systemModel', name: '系统模板' }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
path: '/system'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: '分销商管理',
|
|
||||||
childmenu: [
|
|
||||||
{
|
|
||||||
group: '分销商管理',
|
|
||||||
items: [{ path: '/home/distributor-list', name: '分销商管理' }]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
path: '/home/distributor-list'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: '营销计划管理',
|
|
||||||
childmenu: [
|
|
||||||
{
|
|
||||||
group: '营销计划管理',
|
|
||||||
items: [
|
|
||||||
{ path: '/home/plan-list', name: '营销计划管理' },
|
|
||||||
{ path: '/home/plan-keyList', name: 'KEY列表管理' }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
path: '/home/plan-list'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: '兑换码管理',
|
|
||||||
childmenu: [
|
|
||||||
{
|
|
||||||
group: '兑换码列表',
|
|
||||||
items: [{ path: '/home/exchangecode-list', name: '兑换码列表' }]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
path: '/home/exchangecode-list'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: '落地页管理',
|
|
||||||
childmenu: [
|
|
||||||
{
|
|
||||||
group: '落地页列表',
|
|
||||||
items: [
|
|
||||||
{ path: '/home/exchangepage', name: '落地页列表' },
|
|
||||||
{ path: '/home/myexchangetemplate', name: '我的模板' }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
path: '/home/exchangepage'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: '订单管理',
|
|
||||||
childmenu: [
|
|
||||||
{
|
|
||||||
group: '订单管理',
|
|
||||||
items: [{ path: '/home/order-list', name: '订单列表' }]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
path: '/home/order-list'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
//打开菜单移入遮罩
|
//打开菜单移入遮罩
|
||||||
openMouseMask() {
|
openMouseMask() {
|
||||||
|
@ -223,23 +149,23 @@ export default class App extends Component {
|
||||||
let pathnameNow = nextProps.location.pathname
|
let pathnameNow = nextProps.location.pathname
|
||||||
let item = null
|
let item = null
|
||||||
if (pathnameNow.includes('system')) {
|
if (pathnameNow.includes('system')) {
|
||||||
item = activeMenuList.filter((item) => item.id == 14)
|
item = activeMenuList?.filter((item) => item.id == 14)
|
||||||
this.setState({ setrender: 1 })
|
this.setState({ setrender: 1 })
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pathnameNow.includes('distributor')) {
|
if (pathnameNow.includes('distributor')) {
|
||||||
item = activeMenuList.filter((item) => item.id == 15)
|
item = activeMenuList?.filter((item) => item.id == 15)
|
||||||
this.setState({ setrender: 2 })
|
this.setState({ setrender: 2 })
|
||||||
}
|
}
|
||||||
if (pathnameNow.includes('plan') || pathnameNow.includes('key')) {
|
if (pathnameNow.includes('plan') || pathnameNow.includes('key')) {
|
||||||
item = activeMenuList.filter((item) => item.id == 16)
|
item = activeMenuList?.filter((item) => item.id == 16)
|
||||||
this.setState({ setrender: 3 })
|
this.setState({ setrender: 3 })
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
pathnameNow.includes('exchangecode') &&
|
pathnameNow.includes('exchangecode') &&
|
||||||
!pathnameNow.includes('exchangecode-add')
|
!pathnameNow.includes('exchangecode-add')
|
||||||
) {
|
) {
|
||||||
item = activeMenuList.filter((item) => item.id == 17)
|
item = activeMenuList?.filter((item) => item.id == 17)
|
||||||
this.setState({ setrender: 4 })
|
this.setState({ setrender: 4 })
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
|
@ -247,16 +173,16 @@ export default class App extends Component {
|
||||||
pathnameNow.includes('edittemplate') ||
|
pathnameNow.includes('edittemplate') ||
|
||||||
pathnameNow.includes('myexchangetemplate')
|
pathnameNow.includes('myexchangetemplate')
|
||||||
) {
|
) {
|
||||||
item = activeMenuList.filter((item) => item.id == 18)
|
item = activeMenuList?.filter((item) => item.id == 18)
|
||||||
this.setState({ setrender: 5 })
|
this.setState({ setrender: 5 })
|
||||||
}
|
}
|
||||||
if (pathnameNow.includes('order-list')) {
|
if (pathnameNow.includes('order-list')) {
|
||||||
item = activeMenuList.filter((item) => item.id == 19)
|
item = activeMenuList?.filter((item) => item.id == 19)
|
||||||
this.setState({ setrender: 6 })
|
this.setState({ setrender: 6 })
|
||||||
}
|
}
|
||||||
if (item) {
|
if (item) {
|
||||||
try {
|
try {
|
||||||
item[0].children.forEach((it) => {
|
item[0]?.children?.forEach((it) => {
|
||||||
if (it.level === 5) {
|
if (it.level === 5) {
|
||||||
sessionStorage.setItem('pathname2', it.router)
|
sessionStorage.setItem('pathname2', it.router)
|
||||||
throw '终止循环'
|
throw '终止循环'
|
||||||
|
|
|
@ -250,4 +250,80 @@ const router = [
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
export default router
|
const navRoute = [
|
||||||
|
{
|
||||||
|
name: '系统管理',
|
||||||
|
childmenu: [
|
||||||
|
{
|
||||||
|
group: '账号管理',
|
||||||
|
items: [
|
||||||
|
{ path: '/home/system/account-list', name: '账号管理' },
|
||||||
|
{ path: '/home/system/role-list', name: '角色管理' },
|
||||||
|
{ path: '/home/system/station', name: '岗位管理' },
|
||||||
|
{ path: '/home/system/menu', name: '菜单管理' },
|
||||||
|
{ path: '/home/system/customize', name: '定制化模板' },
|
||||||
|
{ path: '/home/system/systemModel', name: '系统模板' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
path: '/system'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '分销商管理',
|
||||||
|
childmenu: [
|
||||||
|
{
|
||||||
|
group: '分销商管理',
|
||||||
|
items: [{ path: '/home/distributor-list', name: '分销商管理' }]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
path: '/home/distributor-list'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '营销计划管理',
|
||||||
|
childmenu: [
|
||||||
|
{
|
||||||
|
group: '营销计划管理',
|
||||||
|
items: [
|
||||||
|
{ path: '/home/plan-list', name: '营销计划管理' },
|
||||||
|
{ path: '/home/plan-keyList', name: 'KEY列表管理' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
path: '/home/plan-list'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '兑换码管理',
|
||||||
|
childmenu: [
|
||||||
|
{
|
||||||
|
group: '兑换码列表',
|
||||||
|
items: [{ path: '/home/exchangecode-list', name: '兑换码列表' }]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
path: '/home/exchangecode-list'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '落地页管理',
|
||||||
|
childmenu: [
|
||||||
|
{
|
||||||
|
group: '落地页列表',
|
||||||
|
items: [
|
||||||
|
{ path: '/home/exchangepage', name: '落地页列表' },
|
||||||
|
{ path: '/home/myexchangetemplate', name: '我的模板' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
path: '/home/exchangepage'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '订单管理',
|
||||||
|
childmenu: [
|
||||||
|
{
|
||||||
|
group: '订单管理',
|
||||||
|
items: [{ path: '/home/order-list', name: '订单列表' }]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
path: '/home/order-list'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
export { router, navRoute }
|
||||||
|
|
Loading…
Reference in New Issue