From 3b07db8ba6e977bf07b50e14298e678da1a1544e Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Thu, 1 Jun 2023 16:02:41 +0800 Subject: [PATCH] update --- src/forge/Information/Component/hot.jsx | 5 +- .../Information/Component/publicBanner.jsx | 11 +- src/forge/Information/Pages/headerPage.jsx | 6 +- src/forge/Information/Pages/main.jsx | 110 ++++++------ src/forge/Information/Pages/newsDetail.jsx | 1 + src/forge/Information/Pages/newsList.jsx | 159 +++++++++--------- src/forge/Information/Pages/projectSource.jsx | 4 +- src/forge/Information/Pages/zoneVIP.jsx | 7 +- src/forge/Information/index.jsx | 6 +- src/forge/Information/index.scss | 21 ++- src/forge/SecuritySetting/notice/fetch.js | 1 + 11 files changed, 179 insertions(+), 152 deletions(-) diff --git a/src/forge/Information/Component/hot.jsx b/src/forge/Information/Component/hot.jsx index 69833ef86..f0c0b7349 100644 --- a/src/forge/Information/Component/hot.jsx +++ b/src/forge/Information/Component/hot.jsx @@ -1,6 +1,7 @@ import React from 'react'; +import { Link } from 'react-router-dom'; -function Hot({list , title}){ +function Hot({list , title,deptId}){ return(

{title}

@@ -12,7 +13,7 @@ function Hot({list , title}){ return(
  • {k+1} - {i.name} + {i.name}
  • ) }) diff --git a/src/forge/Information/Component/publicBanner.jsx b/src/forge/Information/Component/publicBanner.jsx index d763f7809..6b2a74def 100644 --- a/src/forge/Information/Component/publicBanner.jsx +++ b/src/forge/Information/Component/publicBanner.jsx @@ -22,21 +22,20 @@ function PublicBanner(props){ useEffect(()=>{ if(pathname){ - const head = /\/information\/[0-9]{0,}/g; const info = /\/information\/[0-9]{0,}\/news/g; const infodetail = /\/information\/[0-9]{0,}\/newdetail/g; const project = /\/information\/[0-9]{0,}\/projects/g; const vip = /\/information\/[0-9]{0,}\/VIP/g; - if(head.test(pathname)){ + if(pathname === `/information/${deptId}`){ setKey("1"); } - if(project.test(pathname)){ + else if(project.test(pathname)){ setKey("2"); } - if(info.test(pathname) || infodetail.test(pathname)){ + else if(info.test(pathname) || infodetail.test(pathname)){ setKey("4"); } - if(vip.test(pathname)){ + else if(vip.test(pathname)){ setKey("6"); } } @@ -59,7 +58,7 @@ function PublicBanner(props){ 领域资讯 {/* Sig小组 */} 专区会员 - { adminUrl && {window.location.href=adminUrl}}>后台管理 } + { adminUrl && {window.location.href=adminUrl}}>后台管理 }
    diff --git a/src/forge/Information/Pages/headerPage.jsx b/src/forge/Information/Pages/headerPage.jsx index 450fa603f..144d1f853 100644 --- a/src/forge/Information/Pages/headerPage.jsx +++ b/src/forge/Information/Pages/headerPage.jsx @@ -114,7 +114,7 @@ function HeaderPage(props){ return(
  • {i.projectProperties && i.projectProperties.authorImageUrl && }
    -
    +
    window.open(i.projectURL)} className="z_p_title task-hide">{i.projectProperties && i.projectProperties.name}

    {i.projectProperties && i.projectProperties.description ? i.projectProperties.description : "暂无~"}

    @@ -134,9 +134,9 @@ function HeaderPage(props){ personList.map((i,k)=>{ return(
  • - + {i.name} -

    {i.introduction}

    +

    {i.introduction || "暂无~"}

  • ) }) diff --git a/src/forge/Information/Pages/main.jsx b/src/forge/Information/Pages/main.jsx index bff930efc..694a06f08 100644 --- a/src/forge/Information/Pages/main.jsx +++ b/src/forge/Information/Pages/main.jsx @@ -1,9 +1,9 @@ import React , { useState , useEffect } from 'react'; -import Banner from '../Component/publicBanner'; import { Menu , Spin , Skeleton } from 'antd'; import Hot from '../Component/hot'; import { Box , LongWidth } from '../../Component/layout'; import { Link } from 'react-router-dom'; +import Lists from './newsList'; import guideArrow from '../img/guideArrow.png'; import axios from 'axios'; import shijian from '../img/shijian.png'; @@ -15,9 +15,11 @@ import DefaultImg from '../Component/defaultImg'; function Main(props){ const [ key , setKey ] = useState("1"); const [ mainList , setMainList ] = useState(undefined); + const [ name , setName] = useState(undefined); + const [ menuH , setMenuH ] = useState(true); const [ hotList , setHotList ] = useState(undefined); const [ isSpin , setIsSpin ] = useState(true); - const { deptId } = props.match.params; + const { deptId , cateId } = props.match.params; const { address } = props; @@ -37,8 +39,16 @@ function Main(props){ } }).then(result=>{ if(result){ - setMainList(result.data.rows); - setIsSpin(false); + let rows = result.data.rows; + setMainList(rows); + setTimeout(() => { + let ele = document.getElementById("menus"); + if(ele){ + let h = ele.clientHeight; + setMenuH(h>56); + } + setIsSpin(false); + }, 100); } }).catch(error=>{}) } @@ -61,42 +71,47 @@ function Main(props){ return(
    -
    -

    领域资讯

    - { - mainList && mainList.length>0 && - - { - mainList.map((i,k)=>{ - return( - clickTab(`${k+1}`,`main_card_item_${k+1}`)}>{i.name} - ) - }) - } - - } - { - !mainList &&
    - } +
    +

    领域资讯

    + { + mainList && mainList.length>0 && + + 全部 + { + mainList.map((i,k)=>{ + return( + {i.name} + ) + }) + } + + } + { + !mainList &&
    + } +
    -
    { - mainList && mainList.length>0 && - mainList.map((i,k)=>{ - return( -
    -
    - {i.name} - 更多 -
    -
    - { - i.cmsDocList && i.cmsDocList.length>0 ? - - {i.cmsDocList.map((j,e)=>{ + cateId ? + + : +
    + { + mainList && mainList.length>0 && + mainList.map((i,k)=>{ + return( +
    +
    + {i.name} + { i.cmsDocList && i.cmsDocList.length> 0 && {window.scrollTo(0,400)}}>更多 } +
    +
    + { + i.cmsDocList && i.cmsDocList.length>0 ? + i.cmsDocList.map((j,e)=>{ return(
    {props.history.push(`/information/${deptId}/newdetail/${j.id}`)}}> {e===0 && @@ -120,27 +135,24 @@ function Main(props){
    ) }) + : +
    + +

    暂无数据~

    +
    } -
    - - : -
    - -

    暂无数据~

    -
    -
    - } +
    -
    - ) - }) + ) + }) + } +
    } -
    - +
    diff --git a/src/forge/Information/Pages/newsDetail.jsx b/src/forge/Information/Pages/newsDetail.jsx index 7ddac2101..f57c3f07d 100644 --- a/src/forge/Information/Pages/newsDetail.jsx +++ b/src/forge/Information/Pages/newsDetail.jsx @@ -14,6 +14,7 @@ function NewsDetail(props){ useEffect(()=>{ if(id && address){ + window.scrollTo(0,450); getDetails(); } },[id,address]) diff --git a/src/forge/Information/Pages/newsList.jsx b/src/forge/Information/Pages/newsList.jsx index c1a3ced7a..d729cf540 100644 --- a/src/forge/Information/Pages/newsList.jsx +++ b/src/forge/Information/Pages/newsList.jsx @@ -25,21 +25,22 @@ function NewsList(props){ useEffect(()=>{ if(deptId && cateId && address){ + setMenuSpin(true); getMainList(); } },[deptId,cateId,pageNum,address]) - useEffect(()=>{ - if(deptId && cateId){ - setMenuSpin(true); - getMainList(); - getHotList(); - getColumnList(); - getColumnDetail(); - } - },[deptId,cateId]) + // useEffect(()=>{ + // if(deptId && cateId){ + // setMenuSpin(true); + // getMainList(); + // getHotList(); + // getColumnList(); + // getColumnDetail(); + // } + // },[deptId,cateId]) function getColumnDetail(){ const url = `${address}/cms/doc/open/dir/${cateId}`; @@ -71,6 +72,7 @@ function NewsList(props){ if(result){ setMainList(result.data.rows); setTotal(result.data.total); + setMenuSpin(false); } }).catch(error=>{}) } @@ -89,82 +91,85 @@ function NewsList(props){ } return( -
    - {/* */} -
    - - 领域资讯 - {details && details.name} - -

    {details && details.name}

    - - -
    - { - columnList && columnList.length>0 && - + //
    + //
    + // + // 领域资讯 + // {details && details.name} + // + //

    {details && details.name}

    + // + // + //
    + // { + // columnList && columnList.length>0 && + // + // { + // columnList.map((i,k)=>{ + // return( + // {if(document.documentElement.scrollTop > 600)window.scrollTo(0,480);}} to={`/information/${deptId}/news/${i.id}`} title={i.name}>{i.name} + // ) + // }) + // } + // + // } + //
    + //
    + //
    + // + +
    + { + mainList && mainList.length>0 && + mainList.map((i,k)=>{ + return( +
    {props.history.push(`/information/${deptId}/newdetail/${i.id}`)}} key={k}> { - columnList.map((i,k)=>{ - return( - {if(document.documentElement.scrollTop > 600)window.scrollTo(0,480);}} to={`/information/${deptId}/news/${i.id}`} title={i.name}>{i.name} - ) - }) + i.headImg ? + + : + } -
    - } +
    + {i.name} +

    + {i.summary} +

    +
    + {i.publishTime} + {i.visits} +
    +
    +
    + ) + }) + } + { + mainList && mainList.length === 0 && +
    + +

    暂无数据~

    -
    -
    - -
    - { - mainList && mainList.length>0 ? - mainList.map((i,k)=>{ - return( -
    {props.history.push(`/information/${deptId}/newdetail/${i.id}`)}} key={k}> - { - i.headImg ? - - : - - } -
    - {i.name} -

    - {i.summary} -

    -
    - {i.publishTime} - {i.visits} -
    -
    -
    - ) - }) - : -
    - -

    暂无数据~

    -
    - } - { - total > pageSize && -
    - {setPageNum(p)}}/> -
    - } -
    -
    - { + } + { + total > pageSize && +
    + {setPageNum(p)}}/> +
    + } +
    + + // + /* { hostList && hostList.length>0 &&
    - } -
    + } */ + /*
    -
    -
    +
    */ + // ) } export default NewsList; \ No newline at end of file diff --git a/src/forge/Information/Pages/projectSource.jsx b/src/forge/Information/Pages/projectSource.jsx index 4fbdee588..c4926f3f8 100644 --- a/src/forge/Information/Pages/projectSource.jsx +++ b/src/forge/Information/Pages/projectSource.jsx @@ -83,12 +83,12 @@ function ProjectSource(props){