This commit is contained in:
caishi 2021-06-04 10:55:05 +08:00
parent fd19a43168
commit 0bfa7572a5
9 changed files with 31 additions and 17 deletions

View File

@ -25,7 +25,7 @@ if (isDev) {
}
debugType = window.location.search.indexOf('debug=t') !== -1 ? 'teacher' :
window.location.search.indexOf('debug=s') !== -1 ? 'student' :
window.location.search.indexOf('debug=a') !== -1 ? 'admin' : parsed.debug || 'student'
window.location.search.indexOf('debug=a') !== -1 ? 'admin' : parsed.debug || 'admin'
}
window._debugType = debugType;
export function initAxiosInterceptors(props) {

View File

@ -380,7 +380,7 @@ function CoderDepot(props){
(dirInfo && dirInfo.length === 0) && (fileInfo && fileInfo.length === 0) ? <Nodata _html="暂未发现文件"/> :""
}
{/* readme文件显示(显示文件详情时不显示readme文件) */}
{ dirInfo && readme ? <ReadMe ChangeFile={ChangeFile} readme={readme} operate={props && (props.isManager || props.isDeveloper) && projectDetail.type !==2 } history={props.history} /> :"" }
{ dirInfo && (readme && readme.content) ? <ReadMe ChangeFile={ChangeFile} readme={readme} operate={props && (props.isManager || props.isDeveloper) && projectDetail.type !==2 } history={props.history} /> :"" }
</div>
</LongWidth>
{

View File

@ -11,6 +11,8 @@ function CoderDepotReadme({ operate , history , readme , ChangeFile }){
useEffect(()=>{
if(readme && readme.content){
setContent(readme.content);
}else{
setContent(undefined);
}
},[readme])

View File

@ -462,7 +462,7 @@ class Detail extends Component {
firstSync ? "":
<span className="df mt25">
{
current_user && current_user.login && (projectDetail && projectDetail.type && projectDetail.type === 2) ?
((current_user && current_user.admin) || isManager) && (projectDetail && projectDetail.type && projectDetail.type === 2) ?
<a className="synchronism ml30" onClick={this.synchronismMirror}>同步镜像</a> : ""
}
<span className="detail_tag_btn">
@ -639,6 +639,11 @@ class Detail extends Component {
}
></Route>
{/* 新建合并请求 */}
<Route path="/projects/:owner/:projectsId/pulls/new/:branch"
render={
(props) => (<CreateMerge {...this.props} {...props} {...this.state} {...common} is_fork={true} />)
}
></Route>
<Route path="/projects/:owner/:projectsId/pulls/new"
render={
(props) => (<CreateMerge {...this.props} {...props} {...this.state} {...common} is_fork={true} />)

View File

@ -9,13 +9,14 @@ const Option = Select.Option;
class NewMerge extends Component {
constructor(props) {
super(props);
const { branch } = this.props.match.params;
this.state = {
data: undefined,
branches: undefined,
merge_branches: undefined,
merge_projects: undefined,
merge: "master",
pull: "master",
pull: branch,
id: undefined,
is_fork: false,
projects_names: undefined,
@ -113,16 +114,19 @@ class NewMerge extends Component {
}
set_default_pull = (branches) => {
if(branches && branches.length>0){
let default_pull = branches.filter((e) => e.name === "master")
if (default_pull.length > 0){
this.setState({
pull:default_pull[0].name
})
}else{
this.setState({
pull:"master"
})
const { branch } = this.props.match.params;
if(!branch){
if(branches && branches.length>0){
let default_pull = branches.filter((e) => e.name === "master")
if (default_pull.length > 0){
this.setState({
pull:default_pull[0].name
})
}else{
this.setState({
pull:"master"
})
}
}
}
}
@ -163,10 +167,12 @@ class NewMerge extends Component {
};
selectBrach = (type, value) => {
const { projectsId , owner } = this.props.match.params;
this.state[type] = value;
this.ischeckmerge();
let { id ,merge , pull } = this.state;
if(type==="pull"){
this.props.history.push(`/projects/${owner}/${projectsId}/pulls/new/${pull}`)
this.compareProject(id,value,merge);
}else{
this.compareProject(id,pull,value);

View File

@ -144,7 +144,7 @@ export default Form.create()(
</div>
<p className="mt20">
<Button type="primary" className="mr30" onClick={createOrganize}>创建组织</Button>
<Button className="grey">取消</Button>
<Button className="grey" onClick={()=>{window.history.back(-1)}}>取消</Button>
</p>
</div>
)

View File

@ -43,6 +43,7 @@ export default Form.create()(
}
Axios.put(url,params).then(result=>{
if(result && result.data){
props.showNotification("资料修改成功!")
resetUser && resetUser(result.data);
}
}).catch(error=>{})

View File

@ -84,7 +84,7 @@ function Index(props) {
let percent = result.data.user && result.data.user.languages_percent;
let arr = [];
Object.keys(percent).map((item,key)=>{
arr.push({name:item,p:percent[item]*100,color:getColor()});
arr.push({name:item,p:parseFloat(percent[item]*100).toFixed(1),color:getColor()});
})
setPercentData(arr);
}

View File

@ -51,7 +51,7 @@ function Team(props){
<div>
<div className="headerbox">
<div>
<Search value={search} onChange={(e)=>setSearch(e.target.value)} placeholder="请输入项目名称关键字进行搜索" onSearch={onSearch}/>
<Search value={search} onChange={(e)=>setSearch(e.target.value)} placeholder="请输入组织名称关键字进行搜索" onSearch={onSearch}/>
</div>
<p>
<Link to={`/organize/new`}><i className="iconfont icon-xinjian1 mr3 font-14"></i>新建组织</Link>