Commit 527e3c70 by maolipeng

fix:用户没有重新上传logo时显示默认logo

parent 342eb4a0
......@@ -14,12 +14,20 @@
color: #333;
.topLogo {
height: 62px;
img {
background: rgba(255, 255, 255, 0.5);
.img1 {
width: 138px;
height: 35px;
margin-left: 19px;
margin-top: 13px;
}
.img0 {
display: none;
width: 35px;
height: 35px;
margin-left: 10px;
margin-top: 13px;
}
}
.menu-type-icon{
margin:4px 0 0px 150px;
......
import React, { useContext, useEffect, useState } from 'react';
import React, { useContext, useEffect, useRef, useState } from 'react';
import {
withRouter,
} from 'react-router-dom';
......@@ -18,6 +18,8 @@ function Aside(props: any) {
const [selectKey, setSelectKey] = useState();
const [openKeys, setOpenKeys] = useState(['']);
const [topLogoUrl, setTopLogoUrl] = useState("")
const logoImg0Ref = useRef<any>()
const logoImg1Ref = useRef<any>()
const rootSubmenuKeys = _.pluck(menuList, 'groupCode');
useEffect(() => {
const link = props.location.pathname;
......@@ -57,8 +59,26 @@ function Aside(props: any) {
}
}
function handleMenu() {
handleMenuType();
}
useEffect(()=> {
if (!logoImg0Ref.current || !logoImg1Ref.current) {
return
}
if (!menuType) {
if (topLogoUrl.indexOf("xiaomaiketang.com") < 0 && topLogoUrl.indexOf("qlogo.cn") < 0) {
logoImg0Ref.current.style.display = "none"
logoImg1Ref.current.style.display = "none"
} else {
logoImg0Ref.current.style.display = "inline"
logoImg1Ref.current.style.display = "none"
}
} else {
logoImg0Ref.current.style.display = "none"
logoImg1Ref.current.style.display = "inline"
}
},[menuType])
return (
<div
......@@ -70,8 +90,8 @@ function Aside(props: any) {
}
>
<div className="topLogo">
{ menuType ? (<img src={topLogoUrl} alt=""></img>) : ("")}
<img ref={logoImg0Ref} src="https://image.xiaomaiketang.com/xm/c4KiP2epBP.png" alt="" className="img0"></img>
<img ref={logoImg1Ref} src={topLogoUrl} alt="" className="img1"></img>
</div>
<div className="menu-type-icon" onClick={handleMenu}>
{menuType ? (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment