积分 项目置顶

积分 项目置顶
This commit is contained in:
amypeng 2026-06-08 15:38:28 +08:00
parent f4d04ec083
commit 36059bcc6d
4 changed files with 172 additions and 4 deletions

View File

@ -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);

View File

@ -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(
<Modal
closeIcon={<i className="iconfont icon-guanbi font-20 closeIconFont" onClick={onCancel}></i>}
className="doc_modal"
visible={visible}
title={<div className="title_box">
专区首页项目推荐
</div>}
closable={true}
width={800}
footer={
<div>
<Button onClick={onCancel}>取消</Button>
<Button className="btn_ok" style={{marginLeft:"20px"}} onClick={onOk}>确定</Button>
</div>
}
okText="确定"
cancelText="取消"
>
<div className="info">
<Spin spinning={isSpin}>
<div className="line topline">
<span className="content">新闻标题</span>
<span className="action">操作</span>
</div>
{currentRow && (
<div className="line dataline">
<span className="content">{currentRow.name}</span>
<span className="action">
<Button type="primary" shape="round" disabled style={{backgroundColor:'rgba(70, 106, 255, 0.43)', borderColor:'rgba(70, 106, 255, 0.43)', color:'#fff'}}>已置顶</Button>
</span>
</div>
)}
{list && list.map((item) => (
<div className="line dataline" key={item.id}>
<span className="content">{item.projectProperties?.name}</span>
<span className="action">
<Button type="primary" shape="round" disabled={!!currentRow} onClick={() => handlePin(item)}>置顶</Button>
</span>
</div>
))}
{ !isSpin && !currentId && (!list || !list.length) && <Nodata _html="暂无数据" />
}
</Spin>
{
total > limit &&
<div style={{padding:"20px",textAlign:"right"}}>
<Pagination showQuickJumper current={page} total={total} pageSize={limit} onChange={(p)=>{setPage(p);}}/>
</div>
}
</div>
</Modal>
)
}
export default PointsDoc;

View File

@ -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)}
/>
<PointsDoc visible={docVisible} member={memberInfo}
onCancel={()=>setDocVisible(false)} onSure={() => { setDocVisible(false); setSuccessVisible(true);getInfo();}}
onCancel={()=>setDocVisible(false)} onSure={() => { setDocVisible(false); setMsg('首页新闻推荐'); setSuccessVisible(true);getInfo();}}
/>
<PointsProject visible={projectVisible} member={memberInfo}
onCancel={()=>setProjectVisible(false)} onSure={() => { setProjectVisible(false); setMsg('首页项目推荐'); setSuccessVisible(true);getInfo();}}
/>
<ApplyAcitvity visible={acitvityVisible} member={memberInfo} zoneName={zoneInfo?.name}
onCancel={()=>setAcitvityVisible(false)} onSure={(msg) => { showNotification(msg); setAcitvityVisible(false); getInfo();}}
@ -397,7 +405,7 @@ function ZoneUser(props){
>
<div className="info">
<img src={SuccessImg} alt=""/>
<p>恭喜获得专区<label>首页新闻推荐</label></p>
<p>恭喜获得专区<label>{msg}</label></p>
<Button className="btn_ok" onClick={() => {setSuccessVisible(false)}}>确定({timeNum}s)</Button>
</div>
</Modal>

View File

@ -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
});
}