修改论坛交流、首页路由指向、代码库详情页

This commit is contained in:
谢思 2026-01-05 18:04:22 +08:00
parent 79f424e5e0
commit 3b0e4df3b1
9 changed files with 98 additions and 68 deletions

View File

@ -204,7 +204,7 @@
"eslintConfig": {
"extends": "react-app"
},
"proxy": "http://172.20.32.203:4000/",
"proxy": "https://testforgeplus.trustie.net/",
"port": "3007",
"devDependencies": {
"@babel/core": "^7.23.6",

View File

@ -734,7 +734,7 @@ class App extends Component {
<Route exact path="/"
render={
(props) => (
<Store {...props} {...this.props} {...this.state} />
<Home {...props} {...this.props} {...this.state} />
)
}
/>

View File

@ -70,7 +70,16 @@ function DetailBanner({ history,list , owner , projectsId ,showNotification , ur
</Link>
</li>
}
{/* {
{
owner === "gh_mirrors" && item.menu_name === "issues" &&
<li className={pathname === "server" ? "active" : ""}>
<Link className='newTab' to={{ pathname: `/${owner}/${projectsId}/sbom`, state }}>
<i className={"iconfont icon-fuwuicon color-grey-3 mr5 font-15"} style={{marginTop:"1px"}}></i>
<span>供应链</span>
</Link>
</li>
}
{
owner === "gh_mirrors" && item.menu_name === "issues" &&
<li className={pathname==="issues" ? "active" : ""}>
<Link to={{ pathname: `/${owner}/${projectsId}/issues`, state }}>
@ -81,8 +90,8 @@ function DetailBanner({ history,list , owner , projectsId ,showNotification , ur
{projectDetail && projectDetail.issues_count ? <span className="num">{numFormat(projectDetail.issues_count)}</span> : ""}
</Link>
</li>
} */}
{/* {
}
{
item.menu_name === "pulls" && projectDetail && parseInt(projectDetail.type) !== 2 && platform ?
<li className={pathname==="pulls" ? "active" : ""}>
<Link to={{ pathname: `/${owner}/${projectsId}/pulls`, state }}>
@ -91,7 +100,7 @@ function DetailBanner({ history,list , owner , projectsId ,showNotification , ur
{projectDetail && projectDetail.pull_requests_count ? <span className="num">{numFormat(projectDetail.pull_requests_count)}</span> : ""}
</Link>
</li>:""
} */}
}
{/* 引擎仅对当前仓库管理员可见 */}
{/* {
item.menu_name === "devops" ?
@ -123,7 +132,7 @@ function DetailBanner({ history,list , owner , projectsId ,showNotification , ur
</Link>
</li>
} */}
{/* {
{
item.menu_name === "versions" &&
<li className={pathname==="milestones" ? "active" : ""}>
<Link to={{ pathname: `/${owner}/${projectsId}/milestones`, state }}>
@ -132,8 +141,8 @@ function DetailBanner({ history,list , owner , projectsId ,showNotification , ur
{projectDetail && projectDetail.versions_count ? <span className="num">{numFormat(projectDetail.versions_count)}</span> :""}
</Link>
</li>
} */}
{/* {
}
{
item.menu_name === "wiki" &&
<li className={pathname === "wiki" ? "active" : ""}>
<Link to={{ pathname: `/${owner}/${projectsId}/wiki`, state }}>
@ -141,17 +150,8 @@ function DetailBanner({ history,list , owner , projectsId ,showNotification , ur
<span>维基(Wiki)</span>
</Link>
</li>
} */}
{
owner === "gh_mirrors" && item.menu_name === "issues" &&
<li className={pathname === "server" ? "active" : ""}>
<Link className='newTab' to={{ pathname: `/${owner}/${projectsId}/sbom`, state }}>
<i className={"iconfont icon-fuwuicon color-grey-3 mr5 font-15"} style={{marginTop:"1px"}}></i>
<span>供应链</span>
</Link>
</li>
}
{/* {
{
item.menu_name === "activity" &&
<li className={pathname==="activity" ? "active" : ""}>
<Link to={{ pathname: `/${owner}/${projectsId}/activity`, state }}>
@ -159,7 +159,7 @@ function DetailBanner({ history,list , owner , projectsId ,showNotification , ur
<span>动态</span>
</Link>
</li>
} */}
}
{
item.menu_name === "settings" && platform &&
<li className={pathname === "settings" ? "active" : ""}>

BIN
src/forums/image/img1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 KiB

BIN
src/forums/image/img2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 KiB

BIN
src/forums/image/img3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 326 KiB

BIN
src/forums/image/img4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 366 KiB

View File

@ -7,6 +7,10 @@ import { Link } from "react-router-dom";
import icon5 from '../image/icon5.png';
import icon6 from '../image/icon6.png';
import icon10 from '../image/icon10.png';
import img1 from '../image/img1.png';
import img2 from '../image/img2.png';
import img3 from '../image/img3.png';
import img4 from '../image/img4.png';
import Nodata from "../../forge/Nodata";
import { forumSectionId } from "../static";
import { rollingButton } from "../../components/button";
@ -42,6 +46,12 @@ function List(props) {
1: require('../image/icon3.png'),
2: require('../image/icon4.png'),
}
const forumsImg = {
0: img1,
1: img2,
2: img3,
3: img4
}
function init(updatedTags){
const tagByState = updatedTags.filter(i=>i.title.includes(tagNameByState))
@ -73,57 +83,59 @@ function List(props) {
if (res && res.recommend_forum_sections) {
//
const childrenTags = res.recommend_forum_sections;
setForumTag(childrenTags);
init(childrenTags)
//
const fetchEssencePosts = async (tag) => {
try {
const essenceRes = await getForumsById(tag.id, {
page: 1,
limit: 1,
sort: 'published_at',
select_type: 'is_fine',
});
// const fetchEssencePosts = async (tag) => {
// try {
// const essenceRes = await getForumsById(tag.id, {
// page: 1,
// limit: 1,
// sort: 'published_at',
// select_type: 'is_fine',
// });
return {
...tag,
essencePosts: essenceRes?.memos || []
};
} catch (err) {
return {
...tag,
essencePosts: []
};
}
};
// return {
// ...tag,
// essencePosts: essenceRes?.memos || []
// };
// } catch (err) {
// return {
// ...tag,
// essencePosts: []
// };
// }
// };
// 使 Promise.all
Promise.all(childrenTags.map(fetchEssencePosts))
.then(updatedTags => {
setForumTag(updatedTags);
if (updatedTags.length > 0) {
init(updatedTags)
}
})
.catch(error => {
//
setForumTag(childrenTags);
if (childrenTags.length > 0) {
init(childrenTags)
}
});
// // 使 Promise.all
// Promise.all(childrenTags.map(fetchEssencePosts))
// .then(updatedTags => {
// setForumTag(updatedTags);
// if (updatedTags.length > 0) {
// init(updatedTags)
// }
// })
// .catch(error => {
// //
// setForumTag(childrenTags);
// if (childrenTags.length > 0) {
// init(childrenTags)
// }
// });
}
})
}, [])
useEffect(() => {
if (forumTagDetail && forumTagDetail.id) {
const forums = forumTagDetail.essencePosts[0] || {}
// const forums = forumTagDetail.essencePosts[0] || {}
getForumsById(forumTagDetail.id, {
page: page,
limit: LIMIT,
sort: 'published_at',
select_type: 'all',
hide_id: forums.id
// hide_id: forums.id
}).then(res => {
if (res) {
setForumListByTag(res.memos || []);
@ -178,7 +190,7 @@ function List(props) {
</div>
</div>
<div className="forums-list3-box">
<div className="font-40 font-bd center mb20">精华论坛</div>
<div className="font-40 font-bd center mb40">精华论坛</div>
<div className="width1600 pb100" id="forums-list3-id">
{/* 四个板块 */}
<div className="forums-section-box df">
@ -188,9 +200,12 @@ function List(props) {
return (
<div key={index} className={`forums-section-item-box flex1 ${isSelected && 'active'}`} onClick={()=>{setForumTagDetail(item)}}>
<div className="forums-section-item">
<div className="font-22 center section-title pt8 pb5">{item.title}</div>
<div className="font-22 center section-title line-normal pt15">{item.title}</div>
<div className="forums-section-item-content">
{forums.memo_image_info && <img src={httpUrl + forums.memo_image_info.url} alt="" className="memo_image_info"/>}
<div className="memo_image_info_box">
<img src={forumsImg[index]} alt="" className="memo_image_info"/>
</div>
{/* {forums.memo_image_info && <img src={httpUrl + forums.memo_image_info.url} alt="" className="memo_image_info"/>}
<div className="pl20 pr20">
<Link to={`/forums/${forums.id}`} className="AlignCenter pt10 pb10">
<div className="task-hide font-20">{forums.subject}</div>
@ -207,7 +222,7 @@ function List(props) {
{forums.replies_count}
<span className="fr">{forums.published_time}</span>
</div>
</div>
</div> */}
</div>
</div>
</div>
@ -215,7 +230,7 @@ function List(props) {
})}
</div>
{/* 板块对应的帖子列表 */}
<div className="forums-list4-box mt30">
<div className="forums-list4-box mt40">
{forumListByTag.map((item, index) => {
const orderIndex = index+LIMIT*(page-1)
return <div className="forums-list4-item">

View File

@ -166,7 +166,7 @@
}
.forums-list3-box {
padding: 80px 0 60px;
padding: 60px 0 60px;
background-image: linear-gradient(179.88deg, #ffffff 0%, rgba(255, 255, 255, 0.62) 16.1%, rgba(255, 255, 255, 0) 100%);
border-radius: 40px;
position: relative;
@ -190,15 +190,25 @@
&.active{
border-color: #2149d4;
&::before{
width: 104%;
height: 104%;
width: 106%;
height: 110%;
content: '';
position: absolute;
background-color: rgb(33 72 212 / 20%);
top: -2%;
left: -2%;
top: -5%;
left: -3%;
border-radius:15px;
}
&::after{
content: "";
position: absolute;
top: 105%;
left: 50%;
transform: translateX(-50%);
border-left: 10px solid transparent;
border-right: 10px solid transparent;
border-top: 10px solid rgb(33 72 212 / 20%);
}
}
&:nth-of-type(3) .forums-section-item{
background-image:linear-gradient(90deg,#D7DEFF 0% 49.37%,#C7CFFF 100%);
@ -218,13 +228,18 @@
.memo_image_info{
width: 100%;
height: 160px;
height: auto;
object-fit: cover;
border-radius: 15px 15px 0 0;
transition: transform .4s cubic-bezier(.25, .46, .45, .94);
}
.memo_image_info_box{
margin: 15px;
overflow: hidden;
border-radius:15px;
}
.forums-section-item-content{
background-color: white;
// background-color: white;
border-radius:15px;
overflow: hidden;
}