dev_forge
Jasder 5 years ago
commit c0eb363fe3

@ -328,7 +328,7 @@ class ApplicationController < ActionController::Base
def current_user
# User.current
User.find_by_id 1
User.find_by_id 50207
end
## 默认输出json

@ -9,7 +9,7 @@ const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin');
const WatchMissingNodeModulesPlugin = require('react-dev-utils/WatchMissingNodeModulesPlugin');
const eslintFormatter = require('react-dev-utils/eslintFormatter');
const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin');
// const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin');
const getClientEnvironment = require('./env');
const paths = require('./paths');
@ -267,7 +267,7 @@ module.exports = {
// https://github.com/jmblog/how-to-optimize-momentjs-with-webpack
// You can remove this if you don't use Moment.js:
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
new MonacoWebpackPlugin(),
// new MonacoWebpackPlugin(),
],
// Some libraries import Node modules but don't use them in the browser.
// Tell Webpack to provide empty mocks for them so importing them works.

@ -50,8 +50,8 @@
"loglevel": "^1.6.1",
"material-ui": "^1.0.0-beta.40",
"moment": "^2.23.0",
"monaco-editor": "^0.15.6",
"monaco-editor-webpack-plugin": "^1.7.0",
"monaco-editor": "0.13",
"monaco-editor-webpack-plugin": "^1.8.1",
"npm": "^6.10.1",
"numeral": "^2.0.6",
"object-assign": "4.1.1",

@ -4,6 +4,7 @@
<meta charset="utf-8">
<!--<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">-->
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0,minimum-scale=1.0,user-scalable=0" />
<!-- width=device-width, initial-scale=1 , shrink-to-fit=no -->
<!-- <meta name="viewport" content=""> -->

