diff --git a/src/forge/Information/Component/pointsDoc.jsx b/src/forge/Information/Component/pointsDoc.jsx
index 81b340b18..7240effef 100644
--- a/src/forge/Information/Component/pointsDoc.jsx
+++ b/src/forge/Information/Component/pointsDoc.jsx
@@ -3,7 +3,7 @@ import { Modal, Form, Input, Button, Spin, Pagination } from 'antd';
import Nodata from '../../Nodata';
-import { getNewsMyList, getApplyMyList, doDocTop } from '../api';
+import { getNewsMyList, getMyTopArticle, doDocTop } from '../api';
const { TextArea } = Input;
@@ -45,23 +45,17 @@ function PointsDoc({ visible , onCancel , onSure , type , username , choosed , h
async function init() {
setIsSpin(true);
try{
- // let result = await getApplyMyList({
- // zoneId: member.zoneId,
- // applyType: 'doc',
- // status:1,
- // pageSize:limit,
- // pageNum:page
- // });
- // let rows = result.data && result.data.rows;
- // TODO 查询获取用户已置顶新闻
- let rows = null;
- if(Array.isArray(rows) && rows.length > 0) {
- setCurrentId(rows[0].applyId)
- } else {
- setCurrentId(null)
+ let res = await getMyTopArticle(member.zoneId);
+ if(res && res.data.code === 200){
+ setCurrentRow(res.data.data);
+ if(res.data.data) {
+ setCurrentId(res.data.data.docId);
+ } else {
+ setCurrentId(null);
+ }
+
+ await getMyNews();
}
-
- await getMyNews();
}finally{
setIsSpin(false)
}
@@ -72,10 +66,6 @@ function PointsDoc({ visible , onCancel , onSure , type , username , choosed , h
let rows = result.data && result.data.rows;
if(rows && rows.length>0){
setList(rows);
- if(currentId){
- const row = rows.find(item => item.applyId === currentId || item.id === currentId);
- setCurrentRow(row || null);
- }
}else{
setList([]);
setCurrentRow(null);
@@ -124,7 +114,7 @@ function PointsDoc({ visible , onCancel , onSure , type , username , choosed , h
{currentRow && (
-
{currentRow.name}
+
{currentRow.docName}
diff --git a/src/forge/Information/Component/pointsProject.jsx b/src/forge/Information/Component/pointsProject.jsx
new file mode 100644
index 000000000..73e6877c6
--- /dev/null
+++ b/src/forge/Information/Component/pointsProject.jsx
@@ -0,0 +1,144 @@
+import React, { useEffect, useState } from 'react';
+import { Modal, Form, Input, Button, Spin, Pagination } from 'antd';
+
+import Nodata from '../../Nodata';
+
+import { getProjectMyList, getMyTopProject, doProjectTop } from '../api';
+
+
+const { TextArea } = Input;
+
+
+import { getImageUrl } from 'educoder'
+
+import '../indexUser.scss';
+
+function PointsDoc({ visible , onCancel , onSure , type , username , choosed , history , showCompeleteDialog , member }) {
+ const limit = 5;
+
+ const [ page , setPage ] = useState(1);
+ const [ total , setTotal ] = useState(0);
+ const [ isSpin , setIsSpin ] = useState(true);
+ const [ list , setList ] = useState(undefined);
+ const [ currentId , setCurrentId ] = useState(null);
+ const [ currentRow , setCurrentRow ] = useState(null);
+
+ useEffect(()=>{
+ if(visible && member) {
+ setPage(1);
+ }
+ },[visible, member])
+
+ useEffect(()=>{
+ if(visible && member) {
+ init();
+ }
+ },[visible, member])
+
+
+ useEffect(()=>{
+ if(visible && member) {
+ getMyProject();
+ }
+ },[page])
+
+ async function init() {
+ setIsSpin(true);
+ try{
+ let res = await getMyTopProject(member.zoneId);
+ if(res && res.data.code === 200){
+ setCurrentRow(res.data.data);
+ if(res.data.data) {
+ setCurrentId(res.data.data.id);
+ } else {
+ setCurrentId(null);
+ }
+
+ await getMyProject();
+ }
+ }finally{
+ setIsSpin(false)
+ }
+ }
+
+ async function getMyProject(){
+ let result = await getProjectMyList({zoneId: member.zoneId, auditStatus:1, excludeId: currentId, pageSize:limit, pageNum:page});
+ let rows = result.data && result.data.rows;
+ if(rows && rows.length>0){
+ setList(rows);
+ }else{
+ setList([]);
+ setCurrentRow(null);
+ }
+ setTotal(result.data.total);
+ }
+
+ function onOk() {
+ }
+
+ async function handlePin(item) {
+ setIsSpin(true);
+ try {
+ let data = Object.assign({}, item, {zoneId: member.zoneId});
+ await doProjectTop(data);
+ onSure();
+ } finally {
+ setIsSpin(false);
+ }
+ }
+
+ return(
+
}
+ className="doc_modal"
+ visible={visible}
+ title={
+ 专区首页项目推荐
+
}
+ closable={true}
+ width={800}
+ footer={
+
+
+
+
+ }
+ okText="确定"
+ cancelText="取消"
+ >
+
+
+
+ 新闻标题
+ 操作
+
+ {currentRow && (
+
+ {currentRow.name}
+
+
+
+
+ )}
+ {list && list.map((item) => (
+
+ {item.projectProperties?.name}
+
+
+
+
+ ))}
+ { !isSpin && !currentId && (!list || !list.length) &&
+ }
+
+ {
+ total > limit &&
+
+ }
+
+
+ )
+}
+export default PointsDoc;
\ No newline at end of file
diff --git a/src/forge/Information/Pages/homepage/component/newsByNSCC.jsx b/src/forge/Information/Pages/homepage/component/newsByNSCC.jsx
index 33523a73b..9f46400d8 100644
--- a/src/forge/Information/Pages/homepage/component/newsByNSCC.jsx
+++ b/src/forge/Information/Pages/homepage/component/newsByNSCC.jsx
@@ -1,6 +1,6 @@
import React , { useEffect, useRef, useState } from 'react';
import { Link } from 'react-router-dom';
-import { getDirListById, getSubDocList } from '../../../api';
+import { getDirListById, getSubDocList, getPointsDocList } from '../../../api';
import { Badge, Col, Divider, Icon, Row } from 'antd';
import '../index.scss';
import Nodata from '../../../../Nodata';
@@ -60,11 +60,8 @@ function News(props) {
rows[0] && getDocById(rows[0].id, 5, (data)=>{
setDocListByFirstDir(data)
})
- // 获取第2个栏目的3篇文章
- rows[1] && getDocById(rows[1].id, 3, (data)=>{
- setDocListBySecondDir(data)
- })
- // rows[2] && setActiveDirId(rows[2].id)
+
+ getPointsDoc(rows[1].id);
}
})
}, [id])
@@ -74,6 +71,35 @@ function News(props) {
setDocListByDir(data)
}, (data)=>{setTotal(data)})
}, [activeDirId])
+
+ async function getPointsDoc(rowId) {
+ let res = await
+ getPointsDocList(id).then(result=>{
+ let docList = [];
+ if(result && Array.isArray(result.data.data) && result.data.data.length){
+ docList = result.data.data.map(item => {
+ item.id = item.docId;
+ item.name = item.docName;
+ item.summary = item.summary;
+ item.zoneId = item.zoneId;
+ return item;
+ });
+ }
+
+ if(rowId) {
+ getSubDocList(rowId,{pageSize:3,pageNum:1,auditStatus:1}).then(result=>{
+ if(result && result.data.rows){
+ let rows = result.data.rows;
+ const existIds = new Set(docList.map(item => item.id));
+ const newRows = rows.filter(row => !existIds.has(row.id));
+ docList = [...docList, ...newRows];
+ }
+ }).finally(() => {
+ setDocListBySecondDir(docList);
+ })
+ }
+ });
+ }
// 根据招聘专栏的id获取其栏目下的招聘文章
function getDocById(dirId, pageSize=10, setData, setTotal1){
diff --git a/src/forge/Information/Pages/homepage/component/projectByNSCC.jsx b/src/forge/Information/Pages/homepage/component/projectByNSCC.jsx
index b35d69ec9..552713974 100644
--- a/src/forge/Information/Pages/homepage/component/projectByNSCC.jsx
+++ b/src/forge/Information/Pages/homepage/component/projectByNSCC.jsx
@@ -1,6 +1,6 @@
import React, { useEffect, useRef, useState } from 'react';
import '../index.scss';
-import { getProjectListByScore, getProjectsTypeLists } from '../../../api';
+import { getProjectListByScore, getProjectsTypeLists, getPointsProjectList } from '../../../api';
import { Carousel, Divider, Pagination, Spin } from 'antd';
import Nodata from '../../../../Nodata';
import Slider from 'react-slick';
@@ -16,6 +16,7 @@ function TypeCarousel({pageSize=4, list=[], typeId, onClick}) {
const start = i * pageSize;
const end = start + pageSize;
pages.push(list.slice(start, end));
+ console.log('ppp', pages)
}
return
{pages.map((page, index)=>{
@@ -24,6 +25,7 @@ function TypeCarousel({pageSize=4, list=[], typeId, onClick}) {
{page.map((item, i) => {
const order = index*pageSize+i
const iconName = {
+ "精选项目": "icon-jingxuanxiangmu",
"并行计算框架": "icon-binghangjisuankuangjia",
"异构数据库": "icon-yigoushujuku",
"性能基准与评测": "icon-xingnengjizhunyupingce",
@@ -55,6 +57,7 @@ function Project({ data, nsccTitle }) {
const [typeList, setTypeList] = useState([]);
const [typeId, setTypeId] = useState(undefined);
const [lists, setLists] = useState([]);
+ const [topList, setTopList] = useState([]);
const [loading, setLoading] = useState(false);
const [page, setPage] = useState(1);
const [total, setTotal] = useState(0);
@@ -93,20 +96,41 @@ function Project({ data, nsccTitle }) {
}, []);
useEffect(() => {
- id && getProjectsTypeLists(id, {
- pageNum: 1,
- pageSize: 100,
- }).then(result => {
- if (result) {
- const rows = result.data.rows;
- rows[0] && setTypeId(rows[0].id)
- setTypeList(rows);
+ async function fetchTypeData() {
+ let typeList = [];
+ let typeId = null;
+ if(id) {
+ let res = await getPointsProjectList(id);
+ if(res && Array.isArray(res.data.data) && res.data.data.length){
+ setTopList(res.data.data);
+ typeList.push({id: -1, zoneId: id, name: '精选项目'});
+ typeId = -1;
+ }
+
+ getProjectsTypeLists(id, {
+ pageNum: 1,
+ pageSize: 100,
+ }).then(result => {
+ if (result) {
+ const rows = result.data.rows;
+ if(Array.isArray(rows) && rows.length) {
+ typeList = [...typeList, ...rows];
+ setTypeList(typeList);
+ if (typeId === null) {
+ setTypeId(rows[0].id);
+ } else {
+ setTypeId(typeId);
+ }
+ }
+ }
+ }).catch(() => { })
}
- }).catch(() => { })
+ }
+ fetchTypeData();
}, [id])
useEffect(() => {
- if (typeId) {
+ if (typeId && typeId !== -1) { // 非置顶项目查询数据
setLoading(true);
getProjectListByScore(id, {
pageNum: page,
@@ -168,25 +192,86 @@ function Project({ data, nsccTitle }) {
}
+ const topDetail = (className="online_detail", i, index, length) => {
+ const { extra: { } } = i || {}
+ return window.open(i.projectURL)}>
+
+ {i.projectProperties && i.projectProperties.name}
+
+
+ {i.projectProperties.description || "暂无描述"}
+
+
+
+ {i.projectProperties.language && - {i.projectProperties.language}
}
+ {
+ i.projectProperties && i.projectProperties.topics &&
+ i.projectProperties.topics.split(",").map(t => {
+ return (
+ - {t}
+ )
+ })
+ }
+
+
+
+
+ {i.projectProperties.language && (
+ <>
+
{i.projectProperties.language}
+
+ >
+ )}
+ {i.projectProperties.timeAgo &&
更新于{i.projectProperties.timeAgo}}
+
+
+ 赞{i.projectProperties.praisesCount}
+ fork{i.projectProperties.forkedCount}
+
+
+
+ }
+
return
{nsccTitle(homepageProjectTitle, 0.1, "font-bd font-30 mb50 align task-hide")}
{setTypeId(id); setPage(1)}}/>
-
-
- {lists.slice(0, 3).map((i, index)=>{
- return projectDetail("online_detail", i, index, 3)
- })}
-
- {lists.length > 3 &&
- {lists.slice(3).map((i, index)=>{
- return projectDetail("second_detail", i, index, lists.slice(4).length)
- })}
-
}
- {setPage(page)}} className='center mt30'/>
- {!loading && lists.length === 0 && }
-
+ {
+ typeId !== -1 &&
+
+
+ {lists.slice(0, 3).map((i, index)=>{
+ return projectDetail("online_detail", i, index, 3)
+ })}
+
+ {lists.length > 3 &&
+ {lists.slice(3).map((i, index)=>{
+ return projectDetail("second_detail", i, index, lists.slice(4).length)
+ })}
+
}
+ {setPage(page)}} className='center mt30'/>
+ {!loading && lists.length === 0 && }
+
+ }
+ {
+ typeId === -1 &&
+
+
+ {topList.slice(0, 3).map((i, index)=>{
+ return topDetail("online_detail", i, index, 3)
+ })}
+
+ {lists.length > 3 &&
+ {topList.slice(3).map((i, index)=>{
+ return topDetail("second_detail", i, index, lists.slice(4).length)
+ })}
+
}
+ {setPage(page)}} className='center mt30'/>
+ {!loading && lists.length === 0 && }
+
+ }
+
diff --git a/src/forge/Information/Pages/homepage/index.scss b/src/forge/Information/Pages/homepage/index.scss
index 49ec7840a..9b054ce4c 100644
--- a/src/forge/Information/Pages/homepage/index.scss
+++ b/src/forge/Information/Pages/homepage/index.scss
@@ -984,6 +984,11 @@
padding: 22px 20px 20px 20px;
border-radius:15px;
box-shadow:0px 0px 12px rgba(33, 73, 212, 0.1);
+ .topitem{
+ background-color: rgba(0, 0, 0, 0.08);
+ padding: 4px 8px;
+ border-radius: 4px;
+ }
&:hover{
background-image: url('./image/projectBk2.png');
span, div{
@@ -997,6 +1002,9 @@
background-color:rgba(255, 255, 255, 0.12);
border: 1px solid rgba(255, 255, 255, 0.5);
}
+ .topitem{
+ background-color: rgba(255, 255, 255, 0.12);
+ }
}
}
.second_detail{
@@ -1190,4 +1198,5 @@
}
}
}
-}
\ No newline at end of file
+}
+
diff --git a/src/forge/Information/Pages/zoneUser.jsx b/src/forge/Information/Pages/zoneUser.jsx
index 2eed56926..7f6952114 100644
--- a/src/forge/Information/Pages/zoneUser.jsx
+++ b/src/forge/Information/Pages/zoneUser.jsx
@@ -26,6 +26,7 @@ import UserEdit from '../Component/UserEdit';
import UserAward from '../Component/UserAward';
import MemberApply from '../Component/memberApply';
import PointsDoc from '../Component/pointsDoc';
+import PointsProject from '../Component/pointsProject';
import ApplyAcitvity from '../Component/applyAcitvity';
import ApplyQA from '../Component/applyQA';
@@ -46,11 +47,13 @@ function ZoneUser(props){
const [ applyVisible , setApplyVisible ] = useState(false);
const [ awardVisible , setAwardVisible ] = useState(false);
const [ docVisible , setDocVisible ] = useState(false);
+ const [ projectVisible , setProjectVisible ] = useState(false);
const [ acitvityVisible , setAcitvityVisible ] = useState(false);
const [ qaVisible , setQaVisible ] = useState(false);
const [ successVisible , setSuccessVisible ] = useState(false);
const [ timeNum, setTimeNum] = useState(3);
const [ memberAccountInfo, setMemberAccountInfo ] = useState([]);
+ const [msg, setMsg] = useState('');
const { id, showNotification, checkIfLogin, showLoginDialog, temp, sectionMemberTitle } = props;
@@ -267,6 +270,8 @@ function ZoneUser(props){
}
} else if(item.key == 'doc') {
setDocVisible(true);
+ } else if(item.key == 'repo') {
+ setProjectVisible(true);
} else if(item.key == 'acitvity') {
setAcitvityVisible(true);
} else if(item.key == 'qa') {
@@ -377,7 +382,10 @@ function ZoneUser(props){
onCancel={()=>setAwardVisible(false)}
/>
setDocVisible(false)} onSure={() => { setDocVisible(false); setSuccessVisible(true);getInfo();}}
+ onCancel={()=>setDocVisible(false)} onSure={() => { setDocVisible(false); setMsg('首页新闻推荐'); setSuccessVisible(true);getInfo();}}
+ />
+ setProjectVisible(false)} onSure={() => { setProjectVisible(false); setMsg('首页项目推荐'); setSuccessVisible(true);getInfo();}}
/>
setAcitvityVisible(false)} onSure={(msg) => { showNotification(msg); setAcitvityVisible(false); getInfo();}}
@@ -397,7 +405,7 @@ function ZoneUser(props){
>

-
恭喜获得专区
+
恭喜获得专区
diff --git a/src/forge/Information/api.js b/src/forge/Information/api.js
index cb3af8453..9854422f7 100644
--- a/src/forge/Information/api.js
+++ b/src/forge/Information/api.js
@@ -552,12 +552,19 @@ export function getProjectListByScore(id,params) {
})
}
-// 专区获取我的积分申请
-export function getApplyMyList(params){
+// 专区获取我的置顶文章
+export function getMyTopArticle(id){
return fetch({
- url:`/zone/points/apply/my/list`,
+ url:`/zone/points/account/article/top/${id}`,
+ method:"get",
+ })
+}
+
+// 专区获取我的置顶项目
+export function getMyTopProject(id){
+ return fetch({
+ url:`/zone/points/account/project/top/${id}`,
method:"get",
- params
})
}
@@ -680,3 +687,27 @@ export function doDocTop(data) {
});
}
+export function doProjectTop(data) {
+ return fetch({
+ url: `/zone/points/account/project/top`,
+ method: 'post',
+ data
+ });
+}
+
+
+// 获取文章列表
+export function getPointsDocList(id){
+ return fetch({
+ url:`/zone/zoneFront/getTopDoc/${id}`,
+ method: 'get',
+ })
+}
+
+// 获取文章列表
+export function getPointsProjectList(id){
+ return fetch({
+ url:`/zone/zoneFront/getTopProject/${id}`,
+ method: 'get',
+ })
+}