Merge branch 'gitlink_server' of https://git.trustie.net/Gitlink/forgeplus-react into gitlink_server

This commit is contained in:
hucong 2021-12-09 10:15:35 +08:00
commit 6904116a3a
14 changed files with 146 additions and 148 deletions

View File

@ -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 (
<Provider store={store}>
<ConfigProvider locale={zhCN}>
@ -426,7 +421,6 @@ class App extends Component {
<Route component={Shixunnopage} />
</Switch>
{/* </Router> */}
</MuiThemeProvider>
</ConfigProvider>
</Provider>

View File

@ -7,10 +7,10 @@ function CloneAddress({http_url , ssh_url , zip_url , tar_url}) {
const [ key , setKey ] = useState("HTTP");
return (
<div className="downMenu">
<div style={{borderBottom:"1px solid #eee"}}>
<div>
<Menu className="urlMenu" selectedKeys={[key]} mode={"horizontal"}>
<Menu.Item key="HTTP" onClick={(e)=>{setKey(e.key)}}>HTTP</Menu.Item>
<Menu.Item key="SSH" onClick={(e)=>{setKey(e.key)}}>SSH</Menu.Item>
{ssh_url && <Menu.Item key="SSH" onClick={(e)=>{setKey(e.key)}}>SSH</Menu.Item>}
</Menu>
<div className="gitAddressClone">
<input type="text" id="copy_rep_content" value={key==="HTTP" ? http_url:ssh_url} />
@ -18,8 +18,8 @@ function CloneAddress({http_url , ssh_url , zip_url , tar_url}) {
</div>
</div>
<Menu className="edu-txt-center">
<Menu.Item><a href={zip_url}>下载 ZIP</a></Menu.Item>
<Menu.Item><a href={tar_url}>下载 TAR.GZ</a></Menu.Item>
{zip_url && <Menu.Item style={{borderTop:"1px solid #eee"}}><a href={zip_url}>下载 ZIP</a></Menu.Item>}
{tar_url && <Menu.Item><a href={tar_url}>下载 TAR.GZ</a></Menu.Item>}
</Menu>
</div>
)

View File

@ -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);
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=>{})
}
},[contributors])
useEffect(()=>{
if(login){
@ -148,15 +155,15 @@ function Contributors({contributors,owner,projectsId,currentLogin}){
}
return(
total > 0 ?
<div className="halfs">
<Link to={`/${owner}/${projectsId}/contribute`} className="font-16 color-ooo hoverA">
<span>贡献者</span>
{ contributors && contributors.total_count > 0 && <span className="infoCount">{contributors.total_count}</span>}
{ total > 0 && <span className="infoCount">{total}</span>}
</Link>
<div className="attrPerson" onMouseLeave={()=>setVisibleFunc(false)}>
{
total > 0 ?
list.map((item,key)=>{
list && list.length>0 && list.map((item,key)=>{
return(
<Popover content={menu} visible={item.visible} overlayClassName="menuPanels" placement="top">
<Link key={key} to={`/${item.login}`}>
@ -165,10 +172,9 @@ function Contributors({contributors,owner,projectsId,currentLogin}){
</Popover>
)
})
:""
}
</div>
</div>
</div>:""
)
}
export default Contributors;

View File

@ -1,10 +1,21 @@
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(()=>{
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)=>{
@ -12,7 +23,19 @@ function LanguagePower({languages}){
})
setArray(arr);
}
},[languages])
}
}).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) ?
<div>
<Divider />
<p className="font-16 color-ooo aboutSubTitle">开发语言</p>
<div className="progress">
{
@ -47,8 +72,7 @@ function LanguagePower({languages}){
}
</FlexAJ>
}
</div>
</div>:""
)
}
export default LanguagePower;

View File

