From a2550aab1e2486b0fc375a9f60ec952625b9e5f4 Mon Sep 17 00:00:00 2001 From: caicai8 <1149225589@qq.com> Date: Mon, 30 Dec 2019 14:30:42 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/public/index.html | 8 +- public/react/src/App.js | 2 +- public/react/src/forge/Index.js | 31 ++++++- public/react/src/forge/Main/Index.js | 116 +++++++++++++++++++++++++++ public/react/src/forge/Main/list.css | 93 +++++++++++++++++++++ public/react/src/forge/New/Index.js | 81 +++++++++++++------ public/react/src/forge/New/new.css | 11 +-- public/react/src/forge/css/index.css | 12 +-- 8 files changed, 308 insertions(+), 46 deletions(-) create mode 100644 public/react/src/forge/Main/Index.js create mode 100644 public/react/src/forge/Main/list.css diff --git a/public/react/public/index.html b/public/react/public/index.html index 738a796a2..5bde6d5ba 100755 --- a/public/react/public/index.html +++ b/public/react/public/index.html @@ -4,7 +4,7 @@ - + @@ -32,13 +32,13 @@ window.__isR = true; // 不支持ie9 ie10 if ( - ( navigator.userAgent.indexOf('MSIE 9') != -1 + ( navigator.userAgent.indexOf('MSIE 9') != -1 || navigator.userAgent.indexOf('MSIE 10') != -1 ) - && + && location.pathname.indexOf("/compatibility") == -1) { debugger; // location.href = './compatibility' - location.href = '/compatibility.html' + location.href = '/compatibility.html' } // const isMobile = (/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase())); const isWeiXin = (/MicroMessenger/i.test(navigator.userAgent.toLowerCase())); diff --git a/public/react/src/App.js b/public/react/src/App.js index badedbff6..e34ef8fb2 100644 --- a/public/react/src/App.js +++ b/public/react/src/App.js @@ -514,7 +514,7 @@ class App extends Component { {/* 项目 */} - { diff --git a/public/react/src/forge/Index.js b/public/react/src/forge/Index.js index 207706cbc..074e0bda1 100644 --- a/public/react/src/forge/Index.js +++ b/public/react/src/forge/Index.js @@ -12,18 +12,45 @@ import './css/index.css'; import Loadable from 'react-loadable'; import Loading from '../Loading'; + const ProjectNew = Loadable({ loader: () => import('./New/Index'), loading: Loading, }) +const ProjectIndex = Loadable({ + loader: () => import('./Main/Index'), + loading: Loading, +}) class Index extends Component{ + constructor(props){ + super(props); + this.state={ + current_user:undefined + } + } + componentDidMount=()=>{ + let current_user={ + user_id:50207 + } + + this.setState({ + current_user + }) + } render(){ + const {current_user} = this.state; return( - () + } + > + + () + (props) => () } > diff --git a/public/react/src/forge/Main/Index.js b/public/react/src/forge/Main/Index.js new file mode 100644 index 000000000..3021ec7bb --- /dev/null +++ b/public/react/src/forge/Main/Index.js @@ -0,0 +1,116 @@ +import React , { Component } from 'react'; + +import { Menu , Input , Dropdown , Icon, Result } from 'antd'; +import { Link } from 'react-router-dom' +import '../css/index.css' +import './list.css'; + +import axios from 'axios'; + +const Search = Input.Search; +const { SubMenu } = Menu; +class Index extends Component{ + + componentDidMount=()=>{ + this.getListData(); + } + + getListData=()=>{ + const {current_user} = this.props; + const url = `/projects.json`; + axios.get(url,{ + user_id:current_user && current_user.user_id + }).then((result)=>{ + if(result){ + + } + }).catch((error)=>{}) + } + + render(){ + const menu=( + + + 1st menu item + + + 2nd menu item + + + ) + return( + + + + 项目类型 + + + 开源托管项目 + 85 + + + + + 开源镜像项目 + 85 + + + + + 项目类别 + + + Navigation One + + } + > + + Option 1 + Option 2 + Option 3 + Option 4 + + + + + + + + console.log(value)} + className="list-r-Search" + /> + + + 排序 + + + + + + + + C+++++++++++++++++++ + + + + + + + + + + + + ) + } +} +export default Index; \ No newline at end of file diff --git a/public/react/src/forge/Main/list.css b/public/react/src/forge/Main/list.css new file mode 100644 index 000000000..120ead54a --- /dev/null +++ b/public/react/src/forge/Main/list.css @@ -0,0 +1,93 @@ +.ProjectListIndex{ + display: flex; + align-items: flex-start; + flex-wrap:wrap; +} +.list-left{ + width: 26%; + padding-right: 20px; + box-sizing: border-box; + margin-bottom: 20px; +} +.list-right{ + width:74%; +} +.list-l-Menu{ + border:1px solid #f4f4f4; + background: #fff; + border-radius: 4px; + margin-bottom: 20px; +} +.list-l-Menu>li{ + height: 40px; + line-height: 40px; + font-size: 1rem; + padding:0px 20px; + box-sizing: border-box; + color: #333; +} +.list-l-Menu>li a{ + display: flex; + justify-content: space-between; +} +.list-l-Menu li a span:last-child{ + color: #999; +} +.list-l-Menu .MenuTitle{ + background-color: #efefef; + border-radius: 4px 4px 0px 0px; + font-size: 16px; +} +.list-l-Menu > li:not(.MenuTitle):hover{ + background-color: #5fb8ff; +} +.list-l-Menu > li:not(.MenuTitle):hover a{ + color: #fff; +} +/* 左侧menu */ +.list-l-Menu .ant-menu-inline{ + border:none; +} +.list-l-Menu .ant-menu-inline .ant-menu-item{ + width:100%!important; +} +.list-l-Menu .ant-menu-item-group-title{ + padding:0px; +} + +.list-r-operation{ + display: flex; + align-items: center; +} +.list-r-Search{ + flex: 1; + width: 0; + margin-right: 20px; +} +.list-r-Search .ant-btn-lg{ + height: 38px; +} + +/* 列表 */ +.p-r-Item{ + display: flex; + padding:15px 0px; +} +.p-r-photo{ + width: 42px; + height: 42px; + border-radius: 50%; + margin-right: 15px; +} +.p-r-Infos{ + display: flex; + align-content: flex-start; + justify-content: space-between; +} + +@media screen and (max-width: 750px){ + .list-left,.list-right{ + width: 100%; + padding-right: 0px; + } +} \ No newline at end of file diff --git a/public/react/src/forge/New/Index.js b/public/react/src/forge/New/Index.js index 48c07e397..b07805e56 100644 --- a/public/react/src/forge/New/Index.js +++ b/public/react/src/forge/New/Index.js @@ -1,6 +1,6 @@ import React , { Component } from 'react'; -import { Input , Form , Select , Checkbox , Button } from 'antd'; +import { Input , Form , Select , Checkbox , Button , Divider } from 'antd'; import '../css/index.css'; import './new.css' @@ -97,14 +97,17 @@ class Index extends Component{ subMitFrom = () =>{ this.props.form.validateFieldsAndScroll((err, values) => { if(!err){ - console.log(values) - const url = `/projects.json`; + console.log(values); + const { projectsType } =this.props.match.params; + const url = projectsType === "deposit" ? "/projects.json" :"/projects/migrate.json"; axios.post(url,{ ...values, user_id:50207 }).then((result)=>{ if(result){ - + if(result.data.id){ + this.props.showNotification(`${projectsType === "deposit" ? "托管" :"镜像"}项目创建成功!`); + } } }).catch((error)=>{ console.log(error); @@ -115,7 +118,9 @@ class Index extends Component{ render(){ const { getFieldDecorator } = this.props.form; - + console.log(this.props); + // 项目类型:deposit-托管项目,mirror-镜像项目 + const { projectsType } =this.props.match.params; const { // authorValue, preType, @@ -130,9 +135,9 @@ class Index extends Component{ LicensesList }=this.state; return( - + - 创建托管项目 + 创建{projectsType === "deposit" ? "托管":"镜像"}项目 {/* )} */} + { + projectsType != "deposit" && + + + {getFieldDecorator('clone_addr', { + rules: [{ + required: true, message: '请填写镜像版本库地址' + }], + })( + + )} + + 示例:https://github.com/facebook/reack.git + + } @@ -159,6 +182,7 @@ class Index extends Component{ )} + @@ -224,26 +248,31 @@ class Index extends Component{ )} + - - {getFieldDecorator('ignore_id')( - - {GitignoreList} - - )} - - - {getFieldDecorator('license_id')( - - {LicensesList} - - )} - - + { + projectsType === "deposit" && + + + {getFieldDecorator('ignore_id')( + + {GitignoreList} + + )} + + + {getFieldDecorator('license_id')( + + {LicensesList} + + )} + + + } .ant-form-item:nth-child(2){ margin-left: 20px; } .formTip{ - margin:0px 0px 20px 110px; + margin:0px 0px 20px 146px; } @media screen and (max-width: 750px){ .newPanel_content{ diff --git a/public/react/src/forge/css/index.css b/public/react/src/forge/css/index.css index ca09e701a..37d6729f3 100644 --- a/public/react/src/forge/css/index.css +++ b/public/react/src/forge/css/index.css @@ -1,11 +1,13 @@ -body{ - font-size:62.5%; -} + .main{ width: 1200px; - margin:2rem auto; + margin:20px auto; +} +/* 背景色 */ +.back-white{ background: #fff; } +/* 灰色按钮-高度32 */ .btn_32{ border-radius: 4px; padding:0px 12px; @@ -18,7 +20,7 @@ body{ @media screen and (max-width: 1200px){ .main{ width:1000px; - margin:1rem auto; + margin:10px auto; } } @media screen and (max-width: 1000px){
C+++++++++++++++++++
示例:https://github.com/facebook/reack.git