调整登录字段逻辑处理

This commit is contained in:
red-deng-deng 2021-12-08 19:27:05 +08:00
parent cef8c42471
commit 0582462984
5 changed files with 41 additions and 15 deletions

View File

@ -521,8 +521,12 @@ export const putAddAcc = (id,params) => {
return req('put', baseurl + "/auth/admin/"+id,params) return req('put', baseurl + "/auth/admin/"+id,params)
} }
//子账号
//获取子账号权限
// /auth/admin/adminRoleRules/:id
export const getsubAccount = (id) => {
return req('get', baseurl + "/auth/admin/adminRoleRules/"+id)
}
// 角色管理 // 角色管理
//角色管理列表 //角色管理列表
export const getRoleList = (params) => { export const getRoleList = (params) => {

View File

@ -21,7 +21,7 @@ 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(item=>{
if(item.level ===5){ if(item.level ===5){
sessionStorage.setItem('pathname2',item.router); sessionStorage.setItem('pathname2',item.router);
throw '终止循环' throw '终止循环'
@ -30,11 +30,11 @@ export default class topNav extends React.Component{
}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);
} }
@ -63,13 +63,16 @@ export default class topNav extends React.Component{
let pathnameBreak=sessionStorage.getItem('pathname2') let pathnameBreak=sessionStorage.getItem('pathname2')
const pathname=window.location.href.lastIndexOf('\/'); const pathname=window.location.href.lastIndexOf('\/');
const pathnamestr=window.location.href.substr(pathname); const pathnamestr=window.location.href.substr(pathname);
let breakflag=pathnamestr.includes('add')||pathnamestr.includes('key-list')||pathnamestr.includes('key-edit')||pathnamestr.includes('exchangecode-edit')||pathnamestr.includes('plan-edit')||pathnamestr.includes('product-edit'); let breakflag=pathnamestr.includes('add')||pathnamestr.includes('aid')||pathnamestr.includes('key-list')||pathnamestr.includes('key-edit')||pathnamestr.includes('exchangecode-edit')||pathnamestr.includes('plan-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 breakchange = pathnamestr.includes('exchangecode-add')|| pathnamestr.includes('key-edit')||pathnamestr.includes('product-edit')||pathnamestr.includes('plan-edit'); let breakchange = pathnamestr.includes('exchangecode-add')|| pathnamestr.includes('key-edit')||pathnamestr.includes('product-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')){
breaknav=JSON.parse(sessionStorage.getItem('subbreaknav'))
} }
return( return(
<div className="topheader"> <div className="topheader">
@ -77,7 +80,7 @@ export default class topNav extends React.Component{
{ {
this.state.navlists.map((item,i)=>{ this.state.navlists.map((item,i)=>{
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} 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
) )
}) })
@ -92,7 +95,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>

View File

@ -52,10 +52,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(()=>{

View File

@ -204,6 +204,22 @@ export default class acclistDom extends React.Component{
resetpwd(e,row){ resetpwd(e,row){
this.setState({visible:true,id:row.id}); this.setState({visible:true,id:row.id});
} }
//跳转此账号下面的子账号列表
subaccount(e,row){
this.props.history.push('/home/system/subaccount-list?aid='+row.id);
let activerou=[{'pagetitle':'编辑',items:[
{
"path": "/home/system/account-list",
"name": "账号管理"
},
{
"path": "/home/system/subaccount-add",
"name": row.real_name+"的子账号列表"
}
]}]
sessionStorage.setItem('subbreaknav',JSON.stringify(activerou));
sessionStorage.setItem('subaid',row.id);
}
//获取用户列表 //获取用户列表
getAccountFn(){ getAccountFn(){
let _self=this; let _self=this;
@ -309,11 +325,12 @@ componentDidUpdate(prevProps,prevState){
if(com == "opearo") if(com == "opearo")
{ {
return <span> return <p>
<span className="grid-link" onClick={(e)=>this.editFn(e,rowData)}>编辑</span> <span className="grid-link" onClick={(e)=>this.editFn(e,rowData)}>编辑</span>
<span className="grid-link" onClick={(e)=>this.delFn(e,rowData)}>删除</span> <span className="grid-link" onClick={(e)=>this.delFn(e,rowData)}>删除</span>
<span className="grid-link" onClick={(e)=>this.resetpwd(e,rowData)}>重置密码</span> <span className="grid-link" onClick={(e)=>this.resetpwd(e,rowData)}>重置密码</span>
</span> <span className="grid-link" onClick={(e)=>this.subaccount(e,rowData)}>子账号管理</span>
</p>
} }
}} }}
/> />

View File

@ -1,7 +1,7 @@
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';
import React, { Component } from 'react'; import React, { Component } from 'react';
import { Tree,Checkbox} from 'zent'; import { Tree,Checkbox} from 'zent';
import {getMenuList,handelResponse} from "../../../../../assets/api.js" import {getsubAccount,handelResponse} from "../../../../../assets/api.js"
export default class tree extends React.Component{ export default class tree extends React.Component{
constructor(props){ constructor(props){
super(props) super(props)
@ -26,7 +26,8 @@ export default class tree extends React.Component{
//获取权限 //获取权限
getMenuFn(){ getMenuFn(){
let _self=this; let _self=this;
getMenuList().then(res=>{ let subId=sessionStorage.getItem('subaid');
getsubAccount(subId).then(res=>{
handelResponse(res,(response,msg)=>{ handelResponse(res,(response,msg)=>{
const menu_data=response; const menu_data=response;
_self.setState({menu_data}); _self.setState({menu_data});
@ -50,6 +51,7 @@ export default class tree extends React.Component{
</div> </div>
<Tree <Tree
checkable checkable
renderKey={this.state.dataTree}
size="medium" size="medium"
data={this.state.menu_data} data={this.state.menu_data}
onCheck={this.onCheck} onCheck={this.onCheck}