@ -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 (
<div className={publicNav ? `newHeaders publicNav`:`newHeaders`} id="nHeader">
@ -447,7 +370,6 @@ class NewHeader extends Component {
>
<Link to={"/settings/notice"} className="message-icon">
{current_user && <Badge count={current_user.message_unread_total}>
{/* <i className="iconfont icon-xiaoxilingdang ml15 mr15"></i> */}
<img src={require(`./img/ring.png`)} alt="" width="16px" className="ml15 mr15"/>
</Badge>}
</Link>

View File

@ -319,9 +319,9 @@ function CoderDepot(props){
const downloadMenu = (
<CloneAddress
http_url={projectDetail && projectDetail.clone_url}
ssh_url = {projectDetail && projectDetail.ssh_url}
zip_url={zip_url}
tar_url={tar_url}
ssh_url = {(projectDetail && props && props.platform) && projectDetail.ssh_url}
zip_url={(props && props.platform) && zip_url}
tar_url={(props && props.platform) && tar_url}
showNotification={props.showNotification}/>
)
// website
@ -582,17 +582,9 @@ function CoderDepot(props){
</React.Fragment>
}
{/* 贡献者 */}
{
projectDetail && projectDetail.contributors && projectDetail.contributors.total_count >0 &&
<Contributors contributors={projectDetail.contributors} owner={owner} projectsId={projectsId} />
}
<Contributors owner={owner} projectsId={projectsId} />
{/* 语言 */}
{ projectDetail && projectDetail.languages &&
<React.Fragment>
<Divider />
<LanguagePower languages={projectDetail.languages}/>
</React.Fragment>
}
<LanguagePower owner={owner} projectsId={projectsId}/>
</Gap>
</ShortWidth>
}

View File

@ -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{
<div className="commitList-item f-wrap-between">
<div>
<AlignTop>
<div className="commitDesc"><Link to={`/${owner}/${projectsId}/commits/${truncateCommitId(`${item.sha}`)}`} className="font-14 color-grey-3 font-bd"><RenderHtml value={item.message}/></Link></div>
<div className="commitDesc">
{
platform ?
<Link to={`/${owner}/${projectsId}/commits/${truncateCommitId(`${item.sha}`)}`} className="font-14 color-grey-3 font-bd">
<RenderHtml value={item.message}/>
</Link>
:
<RenderHtml value={item.message}/>
}
</div>
</AlignTop>
<p className="f-wrap-alignCenter mt15 pb5">
<User
@ -176,7 +185,12 @@ class CoderRootCommit extends Component{
<div>
<span className="treecopy-cont shadow">
<img src={Tree} alt="sha" width={"16px"}/>
{
platform ?
<Link to={`/${owner}/${projectsId}/commits/${truncateCommitId(`${item.sha}`)}`}>{truncateCommitId(`${item.sha}`)}</Link>
:
<span style={{color:"#466AFF",cursor:"default"}}>{truncateCommitId(`${item.sha}`)}</span>
}
<input type="text" id={`value${k}`} value={`${truncateCommitId(`${item.sha}`)}`}/>
</span>
<CopyTool beforeText="复制commit id" afterText="复制成功" inputId={`value${k}`}/>

View File

@ -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){
@ -53,6 +57,15 @@ function Index() {
}).catch(error=>{})
}
function changeSearchValue(e){
setSearch(e.target.value);
}
function searchFun(value){
setIsSpin(true);
getProject(value);
}
return(
<div>
<SubBanner />
@ -74,6 +87,18 @@ function Index() {
<div className="leftLists">
<div className="leftTitles">
<span>开源项目</span>
<Search
placeholder="输入项目名称关键字进行搜索"
enterButton="搜索"
size="middle"
onSearch={searchFun}
className="list-r-Search"
value={search}
onChange={changeSearchValue}
style={{width:"300px"}}
allowClear={true}
/>
<Link to={`/explore/all`} target="_blank">更多<i className="iconfont icon-triangle font-12"></i></Link>
</div>
<Spin spinning={isSpin}>
@ -85,7 +110,14 @@ function Index() {
projectsList.map((i,k)=>{
return(
<li>
{
i.platform === "educoder" ?
<a href="javascript:void(0)" style={{cursor:"default"}}>
<img className="p-r-photo" alt="" src={i.author && i.author.image_url} ></img>
</a>
:
<Link to={`/${i.author && i.author.login}`} target="_blank"><img src={getImageUrl(`/${i.author && i.author.image_url}`)} alt="" /></Link>
}
<div className="itemTitle">
<div className="item-title-infos">
<Link to={`/${i.author && i.author.login}/${i.identifier}`} target="_blank" className="infotitle task-hide">{i.author && i.author.name}/{i.name}</Link>

View File

@ -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;

View File

@ -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(
<div style={{paddingLeft:`${item.level *10}px`}} className={goHref===item.href?"items active":"items"}>
<div style={{paddingLeft:`${item.level *15}px`}} className={goHref===item.href?"items active":"items"}>
<Link href={`#${item.text}`} title={item.text} />
</div>
)

View File

@ -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;

View File

@ -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) {
<div className={`mynotice-content vertical-center-style ${isBatchDelete?'batchDel':''}`} key={item.id}>
<div className="mynotice-cont vertical-center-style">
<Checkbox value={item.id} className={isBatchDelete ? 'visible-checkbox' : 'invisible-checkbox'} onChange={onChange} checked={item.checkedBatch}></Checkbox>
{item.sender && <img src={`https://testforgeplus.trustie.net//${item.sender.image_url}`} className="currentImg" onClick={()=>{window.open(`/${item.sender && item.sender.login}`);}}/>}
{item.sender && <img alt="" src={getImageUrl(`/${item.sender.image_url}`)} className="currentImg" onClick={()=>{window.open(`/${item.sender && item.sender.login}`);}}/>}
<div className={`atme-notice-text stretch-style ${item.notification_url && 'highlightSpan'}`} onClick={() => {turnToMess(item)}}>
{item.status === 1 ? <Badge color="#FA2020"/> : <span className="system-notice-blank"></span>}
{item.sender && <span className="atme-length" dangerouslySetInnerHTML={{__html: item.content}}></span>}

View File

@ -109,7 +109,7 @@ ul,ol,dl{
width: 49rem;
overflow: hidden;
white-space: normal;
&:hover{
& a:hover{
text-decoration: underline;
& .markdown-body{
color: #466AFF;

View File

@ -139,7 +139,6 @@ const GlobalSearch = ({ location, showNotification, history }) => {
</Row>
</div>
<Tabs defaultActiveKey="1" onChange={changeTab}>
<TabPane tab={`项目(${totalType1}`} key={1}>
<div className="search-content">
@ -150,13 +149,13 @@ const GlobalSearch = ({ location, showNotification, history }) => {
</div>
{
dataList.length ?
<Pagination
<div className="pb20"><Pagination
showQuickJumper={dataList.length > size}
onChange={(page) => { setPage(page) }}
current={page}
total={total}
showTotal={total => `${total}`}
/>
/></div>
: <Nodata _html="暂无数据" className="no-data-box" />
}
</TabPane>
@ -170,13 +169,13 @@ const GlobalSearch = ({ location, showNotification, history }) => {
</div>
{
dataList.length ?
<Pagination
<div className="pb20"><Pagination
showQuickJumper={dataList.length > size}
onChange={(page) => { setPage(page) }}
current={page}
total={total}
showTotal={total => `${total}`}
/> : <Nodata _html="暂无数据" />
/></div> : <Nodata _html="" />
}
</TabPane>
@ -227,13 +226,13 @@ const GlobalSearch = ({ location, showNotification, history }) => {
</div>
{
dataList.length ?
<Pagination
<div className="pb20"><Pagination
showQuickJumper={dataList.length > size}
onChange={(page) => { setPage(page) }}
current={page}
total={total}
showTotal={total => `${total}`}
/> : <Nodata _html="暂无数据" />
/></div> : <Nodata _html="" />
}
</TabPane>
</Tabs>