|
@@ -9,6 +9,7 @@ import { LazyLoadImage } from "react-lazy-load-image-component";
|
|
import { useDispatch, useSelector } from 'react-redux';
|
|
import { useDispatch, useSelector } from 'react-redux';
|
|
import { getListAction, getSortAction } from '@/store/action/home';
|
|
import { getListAction, getSortAction } from '@/store/action/home';
|
|
import { RootState } from '@/store';
|
|
import { RootState } from '@/store';
|
|
|
|
+import Model from '@/components/Model'
|
|
export default function Home() {
|
|
export default function Home() {
|
|
|
|
|
|
const dispatch = useDispatch()
|
|
const dispatch = useDispatch()
|
|
@@ -27,6 +28,8 @@ export default function Home() {
|
|
const clearValueFu = () => {
|
|
const clearValueFu = () => {
|
|
setValue('')
|
|
setValue('')
|
|
setPageNum(1)
|
|
setPageNum(1)
|
|
|
|
+ const sroolDom = modelBoxRef.current
|
|
|
|
+ sroolDom!.scrollTop = 0
|
|
dispatch(getListAction({ ...fromData.current, dictTextureId: fromData.current.dictTextureId === -1 ? null : fromData.current.dictTextureId, searchKey: '', pageNum: 1 }))
|
|
dispatch(getListAction({ ...fromData.current, dictTextureId: fromData.current.dictTextureId === -1 ? null : fromData.current.dictTextureId, searchKey: '', pageNum: 1 }))
|
|
|
|
|
|
}
|
|
}
|
|
@@ -64,22 +67,34 @@ export default function Home() {
|
|
}
|
|
}
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
fromData.current.dictTextureId = sort
|
|
fromData.current.dictTextureId = sort
|
|
- fromData.current.pageNum=1
|
|
|
|
|
|
+ fromData.current.pageNum = 1
|
|
setPageNum(1)
|
|
setPageNum(1)
|
|
getModelList()
|
|
getModelList()
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
}, [sort])
|
|
}, [sort])
|
|
|
|
|
|
|
|
+ // 点击每个模型出来的页面
|
|
|
|
+ const [modelId, setModelId] = useState(0)
|
|
|
|
+
|
|
return (
|
|
return (
|
|
<div className={styles.Home}>
|
|
<div className={styles.Home}>
|
|
|
|
+
|
|
|
|
+ {/* 点击单个模型出来的详情页面 */}
|
|
|
|
+ <div className={classNames('modelTxtBox', modelId ? 'activeTxtBox' : '')}>
|
|
|
|
+ <Model modelId={modelId} closeModel={() => setModelId(0)} />
|
|
|
|
+ </div>
|
|
|
|
+
|
|
<div className='title'>
|
|
<div className='title'>
|
|
<div className='logo'>
|
|
<div className='logo'>
|
|
<img src={logoImg} alt="" />
|
|
<img src={logoImg} alt="" />
|
|
</div>
|
|
</div>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
- {/* 分类选择 */}
|
|
|
|
<div className='mainBox'>
|
|
<div className='mainBox'>
|
|
|
|
+
|
|
|
|
+ {/* 筛选的盒子 */}
|
|
|
|
+ <div className='screenBox'>
|
|
|
|
+
|
|
{/* 输入框 */}
|
|
{/* 输入框 */}
|
|
<div className='search'>
|
|
<div className='search'>
|
|
<div className='searchBtn' onClick={searchBtnFu}></div>
|
|
<div className='searchBtn' onClick={searchBtnFu}></div>
|
|
@@ -87,22 +102,29 @@ export default function Home() {
|
|
<CloseCircleOutlined />
|
|
<CloseCircleOutlined />
|
|
</div>) : null}
|
|
</div>) : null}
|
|
|
|
|
|
- <Input maxLength={10} placeholder='搜查文物' value={value} onChange={(e) => setValue(e.target.value)} onKeyUp={(e) => searchKeyUpFu(e)} prefix={<SearchOutlined />} />
|
|
|
|
|
|
+ <Input maxLength={10} placeholder='请输入文物名称' value={value} onChange={(e) => setValue(e.target.value)} onKeyUp={(e) => searchKeyUpFu(e)} prefix={<SearchOutlined />} />
|
|
</div>
|
|
</div>
|
|
|
|
|
|
- {/* 筛选分类 */}
|
|
|
|
- <div className='sortBox' style={{ height: sortAll ? '90px' : '46px' }}>
|
|
|
|
- <div className='xian' hidden={!sortAll}></div>
|
|
|
|
- <div className={classNames('all', sort === -1 ? 'activeAll' : '')} onClick={() => setSort(-1)}>全部</div>
|
|
|
|
- <div className='sortBox_left'>
|
|
|
|
- {sortList.map((item) => (
|
|
|
|
- <div className={classNames(sort === item.id ? 'active' : '')} onClick={() => setSort(item.id)} key={item.id}>{item.name}</div>
|
|
|
|
- ))}
|
|
|
|
- </div>
|
|
|
|
- <div className='sortBox_right' onClick={() => setSortAll(!sortAll)}>
|
|
|
|
- {sortAll ? <DownOutlined /> : <UpOutlined />}
|
|
|
|
|
|
+ {/* <div className='sortBox' style={{ height: sortAll ? '90px' : '46px' }}>
|
|
|
|
+ <div className='xian' hidden={!sortAll}></div>
|
|
|
|
+ <div className={classNames('all', sort === -1 ? 'activeAll' : '')} onClick={() => setSort(-1)}>全部类别</div>
|
|
|
|
+ <div className='sortBox_left'>
|
|
|
|
+ {sortList.map((item) => (
|
|
|
|
+ <div className={classNames(sort === item.id ? 'active' : '')} onClick={() => setSort(item.id)} key={item.id}>{item.name}</div>
|
|
|
|
+ ))}
|
|
|
|
+ </div>
|
|
|
|
+ <div className='sortBox_right' onClick={() => setSortAll(!sortAll)}>
|
|
|
|
+ {sortAll ? <DownOutlined /> : <UpOutlined />}
|
|
|
|
+ </div>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
|
|
+
|
|
|
|
+ <div className='ageBox'>
|
|
|
|
+ <div className='ageBoxAll'>全部年代</div>
|
|
|
|
+ {[1, 2, 3].map(item => (
|
|
|
|
+ <div className='ageRow' key={item}>{'中华明国年代' + item}</div>
|
|
|
|
+ ))}
|
|
|
|
+ </div> */}
|
|
</div>
|
|
</div>
|
|
|
|
|
|
{/* 页面渲染主体 */}
|
|
{/* 页面渲染主体 */}
|
|
@@ -110,7 +132,7 @@ export default function Home() {
|
|
{
|
|
{
|
|
list && list.length > 0 ?
|
|
list && list.length > 0 ?
|
|
list.map(item => (
|
|
list.map(item => (
|
|
- <div className='modelBox_row' key={item.id}>
|
|
|
|
|
|
+ <div className='modelBox_row' key={item.id} onClick={() => setModelId(item.id)}>
|
|
<LazyLoadImage src={baseURL + item.thumb}
|
|
<LazyLoadImage src={baseURL + item.thumb}
|
|
width={300} height={260}
|
|
width={300} height={260}
|
|
alt=""
|
|
alt=""
|