From 36059bcc6df132230ee0de731b2becf9fc95f303 Mon Sep 17 00:00:00 2001 From: amypeng Date: Mon, 8 Jun 2026 15:38:28 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=AF=E5=88=86=20=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E7=BD=AE=E9=A1=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 积分 项目置顶 --- src/forge/Information/Component/pointsDoc.jsx | 2 +- .../Information/Component/pointsProject.jsx | 144 ++++++++++++++++++ src/forge/Information/Pages/zoneUser.jsx | 12 +- src/forge/Information/api.js | 18 ++- 4 files changed, 172 insertions(+), 4 deletions(-) create mode 100644 src/forge/Information/Component/pointsProject.jsx diff --git a/src/forge/Information/Component/pointsDoc.jsx b/src/forge/Information/Component/pointsDoc.jsx index b99102612..7240effef 100644 --- a/src/forge/Information/Component/pointsDoc.jsx +++ b/src/forge/Information/Component/pointsDoc.jsx @@ -14,7 +14,7 @@ import { getImageUrl } from 'educoder' import '../indexUser.scss'; function PointsDoc({ visible , onCancel , onSure , type , username , choosed , history , showCompeleteDialog , member }) { - const limit = 2; + const limit = 5; const [ page , setPage ] = useState(1); const [ total , setTotal ] = useState(0); 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 && +
+ {setPage(p);}}/> +
+ } +
+
+ ) +} +export default PointsDoc; \ 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 8c4852411..32489ecf8 100644 --- a/src/forge/Information/api.js +++ b/src/forge/Information/api.js @@ -552,7 +552,7 @@ export function getProjectListByScore(id,params) { }) } -// 专区获取我的积分申请 +// 专区获取我的置顶文章 export function getMyTopArticle(id){ return fetch({ url:`/zone/points/account/article/top/${id}`, @@ -560,6 +560,14 @@ export function getMyTopArticle(id){ }) } +// 专区获取我的置顶项目 +export function getMyTopProject(id){ + return fetch({ + url:`/zone/points/account/project/top/${id}`, + method:"get", + }) +} + // 获取已开通企业的组织列表 export function getOrzCompanyList(){ return fetch({ @@ -679,3 +687,11 @@ export function doDocTop(data) { }); } +export function doProjectTop(data) { + return fetch({ + url: `/zone/points/account/project/top`, + method: 'post', + data + }); +} +