Commit 31ee1c6f authored by wty's avatar wty

优化子类样式等

parent f04f2a92
......@@ -4,25 +4,20 @@ import {useContext, useEffect, useState} from "react";
import {Root} from "../../dataCenter/Root";
function Content(props) {
const {dataCenter, fetchData} = useContext(Root)
const [toolBoxData, setToolBoxData] = useState([])
useEffect(()=>{
setToolBoxData(dataCenter?.toolBox?.filter(v => {
if (dataCenter.childTypeId === 'all') return true
else return v.childTypeId === dataCenter.childTypeId
}) || [])
},[dataCenter.childTypeId])
const {dataCenter} = useContext(Root)
return (
<div className="content">
{
toolBoxData.length ? toolBoxData.map(v => {
return (
<ContentItem key={v['toolBoxId']} value={v}/>
)
})
:
'没有数据了!'
dataCenter.childType?.length ? dataCenter?.toolBox?.filter(v => {
if (dataCenter.childTypeId === 'all') return true
else return v.childTypeId === dataCenter.childTypeId
}).map(v => {
return (
<ContentItem key={v['toolBoxId']} value={v}/>
)
})
:
'没有数据了!'
}
</div>
)
......
......@@ -4,21 +4,15 @@ import {useContext, useEffect, useState} from "react";
import {Root} from "../../dataCenter/Root";
function Content(props) {
const {dataCenter, fetchData} = useContext(Root)
const [gridPosition, setGridPosition] = useState([])
const updatePosition = ()=>{
fetchData('/update/updateToolBoxSort',{sortArr: JSON.stringify([{toolBoxId: 10, sortId: 1}])})
}
useEffect(() => {
setGridPosition(dataCenter.toolBox && dataCenter.toolBox.map(v => v.toolBoxId))
}, [dataCenter.toolBox])
const {dataCenter} = useContext(Root)
return (
<div className="content">
{
dataCenter?.toolBox?.length ? dataCenter.toolBox.map(v => {
dataCenter.childType?.length ? dataCenter?.toolBox?.filter(v => {
if (dataCenter.childTypeId === 'all') return true
else return v.childTypeId === dataCenter.childTypeId
}).map(v => {
return (
<ContentItem key={v['toolBoxId']} value={v}/>
)
......
import logo from "../../static/logo.png";
import './index.scss'
import ToolType from "../../component/ToolType/ToolType";
import Content from "../../component/ContentAdmin/Content";
import { useContext, useEffect, useState } from "react";
import PopAddToolBox from "../../component/Pop_addToolBox/Pop_addToolBox";
import { PopContext, Root } from "../../dataCenter/Root";
import PopAddType from "../../component/Pop_addType/Pop_addType";
import logo from '../../static/logo.png'
import AdminIndex from '../../component/AdminIndex/AdminIndex'
import Content from "../../component/Content/Content";
import {PopContext, Root} from "../../dataCenter/Root";
import {useContext, useEffect, useState} from "react";
import {NEED_UPDATE_INDEX} from "../../dataCenter/action";
import AdminIndex from "../../component/AdminIndex/AdminIndex";
function IndexAdmin() {
const { updateIndex } = useContext(Root)
const {fetchData, dataCenter} = useContext(Root)
function Index() {
const [pop, setPop] = useState()
const {fetchData, dataCenter, dispatch} = useContext(Root)
const showPop = popComponent => {
setPop(popComponent)
}
const getUser = ()=>{
fetchData('/users/getUser', {userId:'100001'}, 'userInfo')
const getUser = () => {
fetchData('/users/getUser', {userId: '100001'}, 'userInfo')
.catch(res =>
res.code === 70001 && (window.location.href = '/login')
)
}
useEffect(()=>{
getUser()
},[])
useEffect(() => {
updateIndex()
// dataCenter()
fetchData('/query/queryType', {}, 'type')
.then(()=> fetchData('/query/queryChildType',{typeId: dataCenter.typeId},'childType'))
.then(() => dispatch(NEED_UPDATE_INDEX()))
}, [dataCenter.typeId])
useEffect(() => {
if (dataCenter.needUpdateIndex) {
const _typeId = dataCenter.typeId === 'all' ? {} : dataCenter.typeId === 'follow' ? {
isFollow: true,
typeId: JSON.stringify(dataCenter.userInfo.follow)
} : {typeId: dataCenter.typeId}
fetchData('/query/queryToolBox', _typeId, 'toolBox').then(() => dispatch(NEED_UPDATE_INDEX()))
}
}, [dataCenter.needUpdateIndex])
useEffect(() => {
getUser()
}, [])
return (
......@@ -44,9 +51,12 @@ function IndexAdmin() {
</div>
<div className="nav">
<div className="nav-title">
<img src={logo} alt=""/>
<img src={logo} alt=""/>
</div>
<div className="nav-weather">
<iframe width="360" height="40" frameBorder="0" scrolling="no" hspace="0"
src="https://i.tianqi.com/?c=code&a=getcode&id=40&icon=1"/>
</div>
<div className="nav-weather"><iframe width="360" height="40" frameBorder="0" scrolling="no" hspace="0" src="https://i.tianqi.com/?c=code&a=getcode&id=40&icon=1"/></div>
</div>
<div className="tool-nav">
<ToolType/>
......@@ -57,34 +67,16 @@ function IndexAdmin() {
{
pop
}
<div className></div>
<div className="index-footer">
兑吧研发中心·杭州兑吧网络科技游戏公司版权所有
<br/>
浙ICP备14017299号-1
</div>
<AdminIndex />
{/* <div className="adminTool">
<button className='btn-admin' onClick={() => setPop((<PopAddToolBox/>))}>新建工具盒</button>
<button className='btn-admin' onClick={() => setPop((<PopAddType/>))}>新建类型</button>
兑吧研发中心·杭州兑吧网络科技游戏公司版权所有
<br/>
浙ICP备14017299号-1
</div>
<div className="tool-nav">
<ToolType/>
</div>
<div className="container">
<Content/>
</div>
{
pop
} */}
<AdminIndex/>
</div>
</PopContext.Provider>
)
}
export default IndexAdmin
export default Index
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