From e4e20862219f9bbc70a4bc738af68ad3486edd2b Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Wed, 17 Jun 2020 09:43:08 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E6=94=AF=E8=AE=BE=E7=BD=AE=E3=80=81?= =?UTF-8?q?=E9=95=9C=E5=83=8F=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/AppConfig.js | 2 +- src/forge/Component/Title.jsx | 16 ++++ src/forge/Component/layout.jsx | 35 +++++++ src/forge/Main/list.css | 2 +- src/forge/Settings/Branch.js | 73 +++++++------- src/forge/Settings/Collaborator.js | 6 +- src/forge/Settings/Index.js | 28 +++--- src/forge/Settings/Setting.js | 43 +++++---- src/forge/Settings/SettingMirror.jsx | 94 +++++++++++++++++++ src/forge/Settings/new_tags.js | 9 +- .../Settings/{setting.css => setting.scss} | 24 ++++- 11 files changed, 258 insertions(+), 74 deletions(-) create mode 100644 src/forge/Component/Title.jsx create mode 100644 src/forge/Settings/SettingMirror.jsx rename src/forge/Settings/{setting.css => setting.scss} (89%) diff --git a/src/AppConfig.js b/src/AppConfig.js index decab74c..e0799627 100644 --- a/src/AppConfig.js +++ b/src/AppConfig.js @@ -30,7 +30,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 || '' + window.location.search.indexOf('debug=a') !== -1 ? 'admin' : parsed.debug || 'admin' } function clearAllCookie() { cookie.remove('_educoder_session', { path: '/' }); diff --git a/src/forge/Component/Title.jsx b/src/forge/Component/Title.jsx new file mode 100644 index 00000000..a9d1ad37 --- /dev/null +++ b/src/forge/Component/Title.jsx @@ -0,0 +1,16 @@ +import React from 'react'; +import styled from 'styled-components'; + +const Nav = styled.div`{ + background-color:#fff; + padding:20px 30px; + border-bottom:1px solid #eee; + font-size:16px; + color:#333; +}` + +export default (({children})=>{ + return( + + ) +}) \ No newline at end of file diff --git a/src/forge/Component/layout.jsx b/src/forge/Component/layout.jsx index 821071fc..71824e8f 100644 --- a/src/forge/Component/layout.jsx +++ b/src/forge/Component/layout.jsx @@ -15,6 +15,11 @@ export const AlignCenterBetween = styled.div`{ justify-content: space-between; border-bottom:1px solid #eee; }` +export const FlexAJ = styled.div`{ + display:flex; + align-items: center; + justify-content: space-between; +}` export const AlignCenter = styled.div`{ display:flex; align-items: center; @@ -42,3 +47,33 @@ export const WhiteBack = styled.div`{ background-color:#fff; border-radius:5px; }` +export const Blueline = styled.a`{ + height:30px; + line-height:30px; + border-radius:5px; + border:1px solid rgba(80,145,255,1); + color:rgba(80,145,255,1); + padding:0px 12px; +}` +export const NumUl = styled.ul`{ + padding-left: 20px; + & > li{ + list-style-type: decimal; + color:#888; + height:24px; + line-height:24px; + } +}` +export const GreenUnder = styled.a`{ + color:#28BD6C!important; + position:relative; + &:after{ + position:absolute; + bottom:-2px; + left:0px; + width:100%; + height:1px; + content:''; + background:#28BD6C; + } +}` diff --git a/src/forge/Main/list.css b/src/forge/Main/list.css index a022bb31..be8a4db2 100644 --- a/src/forge/Main/list.css +++ b/src/forge/Main/list.css @@ -99,7 +99,7 @@ .list-l-Menu li.active::before{ position: absolute; left: 0px; - top: 10px; + top: 15px; width: 6px; content: ''; height: 33px; diff --git a/src/forge/Settings/Branch.js b/src/forge/Settings/Branch.js index 1ab6c313..b3b4b089 100644 --- a/src/forge/Settings/Branch.js +++ b/src/forge/Settings/Branch.js @@ -1,42 +1,51 @@ -import React , { useEffect , useState } from 'react'; -import { Input , Select } from 'antd'; -import { getBranch } from '../GetData/getData'; +import React , { useState } from 'react'; +import SelectBranch from '../Branch/Select'; +import Title from '../Component/Title'; +import styled from 'styled-components'; +import { Blueline , FlexAJ , NumUl , GreenUnder , AlignCenter , WhiteBack } from '../Component/layout'; +const Div = styled.div`{ + padding:20px 30px; + min-height:500px; +}` -const { Option } = Select; export default ((props)=>{ - const [ branchList , setBranchList] = useState(undefined); + const [ branch , setBranch ] = useState("master"); const { projectsId } = props.match.params; + const projectDetail = props.projectDetail; - useEffect(()=>{ - getBranchs(projectsId); - },[projectsId]) + function resetSetting(){ - async function getBranchs(id){ - let result = await getBranch(id); - setBranchList(result); } - - - const branchListRender = ( - branchList && branchList.map((item,key)=>{ - return( - - ) - }) - ) return( -
-
- 分支列表 -
-

请选择一个默认的分支用于合并请求和提交:

-
- - 更新仓库设置 -
-
+ + 分支设置 +
+
+

默认分支

+

默认分支被视作为代码库中的基本分支,是所有克隆、代码提交、合并请求的目标分支

+ + + 设为默认分支 + +
+
+ + 保护分支规则 + + 新建规则 + + +
  • 限制分支的推送、合并。强制推送相关请去仓库设置
  • +
  • 一个分支同时只能有一个保护分支规则生效,越早创建的规则优先级越高。
  • +
  • 保护分支规则只影响状态是【保护分支】的分支。【常规分支】和【只读分支】都不影响。
  • +
    +
    +
    +
    ) }) \ No newline at end of file diff --git a/src/forge/Settings/Collaborator.js b/src/forge/Settings/Collaborator.js index b1dcea09..8e76e7d4 100644 --- a/src/forge/Settings/Collaborator.js +++ b/src/forge/Settings/Collaborator.js @@ -15,6 +15,8 @@ import { import NoneData from "../Nodata"; import axios from "axios"; import { getImageUrl } from "educoder"; +import {WhiteBack} from '../Component/layout'; + const { Search } = Input; const { Option } = AutoComplete; @@ -425,7 +427,7 @@ class Collaborator extends Component { ); }); return ( -
    +
    协作者管理
    @@ -491,7 +493,7 @@ class Collaborator extends Component { ) : ( "" )} -
    + ); } } diff --git a/src/forge/Settings/Index.js b/src/forge/Settings/Index.js index f5a0de41..5cd077d9 100644 --- a/src/forge/Settings/Index.js +++ b/src/forge/Settings/Index.js @@ -2,10 +2,11 @@ import React, { Component } from "react"; import { Link, Route, Switch } from "react-router-dom"; import "../css/index.css"; -import "./setting.css"; +import "./setting.scss"; import Loadable from "react-loadable"; import Loading from "../../Loading"; +import { Box , Long , Short , Gap , WhiteBack} from '../Component/layout'; const Branch = Loadable({ loader: () => import("./Branch"), @@ -30,8 +31,8 @@ class Index extends Component { const flag = pathname === `/projects/${projectsId}/setting`; return ( -
    -
    + +
    • @@ -63,7 +64,6 @@ class Index extends Component { 分支设置 -

    • */}
    • */}
    -
    -
    -
    - + + + + {/* 协作者 */} )} > + ( + + )} + > {/* 修改仓库信息 */} -
    -
    -
    + + + ); } } diff --git a/src/forge/Settings/Setting.js b/src/forge/Settings/Setting.js index b884678c..8d91fed1 100644 --- a/src/forge/Settings/Setting.js +++ b/src/forge/Settings/Setting.js @@ -1,8 +1,11 @@ import React, { Component } from "react"; import { Form, Input, Checkbox, Select } from "antd"; +import Title from '../Component/Title'; +import Mirror from './SettingMirror'; +import {WhiteBack} from '../Component/layout'; import axios from "axios"; -import "./setting.css"; +import "./setting.scss"; const { TextArea } = Input; const { Option } = Select; class Setting extends Component { @@ -146,10 +149,8 @@ class Setting extends Component { const { CategoryList, LanguageList, private_check } = this.state; return (
    -
    -
    - 基本设置 -
    + + 基本设置
    {getFieldDecorator("project_name", { @@ -212,22 +213,26 @@ class Setting extends Component {

    -
    -
    -
    危险操作区
    -
    -
    -

    删除本仓库

    -

    - 删除仓库是永久性的, - 无法撤消,且删除后,与仓库关联的项目/任务/合并请求/版本发布等,均会被删除 -

    + {/* 镜像设置部分,暂无接口,先不显示 */} + {/* */} + + +
    +
    危险操作区
    +
    +
    +

    删除本仓库

    +

    + 删除仓库是永久性的, + 无法撤消,且删除后,与仓库关联的项目/任务/合并请求/版本发布等,均会被删除 +

    +
    + + 删除本仓库 +
    - - 删除本仓库 -
    -
    +
    ); } diff --git a/src/forge/Settings/SettingMirror.jsx b/src/forge/Settings/SettingMirror.jsx new file mode 100644 index 00000000..22db4f9f --- /dev/null +++ b/src/forge/Settings/SettingMirror.jsx @@ -0,0 +1,94 @@ +import React , { forwardRef , useCallback , useState } from 'react'; +import { Form , Checkbox , Input , Button } from 'antd'; +import styled from 'styled-components'; +import './setting.scss'; + +const Div = styled.div`{ + margin:0px 30px; + background:#FAFAFA; + padding:0px 20px 10px 20px; + .ant-form.ant-form-horizontal{ + padding:15px 0px; + } +}` +const P = styled.p`{ + padding:15px 0px; + font-size:16px; + color:#333; + border-bottom:1px solid #DDDDDD; +}` +const Item = styled.div`{ + padding-bottom:10px; + &>span{ + color:#333; + } + .ant-checkbox-wrapper{ + height:20px; + line-height:20px; + } + .ant-row.ant-form-item{ + margin-bottom:0px; + } +}` +export default Form.create()( + forwardRef(({ form })=>{ + const { getFieldDecorator, validateFields, setFieldsValue } = form; + const [ mirrorCheck , setMirrorCheck ] = useState(false) + const helper = useCallback( + (label, name, rules, widget, classname , isRequired = true ) => ( + + {label} + + {getFieldDecorator(name, { rules, validateFirst: true })(widget)} + + + ), + [] + ); + return( +
    +

    镜像设置

    +
    + {helper( + "修剪", + "cut", + [], + 删除过时的远程跟踪引用,'iteminline setHeight' + )} + {/* {helper( + "镜像间隔(有效时间单位为“h”“m”“s”),0将禁用自动同步。", + "time", + [], + ,'iteminline' + )} */} + {helper( + "从URL克隆", + "clone", + [], + + )} +

    在Clone认证部分里输入必要的信息

    +

    setMirrorCheck(!mirrorCheck)}>需要授权验证

    + { mirrorCheck ? +
    + {helper( + "用户名", + "name", + [], + ,'iteminline' + )} + {helper( + "密码", + "password", + [], + ,'iteminline ml30' + )} +
    + :""} +

    上次同步 2020-06-16 17:40

    + +
    +
    + ) + }) +) \ No newline at end of file diff --git a/src/forge/Settings/new_tags.js b/src/forge/Settings/new_tags.js index 74d2bf90..0d3c023c 100644 --- a/src/forge/Settings/new_tags.js +++ b/src/forge/Settings/new_tags.js @@ -12,13 +12,14 @@ import { Button, Table, } from "antd"; -import { Link } from "react-router-dom"; import "../Order/order.css"; -import "./setting.css"; +import "./setting.scss"; import NoneData from "../Nodata"; import { SketchPicker } from "react-color"; import reactCSS from "reactcss"; import axios from "axios"; +import {WhiteBack} from '../Component/layout'; + class NewTags extends Component { constructor(props) { super(props); @@ -433,7 +434,7 @@ class NewTags extends Component { }; return ( -
    +
    -
    + ); } } diff --git a/src/forge/Settings/setting.css b/src/forge/Settings/setting.scss similarity index 89% rename from src/forge/Settings/setting.css rename to src/forge/Settings/setting.scss index 7434e7dc..2c588158 100644 --- a/src/forge/Settings/setting.css +++ b/src/forge/Settings/setting.scss @@ -23,7 +23,20 @@ content: ''; } .baseForm{ - padding:15px 20px!important; + padding:15px 30px!important; +} +.iteminline{ + display: flex; + align-items: center; + .ant-row.ant-form-item{ + margin-left: 15px; + } +} +.setHeight{ + .ant-form-item-control{ + height: 20px; + line-height: 20px; + } } .baseForm .ant-row.ant-form-item{ margin-bottom: 15px; @@ -49,7 +62,6 @@ } .addPanel{ display: flex; - /* padding:15px; */ } .red_btn{ display: block; @@ -75,10 +87,14 @@ } .dangerousBox{ - border:1px solid #efc16b; - border-radius: 4px; margin-top: 20px; + padding:20px; + &>div{ + border:1px solid #efc16b; + border-radius: 4px; + } } + .dangerousTitle{ padding:10px; background: #f9edbe;