Merge branch 'newVersion_forge' into dev_devOps

This commit is contained in:
caishi 2020-09-30 16:34:14 +08:00
commit 48d9580e78
5 changed files with 127 additions and 101 deletions

View File

@ -4,22 +4,12 @@
<head>
<meta charset="utf-8">
<meta name=”Keywords” Content=”EduCoder,信息技术实践教学,精品课程网,慕课MOOC″>
<meta name=”Keywords” Content=”实践课程,项目实战,java实训,python实战,人工智能技术,后端开发学习,移动开发入门″>
<meta name=”Keywords” Content=”翻转课堂,高效课堂创建,教学模式″>
<meta name=”Keywords” Content=”实训项目,python教程,C语言入门,java书,php后端开发,app前端开发,数据库技术″>
<meta name=”Keywords” Content=”在线竞赛,计算机应用大赛,编程大赛,大学生计算机设计大赛,全国高校绿色计算机大赛″>
<meta name=”Description”
Content=”EduCoder是信息技术类实践教学平台。EduCoder涵盖了计算机、大数据、云计算、人工智能、软件工程、物联网等专业课程。超10000个实训案例及22000个技能评测点建立学、练、评、测一体化实验环境。”>
<meta name=”Description”
Content=”EduCoder实践课程旨在于通过企业级实战实训案例帮助众多程序员提升各项业务能力。解决学生、学员、企业员工等程序设计能力、算法设计能力、问题求解能力、应用开发能力、系统运维能力等。”>
<meta name=”Description”
Content=”EduCoder翻转课堂教学模式颠覆了传统教学模式让教师与学生的关系由“权威”变成了“伙伴”。将学习的主动权转交给学生使学生可个性化化学学生的学习主体得到了彰显。”>
<meta name=”Description” Content=”EduCoder实训项目为单个知识点关卡实践训练帮助学生巩固单一弱点强化学习。 >
<meta name=”Description” Content=”EduCoder实践教学平台各类大赛为进一步提高各类学生综合运用高级语言程序设计能力培养创新意识和实践探索精神发掘优秀软件人才。 >
<meta name="theme-color" content="#000000">
<meta name=”Keywords” Content=”确实让创建更美好,协同开发平台″>
<meta name=”Keywords” Content=”Trustie Open Source Project>
<meta name=”Keywords” Content=”issue, bug, tracker>
<meta name=”Description” Content=”Trustie - 持续构建协同共享可信的软件创建生态开源创作与软件生产相结合支持大规模群体开展软件协同创新活动>
<meta name="theme-color" content="#000000">
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
<!-- <script type="text/javascript">
window.__isR = true;
if (

View File

@ -58,7 +58,7 @@ export function initAxiosInterceptors(props) {
initOnlineOfflineListener()
// TODO 避免重复的请求 https://github.com/axios/axios#cancellation
var
// proxy = "http://localhost:3000"
proxy = "http://localhost:3000"
proxy = "https://testforgeplus.trustie.net"
const requestMap = {};

View File

@ -161,9 +161,7 @@ class CoderRootDirectory extends Component {
index: k,
name: i,
path: str.substr(1),
type:
filePath && filePath.length > 0
? filePath[k] ? filePath[k].type : type : type,
type: filePath && filePath.length > 0 ? filePath[k] ? filePath[k].type : type : type,
});
});
const { projectsId , owner } = this.props.match.params;
@ -234,18 +232,17 @@ class CoderRootDirectory extends Component {
const rootList = [];
const readMeContent = [];
const readMeFile = [];
data &&
data.map((item, key) => {
rootList.push({
key,
message: item.commit && item.commit.message,
...item,
});
if (item.is_readme_file) {
readMeContent.push({ ...item });
readMeFile.push({ ...item });
}
data && data.map((item, key) => {
rootList.push({
key,
message: item.commit && item.commit.message,
...item,
});
if (item.is_readme_file) {
readMeContent.push({ ...item });
readMeFile.push({ ...item });
}
});
this.setState({
rootList: rootList,
readMeContent,
@ -287,26 +284,23 @@ class CoderRootDirectory extends Component {
<span className="commonBox-title-read">
{readMeContent[0].name}
</span>
{permission ? (
{permission ?
<a
onClick={() => this.ChangeFile(readMeFile[0], false)}
className="ml20 pull-right"
>
<i className="iconfont icon-bianji6 font-16 color-blue"></i>
</a>
) : (
:
""
)}
}
</div>
<div className="commonBox-info">
{readMeContent[0].content ? (
<RenderHtml
className="break_word_comments imageLayerParent"
value={readMeContent[0].content}
/>
) : (
{readMeContent[0].content ?
<RenderHtml className="break_word_comments imageLayerParent" value={readMeContent[0].content} />
:
<span>暂无~</span>
)}
}
</div>
</div>
);

View File

@ -1,12 +1,10 @@
import React, { Component } from "react";
import { Popconfirm, Select } from "antd";
import { Popconfirm , Select } from "antd";
import "./list.css";
import axios from "axios";
import Meditor from "../Newfile/m_editor";
import MDEditor from "../../modules/tpm/challengesnew/tpm-md-editor";
import RenderHtml from "../../components/render-html";
function bytesToSize(bytes) {
if (bytes === 0) return "0 B";
let k = 1024,
@ -21,7 +19,7 @@ class CoderRootFileDetail extends Component {
value: undefined,
language: undefined,
languages: undefined,
description:props.detail.content
description: props.detail.content
};
}
@ -95,8 +93,10 @@ class CoderRootFileDetail extends Component {
default_language = item;
}
}
this.state.languages = languages;
this.state.language = default_language;
this.setState({
languages,
language: default_language
})
};
select_language = (e) => {
@ -109,6 +109,13 @@ class CoderRootFileDetail extends Component {
onEdit && onEdit(flag);
};
DownLoadFile = (url) => {
let download_url = "/attachments/entries/get_file?download_url=" + url
window.open(download_url)
}
// 编辑文件
changeMmirror = (e, e1, value) => {
this.setState({
value,
@ -117,17 +124,16 @@ class CoderRootFileDetail extends Component {
deleteFile = () => {
const { branch, detail } = this.props;
const { projectsId , owner } = this.props.match.params;
const { projectsId, owner } = this.props.match.params;
const url = `/${owner}/${projectsId}/delete_file.json`;
axios
.delete(url, {
params: {
filepath: detail.path,
branch,
sha: detail.sha,
},
})
axios.delete(url, {
params: {
filepath: detail.path,
branch,
sha: detail.sha,
},
})
.then((result) => {
if (result) {
this.props.showNotification("删除成功!");
@ -160,7 +166,7 @@ class CoderRootFileDetail extends Component {
isDeveloper,
md
} = this.props;
const { language, languages , description } = this.state;
const { language, languages, description } = this.state;
let flag = current_user && current_user.login && (isManager || isDeveloper);
const Option = Select.Option;
@ -176,37 +182,52 @@ class CoderRootFileDetail extends Component {
{flag && (
<div>
{readOnly ? (
<a onClick={() => this.EditFile(false)} className="ml20">
<i className="iconfont icon-bianji1 font-15 color-grey-6"></i>
</a>
<span>
{
detail.direct_download ?
""
:
<span>
<a onClick={() => this.DownLoadFile(detail.download_url)} className="ml20">
<i className="iconfont icon-xiazai1 font-15 color-grey-6"></i>
</a>
<a onClick={() => this.EditFile(false)} className="ml20">
<i className="iconfont icon-bianji1 font-15 color-grey-6"></i>
</a>
</span>
}
</span>
) : (
<React.Fragment>
<Select
showSearch={true}
placeholder={"请选择文本语言"}
style={{ width: 200 }}
value={language}
onChange={this.select_language}
>
<Option value={undefined}>请选择文本语言</Option>
{languages &&
languages.map((item, key) => {
return (
<Option value={item} key={key}>
{item}
</Option>
);
})}
</Select>
<button
type="button"
className="ant-btn ant-btn-sm ml20"
onClick={() => this.EditFile(true)}
>
<span> </span>
</button>
</React.Fragment>
)}
<React.Fragment>
<Select
showSearch={true}
placeholder={"请选择文本语言"}
style={{ width: 200 }}
value={language}
onChange={this.select_language}
>
<Option value={undefined}>请选择文本语言</Option>
{languages &&
languages.map((item, key) => {
return (
<Option value={item} key={key}>
{item}
</Option>
);
})}
</Select>
<button
type="button"
className="ant-btn ant-btn-sm ml20"
onClick={() => this.EditFile(true)}
>
<span> </span>
</button>
</React.Fragment>
)}
<Popconfirm
title="确认删除这个文件?"
@ -239,21 +260,21 @@ class CoderRootFileDetail extends Component {
</a>
</div>
) : (
md && readOnly ?
<div className="files-md">
<RenderHtml className="file-md imageLayerParent" value={description} />
</div>
:
<Meditor
{...this.props}
{...this.state}
language={language ? language : "javascript"}
filepath={`/${detail.path}`}
content={detail.content}
readOnly={readOnly}
editorType="update"
></Meditor>
)}
md && readOnly ?
<div className="files-md">
<RenderHtml className="file-md imageLayerParent" value={description} />
</div>
:
<Meditor
{...this.props}
{...this.state}
language={language ? language : "javascript"}
filepath={`/${detail.path}`}
content={detail.content}
readOnly={readOnly}
editorType="update"
></Meditor>
)}
</div>
</div>
);

21
src/forge/Upload/untitled Normal file
View File

@ -0,0 +1,21 @@
1.请求URL https://code.ihub.org.cn/api/v1/mirrors/create.json
2.请求方式: POST
3.参数:
{
"image_url": "xxx.git", #必填,且后缀必为.git,
"language": "Ruby", #必填,如数据库不存在,则会创建新的记录
}
4. 返回值: {
"status": 1,
"message": "同步成功项目ID===1806"
}
5. 返回值说明: 仅有当有返回值且返回值的status 的值为1 才是创建成功,其余均为创建失败