解决导航与内容显示冲突bug,优化细节
This commit is contained in:
parent
d5f9efeceb
commit
3b29061562
|
@ -155,13 +155,10 @@ import _ from "lodash";
|
||||||
const { data} = this.props;
|
const { data} = this.props;
|
||||||
let page_num =Math.ceil( data.count / this.state.count);
|
let page_num =Math.ceil( data.count / this.state.count);
|
||||||
|
|
||||||
console.log(page_num)
|
|
||||||
|
|
||||||
|
|
||||||
let btnPages = []
|
let btnPages = []
|
||||||
for(let i = 1;i<page_num + 1;i++ )
|
for(let i = 1;i<page_num + 1;i++ )
|
||||||
{
|
{
|
||||||
console.log(1)
|
|
||||||
// let o = {}
|
// let o = {}
|
||||||
// o.page = i;
|
// o.page = i;
|
||||||
// o.text = i ;
|
// o.text = i ;
|
||||||
|
|
|
@ -12,7 +12,7 @@ export default class topNav extends React.Component{
|
||||||
navlists:this.props.listnav,
|
navlists:this.props.listnav,
|
||||||
menulinklist:JSON.parse( sessionStorage.getItem('menulinklist'))?JSON.parse( sessionStorage.getItem('menulinklist')):[],
|
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')),
|
||||||
}
|
}
|
||||||
|
|
||||||
this.backFn=this.backFn.bind(this)
|
this.backFn=this.backFn.bind(this)
|
||||||
|
@ -21,20 +21,19 @@ export default class topNav extends React.Component{
|
||||||
showlinkmenu(e,item){
|
showlinkmenu(e,item){
|
||||||
let self=this;
|
let self=this;
|
||||||
try{
|
try{
|
||||||
item.child.forEach(item=>{
|
item.children.forEach(it=>{
|
||||||
if(item.level ===5){
|
if(it.level ===5){
|
||||||
sessionStorage.setItem('pathname2',item.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.child});
|
self.setState({'menulinklist':item.children});
|
||||||
|
|
||||||
|
|
||||||
// 防止刷新页面,导航签清空
|
// 防止刷新页面,导航签清空
|
||||||
sessionStorage.setItem('menulinklist',JSON.stringify(item.child));
|
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);
|
||||||
}
|
}
|
||||||
|
@ -74,13 +73,23 @@ export default class topNav extends React.Component{
|
||||||
if(pathnamestr.includes('aid')){
|
if(pathnamestr.includes('aid')){
|
||||||
breaknav=JSON.parse(sessionStorage.getItem('subbreaknav'))
|
breaknav=JSON.parse(sessionStorage.getItem('subbreaknav'))
|
||||||
}
|
}
|
||||||
|
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{
|
||||||
|
item.children.forEach(it=>{
|
||||||
|
if(it.level ===5){
|
||||||
|
accPath=it.router;
|
||||||
|
throw '终止循环'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}catch(e){
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
item.child&&item.child.length>0?<Link key={i} to={item.router} style={this.state.linkshowname==item.title?{width:"#100%",background:"#f2f4f7",color:'#296bef'}:null} className={this.state.linkshowname==item.title?'active':''} onClick={(e)=>this.showlinkmenu(e,item)} >{item.title}</Link>:null
|
item.children&&item.children.length>0?<Link key={i} to={item.router=='/system'?accPath:item.router} style={this.state.linkshowname==item.title?{width:"#100%",background:"#f2f4f7",color:'#296bef'}:null} className={this.state.linkshowname==item.title?'active':''} onClick={(e)=>this.showlinkmenu(e,item)} >{item.title}</Link>:null
|
||||||
|
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -95,7 +104,7 @@ export default class topNav extends React.Component{
|
||||||
<div className="linkmenu-row" >
|
<div className="linkmenu-row" >
|
||||||
{
|
{
|
||||||
this.state.menulinklist.map((item,key)=>{
|
this.state.menulinklist.map((item,key)=>{
|
||||||
return(item.level==5?<Link key={key} to={item.router} onClick={()=>this.btnfn(item)} className={pathnameBreak==item.router&&item.child.length>=1?'menuactive':''}>{item.title}</Link>:null)
|
return(item.level==5?<Link key={key} to={item.router} onClick={()=>this.btnfn(item)} className={pathnameBreak==item.router&&item.children.length>=1?'menuactive':''}>{item.title}</Link>:null)
|
||||||
}) }
|
}) }
|
||||||
</div>
|
</div>
|
||||||
<span>数据最后更新时间:{window.timeshow}</span>
|
<span>数据最后更新时间:{window.timeshow}</span>
|
||||||
|
|
|
@ -374,10 +374,10 @@ export default class App extends Component {
|
||||||
|
|
||||||
<Route path="/home/addkeyorder" exact={true} component={keyorderlist} />
|
<Route path="/home/addkeyorder" exact={true} component={keyorderlist} />
|
||||||
|
|
||||||
<Route exact={true} path="/system" render={
|
{/* <Route exact={true} path="/system" render={
|
||||||
()=> (
|
()=> (
|
||||||
<Redirect to="/home/system/account-list"/>)}>
|
<Redirect to="/home/system/account-list"/>)}>
|
||||||
</Route>
|
</Route> */}
|
||||||
<Route path="/home/system/account-list" exact={true} component={accountlist} />
|
<Route path="/home/system/account-list" exact={true} component={accountlist} />
|
||||||
<Route path="/home/system/account-add" exact={true} component={accountadd} />
|
<Route path="/home/system/account-add" exact={true} component={accountadd} />
|
||||||
{/* <Route path="/home/system/subaccount-list" exact={true} component={subaccountlist} />
|
{/* <Route path="/home/system/subaccount-list" exact={true} component={subaccountlist} />
|
||||||
|
|
|
@ -57,10 +57,10 @@ function FormDom(props) {
|
||||||
sessionStorage.setItem('activeMenu',JSON.stringify(response.menu));
|
sessionStorage.setItem('activeMenu',JSON.stringify(response.menu));
|
||||||
try{
|
try{
|
||||||
menuList.forEach(item=>{
|
menuList.forEach(item=>{
|
||||||
if(item.child&&item.child.length>0){
|
if(item.children&&item.children.length>0){
|
||||||
let obj=item.child.filter(item=>item.level==5);
|
let obj=item.children.filter(item=>item.level==5);
|
||||||
sessionStorage.setItem('pathname2',obj[0].router);
|
sessionStorage.setItem('pathname2',obj[0].router);
|
||||||
sessionStorage.setItem('menulinklist',JSON.stringify(item.child));
|
sessionStorage.setItem('menulinklist',JSON.stringify(item.children));
|
||||||
if(item.id==16){
|
if(item.id==16){
|
||||||
sessionStorage.setItem('linkshowname',"营销计划管理");
|
sessionStorage.setItem('linkshowname',"营销计划管理");
|
||||||
setTimeout(()=>{
|
setTimeout(()=>{
|
||||||
|
@ -68,7 +68,7 @@ function FormDom(props) {
|
||||||
},1000);
|
},1000);
|
||||||
throw '终止循环'
|
throw '终止循环'
|
||||||
}else{
|
}else{
|
||||||
sessionStorage.setItem('linkshowname',obj[0].title);
|
sessionStorage.setItem('linkshowname',item.title);
|
||||||
setTimeout(()=>{
|
setTimeout(()=>{
|
||||||
props.history.push(obj[0].router)
|
props.history.push(obj[0].router)
|
||||||
},1000);
|
},1000);
|
||||||
|
|
|
@ -515,7 +515,7 @@ componentDidUpdate(prevProps,prevState){
|
||||||
<Button type="default" icon="download" onClick={this.exportFn.bind(this)}>导出订单</Button>
|
<Button type="default" icon="download" onClick={this.exportFn.bind(this)}>导出订单</Button>
|
||||||
</p>
|
</p>
|
||||||
<div className="dfleac">
|
<div className="dfleac">
|
||||||
<Select width="180px" value={this.state.option} onChange={(e)=>this.optiononChange(e)} options={options} clearable placeholder="请输入关键字查询" />
|
<Select width="180px" value={this.state.option} onChange={(e)=>this.optiononChange(e)} disableSearch options={options} clearable placeholder="请选择查询分类" />
|
||||||
{/* <Button type="info">批量操作</Button> */}
|
{/* <Button type="info">批量操作</Button> */}
|
||||||
{
|
{
|
||||||
this.state.option?this.state.option.key=='1'? <Ipt labelWidth={0} onClearItem={(e)=>{this.setState({key_word:''})}} wordSearch={this.sureFn.bind(this)} onChange={(e)=>this.setState({key_word:e})} value={this.state.key_word} icon="search" placeholder={"请输入key进行搜索"} countShow={false} height={'36px'} width={'260px'} alignment={'left'}/>:
|
this.state.option?this.state.option.key=='1'? <Ipt labelWidth={0} onClearItem={(e)=>{this.setState({key_word:''})}} wordSearch={this.sureFn.bind(this)} onChange={(e)=>this.setState({key_word:e})} value={this.state.key_word} icon="search" placeholder={"请输入key进行搜索"} countShow={false} height={'36px'} width={'260px'} alignment={'left'}/>:
|
||||||
|
|
|
@ -127,6 +127,7 @@ export default class adduserinfo extends React.Component{
|
||||||
Notify.success(msg);
|
Notify.success(msg);
|
||||||
setTimeout(()=>{
|
setTimeout(()=>{
|
||||||
window.history.back()
|
window.history.back()
|
||||||
|
sessionStorage.setItem('pathname2','/home/system/account-list')
|
||||||
},1000);
|
},1000);
|
||||||
},(err)=>{
|
},(err)=>{
|
||||||
Notify.error(err)
|
Notify.error(err)
|
||||||
|
@ -142,6 +143,7 @@ export default class adduserinfo extends React.Component{
|
||||||
Notify.clear();
|
Notify.clear();
|
||||||
Notify.success(msg);
|
Notify.success(msg);
|
||||||
setTimeout(()=>{
|
setTimeout(()=>{
|
||||||
|
sessionStorage.setItem('pathname2','/home/system/account-list')
|
||||||
window.history.back()
|
window.history.back()
|
||||||
},1000);
|
},1000);
|
||||||
},(err)=>{
|
},(err)=>{
|
||||||
|
|
Loading…
Reference in New Issue