Compare commits

..

2 Commits

Author SHA1 Message Date
anph f8655d5826 update 2023-10-07 16:03:00 +08:00
anph 847cedd9bc add badge module 2023-09-29 14:11:06 +08:00
7 changed files with 5210 additions and 4743 deletions

9818
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -187,7 +187,7 @@
"eslintConfig": { "eslintConfig": {
"extends": "react-app" "extends": "react-app"
}, },
"proxy": "http://localhost:3001", "proxy": "http://localhost:3000",
"port": "3007", "port": "3007",
"devDependencies": { "devDependencies": {
"@babel/runtime": "7.0.0-beta.51", "@babel/runtime": "7.0.0-beta.51",

View File

@ -82,11 +82,23 @@ function CoderDepot(props){
const { bannerList } = props; const { bannerList } = props;
// const [ badges , setBadges] = useState(undefined);
// // axios
// function getBadgeData() {
// axios.get(`/${owner}/${projectsId}/badge.json`)
// .then(result => {
// if(result) {
// setBadges(result)
// }
// })
// }
// test data // test data
const badges = {badge:[{ "login": "many_stars", "image_url": "https://www.gitlink.org.cn/system/lets/letter_avatars/2/J/236_194_58/120.png", "description": "test description1"}, {"login": "many_stars", "image_url": "https://www.gitlink.org.cn/system/lets/letter_avatars/2/X/181_166_38/120.png", "description": "test description2"}], total_count: 3} const badges = {badge:[{ "login": "many_stars", "image_url": "https://www.gitlink.org.cn/system/lets/letter_avatars/2/J/236_194_58/120.png", "description": "test description1"}, {"login": "many_stars", "image_url": "https://www.gitlink.org.cn/system/lets/letter_avatars/2/X/181_166_38/120.png", "description": "test description2"}], total_count: 3}
console.log(badges.badge) console.log(badges.badge)
console.log(badges.total_count) console.log(badges.total_count)
useEffect(()=>{ useEffect(()=>{
if(bannerList && bannerList.length>0){ if(bannerList && bannerList.length>0){
let a = bannerList.filter(i=>i.menu_name === "pulls"); let a = bannerList.filter(i=>i.menu_name === "pulls");
@ -353,7 +365,6 @@ function CoderDepot(props){
const fileOperate = type === "dir" && projectDetail && projectDetail.type !== 2 && ((projectDetail.permission && projectDetail.permission !=="Reporter") || (current_user && current_user.admin)); const fileOperate = type === "dir" && projectDetail && projectDetail.type !== 2 && ((projectDetail.permission && projectDetail.permission !=="Reporter") || (current_user && current_user.admin));
return( return(
<WhiteBack> <WhiteBack>
<UpdateDescModal desc={desc} website={website} lesson_url={lesson_url} visible={openModal} onCancel={()=>setOpenModal(false)} onOk={okUpdate}/> <UpdateDescModal desc={desc} website={website} lesson_url={lesson_url} visible={openModal} onCancel={()=>setOpenModal(false)} onOk={okUpdate}/>
<Spin spinning={isSpin}> <Spin spinning={isSpin}>
@ -378,7 +389,6 @@ function CoderDepot(props){
} }
<div style={{minHeight:"500px"}}> <div style={{minHeight:"500px"}}>
{ {
projectDetail && projectDetail &&
<Box className="Panels"> <Box className="Panels">
<LongWidth> <LongWidth>
@ -559,19 +569,11 @@ function CoderDepot(props){
<Invite code={inviteCode}/> <Invite code={inviteCode}/>
</div> </div>
} }
{/*{*/}
{/* inviteCode &&*/}
{/* <div>*/}
{/* <Badge code={inviteCode}/>*/}
{/* </div>*/}
{/*}*/}
{/* 徽章 */}
{ {
badges && badges.total_count >0 && badges && badges.total_count >0 &&
<Badge badges={badges} owner={owner} /> <Badge badges={badges} owner={owner} />
} }
{ {
lesson_url && lesson_url &&
<div> <div>

View File

@ -200,26 +200,6 @@
} }
} }
} }
.attrBadge{
padding-top: 12px;
display: flex;
flex-wrap: wrap;
padding-bottom: 2px;
a{
margin: 0px 17px 10px 0px;
img{
border-radius: 50%;
width: 40px;
height: 40px;
}
&:nth-child(5n){
margin-right: 0px;
}
}
}
.progress{ .progress{
display: flex; display: flex;
border-radius: 2px; border-radius: 2px;
@ -529,3 +509,21 @@
} }
} }
} }
.attrBadge{
padding-top: 12px;
display: flex;
flex-wrap: wrap;
padding-bottom: 2px;
a{
margin: 0px 17px 10px 0px;
img{
border-radius: 50%;
width: 40px;
height: 40px;
}
&:nth-child(5n){
margin-right: 0px;
}
}
}

View File

@ -3,7 +3,7 @@ import { AlignCenter , FlexAJ } from '/home/gitlink/forgeplus/public/react/forg
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { Popover , Spin , Button } from 'antd'; import { Popover , Spin , Button } from 'antd';
import { getImageUrl } from 'educoder'; import { getImageUrl } from 'educoder';
import '/home/gitlink/forgeplus/public/react/forgeplus-react/src/forge/Component/Component.scss'; import '../../Component/Component.scss';

View File

@ -260,25 +260,6 @@ ul.ant-menu.menuStyle{
} }
.attrBadge{
padding-top: 12px;
display: flex;
flex-wrap: wrap;
padding-bottom: 2px;
a{
margin: 0px 17px 10px 0px;
img{
border-radius: 50%;
width: 40px;
height: 40px;
}
&:nth-child(5n){
margin-right: 0px;
}
}
}
.infoCount{ .infoCount{
display: inline-block; display: inline-block;
width: 24px; width: 24px;
@ -291,7 +272,3 @@ ul.ant-menu.menuStyle{
margin-left: 6px; margin-left: 6px;
font-size: 12px; font-size: 12px;
} }

View File

@ -1,6 +1,6 @@
import React, { Component } from "react"; import React, { Component } from "react";
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import { Button, Spin , Menu, Popover } from "antd"; import { Button, Spin , Menu } from "antd";
import FocusButton from "../UsersList/focus_button"; import FocusButton from "../UsersList/focus_button";
import axios from "axios"; import axios from "axios";
@ -15,6 +15,17 @@ import Loadable from "react-loadable";
import Loading from "../../Loading"; import Loading from "../../Loading";
import Badge from "../Main/sub/Badge"; import Badge from "../Main/sub/Badge";
//const [ badges , setBadges] = useState(undefined);
// 按照后端返回的数据格式创建的临时数据 后续改为axios
// function getBadgeData() {
// axios.get(`/${username}/statistics/badge.json`)
// .then(result => {
// if(result) {
// setBadges(result)
// }
// })
// }
//test data //test data
const badges = {badge:[{ "login": "many_stars", "image_url": "https://testforgeplus.trustie.net//system/lets/letter_avatars/2/G/178_217_57/120.png", "description": "test description1"}, {"login": "many_stars", "image_url": "https://testforgeplus.trustie.net//images/avatars/User/36480?t=1686645429", "description": "test description2"}], total_count: 3} const badges = {badge:[{ "login": "many_stars", "image_url": "https://testforgeplus.trustie.net//system/lets/letter_avatars/2/G/178_217_57/120.png", "description": "test description1"}, {"login": "many_stars", "image_url": "https://testforgeplus.trustie.net//images/avatars/User/36480?t=1686645429", "description": "test description2"}], total_count: 3}
@ -74,7 +85,6 @@ class Infos extends Component {
}; };
} }
renderPath=(pathname)=>{ renderPath=(pathname)=>{
const { username } = this.props.match.params; const { username } = this.props.match.params;
if(pathname === `/${username}`){ if(pathname === `/${username}`){
@ -135,9 +145,7 @@ class Infos extends Component {
this.setState({ this.setState({
user: result.data, user: result.data,
isSpin: false, isSpin: false,
undo_events:e, undo_events:e
//测试数据
badges : {badge:[1, 2, 3], total_count: 3}
}); });
}) })
.catch((error) => { .catch((error) => {
@ -201,7 +209,7 @@ class Infos extends Component {
render() { render() {
const { current_user } = this.props; const { current_user } = this.props;
const { username } = this.props.match.params; const { username } = this.props.match.params;
const { user, isSpin, route_type , undo_events , menuKey} = this.state; const { user, isSpin, route_type , undo_events , menuKey } = this.state;
return ( return (
<div className="newMain clearfix"> <div className="newMain clearfix">
<Spin spinning={isSpin}> <Spin spinning={isSpin}>
@ -282,34 +290,12 @@ class Infos extends Component {
</div> </div>
:"" :""
} }
</div> </div>
{/* 徽章 */}
{ {
badges && badges.total_count >0 && badges && badges.total_count >0 &&
<Badge badges={badges} /> <Badge badges={badges} />
} }
{/*{*/}
{/* badges && badges.total_count >0 &&*/}
{/* <div className="list-l-Menu text-center">*/}
{/* {*/}
{/* badges.total_count > 0 ? owner={owner} projectsId={projectsId} */}
{/* badges.badge.map((item,key)=>{*/}
{/* return(*/}
{/* <Popover content={menu} visible={item.visible} overlayClassName="menuPanels" placement="top">*/}
{/* <div>*/}
{/* <span>{item}</span>*/}
{/* <img src={getImageUrl(`/${item.image_url}`)} />*/}
{/* </div>*/}
{/* </Popover>*/}
{/* )*/}
{/* })*/}
{/* :""*/}
{/* }*/}
{/* </div>*/}
{/*}*/}
</div> </div>
</div> </div>