parent
36059bcc6d
commit
57e07818d8
|
|
@ -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){
|
||||
|
|
|
|||
|
|
@ -695,3 +695,12 @@ export function doProjectTop(data) {
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
// 获取文章列表
|
||||
export function getPointsDocList(id){
|
||||
return fetch({
|
||||
url:`/zone/zoneFront/getTopDoc/${id}`,
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue