From a3226dca4eb7109d4d3debb06e38481b1531f136 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Fri, 19 Mar 2021 12:11:55 +0800 Subject: [PATCH 1/2] banner --- src/forge/Main/sub/DetailBanner.jsx | 73 +++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 src/forge/Main/sub/DetailBanner.jsx diff --git a/src/forge/Main/sub/DetailBanner.jsx b/src/forge/Main/sub/DetailBanner.jsx new file mode 100644 index 00000000..c80999c1 --- /dev/null +++ b/src/forge/Main/sub/DetailBanner.jsx @@ -0,0 +1,73 @@ +import React from 'react'; +import { Link } from 'react-router-dom'; + +function DetailBanner({ isManager , url , pathname , owner , projectsId , state , urlFlag , projectDetail , platform ,open_devops }){ + return( +
- + 项目标签
diff --git a/src/forge/Settings/Setting.js b/src/forge/Settings/Setting.js index 263db31e..dda9a9f8 100644 --- a/src/forge/Settings/Setting.js +++ b/src/forge/Settings/Setting.js @@ -2,11 +2,20 @@ import React, { Component } from "react"; import { Form, Input, Checkbox, Select , Spin } from "antd"; import Title from '../Component/Title'; 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:"versions"}, + {name:"动态",index:"activity"}, +] class Setting extends Component { constructor(props) { super(props); @@ -14,7 +23,8 @@ class Setting extends Component { CategoryList: undefined, LanguageList: undefined, private_check: undefined, - loading:true + loading:true, + project_units:['home',"activity"] }; } @@ -51,12 +61,18 @@ class Setting extends Component { .get(url) .then((result) => { if (result) { + const { project_units } = this.state; + let units = result.data.project_units; + units.push(...project_units); + this.props.form.setFieldsValue({ ...result.data, + project_units:units }); this.setState({ private_check: result.data.private, - loading:false + loading:false, + project_units:units }); } }) @@ -104,36 +120,46 @@ class Setting extends Component { loading:true }) const { projectsId , owner } = this.props.match.params; + const navUrl = `/${owner}/${projectsId}/project_units.json`; - const { private_check } = this.state; - const url = `/${owner}/${projectsId}.json`; - axios - .put(url, { - name: values.project_name, - description: values.project_description, - private: private_check, - ...values, - }) - .then((result) => { - if (result) { - this.props.showNotification(`仓库信息修改成功!`); - const { getDetail } = this.props; - getDetail && getDetail(); - this.setState({ - loading:false - }) - } - }) - .catch((error) => { - console.log(error); - this.setState({ - loading:false - }) - }); + let unit = values.project_units.filter(item => (item !== "home" && item!== "activity")); + axios.post(navUrl, { + unit_types:unit + }).then((result) => { + if (result) { + this.update(values); + } + }).catch(error=>{}) } }); }; + update=(values)=>{ + const { projectsId , owner } = this.props.match.params; + const { private_check } = this.state; + const url = `/${owner}/${projectsId}.json`; + axios.put(url, { + name: values.project_name, + description: values.project_description, + private: private_check, + ...values, + }).then((result) => { + if (result) { + this.props.showNotification(`仓库信息修改成功!`); + const { getDetail } = this.props; + getDetail && getDetail(); + this.setState({ + loading:false + }) + } + }).catch((error) => { + console.log(error); + this.setState({ + loading:false + }) + }); + } + // 删除本仓库 deleteProject = () => { this.props.confirm({ @@ -224,6 +250,25 @@ class Setting extends Component { ], })()} +