From 758600e4d008330d3774576d38cdc982fe301223 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Fri, 3 Dec 2021 10:47:47 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E6=90=9C=E7=B4=A2=E9=A1=B5=E7=BF=BB?= =?UTF-8?q?=E9=A1=B5=E8=B7=9D=E7=A6=BB=E5=BA=95=E9=83=A8=E7=9A=84=E8=B7=9D?= =?UTF-8?q?=E7=A6=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Head/Header.js | 78 ------------------------------------ src/modules/search/index.jsx | 13 +++--- 2 files changed, 6 insertions(+), 85 deletions(-) diff --git a/src/forge/Head/Header.js b/src/forge/Head/Header.js index 4eb52b00..28b20640 100644 --- a/src/forge/Head/Header.js +++ b/src/forge/Head/Header.js @@ -17,7 +17,6 @@ import './header.scss'; import NoticeContent from './NoticeContent'; import MainLogo from './img/logo.png'; // TODO 这部分脚本从公共脚本中直接调用 -let old_url; window._header_componentHandler = null; // 非trustie链接则新开页跳转 @@ -279,82 +278,6 @@ class NewHeader extends Component { settings, visible, } = this.state; - /*用户名称 用户头像url*/ - // let activeIndex = false; - // let activeForums = false; - // let activeShixuns = false; - // let activePaths = false; - // let coursestype = false; - // let activePackages = false; - // let activeMoopCases = false; - // let activeCompetitions = false; - - // if (match.path === '/forums') { - // activeForums = true; - // } else if (match.path.startsWith('/shixuns')) { - // activeShixuns = true; - // } else if (match.path.startsWith('/paths')) { - // activePaths = true; - // } else if (match.path.startsWith('/courses')) { - // coursestype = true; - // } else if (match.path.startsWith('/crowdsourcing')) { - // activePackages = true; - // } else if (match.path.startsWith('/moop_cases')) { - // activeMoopCases = true; - // } else if (match.path.startsWith('/competitions')) { - // activeCompetitions = true; - // } else { - // activeIndex = true; - // } - - // let headtypes = '/'; - // if (settings) { - // if (settings.navbar) { - // if (settings.navbar.length > 0) { - // if (match.path === '/') { - // if (headtypesonClickbool === false) { - // headtypes = undefined; - // } else { - // headtypes = headtypess; - // } - // } else { - // for (var i = 0; i < settings.navbar.length; i++) { - // if (match.path === settings.navbar[i].link) { - // headtypes = settings.navbar[i].link; - // break; - // } - // } - // } - // } - // } - // } - // let shixuntype = false; - // let pathstype = false; - // let coursestypes = false; - // if (this.props && this.props.mygetHelmetapi != null) { - // let shixun = "/shixuns"; - // let paths = "/paths"; - // let courses = "/courses"; - // this.props.mygetHelmetapi && this.props.mygetHelmetapi.navbar && this.props.mygetHelmetapi.navbar.map((item, key) => { - // var reg = RegExp(item.link); - // if (shixun.match(reg)) { - // if (item.hidden === true) { - // shixuntype = true - // } - // } - // if (paths.match(reg)) { - // if (item.hidden === true) { - // pathstype = true - // } - // } - // if (courses.match(reg)) { - // if (item.hidden === true) { - // coursestypes = true - // } - // } - // }) - // } - let search_url = settings && settings.common && settings.common.search; return (
@@ -447,7 +370,6 @@ class NewHeader extends Component { > {current_user && - {/* */} } diff --git a/src/modules/search/index.jsx b/src/modules/search/index.jsx index 3afd1ae5..09bdb458 100644 --- a/src/modules/search/index.jsx +++ b/src/modules/search/index.jsx @@ -139,7 +139,6 @@ const GlobalSearch = ({ location, showNotification, history }) => {
-
@@ -150,13 +149,13 @@ const GlobalSearch = ({ location, showNotification, history }) => {
{ dataList.length ? - size} onChange={(page) => { setPage(page) }} current={page} total={total} showTotal={total => `共 ${total} 条`} - /> + /> : }
@@ -170,13 +169,13 @@ const GlobalSearch = ({ location, showNotification, history }) => { { dataList.length ? - size} onChange={(page) => { setPage(page) }} current={page} total={total} showTotal={total => `共 ${total} 条`} - /> : + /> : } @@ -227,13 +226,13 @@ const GlobalSearch = ({ location, showNotification, history }) => { { dataList.length ? - size} onChange={(page) => { setPage(page) }} current={page} total={total} showTotal={total => `共 ${total} 条`} - /> : + /> : }
From 255ae1101215d560526477f9a5322836def61ce0 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Tue, 7 Dec 2021 16:03:37 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E9=A6=96=E9=A1=B5-educod?= =?UTF-8?q?er=E5=B9=B3=E5=8F=B0=E5=A4=B4=E5=83=8F=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Main/projecthome/Index.jsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/forge/Main/projecthome/Index.jsx b/src/forge/Main/projecthome/Index.jsx index 9045a274..3d214010 100644 --- a/src/forge/Main/projecthome/Index.jsx +++ b/src/forge/Main/projecthome/Index.jsx @@ -85,7 +85,14 @@ function Index() { projectsList.map((i,k)=>{ return(
  • - + { + i.platform === "educoder" ? + + + + : + + }
    {i.author && i.author.name}/{i.name} From 4270d1d8eb2adceba04f7cf7c8b926216d594a02 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Tue, 7 Dec 2021 17:28:25 +0800 Subject: [PATCH 3/6] =?UTF-8?q?@=E6=88=91=E5=88=97=E8=A1=A8=E5=A4=B4?= =?UTF-8?q?=E5=83=8F=E9=93=BE=E6=8E=A5=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/SecuritySetting/notice/myNotice/Index.jsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/forge/SecuritySetting/notice/myNotice/Index.jsx b/src/forge/SecuritySetting/notice/myNotice/Index.jsx index 3d495722..1a8ddf9d 100644 --- a/src/forge/SecuritySetting/notice/myNotice/Index.jsx +++ b/src/forge/SecuritySetting/notice/myNotice/Index.jsx @@ -1,12 +1,13 @@ import React, { useState, useEffect } from 'react'; -import { Link } from 'react-router-dom'; import axios from 'axios'; -import { Badge, Button, Checkbox, Menu, Pagination } from 'antd'; +import { Badge, Checkbox, Menu, Pagination } from 'antd'; import DelModal from '../../../Component/ModalFun'; import NoneData from '../../../Nodata.js'; import { noticeSourceType } from '../../../common/static'; import './Index.scss'; -import '../manager/Index.scss' +import '../manager/Index.scss'; +import { getImageUrl } from 'educoder'; + function MyNotice(props) { let { current_user, resetUserInfo, location, mygetHelmetapi, history}= props; @@ -227,7 +228,7 @@ function MyNotice(props) {
    - {item.sender && {window.open(`/${item.sender && item.sender.login}`);}}/>} + {item.sender && {window.open(`/${item.sender && item.sender.login}`);}}/>}
    {turnToMess(item)}}> {item.status === 1 ? : } {item.sender && } From 5ee3519c2175755ac89655ac350220ca85ee5d01 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Wed, 8 Dec 2021 10:11:13 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E9=A6=96=E9=A1=B5?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=90=9C=E7=B4=A2=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Main/projecthome/Index.jsx | 31 ++++++++++++++++++++++++--- src/forge/Main/projecthome/Index.scss | 10 ++++++++- 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/src/forge/Main/projecthome/Index.jsx b/src/forge/Main/projecthome/Index.jsx index 3d214010..3b56b455 100644 --- a/src/forge/Main/projecthome/Index.jsx +++ b/src/forge/Main/projecthome/Index.jsx @@ -4,18 +4,21 @@ import SubBanner from './SubBanner'; import SubUnitBanner from './SubUnitBanner'; import Icon from '../img/index/icon.png'; import { Link } from 'react-router-dom'; -import { Spin } from 'antd'; +import { Spin , Input } from 'antd'; import SubList from './SubList'; import more from '../img/index/more.png'; import axios from 'axios'; import { getImageUrl } from 'educoder'; import Nodata from '../../Nodata'; +const { Search } = Input; + const LIMIT = 20; function Index() { const [ cateList , setCateList ] = useState(undefined); const [ projectsList , setProjectsList ] = useState(undefined); + const [ search , setSearch ] = useState(undefined); const [ cateID, setCateID ] = useState(undefined); const [ isSpin, setIsSpin ] = useState(true); @@ -37,13 +40,14 @@ function Index() { }).catch(error=>{}) } - function getProject() { + function getProject(searchValue) { const url = `/projects.json`; axios.get(url,{ params:{ pinned:"d", category_id:cateID, - limit:LIMIT + limit:LIMIT, + search:searchValue } }).then(result=>{ if(result && result.data){ @@ -52,6 +56,15 @@ function Index() { } }).catch(error=>{}) } + + function changeSearchValue(e){ + setSearch(e.target.value); + } + + function searchFun(value){ + setIsSpin(true); + getProject(value); + } return(
    @@ -74,6 +87,18 @@ function Index() {
    开源项目 + + 更多
    diff --git a/src/forge/Main/projecthome/Index.scss b/src/forge/Main/projecthome/Index.scss index 80742234..fd4b604e 100644 --- a/src/forge/Main/projecthome/Index.scss +++ b/src/forge/Main/projecthome/Index.scss @@ -350,7 +350,15 @@ justify-content: space-between; border-bottom: 1px solid rgba(153, 153, 153, 0.16); padding:0px 20px; - span{ + .ant-btn-primary{ + background-color: #466AFF; + border-color: #466AFF; + &:hover,&:active{ + background-color: rgba(70,106,255,0.8); + border-color: rgba(70,106,255,0.8); + } + } + &>span{ font-size: 18px; font-weight: 500; color: #000000; From 232e09c04fce735d3c32c761c5290e32e9de1da0 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Wed, 8 Dec 2021 15:20:55 +0800 Subject: [PATCH 5/6] clear --- src/App.js | 10 ++-------- src/forge/Main/sub/ReadmeCatelogue.jsx | 3 +-- src/forge/Main/sub/sub.scss | 9 ++++++++- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/App.js b/src/App.js index ed1db564..91dbfe3f 100644 --- a/src/App.js +++ b/src/App.js @@ -3,7 +3,6 @@ import './App.css'; import { ConfigProvider } from 'antd' import zhCN from 'antd/lib/locale-provider/zh_CN'; import { - // BrowserRouter as Router, Route, Switch } from 'react-router-dom'; @@ -79,10 +78,7 @@ const OrganizeIndex = Loadable({ loader: () => import('./forge/Team/Index'), loading: Loading, }) -const EducoderLogin = Loadable({ - loader: () => import('./modules/login/EducoderLogin'), - loading: Loading, -}) + const Search = Loadable({ loader: () => import('./modules/search/'), loading: Loading, @@ -278,8 +274,7 @@ class App extends Component { }; render() { - const { mygetHelmetapi, pathType} = this.state; - let personal = mygetHelmetapi && mygetHelmetapi.personal; + const { pathType } = this.state; return ( @@ -426,7 +421,6 @@ class App extends Component { - {/* */} diff --git a/src/forge/Main/sub/ReadmeCatelogue.jsx b/src/forge/Main/sub/ReadmeCatelogue.jsx index 754f3cc2..a913b152 100644 --- a/src/forge/Main/sub/ReadmeCatelogue.jsx +++ b/src/forge/Main/sub/ReadmeCatelogue.jsx @@ -1,7 +1,6 @@ import React , { useState } from 'react'; import { Anchor , Input } from 'antd'; import './sub.scss'; -import { useEffect } from 'react'; const { Link } = Anchor; @@ -40,7 +39,7 @@ function ReadmeCatelogue({ menuList , hash }) { { menu.map((item,key)=>{ return( -
    +
    ) diff --git a/src/forge/Main/sub/sub.scss b/src/forge/Main/sub/sub.scss index 7716f0c5..f284edbb 100644 --- a/src/forge/Main/sub/sub.scss +++ b/src/forge/Main/sub/sub.scss @@ -34,10 +34,17 @@ padding:15px; border-bottom: 1px solid #eee; } + .ant-anchor{ + padding-left: 0px!important; + .ant-anchor-ink::before{ + width: 0px; + } + } .ant-anchor-wrapper{ margin-left: 0px; - padding:5px 15px; + padding:5px 0px; max-height: 255px!important; + padding-left: 0px!important; .items{ border-radius: 4px; margin-bottom: 5px; From 2ffa835b841c3d02468121b6a6edc104cf919be2 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Thu, 9 Dec 2021 09:48:47 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E5=BA=93-=E8=B4=A1?= =?UTF-8?q?=E7=8C=AE=E8=80=85=E5=92=8C=E8=AF=AD=E8=A8=80=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E5=8D=95=E7=8B=AC=E6=8E=A5=E5=8F=A3=EF=BC=8Cdetail.json?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E4=B8=8D=E8=BF=94=E5=9B=9E=E8=BF=99=E4=B8=A4?= =?UTF-8?q?=E4=B8=AA=E6=95=B0=E7=BB=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Branch/CloneAddress.js | 8 ++--- src/forge/Component/Contributors.jsx | 28 +++++++++------- src/forge/Component/LanguagePower.jsx | 46 ++++++++++++++++++++------- src/forge/Main/CoderDepot.jsx | 18 +++-------- src/forge/Main/CoderRootCommit.js | 20 ++++++++++-- src/forge/css/index.scss | 2 +- 6 files changed, 79 insertions(+), 43 deletions(-) diff --git a/src/forge/Branch/CloneAddress.js b/src/forge/Branch/CloneAddress.js index c2e6dd74..b3e31ccc 100644 --- a/src/forge/Branch/CloneAddress.js +++ b/src/forge/Branch/CloneAddress.js @@ -7,10 +7,10 @@ function CloneAddress({http_url , ssh_url , zip_url , tar_url}) { const [ key , setKey ] = useState("HTTP"); return (
    -
    +
    {setKey(e.key)}}>HTTP - {setKey(e.key)}}>SSH + {ssh_url && {setKey(e.key)}}>SSH}
    @@ -18,8 +18,8 @@ function CloneAddress({http_url , ssh_url , zip_url , tar_url}) {
    - 下载 ZIP - 下载 TAR.GZ + {zip_url && 下载 ZIP} + {tar_url && 下载 TAR.GZ}
    ) diff --git a/src/forge/Component/Contributors.jsx b/src/forge/Component/Contributors.jsx index e88acc05..f6dade6a 100644 --- a/src/forge/Component/Contributors.jsx +++ b/src/forge/Component/Contributors.jsx @@ -7,7 +7,7 @@ import './Component.scss'; import { getUser } from '../GetData/getData'; import axios from 'axios'; -function Contributors({contributors,owner,projectsId,currentLogin}){ +function Contributors({owner,projectsId,currentLogin}){ const [ menuList ,setMenuList ]= useState([]); const [ list , setList ]= useState(undefined); const [ total , setTotal ]= useState(0); @@ -16,11 +16,18 @@ function Contributors({contributors,owner,projectsId,currentLogin}){ const [ isSpin , setIsSpin ] = useState(false); useEffect(()=>{ - if(contributors && contributors.total_count>0){ - setTotal(contributors.total_count); - setList(contributors.list); - } - },[contributors]) + getData(); + },[]) + + function getData(){ + const url = `/${owner}/${projectsId}/contributors.json`; + axios.get(url).then(result=>{ + if(result){ + setTotal(result.data.total_count); + setList(result.data.list); + } + }).catch(error=>{}) + } useEffect(()=>{ if(login){ @@ -148,15 +155,15 @@ function Contributors({contributors,owner,projectsId,currentLogin}){ } return( + total > 0 ?
    贡献者 - { contributors && contributors.total_count > 0 && {contributors.total_count}} + { total > 0 && {total}}
    setVisibleFunc(false)}> { - total > 0 ? - list.map((item,key)=>{ + list && list.length>0 && list.map((item,key)=>{ return( @@ -165,10 +172,9 @@ function Contributors({contributors,owner,projectsId,currentLogin}){ ) }) - :"" }
    -
    +
    :"" ) } export default Contributors; \ No newline at end of file diff --git a/src/forge/Component/LanguagePower.jsx b/src/forge/Component/LanguagePower.jsx index 8d3e361b..b2fb174b 100644 --- a/src/forge/Component/LanguagePower.jsx +++ b/src/forge/Component/LanguagePower.jsx @@ -1,18 +1,41 @@ import React, { useEffect, useState } from 'react'; import { FlexAJ } from '../Component/layout'; +import { Divider } from 'antd'; +import axios from 'axios'; -function LanguagePower({languages}){ +function LanguagePower({owner,projectsId}){ const [ array , setArray ] = useState(undefined); + useEffect(()=>{ - if(languages){ - let arr = []; - Object.keys(languages).map((item,key)=>{ - arr.push({name:item,percent:languages[item],color:getColor()}); - }) - setArray(arr); - } - },[languages]) + getData(); + },[]) + + function getData(){ + const url = `/${owner}/${projectsId}/languages.json`; + axios.get(url).then(result=>{ + if(result){ + let languages = result.data; + if(languages){ + let arr = []; + Object.keys(languages).map((item,key)=>{ + arr.push({name:item,percent:languages[item],color:getColor()}); + }) + setArray(arr); + } + } + }).catch(error=>{}) + } + + // useEffect(()=>{ + // if(languages){ + // let arr = []; + // Object.keys(languages).map((item,key)=>{ + // arr.push({name:item,percent:languages[item],color:getColor()}); + // }) + // setArray(arr); + // } + // },[languages])  function getColor(){ let str = "#"; @@ -24,7 +47,9 @@ function LanguagePower({languages}){ return str; } return( + (array && array.length > 0) ?
    +

    开发语言

    { @@ -47,8 +72,7 @@ function LanguagePower({languages}){ } } - -
    +
    :"" ) } export default LanguagePower; \ No newline at end of file diff --git a/src/forge/Main/CoderDepot.jsx b/src/forge/Main/CoderDepot.jsx index 11521dc0..76bce5c7 100644 --- a/src/forge/Main/CoderDepot.jsx +++ b/src/forge/Main/CoderDepot.jsx @@ -319,9 +319,9 @@ function CoderDepot(props){ const downloadMenu = ( ) // 确认修改简介、website、实践课程链接 @@ -582,17 +582,9 @@ function CoderDepot(props){ } {/* 贡献者 */} - { - projectDetail && projectDetail.contributors && projectDetail.contributors.total_count >0 && - - } + {/* 语言 */} - { projectDetail && projectDetail.languages && - - - - - } + } diff --git a/src/forge/Main/CoderRootCommit.js b/src/forge/Main/CoderRootCommit.js index b542c390..99637c91 100644 --- a/src/forge/Main/CoderRootCommit.js +++ b/src/forge/Main/CoderRootCommit.js @@ -133,7 +133,7 @@ class CoderRootCommit extends Component{ render(){ const { commitDatas , dataCount , limit , page , isSpining , branchList } = this.state; - const { projectDetail, commit_class , defaultBranch } = this.props; + const { projectDetail, commit_class , defaultBranch , platform } = this.props; const { projectsId , owner , branchName } = this.props.match.params; let branch = returnbar(branchName || defaultBranch); return( @@ -159,7 +159,16 @@ class CoderRootCommit extends Component{
    -
    +
    + { + platform ? + + + + : + + } +

    sha - {truncateCommitId(`${item.sha}`)} + { + platform ? + {truncateCommitId(`${item.sha}`)} + : + {truncateCommitId(`${item.sha}`)} + } diff --git a/src/forge/css/index.scss b/src/forge/css/index.scss index 9ff62ada..ad1aad36 100644 --- a/src/forge/css/index.scss +++ b/src/forge/css/index.scss @@ -109,7 +109,7 @@ ul,ol,dl{ width: 49rem; overflow: hidden; white-space: normal; - &:hover{ + & a:hover{ text-decoration: underline; & .markdown-body{ color: #466AFF;