首页新闻 积分置顶新闻

首页新闻 积分置顶新闻
This commit is contained in:
amypeng 2026-06-08 16:44:00 +08:00
parent 36059bcc6d
commit 57e07818d8
2 changed files with 41 additions and 6 deletions

View File

@ -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)
})
// 23
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){

View File

@ -695,3 +695,12 @@ export function doProjectTop(data) {
});
}
// 获取文章列表
export function getPointsDocList(id){
return fetch({
url:`/zone/zoneFront/getTopDoc/${id}`,
method: 'get',
})
}