This commit is contained in:
caishi 2023-06-01 16:02:41 +08:00
parent 45d9f22477
commit 3b07db8ba6
11 changed files with 179 additions and 152 deletions

View File

@ -1,6 +1,7 @@
import React from 'react';
import { Link } from 'react-router-dom';
function Hot({list , title}){
function Hot({list , title,deptId}){
return(
<div>
<p className="hot_title">{title}</p>
@ -12,7 +13,7 @@ function Hot({list , title}){
return(
<li>
<span style={{opacity:k<3 ? `${1-((k+1)/10)}` :"0.3"}}>{k+1}</span>
<a href="">{i.name}</a>
<Link to={`/information/${deptId}/newdetail/${i.id}`}>{i.name}</Link>
</li>
)
})

View File

@ -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){
<Menu.Item key={"4"}><Link to={`/information/${deptId}/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/${deptId}/VIP`}><img src={Menu6} alt="" width="36px"/>专区会员</Link></Menu.Item>
{ adminUrl && <Menu.Item key={"6"}><a onClick={()=>{window.location.href=adminUrl}}><img src={Menu7} alt="" width="34px"/>后台管理</a></Menu.Item> }
{ adminUrl && <Menu.Item key={"7"}><a onClick={()=>{window.location.href=adminUrl}}><img src={Menu7} alt="" width="34px"/>后台管理</a></Menu.Item> }
</Menu>
</div>
</div>

View File

@ -114,7 +114,7 @@ function HeaderPage(props){
return(
<li>
<div className="imgBox">{i.projectProperties && i.projectProperties.authorImageUrl && <img src={i.projectProperties.authorImageUrl} alt="" /> }</div>
<div className="infoBox">
<div className="infosBox">
<a onClick={()=>window.open(i.projectURL)} className="z_p_title task-hide">{i.projectProperties && i.projectProperties.name}</a>
<p className="z_p_desc task-hide-2">{i.projectProperties && i.projectProperties.description ? i.projectProperties.description : "暂无~"}</p>
</div>
@ -134,9 +134,9 @@ function HeaderPage(props){
personList.map((i,k)=>{
return(
<li>
<img src={i.imageUrl} alt="" />
<Link to={`/${i.login}`}><img src={i.imageUrl} alt="" /></Link>
<span>{i.name}</span>
<p className="task-hide-2">{i.introduction}</p>
<p className="task-hide-2" style={{display:i.introduction?"-webkit-flex":"flex"}}>{i.introduction || "暂无~"}</p>
</li>
)
})

View File

@ -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(
<div>
<div className="main_content">
<div id={`main_card_item_1`} style={{opacity:"0"}}></div>
<p className="in_title">领域资讯</p>
{
mainList && mainList.length>0 &&
<Menu mode={"horizontal"} selectedKeys={[key]}>
{
mainList.map((i,k)=>{
return(
<Menu.Item key={`${k+1}`} onClick={()=>clickTab(`${k+1}`,`main_card_item_${k+1}`)}><a href={`/information/${deptId}/news#main_card_item_${k+1}`}>{i.name}</a></Menu.Item>
)
})
}
</Menu>
}
{
!mainList && <div className="boxmain" style={{height:105}}><Skeleton /></div>
}
<div className="boxmain">
<p className="in_title">领域资讯</p>
{
mainList && mainList.length>0 &&
<Menu mode={"horizontal"} id="menus" selectedKeys={[cateId||"0"]} style={{justifyContent:menuH?"flex-start":"center"}}>
<Menu.Item key={"0"}><Link to={`/information/${deptId}/news`}>全部</Link></Menu.Item>
{
mainList.map((i,k)=>{
return(
<Menu.Item key={`${i.id}`}><Link to={`/information/${deptId}/news/${i.id}`}>{i.name}</Link></Menu.Item>
)
})
}
</Menu>
}
{
!mainList && <div style={{height:105}}><Skeleton /></div>
}
</div>
<div style={{width:'1200px',margin:"0px auto"}}>
<Box>
<LongWidth>
<Spin spinning={isSpin}>
<div style={{minHeight:"400px"}}>
{
mainList && mainList.length>0 &&
mainList.map((i,k)=>{
return(
<div className="main_card radius4">
<div className="guide">
<span className="task-hide">{i.name}</span>
<Link className="flexCenter" to={`/information/${deptId}/news/${i.id}`}>更多<img src={guideArrow} alt="" width="14px"/></Link>
</div>
<div>
{
i.cmsDocList && i.cmsDocList.length>0 ?
<React.Fragment>
{i.cmsDocList.map((j,e)=>{
cateId ?
<Lists {...props}/>
:
<div style={{minHeight:"400px"}}>
{
mainList && mainList.length>0 &&
mainList.map((i,k)=>{
return(
<div className="main_card radius4" style={{paddingTop:"25px"}}>
<div className="guide">
<span className="task-hide">{i.name}</span>
{ i.cmsDocList && i.cmsDocList.length> 0 && <Link className="flexCenter" to={`/information/${deptId}/news/${i.id}`} onClick={()=>{window.scrollTo(0,400)}}>更多<img src={guideArrow} alt="" width="14px"/></Link> }
</div>
<div>
{
i.cmsDocList && i.cmsDocList.length>0 ?
i.cmsDocList.map((j,e)=>{
return(
<div className="main_card_item" onClick={()=>{props.history.push(`/information/${deptId}/newdetail/${j.id}`)}}>
{e===0 &&
@ -120,27 +135,24 @@ function Main(props){
</div>
)
})
:
<div style={{display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"column",height:300}}>
<img src={emptydata} alt="" width="230"/>
<p className="font-15 color-grey-6 mt20">暂无数据~</p>
</div>
}
<div id={`main_card_item_${k+2}`} style={{opacity:"0"}}></div>
</React.Fragment>
:
<div style={{display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"column",height:300}}>
<img src={emptydata} alt="" width="230"/>
<p className="font-15 color-grey-6 mt20">暂无数据~</p>
<div id={`main_card_item_${k+2}`} style={{opacity:"0"}}></div>
</div>
}
</div>
</div>
</div>
)
})
)
})
}
</div>
}
</div>
</Spin>
</LongWidth>
<div className="short_width radius4">
<Hot title={"热门领域资讯"} list={hotList}/>
<Hot title={"热门资讯"} list={hotList} deptId={deptId}/>
</div>
</Box>
</div>

View File

@ -14,6 +14,7 @@ function NewsDetail(props){
useEffect(()=>{
if(id && address){
window.scrollTo(0,450);
getDetails();
}
},[id,address])

View File

@ -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(
<div className="info_news_list">
{/* <PublicBanner {...props}/> */}
<div style={{width:'1200px',margin:"0px auto",padding:"30px 0px"}}>
<Breadcrumb separator=">">
<Breadcrumb.Item href={`/information/${deptId}/news`}>领域资讯</Breadcrumb.Item>
<Breadcrumb.Item>{details && details.name}</Breadcrumb.Item>
</Breadcrumb>
<p className="in_title mb30">{details && details.name}</p>
<Box>
<Spin spinning={menuSpin}>
<div className="column_menu">
{
columnList && columnList.length>0 &&
<Menu selectedKeys={[cateId]}>
// <div className="info_news_list">
// <div style={{width:'1200px',margin:"0px auto",padding:"30px 0px"}}>
// <Breadcrumb separator=">">
// <Breadcrumb.Item href={`/information/${deptId}/news`}></Breadcrumb.Item>
// <Breadcrumb.Item>{details && details.name}</Breadcrumb.Item>
// </Breadcrumb>
// <p className="in_title mb30">{details && details.name}</p>
// <Box>
// <Spin spinning={menuSpin}>
// <div className="column_menu">
// {
// columnList && columnList.length>0 &&
// <Menu selectedKeys={[cateId]}>
// {
// columnList.map((i,k)=>{
// return(
// <Menu.Item key={i.id} value={i.id} ><Tooltip placement={'left'} title={i.name}><Link className="task-hide" onClick={()=>{if(document.documentElement.scrollTop > 600)window.scrollTo(0,480);}} to={`/information/${deptId}/news/${i.id}`} title={i.name}>{i.name}</Link></Tooltip></Menu.Item>
// )
// })
// }
// </Menu>
// }
// </div>
// </Spin>
// <div className="column_content">
// <LongWidth>
<Spin spinning={menuSpin}>
<div className="main_card">
{
mainList && mainList.length>0 &&
mainList.map((i,k)=>{
return(
<div className="main_card_item" onClick={()=>{props.history.push(`/information/${deptId}/newdetail/${i.id}`)}} key={k}>
{
columnList.map((i,k)=>{
return(
<Menu.Item key={i.id} value={i.id} ><Tooltip placement={'left'} title={i.name}><Link className="task-hide" onClick={()=>{if(document.documentElement.scrollTop > 600)window.scrollTo(0,480);}} to={`/information/${deptId}/news/${i.id}`} title={i.name}>{i.name}</Link></Tooltip></Menu.Item>
)
})
i.headImg ?
<img src={i.headImg} alt=""/>
:
<DefaultImg name="GitLink" title={details && details.name} />
}
</Menu>
}
<div style={{flex:1,width:0}}>
<Link to={`/information/${deptId}/newdetail/${i.id}`} className={`sub_name task-hide`}>{i.name}</Link>
<p className={`sub_desc task-hide-2`}>
{i.summary}
</p>
<div className="sub_info">
<span><img src={shijian} alt="" />{i.publishTime}</span>
<span><img src={liulan} alt="" />{i.visits}</span>
</div>
</div>
</div>
)
})
}
{
mainList && mainList.length === 0 &&
<div style={{display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"column",height:500}}>
<img src={emptydata} alt="" width="300"/>
<p className="font-15 color-grey-6 mt20">暂无数据~</p>
</div>
</Spin>
<div className="column_content">
<LongWidth>
<div className="main_card">
{
mainList && mainList.length>0 ?
mainList.map((i,k)=>{
return(
<div className="main_card_item" onClick={()=>{props.history.push(`/information/${deptId}/newdetail/${i.id}`)}} key={k}>
{
i.headImg ?
<img src={i.headImg} alt=""/>
:
<DefaultImg name="GitLink" title={details && details.name} />
}
<div style={{flex:1,width:0}}>
<Link to={`/information/${deptId}/newdetail/${i.id}`} className={`sub_name task-hide`}>{i.name}</Link>
<p className={`sub_desc task-hide-2`}>
{i.summary}
</p>
<div className="sub_info">
<span><img src={shijian} alt="" />{i.publishTime}</span>
<span><img src={liulan} alt="" />{i.visits}</span>
</div>
</div>
</div>
)
})
:
<div style={{display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"column",height:500}}>
<img src={emptydata} alt="" width="300"/>
<p className="font-15 color-grey-6 mt20">暂无数据~</p>
</div>
}
{
total > pageSize &&
<div style={{padding:"25px 0px"}}>
<Pagination current={pageNum} pageSize={pageSize} total={total} showQuickJumper onChange={p=>{setPageNum(p)}}/>
</div>
}
</div>
</LongWidth>
{
}
{
total > pageSize &&
<div style={{padding:"25px 0px"}}>
<Pagination current={pageNum} pageSize={pageSize} total={total} showQuickJumper onChange={p=>{setPageNum(p)}}/>
</div>
}
</div>
</Spin>
// </LongWidth>
/* {
hostList && hostList.length>0 &&
<div className="short_width">
<Hot title="热门领域资讯" list={hostList} />
</div>
}
</div>
} */
/* </div>
</Box>
</div>
</div>
</div> */
// </div>
)
}
export default NewsList;

View File

@ -83,12 +83,12 @@ function ProjectSource(props){
<Box>
<ul className="in_pro_menu">
<li className="u_t"><i className="iconfont icon-muluicon font-15 mr10 mt2" style={{color:"#1f2329"}} />项目分类</li>
<li className={0 === typeId ? "active":""} onClick={()=>setTypeId(0)}>全部分类</li>
<li className={0 === typeId ? "active":""} onClick={()=>{setTypeId(0)}}>全部分类</li>
{
typeList && typeList.length>0 &&
typeList.map((i,k)=>{
return(
<li className={i.id === typeId ? "active":""} onClick={()=>setTypeId(i.id)}>{i.name}</li>
<li className={i.id === typeId ? "active":""} onClick={()=>{setTypeId(i.id);window.scrollTo(0,0)}}>{i.name}</li>
)
})
}

View File

@ -1,6 +1,7 @@
import React , { useState , useEffect } from 'react';
import Crown from '../img/crown.png';
import Nodata from '../../Nodata';
import { Link } from 'react-router-dom';
import { Spin } from 'antd';
import axios from 'axios';
@ -47,13 +48,13 @@ function ZoneVIP(props){
</div>
<p className="card_desc">{i.typeIntroduction}</p>
{
i.zoneMemberList && i.zoneMemberList.length > 0 &&
i.zoneMemberList && i.zoneMemberList.length > 0 ?
<ul className="card_ul">
{
i.zoneMemberList.map((j,key)=>{
return(
<li className="card_u_li">
<img src={j.imageUrl} alt="" />
<Link to={`/${j.login}`} ><img src={j.imageUrl} alt="" /></Link>
<div className="card_u_info">
<div className="card_u_up"><span className="card_name task-hide">{j.name}</span>{j.memberLevel && <span className="card_tag">{j.memberLevel}</span> }</div>
<p className="card_u_down task-hide-2">{j.introduction}</p>
@ -63,6 +64,8 @@ function ZoneVIP(props){
})
}
</ul>
:
<Nodata _html="暂无数据"/>
}
</div>
)

View File

@ -42,7 +42,6 @@ function Index(props){
const [ address , setAddress ] = useState("");
const { deptId } = props.match.params;
const isDev = window.location.port === '3007' || window.location.origin === "https://testforgeplus.trustie.net";
console.log(isDev,window.location);
useEffect(()=>{
const isDev = window.location.port === '3007' || window.location.origin === "https://testforgeplus.trustie.net";
@ -80,6 +79,9 @@ function Index(props){
function getAdminUrl(){
const url = `${address}/zone/zoneDetail/${deptId}/checkZoneRole`;
if (window.location.href.indexOf('localhost') < 0) {
axios.defaults.withCredentials = true;
}
axios.get(url).then(response=>{
if(response && response.data.code === 200){
setAdminUrl(response.data.data);
@ -106,7 +108,7 @@ function Index(props){
<Route
path="/information/:deptId/news/:cateId"
render={(p) => (
<NewsList {...props} {...p} address={address}/>
<Main {...props} {...p} address={address}/>
)}
></Route>
<Route

View File

@ -91,10 +91,9 @@
.main_content{
padding: 40px 0px 80px;
.ant-menu{
height: 40px;
line-height: 30px;
border:none!important;
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: center;
margin: 30px 0px 35px!important;
@ -103,7 +102,7 @@
border: none!important;
font-size: 16px;
padding:0px ;
margin:0px 28px!important;
margin:10px 28px 0px 0px!important;
&.ant-menu-item-selected::after{
content:"";
position: absolute;
@ -170,7 +169,7 @@
}
.main_card{
background-color: #fff;
padding:25px;
padding:0px 25px;
margin-bottom: 25px;
.main_card_item{
display: flex;
@ -602,8 +601,8 @@
.zone_news{
background-image: url(./img/productBg1.png);
background-size: 100% 100%;
min-height: 764px;
margin-top: 80px;
min-height: 740px;
margin-top: 40px;
display: flex;
align-items: center;
justify-content: center;
@ -715,7 +714,7 @@
border-radius: 8px;
}
}
.infoBox{
.infosBox{
flex:1;
width: 0;
.z_p_title{
@ -726,6 +725,7 @@
height: 22px;
line-height: 22px;
display: block;
word-break: break-all;
&:hover{
color: #466aff;
}
@ -768,7 +768,7 @@
&:nth-child(4n){
margin-right: 0px;
}
&>img{
& >a >img{
width: 80px;
height: 80px;
border-radius: 50%;
@ -789,6 +789,9 @@
line-height:26px;
text-align:center;
-webkit-line-clamp: 3;
align-items: center;
height: 78px;
word-break: break-all;
}
}
}
@ -888,7 +891,7 @@
&:last-child{
border-bottom: none;
}
&>img{
& > a >img{
width: 100px;
height: 100px;
border-radius: 50%;

View File

@ -5,6 +5,7 @@ const developUrl = "https://test-search.trustie.net";
const testUrl = "https://test-search.trustie.net";
const productUrl = "https://wiki-api.trustie.net";
const { service, actionUrl } = javaFetch(productUrl, testUrl, developUrl);
export const httpUrl = actionUrl;
export default service;