forked from Gitlink/forgeplus-react
issue:11588
This commit is contained in:
parent
5f21c58832
commit
60f460bace
|
|
@ -20793,4 +20793,4 @@
|
|||
"integrity": "sha512-bIusJLS8c4DkIcdiK+s13HiQ/zjQQVgpNohtd8d94Y2DnJqgM1yjh/jpDb8DoL6hd7r8Awagw8e3qK/oLaWr3g=="
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,13 +13,13 @@ $BaseRem: 1; // rem基准为16px
|
|||
}
|
||||
|
||||
.py-#{$value}px-rem {
|
||||
padding-top: #{$value / $BaseRem}rem;
|
||||
padding-bottom: #{$value / $BaseRem}rem;
|
||||
padding-top: calc(#{$value} / #{$BaseRem})rem;
|
||||
padding-bottom: calc(#{$value} / #{$BaseRem})rem;
|
||||
}
|
||||
|
||||
.px-#{$value}px-rem {
|
||||
padding-left: #{$value / $BaseRem}rem;
|
||||
padding-right: #{$value / $BaseRem}rem;
|
||||
padding-left: calc(#{$value} / #{$BaseRem})rem;
|
||||
padding-right: calc(#{$value} / #{$BaseRem})rem;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -30,7 +30,7 @@ $BaseRem: 1; // rem基准为16px
|
|||
}
|
||||
|
||||
.#{$prefix}-#{$value}px-rem {
|
||||
#{$property}: #{$value / $BaseRem}rem;
|
||||
#{$property}: calc(#{$value} / #{$BaseRem})rem;
|
||||
}
|
||||
|
||||
.hover\:#{$prefix}-#{$value}px:hover {
|
||||
|
|
@ -38,7 +38,7 @@ $BaseRem: 1; // rem基准为16px
|
|||
}
|
||||
|
||||
.hover\:#{$prefix}-#{$value}px-rem:hover {
|
||||
#{$property}: #{$value / $BaseRem}rem;
|
||||
#{$property}: calc(#{$value} / #{$BaseRem})rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -269,6 +269,7 @@ class Index extends Component {
|
|||
|
||||
const { projectsList, recommendList, languageList, languageId,
|
||||
isSpin, total, search, limit, page, typeList, categoryList, filter } = this.state;
|
||||
console.log("projects", filter);
|
||||
|
||||
return (
|
||||
<div className='pt-20px' style={{ background: "#EEF5FE", lineHeight: "normal" }}>
|
||||
|
|
@ -332,10 +333,10 @@ class Index extends Component {
|
|||
{ label: "我管理的", key: "manage" },
|
||||
{ label: "我学习的", key: "study" },
|
||||
].map((item) => (<div key={item.key} className={`h-full flex item-center relative cursor-pointer ${(filter || "undefined") == item.key ? "font-medium" : ""}`}
|
||||
style={{ color: filter == item.key ? "#232B40" : "#5F6368" }}
|
||||
style={{ color: (filter || "undefined") == item.key ? "#232B40" : "#5F6368" }}
|
||||
onClick={() => { this.changeFilter(item.key) }}>
|
||||
{item.label}
|
||||
{filter == item.key && <div className='w-full h-2px absolute' style={{ background: "#232B40", left: 0, bottom: "-12px" }}></div>}
|
||||
{(filter || "undefined") == item.key && <div className='w-full h-2px absolute' style={{ background: "#232B40", left: 0, bottom: "-12px" }}></div>}
|
||||
</div>))}
|
||||
</div>
|
||||
<Button type={"primary"} size={"large"} style={{ background: "#3061D0" }}>
|
||||
|
|
|
|||
|
|
@ -1,21 +1,21 @@
|
|||
import React, { Component } from "react";
|
||||
import { Form, Input, Checkbox, Select , Spin } from "antd";
|
||||
import { Form, Input, Checkbox, Select, Spin } from "antd";
|
||||
import Title from '../Component/Title';
|
||||
import {WhiteBack} from '../Component/layout';
|
||||
import { WhiteBack } from '../Component/layout';
|
||||
import axios from "axios";
|
||||
import "./setting.scss";
|
||||
const { TextArea } = Input;
|
||||
const { Option } = Select;
|
||||
|
||||
const menu = [
|
||||
{name:"主页",index:"home"},
|
||||
{name:"代码库",index:"code"},
|
||||
{name:"易修 (Issue)",index:"issues"},
|
||||
{name:"合并请求",index:"pulls"},
|
||||
{name:"工作流(beta版)",index:"devops"},
|
||||
{ name: "主页", index: "home" },
|
||||
{ name: "代码库", index: "code" },
|
||||
{ name: "易修 (Issue)", index: "issues" },
|
||||
{ name: "合并请求", index: "pulls" },
|
||||
{ name: "工作流(beta版)", index: "devops" },
|
||||
// {name:"资源库",index:"resources"},
|
||||
{name:"里程碑",index:"versions"},
|
||||
{name:"动态",index:"activity"},
|
||||
{ name: "里程碑", index: "versions" },
|
||||
{ name: "动态", index: "activity" },
|
||||
]
|
||||
class Setting extends Component {
|
||||
constructor(props) {
|
||||
|
|
@ -24,18 +24,20 @@ class Setting extends Component {
|
|||
CategoryList: undefined,
|
||||
LanguageList: undefined,
|
||||
private_check: undefined,
|
||||
loading:true,
|
||||
project_units:['home',"activity","code"],
|
||||
divertVisible:false,
|
||||
is_transfering:undefined,
|
||||
projectName:undefined,
|
||||
join_project_need_verify:false
|
||||
loading: true,
|
||||
project_units: ['home', "activity", "code"],
|
||||
divertVisible: false,
|
||||
is_transfering: undefined,
|
||||
projectName: undefined,
|
||||
join_project_need_verify: false,
|
||||
project_id: undefined,
|
||||
audit_statu: undefined,
|
||||
};
|
||||
}
|
||||
|
||||
componentDidUpdate=(prevPros)=>{
|
||||
componentDidUpdate = (prevPros) => {
|
||||
|
||||
if(prevPros && this.props && !this.props.checkIfLogin()){
|
||||
if (prevPros && this.props && !this.props.checkIfLogin()) {
|
||||
this.props.history.push("/403")
|
||||
return;
|
||||
}
|
||||
|
|
@ -57,30 +59,32 @@ class Setting extends Component {
|
|||
});
|
||||
}
|
||||
})
|
||||
.catch((error) => {});
|
||||
.catch((error) => { });
|
||||
};
|
||||
|
||||
getInfo = () => {
|
||||
const { projectsId , owner } = this.props.match.params;
|
||||
const { projectsId, owner } = this.props.match.params;
|
||||
const url = `/${owner}/${projectsId}/edit.json`;
|
||||
axios
|
||||
.get(url)
|
||||
.then((result) => {
|
||||
if (result) {
|
||||
const { project_units } = this.state;
|
||||
let units = result.data.project_units;
|
||||
let units = result.data.project_units;
|
||||
units.push(...project_units);
|
||||
|
||||
this.props.form.setFieldsValue({
|
||||
...result.data,
|
||||
project_units:units
|
||||
project_units: units
|
||||
});
|
||||
this.setState({
|
||||
projectName:result.data.project_name,
|
||||
projectName: result.data.project_name,
|
||||
private_check: result.data.private,
|
||||
join_project_need_verify:result.data.join_project_need_verify,
|
||||
loading:false,
|
||||
project_units:units
|
||||
join_project_need_verify: result.data.join_project_need_verify,
|
||||
loading: false,
|
||||
project_units: units,
|
||||
project_id: result.data.project_id,
|
||||
audit_statu: result.data.audit_statu
|
||||
});
|
||||
}
|
||||
})
|
||||
|
|
@ -103,7 +107,7 @@ class Setting extends Component {
|
|||
});
|
||||
}
|
||||
})
|
||||
.catch((error) => {});
|
||||
.catch((error) => { });
|
||||
};
|
||||
|
||||
setOptionsList = (data) => {
|
||||
|
|
@ -125,32 +129,32 @@ class Setting extends Component {
|
|||
this.props.form.validateFields((err, values) => {
|
||||
if (!err) {
|
||||
this.setState({
|
||||
loading:true
|
||||
loading: true
|
||||
})
|
||||
const { projectsId , owner } = this.props.match.params;
|
||||
const navUrl = `/${owner}/${projectsId}/project_units.json`;
|
||||
const { projectsId, owner } = this.props.match.params;
|
||||
const navUrl = `/${owner}/${projectsId}/project_units.json`;
|
||||
|
||||
let unit = values.project_units.filter(item => (item !== "home" && item!== "activity" && item!== "code"));
|
||||
let unit = values.project_units.filter(item => (item !== "home" && item !== "activity" && item !== "code"));
|
||||
axios.post(navUrl, {
|
||||
unit_types:unit
|
||||
unit_types: unit
|
||||
}).then((result) => {
|
||||
if (result) {
|
||||
this.update(values);
|
||||
}
|
||||
}).catch(error=>{})
|
||||
}).catch(error => { })
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
update=(values)=>{
|
||||
const { projectsId , owner } = this.props.match.params;
|
||||
const { private_check ,join_project_need_verify} = this.state;
|
||||
update = (values) => {
|
||||
const { projectsId, owner } = this.props.match.params;
|
||||
const { private_check, join_project_need_verify } = this.state;
|
||||
const url = `/${owner}/${projectsId}.json`;
|
||||
axios.put(url, {
|
||||
name: values.project_name,
|
||||
description: values.project_description,
|
||||
private: private_check,
|
||||
join_project_need_verify:join_project_need_verify,
|
||||
join_project_need_verify: join_project_need_verify,
|
||||
...values,
|
||||
}).then((result) => {
|
||||
if (result) {
|
||||
|
|
@ -158,23 +162,23 @@ class Setting extends Component {
|
|||
const { getDetail } = this.props;
|
||||
getDetail && getDetail();
|
||||
this.setState({
|
||||
loading:false
|
||||
loading: false
|
||||
})
|
||||
}
|
||||
}).catch((error) => {
|
||||
console.log(error);
|
||||
this.setState({
|
||||
loading:false
|
||||
loading: false
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
// 删除本仓库
|
||||
deleteProject = () => {
|
||||
const { projectsId , owner } = this.props.match.params;
|
||||
const { projectsId, owner } = this.props.match.params;
|
||||
const { projectName } = this.state;
|
||||
this.props.confirm({
|
||||
content: <span style={{display:"block",textAlign:"left"}}>该操作无法撤销!且将会一并删除相关的易修、合并请求、工作流、里程碑、动态等数据。<br/>是否确认删除 <span style={{fontWeight:"bold"}}>{owner}/{projectName}({projectsId})</span>?</span>,
|
||||
content: <span style={{ display: "block", textAlign: "left" }}>该操作无法撤销!且将会一并删除相关的易修、合并请求、工作流、里程碑、动态等数据。<br />是否确认删除 <span style={{ fontWeight: "bold" }}>{owner}/{projectName}({projectsId})</span>?</span>,
|
||||
onOk: () => {
|
||||
const url = `/${owner}/${projectsId}.json`;
|
||||
axios
|
||||
|
|
@ -199,7 +203,7 @@ class Setting extends Component {
|
|||
const { getFieldDecorator } = this.props.form;
|
||||
const { projectDetail } = this.props;
|
||||
|
||||
const { CategoryList, LanguageList, private_check ,loading,join_project_need_verify } = this.state;
|
||||
const { CategoryList, LanguageList, private_check, loading, join_project_need_verify, project_id, audit_statu } = this.state;
|
||||
let mirror = projectDetail && projectDetail.mirror;
|
||||
let type = projectDetail && projectDetail.type;
|
||||
const forked_from_project_id = this.props && this.props.projectDetail && this.props.projectDetail.forked_from_project_id;
|
||||
|
|
@ -219,9 +223,9 @@ class Setting extends Component {
|
|||
],
|
||||
})(<Input placeholder="请输入项目名称" />)}
|
||||
</Form.Item>
|
||||
<div className="df">
|
||||
<span className="mr20 mb15 font-14" style={{marginTop:'8px'}}>可见性</span>
|
||||
<Form.Item label="">
|
||||
<div className="df gap-20px">
|
||||
<span className="mr20 mb15 font-14" style={{ marginTop: '8px' }}>可见性</span>
|
||||
{audit_statu == 2 ? <Form.Item label="">
|
||||
{getFieldDecorator("private", {
|
||||
rules: [],
|
||||
})(
|
||||
|
|
@ -232,11 +236,23 @@ class Setting extends Component {
|
|||
>
|
||||
<span className="color-grey-6">将仓库设为私有</span>
|
||||
<span className="color-grey-9">
|
||||
{ forked_from_project_id ?`(Fork仓库的可见性实时同步自源仓库,不支持直接修改)`:`(修改仓库的可见性,将会影响到该仓库下所有Fork仓库的可见性)`}
|
||||
{forked_from_project_id ? `(Fork仓库的可见性实时同步自源仓库,不支持直接修改)` : `(修改仓库的可见性,将会影响到该仓库下所有Fork仓库的可见性)`}
|
||||
</span>
|
||||
</Checkbox>
|
||||
)}
|
||||
</Form.Item>
|
||||
</Form.Item> : <div className="flex item-center gap-20px">
|
||||
{audit_statu == 1 ? <div className='rounded-14px px-10px py-2px' style={{ color: "#EA7C1F", border: "1px solid #EA7C1F", background: "rgba(255,146,54,0.14)" }}>审核中</div> :
|
||||
<div className='rounded-14px px-10px py-2px cursor-pointer'
|
||||
style={{ color: "#1CAC70", border: "1px solid #1CAC70", background: "rgba(60,218,152,0.14)" }}
|
||||
onClick={() => {
|
||||
axios.post(`/projects/${project_id}/create_project_review.json`, {}).then((result) => {
|
||||
if (result.status == 0) {
|
||||
this.getInfo();
|
||||
}
|
||||
}).catch(error => { })
|
||||
}}>申请公开</div>}
|
||||
<div className="color-grey-9">(项目需管理员审核通过才可公开展示,未通过或待审核期间默认保持私有状态)</div>
|
||||
</div>}
|
||||
</div>
|
||||
<Form.Item label="项目简介">
|
||||
{getFieldDecorator("project_description", {
|
||||
|
|
@ -274,12 +290,12 @@ class Setting extends Component {
|
|||
})(
|
||||
<Checkbox.Group>
|
||||
{
|
||||
menu.map((item,key)=>{
|
||||
return(
|
||||
<Checkbox
|
||||
key={key}
|
||||
value={item.index}
|
||||
disabled={item.index === "home" || item.index === "activity" || item.index === "code" || (mirror && (type && type===2) && item.index === "pulls")}
|
||||
menu.map((item, key) => {
|
||||
return (
|
||||
<Checkbox
|
||||
key={key}
|
||||
value={item.index}
|
||||
disabled={item.index === "home" || item.index === "activity" || item.index === "code" || (mirror && (type && type === 2) && item.index === "pulls")}
|
||||
>{item.name}</Checkbox>
|
||||
)
|
||||
})
|
||||
|
|
@ -288,18 +304,18 @@ class Setting extends Component {
|
|||
)}
|
||||
</Form.Item>
|
||||
<div className="df">
|
||||
<span className="mr20 mb15 font-14" style={{marginTop:'8px'}}>加入项目设置</span>
|
||||
<span className="mr20 mb15 font-14" style={{ marginTop: '8px' }}>加入项目设置</span>
|
||||
<Form.Item label="">
|
||||
{getFieldDecorator("join_project_need_verify", {
|
||||
rules: [],
|
||||
})(
|
||||
<Checkbox
|
||||
checked={join_project_need_verify}
|
||||
onChange={(e)=>this.setState({join_project_need_verify:e.target.checked})}
|
||||
onChange={(e) => this.setState({ join_project_need_verify: e.target.checked })}
|
||||
>
|
||||
<span className="color-grey-6">用户加入项目时需要审核</span>
|
||||
<span className="color-grey-9">
|
||||
(使用邀请码加入也需要审核,由项目所有人或管理员审核)
|
||||
(使用邀请码加入也需要审核,由项目所有人或管理员审核)
|
||||
</span>
|
||||
</Checkbox>
|
||||
)}
|
||||
|
|
@ -315,22 +331,22 @@ class Setting extends Component {
|
|||
{/* <Mirror /> */}
|
||||
</WhiteBack>
|
||||
<WhiteBack className="dangerousBox mb20">
|
||||
<div>
|
||||
<div className="dangerousTitle">危险操作区</div>
|
||||
<div className="flex-a-center padding15-10">
|
||||
<div>
|
||||
<p className="font-bd font-16">删除本仓库</p>
|
||||
<p className="mt10">
|
||||
删除仓库是永久性的,
|
||||
无法撤消,且删除后,与仓库关联的项目/任务/合并请求/版本发布等,均会被删除
|
||||
</p>
|
||||
<div>
|
||||
<div className="dangerousTitle">危险操作区</div>
|
||||
<div className="flex-a-center padding15-10">
|
||||
<div>
|
||||
<p className="font-bd font-16">删除本仓库</p>
|
||||
<p className="mt10">
|
||||
删除仓库是永久性的,
|
||||
无法撤消,且删除后,与仓库关联的项目/任务/合并请求/版本发布等,均会被删除
|
||||
</p>
|
||||
</div>
|
||||
<a onClick={this.deleteProject} className="red_deleteBtn">
|
||||
删除本仓库
|
||||
</a>
|
||||
</div>
|
||||
<a onClick={this.deleteProject} className="red_deleteBtn">
|
||||
删除本仓库
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</WhiteBack>
|
||||
</WhiteBack>
|
||||
</Spin>
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in New Issue