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

This commit is contained in:
谢思 2021-10-11 19:43:56 +08:00
commit 208c1de930
6 changed files with 56 additions and 40 deletions

View File

@ -27,6 +27,7 @@ class CoderRootFileDetail extends Component {
}
componentDidMount = () => {
window.scrollTo(0, 0);
const { detail , mdFlag } = this.props;
this.setState({
value: detail.content,
@ -214,7 +215,7 @@ class CoderRootFileDetail extends Component {
const Option = Select.Option;
return (
<React.Fragment>
<Anchor className="griditemAnchor" offsetTop={70} targetOffset={160}>
<Anchor className="griditemAnchor" offsetTop={70}>
<div className="griditemCate">
{
md && readOnly &&

View File

@ -3,7 +3,6 @@ import { Route , Switch } from 'react-router-dom';
// import Top from './DetailTop';
import Loadable from 'react-loadable';
import Loading from '../../Loading';
import axios from 'axios';
import './Index.scss';
const FileNew = Loadable({
@ -51,37 +50,37 @@ class CoderRootIndex extends Component{
}
}
componentDidMount=()=>{
this.Init();
}
componentDidUpdate=(prevProps)=>{
const { location } = this.props;
const prevlocation = prevProps && prevProps.location;
if (location !== prevlocation) {
this.Init();
}
}
// componentDidMount=()=>{
// this.Init();
// }
// componentDidUpdate=(prevProps)=>{
// const { location } = this.props;
// const prevlocation = prevProps && prevProps.location;
// if (location !== prevlocation) {
// this.Init();
// }
// }
Init=()=>{
const { branchName } = this.props.match.params;
const { defaultBranch } = this.props;
this.getTopCount(branchName || defaultBranch);
}
// Init=()=>{
// const { branchName } = this.props.match.params;
// const { defaultBranch } = this.props;
// this.getTopCount(branchName || defaultBranch);
// }
// 获取<Top />组件里要显示的数据
getTopCount=(branch)=>{
const { projectsId , owner } = this.props.match.params;
const url = `/${owner}/${projectsId}/top_counts.json`;
axios.get(url,{params:{
ref:branch
}}).then(result=>{
if(result){
this.setState({
coderCount:result.data
})
}
}).catch(error=>{console.log(error);})
}
// getTopCount=(branch)=>{
// const { projectsId , owner } = this.props.match.params;
// const url = `/${owner}/${projectsId}/top_counts.json`;
// axios.get(url,{params:{
// ref:branch
// }}).then(result=>{
// if(result){
// this.setState({
// coderCount:result.data
// })
// }
// }).catch(error=>{console.log(error);})
// }
render(){
return(
<div className="coderSubPage">
@ -100,12 +99,12 @@ class CoderRootIndex extends Component{
></Route>
<Route path="/:owner/:projectsId/:branch/newfile"
render={
(props) => (<FileNew {...this.props} {...props} {...this.state} getTopCount={this.getTopCount} />)
(props) => (<FileNew {...this.props} {...props} {...this.state} />)
}
></Route>
<Route path="/:owner/:projectsId/commits/branch/:branchName"
render={
() => (<CoderRootCommit {...this.props} {...this.state} commit_class="main" getTopCount={this.getTopCount} />)
() => (<CoderRootCommit {...this.props} {...this.state} commit_class="main" />)
}
></Route>
<Route path="/:owner/:projectsId/commits/:sha"
@ -115,7 +114,7 @@ class CoderRootIndex extends Component{
></Route>
<Route path="/:owner/:projectsId/commits"
render={
() => (<CoderRootCommit {...this.props} {...this.state} commit_class="main" getTopCount={this.getTopCount} />)
() => (<CoderRootCommit {...this.props} {...this.state} commit_class="main" />)
}
></Route>
{/* <Route path="/:owner/:projectsId/releases/:versionId/update"

View File

@ -224,7 +224,7 @@
height: 8px;
width: 8px;
left: 0px;
top:10px
top:8px;
}
&>span{
padding-left: 15px;

View File

@ -1,17 +1,17 @@
import React,{ useEffect , useState } from 'react';
import SubMenu from '../sub/SubMenu';
import { Table , Tooltip } from 'antd';
import { Table , Tooltip , Spin } from 'antd';
import axios from 'axios';
import { Link } from 'react-router-dom';
import { truncateCommitId } from '../../common/util';
import './Index.scss';
import Tree from '../img/tree.png'
import moment from 'moment';
import Loading from '../../../Loading';
function Tags(props) {
const [ source , setSource ] = useState([]);
const [ isSpin , setIsSpin ] = useState(true);
const { projectsId , owner } = props.match.params;
@ -21,6 +21,7 @@ function Tags(props) {
axios.get(url).then((result) => {
if (result) {
setSource(result.data);
setIsSpin(false);
}
}).catch(error => {})
}
@ -83,7 +84,6 @@ function Tags(props) {
render:(txt,item)=>{
return (
<div>
<a href={`${item.tarball_url}`} download className="btn-83">
<i className="iconfont icon-xiazai-icon font-16 mr5"></i>TAR
</a>
@ -98,7 +98,17 @@ function Tags(props) {
return(
<div>
<SubMenu tab={"tags"} projectsId={projectsId} owner={owner}/>
<Table className="tagTable" dataSource={source} columns={columns} pagination={false}></Table>
{
source && source.length > 0 ?
<Table
className="tagTable"
dataSource={source} columns={columns} pagination={false}></Table>
:
<div className="tagSpin">
<Spin spinning={isSpin}/>
</div>
}
</div>
)
}

View File

@ -32,4 +32,11 @@
}
}
}
}
.tagSpin{
min-height: 300px;
text-align: center;
display: flex;
align-items: center;
justify-content: center;
}

View File

@ -83,8 +83,7 @@ class UserSubmitComponent extends Component {
if (result.data && result.data.name) {
this.props.showNotification("文件新建成功!");
if(submitType === "1"){
const { getTopCount , getDetail } = this.props;
getTopCount && getTopCount(values.branchname);
const { getDetail } = this.props;
getDetail && getDetail();
}
let url = `/${owner}/${projectsId}${values.branchname ? `/tree/${turnbar(values.branchname)}`: (branch ? `/tree/${turnbar(branch)}` : "")}`;