@ -169,6 +169,11 @@ const ForumsIndexComponent = Loadable({
loading: Loading,
})
const ProjectIndex = Loadable({
loader: () => import('./forge/Index'),
loading: Loading,
})
// trustie plus forum
// const TPForumsIndexComponent = Loadable({
// loader: () => import('./modules/tp-forums/TPForumsIndex'),
@ -391,7 +396,8 @@ class App extends Component {
});
initAxiosInterceptors(this.props);
this.getAppdata();
// 顶部和底部的动态设置
// this.getAppdata();
//
// axios.interceptors.response.use((response) => {
// // console.log("response"+response);
@ -507,6 +513,14 @@ class App extends Component {
<Router>
<Switch>
{/* 项目 */}
<Route path="/forge"
render={
(props) => {
return (<ProjectIndex {...this.props} {...props} {...this.state} />)
}
}></Route>
{/*题库*/}
<Route path="/topicbank/:username/:topicstype"
render={

@ -50,8 +50,8 @@ export function initAxiosInterceptors(props) {
// proxy = "http://testbdweb.educoder.net"
// proxy = "https://testeduplus2.educoder.net"
//proxy="http://47.96.87.25:48080"
proxy="https://pre-newweb.educoder.net"
proxy="https://test-newweb.educoder.net"
// proxy="https://pre-newweb.educoder.net"
// proxy="https://test-newweb.educoder.net"
//proxy="https://test-jupyterweb.educoder.net"
//proxy="http://192.168.2.63:3001"

@ -0,0 +1,33 @@
import React , { Component } from 'react';
import {Route,Switch} from 'react-router-dom';
import { SnackbarHOC } from 'educoder';
import { CNotificationHOC } from '../modules/courses/common/CNotificationHOC';
import './css/index.css';
import Loadable from 'react-loadable';
import Loading from '../Loading';
const ProjectNew = Loadable({
loader: () => import('./New/Index'),
loading: Loading,
})
class Index extends Component{
render(){
return(
<Switch {...this.props}>
<Route exact path="/forge/projects/new"
render={
(props) => (<ProjectNew {...this.props} {...props} {...this.state} />)
}
></Route>
</Switch>
)
}
}
export default CNotificationHOC() ( SnackbarHOC() ( Index ));

@ -0,0 +1,270 @@
import React , { Component } from 'react';
import { Input , Form , Select , Checkbox , Button } from 'antd';
import '../css/index.css';
import './new.css'
import axios from 'axios' ;
const Option = Select.Option
class Index extends Component{
constructor(props){
super(props);
this.state={
// authorValue:"0",
preType:"0",
// subType:"0",
languageValue:"0",
gitignoreType:"0",
LicensesType:"0",
CategoryList:undefined,
LanguageList:undefined,
GitignoreList:undefined,
LicensesList:undefined,
}
}
componentDidMount=()=>{
// 获取项目类别
this.getCategory();
// 获取项目语言
this.getLanguage();
// 获取Gitignore
this.getGitignore();
// 获取开源许可证
this.getLicenses();
}
getCategory=()=>{
const url = `/project_categories.json`
axios.get(url).then((result)=>{
if(result){
let CategoryList = this.setOptionsList(result.data.project_categories)
this.setState({
CategoryList
})
}
}).catch((error)=>{})
}
getLanguage=()=>{
const url = `/project_languages.json`
axios.get(url).then((result)=>{
if(result){
let LanguageList = this.setOptionsList(result.data.project_languages)
this.setState({
LanguageList
})
}
}).catch((error)=>{})
}
getGitignore=()=>{
const url = `/ignores.json`
axios.get(url).then((result)=>{
if(result){
let GitignoreList = this.setOptionsList(result.data.ignores)
this.setState({
GitignoreList
})
}
}).catch((error)=>{})
}
getLicenses=()=>{
const url = `/licenses.json`
axios.get(url).then((result)=>{
if(result){
let LicensesList = this.setOptionsList(result.data.licenses)
this.setState({
LicensesList
})
}
}).catch((error)=>{})
}
setOptionsList = (data) =>{
let list = undefined;
if(data && data.length > 0){
list = data.map((item,key)=>{
return(
<Option key={item.id}>{item.name}</Option>
)
})
}
return list;
}
subMitFrom = () =>{
this.props.form.validateFieldsAndScroll((err, values) => {
if(!err){
console.log(values)
const url = `/projects.json`;
axios.post(url,{
...values,
user_id:50207
}).then((result)=>{
if(result){
}
}).catch((error)=>{
console.log(error);
})
}
})
}
render(){
const { getFieldDecorator } = this.props.form;
const {
// authorValue,
preType,
// subType,
languageValue,
gitignoreType,
LicensesType,
CategoryList,
LanguageList,
GitignoreList,
LicensesList
}=this.state;
return(
<div className="main">
<div className="newPanel">
<div className="newPanel_title">创建托管项目</div>
<Form>
<div className="newPanel_content">
{/* <Form.Item
label="拥有者"
>
{getFieldDecorator('user_id', {
rules: [{
required: true, message: '请选择拥有者'
}],
})(
<Select value={authorValue}>
<Option key="0">kosasa</Option>
</Select>
)}
</Form.Item> */}
<Form.Item
label="项目名称"
>
{getFieldDecorator('name', {
rules: [{
required: true, message: '请填写项目名称'
}],
})(
<Input placeholder="例如:团队协作方法与研究"/>
)}
</Form.Item>
<Form.Item
label="项目简介"
>
{getFieldDecorator('description', {
rules: [{
required: true, message: '请填写项目简介'
}],
})(
<Input.TextArea autoSize={{ minRows: 2, maxRows: 6 }}/>
)}
</Form.Item>
<Form.Item
label="仓库名称"
style={{marginBottom:"0px"}}
>
{getFieldDecorator('repository_name', {
rules: [{
required: true, message: '请填写仓库名称'
}],
})(
<Input placeholder="请输入仓库名称"/>
)}
</Form.Item>
<p className="formTip">好的存储库名称使用简单深刻和独特的关键字</p>
{/* <div className="newContent_inline"> */}
<Form.Item
label="项目类别"
>
{getFieldDecorator('project_category_id', {
rules: [{
required: true, message: '请选择大类别'
}],
})(
<Select value={preType}>
{CategoryList}
</Select>
)}
</Form.Item>
{/* <Form.Item>
{getFieldDecorator('project_language_id', {
rules: [{
required: true, message: '请选择子类别'
}],
})(
<Select value={subType} className="inline_Tag">
<Option key="0">HTMl</Option>
<Option key="1">HTMl111</Option>
</Select>
)}
</Form.Item> */}
{/* </div> */}
<Form.Item
label="项目语言"
>
{getFieldDecorator('project_language_id', {
rules: [{
required: true, message: '请选择项目语言'
}],
})(
<Select value={languageValue}>
{LanguageList}
</Select>
)}
</Form.Item>
</div>
<div className="newPanel_content">
<Form.Item
label=".gitignore"
>
{getFieldDecorator('ignore_id')(
<Select value={gitignoreType} className="inline_Tag">
{GitignoreList}
</Select>
)}
</Form.Item>
<Form.Item
label="开源许可证"
>
{getFieldDecorator('license_id')(
<Select value={LicensesType} className="inline_Tag">
{LicensesList}
</Select>
)}
</Form.Item>
<Form.Item
label="可见性"
style={{marginBottom:"0px"}}
>
{getFieldDecorator('private')(
<Checkbox value="limit">将项目设为私有</Checkbox>
)}
</Form.Item >
<p className="formTip">只有企业所有人或拥有权限的企业成员才能看到</p>
<Form.Item className="formTip">
<Button type="primary" onClick={this.subMitFrom} className="mr20">创建项目</Button>
<a className="btn_32" onClick={() => this.props.onCancel()}>取消</ a>
</Form.Item>
</div>
</Form>
</div>
</div>
)
}
}
const WrappedIndexForm = Form.create({ name: 'NewWorkForm' })(Index);
export default WrappedIndexForm;

@ -0,0 +1,77 @@
.newPanel{
border:1px solid #eaeaea;
border-radius: 4px;
}
.newPanel_title{
height: 3rem;
line-height: 3rem;
background: #f0f0f0;
text-align: center;
border-radius: 4px 4px 0px 0px;
font-size: 1.6em;
border-bottom: 1px solid #f0f0f0
}
.newPanel_content{
width: 600px;
margin:1rem auto;
}
.newPanel_content .ant-row.ant-form-item{
display: flex;
flex-wrap: wrap;
}
.newPanel_content .ant-form-item-label{
width: 100px;
display: block;
text-align: right;
margin-right: 10px;
height: 37px;
line-height: 40px;
}
.newPanel_content .ant-form-item-control-wrapper{
flex: 1;
min-width: 280px;
}
.newPanel_content .ant-select-selection{
height: 37px;
}
.newPanel_content .ant-select-selection__rendered,.newPanel_content input{
height: 35px;
line-height: 35px;
}
.newContent_inline{
display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-items:flex-end
}
.newContent_inline .ant-form-item-control-wrapper{
min-width: 235px;
}
.newContent_inline .inline_Tag{
width: 235px;
}
.newContent_inline > .ant-form-item:nth-child(2){
margin-left: 20px;
}
.formTip{
margin:0px 0px 20px 110px;
}
@media screen and (max-width: 750px){
.newPanel_content{
width:95%;
}
.newPanel_content .ant-row.ant-form-item{
display: grid
}
.newPanel_content .ant-form-item-label{
text-align: left;
}
.newContent_inline > .ant-form-item:nth-child(2){
margin-left:0px
}
.formTip{
margin:0px 0px 20px 0px;
}
}

@ -0,0 +1,35 @@
body{
font-size:62.5%;
}
.main{
width: 1200px;
margin:2rem auto;
background: #fff;
}
.btn_32{
border-radius: 4px;
padding:0px 12px;
height: 32px;
line-height: 32px;
background-color: #f4f4f4;
color: #666;
display: inline-block;
}
@media screen and (max-width: 1200px){
.main{
width:1000px;
margin:1rem auto;
}
}
@media screen and (max-width: 1000px){
.main{
width: 750px;
margin:1rem auto;
}
}
@media screen and (max-width: 750px){
.main{
width: 95%;
margin:1rem auto;
}
}

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save