diff --git a/src/forge/Information/Pages/custom/vip.jsx b/src/forge/Information/Pages/custom/vip.jsx index b0b698791..3f358154c 100644 --- a/src/forge/Information/Pages/custom/vip.jsx +++ b/src/forge/Information/Pages/custom/vip.jsx @@ -5,7 +5,7 @@ import Nodata from '../../../Nodata'; import { Spin, Button, Icon } from 'antd'; import { tempConfig, tempEnum } from '../../tempInfo' import MemberApply from '../../Component/memberApply'; -import { getVIPLists, getAuditStatus, applyJoin } from '../../api'; +import { getVIPLists, getAuditStatus, applyJoin, getVIPTypeLists, getVIPListByTypeId } from '../../api'; import nodata from '../../img/nodata.png'; import MemberList from '../../Component/memberList'; import {getUniqueIdentifier,getUserName,getBrowserPlatform,getBrowserBrand} from '../../utils'; @@ -41,19 +41,117 @@ function CustomVip(props){ useEffect(()=>{ if(id){ - setIsSpin(true); getLists(); getMemberStatus(); } },[id]) function getLists(){ - getVIPLists(id).then(response=>{ - if(response && response.data){ - setVIPLists(response.data.rows); - setIsSpin(false); + setIsSpin(true); + getVIPTypeLists(id).then(res=>{ + const typeList = res.data.rows; + // 根据每个类型的memberCount来决定请求方式 + fetchMembersByTypes(typeList); + }).finally(() => { + setIsSpin(false); + }); + } + + // 根据类型列表获取成员数据 + function fetchMembersByTypes(typeList) { + if (!typeList || typeList.length === 0) { + return; + } + + // 限制并发请求数为5 + const CONCURRENCY_LIMIT = 5; + const results = new Array(typeList.length); + const totalTypes = typeList.length; + let completedCount = 0; + + async function fetchSingleType(type, index) { + const typeId = type.id; + const memberCount = type.memberCount || 0; + const typeName = type.typeName || type.name; + const typeIntroduction = type.typeIntroduction || type.introduction; + + let members; + if (memberCount > 500) { + members = await fetchMembersPaginatedSequential(typeId, memberCount, 500); + } else { + members = await fetchMembersOnce(typeId, memberCount); } - }).catch(error=>{setIsSpin(false);}) + + results[index] = { + id: typeId, + typeName: typeName, + typeIntroduction: typeIntroduction, + zoneMemberList: members || [] + }; + + completedCount++; + // 流式更新:每完成一个类型就更新状态 + setVIPLists([...results.filter(Boolean)]); + } + + // 分批并发执行 + async function executeInBatches() { + const promises = []; + for (let i = 0; i < typeList.length; i++) { + const type = typeList[i]; + promises.push(fetchSingleType(type, i)); + + // 达到并发限制时等待已完成 + if (promises.length >= CONCURRENCY_LIMIT) { + await Promise.all(promises); + promises.length = 0; + } + } + if (promises.length > 0) { + await Promise.all(promises); + } + } + + executeInBatches() + } + + // 分页请求:当memberCount > 200时(顺序执行,避免并发过高) + async function fetchMembersPaginatedSequential(typeId, memberCount, pageSize) { + const totalPages = Math.ceil(memberCount / pageSize); + const allMembers = []; + + for (let pageNum = 1; pageNum <= totalPages; pageNum++) { + try { + const response = await getVIPListByTypeId(id, { + memberTypeId: typeId, + pageNum, + pageSize + }); + if (response && response.data && response.data.rows) { + allMembers.push(...response.data.rows); + } + } catch (error) { + console.error(`分页请求失败: typeId=${typeId}, pageNum=${pageNum}`, error); + } + } + + return allMembers; + } + + // 一次请求:当memberCount <= 200时 + async function fetchMembersOnce(typeId, memberCount) { + return getVIPListByTypeId(id, { + memberTypeId: typeId, + pageNum: 1, + pageSize: memberCount + }).then(response => { + if (response && response.data && response.data.rows) { + return response.data.rows; + } + return []; + }).catch(() => { + return []; + }); } function getMemberStatus() { diff --git a/src/forge/Information/Pages/homepage/ccf/index.scss b/src/forge/Information/Pages/homepage/ccf/index.scss index 768620c63..45e9d8f21 100644 --- a/src/forge/Information/Pages/homepage/ccf/index.scss +++ b/src/forge/Information/Pages/homepage/ccf/index.scss @@ -326,9 +326,9 @@ border: 1px solid rgba(35, 93, 250, 0.13); transition: all 0.3s ease; - // &:hover { - // transform: translateY(-20px); - // } + &:hover { + transform: translateY(-20px); + } } .ccf-vip-avatar { @@ -351,6 +351,12 @@ color: #262626; margin-bottom: 12px; text-align: center; + em{ + font-style: normal; + color: #466aff; + background: #dee4ff; + padding: 0 2px; + } } .ccf-vip-tags { @@ -729,7 +735,7 @@ .ccf-rule-section { background-image: url('../image/ccf_bk14.png'); background-size: 100% 100%; - padding-bottom: 100px; + padding-bottom: 120px; .ccf-rule-cards-container { position: relative; diff --git a/src/forge/Information/Pages/homepage/ccf/intro.jsx b/src/forge/Information/Pages/homepage/ccf/intro.jsx index d61ff5f35..194073585 100644 --- a/src/forge/Information/Pages/homepage/ccf/intro.jsx +++ b/src/forge/Information/Pages/homepage/ccf/intro.jsx @@ -51,8 +51,8 @@ const ActivityItem = ({ id, keywords, name, summary }) => ( {moment(summary).format("YYYY")}
{moment(summary).format("MM/DD")} -
-
{name}
+
+
{name}
{keywords}
@@ -75,7 +75,7 @@ const CCFIntro = ({ zoneInfo, sectionList, role }) => { }, [sectionList]); useEffect(() => { - executiveCalendarId && getSubDocList(executiveCalendarId, { pageSize: 1000, pageNum: 1, auditStatus: 1 }).then(result => { + executiveCalendarId && getSubDocList(executiveCalendarId, { pageSize: 100, pageNum: 1, auditStatus: 1 }).then(result => { if (result && result.data.rows) { setDocList(result.data.rows); } diff --git a/src/forge/Information/Pages/homepage/ccf/project.jsx b/src/forge/Information/Pages/homepage/ccf/project.jsx index 0eeb21622..cf1835812 100644 --- a/src/forge/Information/Pages/homepage/ccf/project.jsx +++ b/src/forge/Information/Pages/homepage/ccf/project.jsx @@ -12,6 +12,10 @@ function project({ id }) { const [ typeList , setTypeList ] = useState([]); const {communityUserCount, projectCount} = statistics || {} + const handleLinkClick = () => { + window.scrollTo(0, 500); + }; + useEffect(()=>{ id && getZoneStatistics(id).then(result => { if (result && result.data) { @@ -52,7 +56,7 @@ function project({ id }) {
- {communityUserCount}+ + {+communityUserCount > 999 ? `999+` : communityUserCount} 贡献者
联结 CCF 会员,搭建全球开源协同创新实践平台
@@ -60,11 +64,11 @@ function project({ id }) {
- {typeList.length}+ + {typeList.length > 99 ? `99+` : typeList.length}
项目分类数
- {projectCount}+ + {+projectCount > 99 ? `99+` : projectCount}
代码库数
@@ -75,13 +79,13 @@ function project({ id }) {
捐赠开源项目库
覆盖AI、云原生、嵌入式等多领域优质开源项目,开放共享
- {typeId1 ? 立即查看 : 暂未开放} + {typeId1 ? { handleLinkClick(); }}>立即查看 : 暂未开放}
开源学习资源库
教程、文档、工具、案例合集,一站式开源学习平台
- {typeId2 ? 立即查看 : 暂未开放} + {typeId2 ? { handleLinkClick(); }}>立即查看 : 暂未开放}
diff --git a/src/forge/Information/Pages/homepage/ccf/registration.jsx b/src/forge/Information/Pages/homepage/ccf/registration.jsx index 06b4f310a..a09e7eabf 100644 --- a/src/forge/Information/Pages/homepage/ccf/registration.jsx +++ b/src/forge/Information/Pages/homepage/ccf/registration.jsx @@ -79,7 +79,7 @@ const Registration = ({ sectionList, autoPlay = true }) => {
{docList.map(item => { - return
+ return
})}
diff --git a/src/forge/Information/Pages/homepage/ccf/rule.jsx b/src/forge/Information/Pages/homepage/ccf/rule.jsx index 1958b3107..f6bd2e000 100644 --- a/src/forge/Information/Pages/homepage/ccf/rule.jsx +++ b/src/forge/Information/Pages/homepage/ccf/rule.jsx @@ -45,7 +45,7 @@ function Rule({ sectionList, history }) { }; }); // .concat(transformedCards) - setRuleCards(transformedCards.concat(transformedCards).concat(transformedCards).concat(transformedCards).concat(transformedCards).concat(transformedCards)); + setRuleCards(transformedCards); } }) }, [ruleTypeId]) @@ -106,10 +106,10 @@ function Rule({ sectionList, history }) { // 自动播放 useEffect(() => { - if (!isAutoPlaying || displayCards.length <= 5) return; + if (!isAutoPlaying || ruleCards.length <= 5) return; const interval = setInterval(nextCard, autoPlayInterval); return () => clearInterval(interval); - }, [isAutoPlaying, nextCard, displayCards.length]); + }, [isAutoPlaying, nextCard, ruleCards.length]); // 鼠标悬停时暂停自动播放 const handleMouseEnter = useCallback(() => { @@ -173,7 +173,7 @@ function Rule({ sectionList, history }) { {/* 导航控制 */} -
+ {ruleCards && ruleCards.length > 5 &&
-
+
} diff --git a/src/forge/Information/Pages/homepage/ccf/vip.jsx b/src/forge/Information/Pages/homepage/ccf/vip.jsx index a9912104c..fede58ecd 100644 --- a/src/forge/Information/Pages/homepage/ccf/vip.jsx +++ b/src/forge/Information/Pages/homepage/ccf/vip.jsx @@ -24,10 +24,11 @@ function Ccf_vip({id}) { setVIPLists(result.data.rows.map(item=>{ const {username, imageUrl, memberLevelName, memberTypeName} = item.extendData return{ - name: username, + name: item.title, imageUrl: imageUrl, memberLevel: memberLevelName, - typeName: memberTypeName + typeName: memberTypeName, + login: username } })); } @@ -40,7 +41,7 @@ function Ccf_vip({id}) { const list = response.data.rows && response.data.rows.reduce((acc, item) => { const members = (item.zoneMemberList || []).map(member => ({ ...member, - typeName: item.typeName + typeName: item.typeName, })); return acc.concat(members); }, []); @@ -76,16 +77,18 @@ function Ccf_vip({id}) { {vipLists && vipLists.length > 0 ? (
{vipLists.map((member, index) => ( -
-
- {member.name} + +
+
+ {member.name} +
+
+
+ {member.typeName} + {member.memberLevel} +
-
{member.name}
-
- {member.typeName} - {member.memberLevel} -
-
+
))}
) : ( diff --git a/src/forge/Information/Pages/newsCreate.jsx b/src/forge/Information/Pages/newsCreate.jsx index 56a1cbabb..9f931f418 100644 --- a/src/forge/Information/Pages/newsCreate.jsx +++ b/src/forge/Information/Pages/newsCreate.jsx @@ -1,5 +1,5 @@ import React,{ useState , useEffect, useMemo } from 'react'; -import { Breadcrumb, Button, Form, Input, Select } from 'antd'; +import { Breadcrumb, Button,Form, Input, Select, message } from 'antd'; import { getZoneUrl } from 'educoder'; import MdEditor from '../../../modules/tpm/challengesnew/tpm-md-editor'; import RichEditor from '../../Component/RichEditor'; diff --git a/src/forge/Information/Pages/projectSource.jsx b/src/forge/Information/Pages/projectSource.jsx index c10b57bf2..22faa3ca5 100644 --- a/src/forge/Information/Pages/projectSource.jsx +++ b/src/forge/Information/Pages/projectSource.jsx @@ -38,7 +38,6 @@ function ProjectSource(props){ let platform = getBrowserPlatform() let browser = getBrowserBrand() let username = getUserName(props.current_user); - getMemberStatus(); // if(!username) uuid = getUniqueIdentifier() let remark = ` 操作系统:${platform};浏览器:${browser};` setZoneVisits({url,username,uuid,remark}) @@ -58,6 +57,7 @@ function ProjectSource(props){ useEffect(()=>{ if(id){ getTypeList(); + getMemberStatus(); } },[id]) diff --git a/src/forge/Information/api.js b/src/forge/Information/api.js index 89ddf1b57..58156993c 100644 --- a/src/forge/Information/api.js +++ b/src/forge/Information/api.js @@ -210,6 +210,22 @@ export function getVIPLists(id, params){ }) } +export function getVIPListByTypeId(id, params){ + return fetch({ + url:`/zone/open/${id}/member/list`, + method: 'get', + params + }) +} + +export function getVIPTypeLists(id, params){ + return fetch({ + url:`/zone/open/${id}/memberType/list`, + method: 'get', + params + }) +} + /**会员申请状态 */ export function getAuditStatus(id){ return fetch({ diff --git a/src/forge/Information/fetch.js b/src/forge/Information/fetch.js index 86908a7bc..d26f59681 100644 --- a/src/forge/Information/fetch.js +++ b/src/forge/Information/fetch.js @@ -15,7 +15,7 @@ function beforeFetch(actionUrl){ service.interceptors.request.use(request => { let deptId = sessionStorage.getItem('deptId'); - request.headers.Authorization = 'ad9cf7c24c0ef721d199f889e9fb2671d76b7655' + // request.headers.Authorization = '2d5f2f54b2d2f9a0fda39ae7ecacc59795058ada' if (deptId) { // 用于权限区分 request.headers['Dept-Id'] = deptId diff --git a/src/forge/Information/index.scss b/src/forge/Information/index.scss index 4f007ca7b..3c1b6462a 100644 --- a/src/forge/Information/index.scss +++ b/src/forge/Information/index.scss @@ -386,9 +386,12 @@ font-size:86px; color:#ffffff; font-family: "sanjikai"; + padding-bottom: 18px; + margin-top: 90px; } .sub_t{ font-size: 18px; + padding-left: 10px; } .bannerMenus{ backdrop-filter:blur(44px);