管理员按钮
This commit is contained in:
parent
0a6b8d20de
commit
dde76c1123
|
|
@ -13,7 +13,8 @@ import { Link } from 'react-router-dom';
|
|||
function PublicBanner(props){
|
||||
const [ key , setKey ] = useState("1");
|
||||
const { pathname } = props.history.location;
|
||||
const { data } = props;
|
||||
const { data , adminUrl } = props;
|
||||
|
||||
|
||||
useEffect(()=>{
|
||||
if(pathname){
|
||||
|
|
@ -54,6 +55,7 @@ function PublicBanner(props){
|
|||
<Menu.Item key={"4"}><Link to={`/information/1/news`}><img src={Menu4} alt="" width="32px"/>领域资讯</Link></Menu.Item>
|
||||
{/* <Menu.Item key={"5"}><img src={Menu5} alt="" width="27px"/>Sig小组</Menu.Item> */}
|
||||
<Menu.Item key={"6"}><Link to={`/information/1/VIP`}><img src={Menu6} alt="" width="27px"/>专区会员</Link></Menu.Item>
|
||||
{ adminUrl && <Menu.Item key={"6"}><a onClick={()=>{window.location.href=adminUrl}}><img src={Menu6} alt="" width="27px"/>后台管理</a></Menu.Item> }
|
||||
</Menu>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ const Main = Loadable({
|
|||
});
|
||||
function Index(props){
|
||||
const [ data , setData ] = useState(undefined);
|
||||
const [ adminUrl , setAdminUrl ] = useState(undefined);
|
||||
const { deptId } = props.match.params;
|
||||
|
||||
useEffect(()=>{
|
||||
|
|
@ -64,9 +65,21 @@ function Index(props){
|
|||
useEffect(()=>{
|
||||
if(deptId){
|
||||
getDetail();
|
||||
getAdminUrl();
|
||||
}
|
||||
},[deptId])
|
||||
|
||||
function getAdminUrl(){
|
||||
const url = `/zone/zoneDetail/${deptId}/checkZoneRole`;
|
||||
axios.get(url).then(response=>{
|
||||
if(response && response.data.code === 200){
|
||||
setAdminUrl(response.data.data);
|
||||
}else{
|
||||
setAdminUrl(undefined);
|
||||
}
|
||||
}).catch(error=>{})
|
||||
}
|
||||
|
||||
function getDetail(){
|
||||
const url = `/zone/open/${deptId}`;
|
||||
axios.get(url).then(result=>{
|
||||
|
|
@ -77,7 +90,7 @@ function Index(props){
|
|||
}
|
||||
return(
|
||||
<div className="information_main">
|
||||
<PublicBanner {...props} data={data} />
|
||||
<PublicBanner {...props} data={data} adminUrl={adminUrl} />
|
||||
<Switch>
|
||||
<Route
|
||||
path="/information/:deptId/news/:cateId"
|
||||
|
|
|
|||
Loading…
Reference in New Issue