版本库改版优化

dev_new_shixunsrepository
杨树明 5 years ago
parent 0fef39ce57
commit 46daa2f7a4

@ -106,6 +106,14 @@ export function getUploadActionUrlthree() {
let anewopens=md5(newopens+newtimestamp); let anewopens=md5(newopens+newtimestamp);
return `${getUrlmys()}/api/jupyters/import_with_tpm.json${isDev ? `?debug=${window._debugType || 'admin'}&randomcode=${newtimestamp}&client_key=${anewopens}` : `?randomcode=${newtimestamp}&client_key=${anewopens}`}` return `${getUrlmys()}/api/jupyters/import_with_tpm.json${isDev ? `?debug=${window._debugType || 'admin'}&randomcode=${newtimestamp}&client_key=${anewopens}` : `?randomcode=${newtimestamp}&client_key=${anewopens}`}`
} }
export function getupload_git_file(id) {
Railsgettimes()
let anewopens=md5(newopens+newtimestamp);
return `${getUrlmys()}/api/shixuns/${id}/upload_git_file.json${isDev ? `?debug=${window._debugType || 'admin'}&randomcode=${newtimestamp}&client_key=${anewopens}` : `?randomcode=${newtimestamp}&client_key=${anewopens}`}`
}
export function getUploadActionUrlOfAuth(id) { export function getUploadActionUrlOfAuth(id) {
Railsgettimes() Railsgettimes()
let anewopens=md5(newopens+newtimestamp); let anewopens=md5(newopens+newtimestamp);

@ -3,7 +3,7 @@
// export { default as OrderStateUtil } from '../routes/Order/components/OrderStateUtil'; // export { default as OrderStateUtil } from '../routes/Order/components/OrderStateUtil';
export { getImageUrl as getImageUrl, getUrl as getUrl, getRandomcode as getRandomcode,getUrlmys as getUrlmys, getUrl2 as getUrl2, setImagesUrl as setImagesUrl export { getImageUrl as getImageUrl, getUrl as getUrl, getRandomcode as getRandomcode,getUrlmys as getUrlmys, getUrl2 as getUrl2, setImagesUrl as setImagesUrl
, getUploadActionUrl as getUploadActionUrl,getUploadActionUrltwo as getUploadActionUrltwo ,getUploadActionUrlthree as getUploadActionUrlthree, getUploadActionUrlOfAuth as getUploadActionUrlOfAuth , getupload_git_file as getupload_git_file,getUploadActionUrl as getUploadActionUrl,getUploadActionUrltwo as getUploadActionUrltwo ,getUploadActionUrlthree as getUploadActionUrlthree, getUploadActionUrlOfAuth as getUploadActionUrlOfAuth
, getTaskUrlById as getTaskUrlById, TEST_HOST ,htmlEncode as htmlEncode } from './UrlTool'; , getTaskUrlById as getTaskUrlById, TEST_HOST ,htmlEncode as htmlEncode } from './UrlTool';
export { default as queryString } from './UrlTool2'; export { default as queryString } from './UrlTool2';

@ -70,6 +70,8 @@ class Sendresource extends Component{
} }
// 附件相关 START // 附件相关 START
handleChange = (info) => { handleChange = (info) => {
console.log(info)
if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') { if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') {
let fileList = info.fileList; let fileList = info.fileList;
if (info.file.status != "removed") { if (info.file.status != "removed") {

@ -1,16 +1,7 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import { Redirect } from 'react-router';
import PropTypes from 'prop-types';
import TPMRepository from './TPMRepository'
import axios from 'axios'; import axios from 'axios';
import { trace_collapse, info } from 'educoder';
import { trace_collapse, info } from 'educoder' import RepositoryCodeEditor from './shixunchild/Repository/RepositoryCodeEditor';
import RepositoryCodeEditor from './shixunchild/Repository/RepositoryCodeEditor'
class TPMRepositoryComponentdetails extends Component { class TPMRepositoryComponentdetails extends Component {
constructor(props) { constructor(props) {
@ -205,10 +196,9 @@ class TPMRepositoryComponentdetails extends Component {
<React.Fragment> <React.Fragment>
{ flag ? "" { flag ? ""
: :
<div className="tpmComment educontent clearfix mt30 mb80"> <div>
{/* 可能会影响到其他页面的样式,需要测试、协商 */} {/* 可能会影响到其他页面的样式,需要测试、协商 */}
<div className={`width100 fl edu-back-white`} <div>
style={{background: 'transparent'}}>
<RepositoryCodeEditor <RepositoryCodeEditor
{...this.state} {...this.state}
{...this.props} {...this.props}

@ -63,6 +63,7 @@ class Repository extends Component {
if(this.props.author!=undefined){ if(this.props.author!=undefined){
userauthority=this.props.author.login===""||this.props.author.user_id===""||this.props.author.login===null||this.props.author.user_id===null; userauthority=this.props.author.login===""||this.props.author.user_id===""||this.props.author.login===null||this.props.author.user_id===null;
} }
return ( return (
<React.Fragment> <React.Fragment>
{this.state.evaluationvisible===true?<Repositoryfile {this.state.evaluationvisible===true?<Repositoryfile
@ -207,16 +208,16 @@ class Repository extends Component {
src={getImageUrl(`images/`+commits[0].author.image_url)} src={getImageUrl(`images/`+commits[0].author.image_url)}
style={{display:userauthority===true?"none":"block"}} style={{display:userauthority===true?"none":"block"}}
width="35"/> width="35"/>
<a href={author.user_url} className="mr5 va_sub" target="_blank">{commits[0].author.name}</a> <a href={author.user_url} className="mr5 va_sub color-grey-8" target="_blank">{commits[0].author.name}</a>
<span className="color-grey-6 va_sub">提交于 <span className="color-grey-8 va_sub">提交于
<acronym title={commits[0].time}> <acronym title={commits[0].time}>
{commits===undefined?"":commits[0].time} {commits===undefined?"":commits[0].time}
</acronym> {commits===undefined?"":commits[0].title} </acronym> {commits===undefined?"":commits[0].title}
</span> </span>
<a href={`/shixuns/${match.params.shixunId}/${this.props.secret_repository_tab ? 'secret_repository' : 'repository'}/${match.params.shixunId}/commits`} <a href={`/shixuns/${match.params.shixunId}/${this.props.secret_repository_tab ? 'secret_repository' : 'repository'}/${match.params.shixunId}/commits`}
className="color-grey-6 fr font-16 mt3"> className="color-grey-8 fr font-16 mt3">
<i className="iconfont icon-tijiaojilu font-18 fl mr5"></i> <i className="iconfont icon-tijiaojilu font-18 fl mr5"></i>
<span className="fl">提交记录</span> <span className="fl color-grey-8 ">提交记录</span>
</a> </a>
</div>} </div>}
@ -242,12 +243,12 @@ class Repository extends Component {
})} })}
</div> </div>
<DirectoryTree multiple defaultExpandAll onSelect={this.onSelect} onExpand={this.onExpand}> {/*<DirectoryTree multiple defaultExpandAll onSelect={this.onSelect} onExpand={this.onExpand}>*/}
<TreeNode title="parent 0" key="0-0" icon={<i className="iconfont icon-xingzhuangjiehebeifen color-blue font-12" />}> {/* <TreeNode title="parent 0" key="0-0" icon={<i className="iconfont icon-xingzhuangjiehebeifen color-blue font-12" />}>*/}
<TreeNode title="leaf 0-0" key="0-0-0" isLeaf icon={<i className="iconfont icon-xingzhuangjiehe color-blue font-12" />} /> {/* <TreeNode title="leaf 0-0" key="0-0-0" isLeaf icon={<i className="iconfont icon-xingzhuangjiehe color-blue font-12" />} />*/}
<TreeNode title="leaf 0-1" key="0-0-1" isLeaf icon={<i className="iconfont icon-xingzhuangjiehe color-blue font-12" />}/> {/* <TreeNode title="leaf 0-1" key="0-0-1" isLeaf icon={<i className="iconfont icon-xingzhuangjiehe color-blue font-12" />}/>*/}
</TreeNode> {/* </TreeNode>*/}
</DirectoryTree> {/*</DirectoryTree>*/}
</div> </div>
</div> </div>

@ -100,6 +100,16 @@ class RepositoryAddFile extends Component {
} }
handleSubmit = () =>{ handleSubmit = () =>{
let matchpath =this.props.match.path;
let Repositoryflag =false;
if( matchpath.indexOf("repository")>-1){
Repositoryflag =false;
}
if(matchpath.indexOf("secret_repository")>-1){
Repositoryflag =true;
}
this.props.form.validateFieldsAndScroll((err, values) => { this.props.form.validateFieldsAndScroll((err, values) => {
if(!err){ if(!err){
let shixunId = this.props.match.params.shixunId; let shixunId = this.props.match.params.shixunId;
@ -107,10 +117,11 @@ class RepositoryAddFile extends Component {
axios.post(url,{ axios.post(url,{
path:values.path, path:values.path,
message:values.message, message:values.message,
content:this.extend_editor.getValue() content:this.extend_editor.getValue(),
secret_repository:Repositoryflag
}).then((result)=>{ }).then((result)=>{
if(result){ if(result){
this.props.history.push(`${result.data.url}`) this.props.history.push(Repositoryflag===true?`/shixuns/${shixunId}/secret_repository`:`/shixuns/${shixunId}/repository`)
} }
}).catch((error)=>{ }).catch((error)=>{
console.log(error); console.log(error);
@ -121,9 +132,18 @@ class RepositoryAddFile extends Component {
render(){ render(){
const {getFieldDecorator} = this.props.form; const {getFieldDecorator} = this.props.form;
let { shixunId } = this.props.match.params; let { shixunId } = this.props.match.params;
let matchpath =this.props.match.path;
let Repositoryflag ="";
if( matchpath.indexOf("repository")>-1){
Repositoryflag ="repository";
}
if(matchpath.indexOf("secret_repository")>-1){
Repositoryflag ="secret_repository";
}
return( return(
<div> <div>
<div className="educontent"> <div className="educontent mt30">
<style> <style>
{` {`
.formStyle .ant-form-item{ .formStyle .ant-form-item{
@ -151,42 +171,51 @@ class RepositoryAddFile extends Component {
}*/ }*/
`} `}
</style> </style>
<p className="mt10 mb10"> {/*<p className="mt10 mb10">*/}
<Breadcrumb separator='>' className="breadcrumb"> {/* <Breadcrumb separator='>' className="breadcrumb">*/}
<Breadcrumb.Item href='/shixuns'>实训项目</Breadcrumb.Item> {/* <Breadcrumb.Item href='/shixuns'>实训项目</Breadcrumb.Item>*/}
<Breadcrumb.Item href={`/shixuns/${shixunId}/repository`}>版本库</Breadcrumb.Item> {/* <Breadcrumb.Item href={`/shixuns/${shixunId}/repository`}>版本库</Breadcrumb.Item>*/}
<Breadcrumb.Item>添加新文件</Breadcrumb.Item> {/* <Breadcrumb.Item>添加新文件</Breadcrumb.Item>*/}
</Breadcrumb> {/* </Breadcrumb>*/}
</p> {/*</p>*/}
<Form onSubmit={this.handleSubmit} className="formStyle"> <Form onSubmit={this.handleSubmit} className="formStyle">
<div className="edu-back-white padding20-30 mb10"> <div className="edu-back-white padding20-30">
<Form.Item label="文件名"> <p className="ant-form-item-label">
{getFieldDecorator('path', { <div className={"font-20 color-black"}>新建文件</div>
rules: [ </p>
{ <Form.Item label="提交信息">
validator:this.checkPath
}] {getFieldDecorator('message', {
rules: [{
required: true, message: '请输入提交信息',
},{
whitespace: true, message: '请勿输入空格'
}],
})( })(
<Input placeholder="输入文件路径名src/HelloWorld.java" className="winput-300-35 fl"/> <Input placeholder="必填描述主要修改内容相当于Git Commit message的Header" size="large" className="winput-300-35 fl "/>
)} )}
</Form.Item> </Form.Item>
<div className={"mt20"}>
{getFieldDecorator('path')(
<span>
<span> </span><span><Input placeholder="文件名称或文件路径" className=" fl" style={{ width: 200 }} size="large"/></span><span className={"mt10 ml10 fl"}>提示:输入 / 可以将文件创建到新文件夹下</span>
</span>
)}
</div>
</div> </div>
<div className="edu-back-white padding30"> <div className="edu-back-white padding30">
<p className="ant-form-item-label">
<label>内容</label>
</p>
<div className="mt10 mb25 repoCMWrapper filecode"> <div className="mt10 mb25 repoCMWrapper filecode">
<textarea className="" id="codemirror-file-edit" style={{display:'none'}} name="content"></textarea> <textarea className="" id="codemirror-file-edit" style={{display:'none'}} name="content"></textarea>
</div> </div>
<Form.Item label="提交信息"> {/*<Form.Item label="提交信息">*/}
{getFieldDecorator('message', { {/* {getFieldDecorator('message', {*/}
rules: [{required: true, message: "请输入提交信息"}], {/* rules: [{required: true, message: "请输入提交信息"}],*/}
})( {/* })(*/}
<textarea className="winput-100-130 fl"></textarea> {/* <textarea className="winput-100-130 fl"></textarea>*/}
)} {/* )}*/}
</Form.Item> {/*</Form.Item>*/}
</div> </div>
<div className="clearfix mt30 edu-txt-right mb30"> <div className="clearfix mt30 edu-txt-right mb30">
{/*<Button type="primary" className="defalutSubmitbtn fr ml20" onClick={this.handleSubmit}>提交</Button>*/} {/*<Button type="primary" className="defalutSubmitbtn fr ml20" onClick={this.handleSubmit}>提交</Button>*/}
@ -195,7 +224,7 @@ class RepositoryAddFile extends Component {
</div> </div>
</Form> </Form>
</div> </div>
<Bottomsubmit {...this.props} {...this.state} url={`/shixuns/${shixunId}/repository`} onSubmits={() => this.handleSubmit()}/> <Bottomsubmit {...this.props} {...this.state} url={`/shixuns/${shixunId}/${Repositoryflag}`} onSubmits={() => this.handleSubmit()}/>
</div> </div>
) )
} }

@ -1,7 +1,7 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import { Form , Upload , Input , Icon, message } from 'antd'; import { Form , Upload , Input , notification, message } from 'antd';
import axios from 'axios'; import axios from 'axios';
import { getUploadActionUrl } from 'educoder'; import { getupload_git_file } from 'educoder';
import Bottomsubmit from "../../../modals/Bottomsubmit"; import Bottomsubmit from "../../../modals/Bottomsubmit";
import "./Repository.css" import "./Repository.css"
const { Dragger } = Upload; const { Dragger } = Upload;
@ -10,6 +10,7 @@ class RepositoryAddFileupload_files extends Component {
super(props); super(props);
this.state={ this.state={
filspath:"", filspath:"",
message:undefined,
fileList: [ fileList: [
// { // {
// uid: '-1', // uid: '-1',
@ -45,27 +46,18 @@ class RepositoryAddFileupload_files extends Component {
}) })
} }
handleChange = (info) => { handleChange = (info) => {
console.log(info)
console.log(info.file)
const { status } = info.file; //
if (status !== 'uploading') { // notification.open({
console.log(info.file, info.fileList); // message: '提示',
} // description: result.data.messages,
if (status === 'done') { // });
message.success(`${info.file.name} file uploaded successfully.`);
} else if (status === 'error') {
message.error(`${info.file.name} file upload failed.`);
}
let fileList = [...info.fileList]; let fileList = [...info.fileList];
fileList = fileList.slice(-2); fileList = fileList.slice(-2);
fileList = fileList.map(file => { fileList = fileList.map(file => {
if (file.response) { if (file.response) {
file.url = file.response.url; file.url = file.response.url;
} }
return file; return file;
@ -73,31 +65,109 @@ class RepositoryAddFileupload_files extends Component {
this.setState({ fileList }); this.setState({ fileList });
console.log(fileList)
}; };
onAttachmentRemove=(info)=>{ onAttachmentRemove=(info)=>{
let shixunId = this.props.match.params.shixunId;
let {message,filspath}=this.state;
if(message===""||message===undefined){
notification.open({
message: '提示',
description: '删除文件请先填写提交信息',
});
return
}
let matchpath =this.props.match.path;
let Repositoryflag =false;
if( matchpath.indexOf("repository")>-1){
Repositoryflag =false;
}
if(matchpath.indexOf("secret_repository")>-1){
Repositoryflag =true;
}
const url = `/shixuns//${shixunId}/delete_git_file.json`;
axios.delete(url, { data: {
path:filspath+info.name,
message:message,
secret_repository:Repositoryflag
}})
.then((response) => {
if (response.data.status == 0) {
}
})
.catch(function (error) {
console.log(error);
});
}
FormInput=(e)=>{
this.setState({
message:e.target.value
})
} }
render(){ render(){
const {getFieldDecorator} = this.props.form; const {getFieldDecorator} = this.props.form;
let { shixunId } = this.props.match.params; let { shixunId } = this.props.match.params;
// const props = {
// height:300,
// // name: 'file',
// multiple: true,
//
// action: `${getUploadActionUrl()}`,
// onChange: this.handleChange,
// onRemove: this.onAttachmentRemove,
// // beforeUpload: (file) => {
// // console.log('beforeUpload', file.name);
// // const isLt150M = file.size / 1024 / 1024 < 150;
// // if (!isLt150M) {
// // this.props.showNotification('文件大小必须小于150MB!');
// // }
// // return isLt150M;
// // },
// };
let matchpath =this.props.match.path;
let Repositoryflagtype =false;
let Repositoryflag ="";
if( matchpath.indexOf("repository")>-1){
Repositoryflag ="repository";
Repositoryflagtype =false;
}
if(matchpath.indexOf("secret_repository")>-1){
Repositoryflag ="secret_repository";
Repositoryflagtype =true;
}
const props = { const props = {
height:300, height:300,
name: 'file',
multiple: true, multiple: true,
fileList:this.state.fileList, data:{
action: getUploadActionUrl(), path:this.state.filspath,
message:this.state.message,
secret_repository:Repositoryflagtype
},
// fileList:this.state.fileList,
// showUploadList:false,
action: `${getupload_git_file(shixunId)}`,
onChange: this.handleChange, onChange: this.handleChange,
onRemove: this.onAttachmentRemove, onRemove: this.onAttachmentRemove,
// beforeUpload: (file) => { beforeUpload: (file) => {
// console.log('beforeUpload', file.name); let {message}=this.state;
// const isLt150M = file.size / 1024 / 1024 < 150; if(message===""||message===undefined){
// if (!isLt150M) { notification.open({
// this.props.showNotification('文件大小必须小于150MB!'); message: '提示',
// } description: '上传文件请先填写提交信息',
// return isLt150M; });
// }, return false
}
},
}; };
return( return(
<div> <div>
<div className="educontent mt30"> <div className="educontent mt30">
@ -149,12 +219,12 @@ class RepositoryAddFileupload_files extends Component {
{getFieldDecorator('message', { {getFieldDecorator('message', {
rules: [{ rules: [{
required: true, message: '请输入名称', required: true, message: '请输入提交信息',
},{ },{
whitespace: true, message: '请勿输入空格' whitespace: true, message: '请勿输入空格'
}], }],
})( })(
<Input placeholder="必填描述主要修改内容相当于Git Commit message的Header" className="winput-300-35 fl"/> <Input placeholder="必填描述主要修改内容相当于Git Commit message的Header" onInput={this.FormInput} className="winput-300-35 fl"/>
)} )}
</Form.Item> </Form.Item>
@ -175,7 +245,7 @@ class RepositoryAddFileupload_files extends Component {
<i className="iconfont icon-shangchuan font-50 color-blue" /> <i className="iconfont icon-shangchuan font-50 color-blue" />
</p> </p>
<p className="ant-upload-hint mt20"> <p className="ant-upload-hint mt30">
拖拽文件或 <span className="color-blue" >点击此处上传</span> 拖拽文件或 <span className="color-blue" >点击此处上传</span>
</p> </p>
</Dragger> </Dragger>
@ -191,7 +261,7 @@ class RepositoryAddFileupload_files extends Component {
</div> </div>
</Form> </Form>
</div> </div>
<Bottomsubmit {...this.props} {...this.state} url={`/shixuns/${shixunId}/repository`} onSubmits={() => this.handleSubmit()}/> <Bottomsubmit {...this.props} {...this.state} url={`/shixuns/${shixunId}/${Repositoryflag}`} onSubmits={() => this.handleSubmit()}/>
</div> </div>
) )
} }

@ -18,6 +18,7 @@ import Popconfirm from 'antd/lib/popconfirm';
import 'antd/lib/popconfirm/style/css'; import 'antd/lib/popconfirm/style/css';
import { message } from 'antd'; import { message } from 'antd';
import Bottomsubmit from "../../../modals/Bottomsubmit";
require('codemirror/lib/codemirror.css'); require('codemirror/lib/codemirror.css');
@ -124,7 +125,7 @@ class RepositoryCodeEditor extends Component {
secret_repository: this.props.secret_repository_tab, secret_repository: this.props.secret_repository_tab,
content: this.extend_editor.getValue(), content: this.extend_editor.getValue(),
// type: forTest === true ? 1 : 0, // type: forTest === true ? 1 : 0,
path: path path: path,
} }
).then((response) => { ).then((response) => {
if (response.data.content) { if (response.data.content) {
@ -134,34 +135,43 @@ class RepositoryCodeEditor extends Component {
}) })
} }
render() { render() {
const { fileContent, match, saveCode } = this.props; const { fileContent, shixunId, saveCode } = this.props;
const { codeSaving } = this.state; const { codeSaving } = this.state;
let matchpath =this.props.match.path;
let Repositoryflag ="";
if( matchpath.indexOf("repository")>-1){
Repositoryflag ="repository";
}
if(matchpath.indexOf("secret_repository")>-1){
Repositoryflag ="secret_repository";
}
return ( return (
<React.Fragment> <React.Fragment>
<div className={" tpmComment educontent clearfix mt30 mb80"}>
<div className="tpmComment educontent clearfix mt30"> <div className={`width100 fl edu-back-white`} >
<RepositoryDirectories {...this.props}></RepositoryDirectories> <div className="tpmComment educontent clearfix mt20">
<RepositoryDirectories {...this.props} tpmComment={true}></RepositoryDirectories>
<div className="edu-back-skyblue padding5-10 clearfix">
<div className="fl"> {/*<div className="edu-back-skyblue padding5-10 clearfix">*/}
</div> {/* <div className="fl">*/}
<div id="file_action" className="recordBanner fr"> {/* </div>*/}
{ codeSaving ? {/* <div id="file_action" className="recordBanner fr">*/}
<a href="javascript:void(0);" {/* { codeSaving ?*/}
className="fr mt12 mr20 color-grey">保存中...</a> {/* <a href="javascript:void(0);"*/}
: <Popconfirm title="确定要保存修改后的代码吗?" {/* className="fr mt12 mr20 color-grey">保存中...</a>*/}
placement="bottom" {/* : <Popconfirm title="确定要保存修改后的代码吗?"*/}
onConfirm={() => this.saveCode(this.extend_editor.getValue())} {/* placement="bottom"*/}
okText="确定" cancelText="取消"> {/* onConfirm={() => this.saveCode(this.extend_editor.getValue())}*/}
{/* onClick={this.saveCode} {/* okText="确定" cancelText="取消">*/}
onClick={() => saveCode(this.extend_editor.getValue())} {/* /!* onClick={this.saveCode}*/}
*/} {/* onClick={() => saveCode(this.extend_editor.getValue())}*/}
<a href="javascript:void(0);" {/* *!/*/}
className="fr mt12 mr20 color-blue">保存</a> {/* <a href="javascript:void(0);"*/}
</Popconfirm> } {/* className="fr mt12 mr20 color-blue">保存</a>*/}
</div> {/* </Popconfirm> }*/}
<div className="cl"></div> {/* </div>*/}
</div> {/* <div className="cl"></div>*/}
{/*</div>*/}
<style> <style>
{` {`
@ -177,6 +187,9 @@ class RepositoryCodeEditor extends Component {
</div> </div>
</div> </div>
</div>
</div>
<Bottomsubmit {...this.props} {...this.state} url={`/shixuns/${shixunId}/${Repositoryflag}`} onSubmits={() => this.saveCode(this.extend_editor.getValue())}/>
</React.Fragment> </React.Fragment>
); );

@ -61,9 +61,9 @@ class RepositoryCombinePath extends Component {
margin-left: 24px; margin-left: 24px;
} }
`}</style> `}</style>
<div> 第一版本库合并路径 </div>
<div className={"df"}> <div className={"df"}>
<Input disabled={!isEdit} value={value} onChange={this.onChange}></Input> <span className={"mt2"}> {!isEdit?"源路径:":"目标路径:"}</span><span><Input disabled={!isEdit} value={value} onChange={this.onChange}></Input></span>
{!isEdit && <WordsBtn className="wordsBtn" onClick={this.onEdit} style="blue">修改</WordsBtn>} {!isEdit && <WordsBtn className="wordsBtn" onClick={this.onEdit} style="blue">修改</WordsBtn>}
{isEdit && <WordsBtn className="wordsBtn" onClick={this.onSave} style="blue">保存</WordsBtn>} {isEdit && <WordsBtn className="wordsBtn" onClick={this.onSave} style="blue">保存</WordsBtn>}
</div> </div>

@ -31,27 +31,28 @@ class RepositoryDirectories extends Component {
<React.Fragment> <React.Fragment>
{ pathArray.length !== 0 && { pathArray.length !== 0 &&
<div className="bor-bottom-greyE padding5-10 font-14 "> <div className={this.props.tpmComment===true?" padding5-10 font-14 mb10":" bor-bottom-greyE padding5-10 font-14"}>
<a className="color-blue" <a className={this.props.tpmComment===true?"ml10 color888":"color-blue"}
onClick={() => fetchRepo(0)} onClick={this.props.tpmComment===true?"":() => fetchRepo(0)}
> >
{match.params.shixunId} {match.params.shixunId}
</a> </a>
<span className="ml3 mr3">/</span> <span className={this.props.tpmComment===true?"color888 ml3 mr3":"ml3 mr3"}>/</span>
{ pathArray.map((item, index) => { { pathArray.map((item, index) => {
// /shixuns/3ozvy5f8/repository/3ozvy5f8/master/shixun_show/src // /shixuns/3ozvy5f8/repository/3ozvy5f8/master/shixun_show/src
return ( return (
<React.Fragment> <React.Fragment>
{ this.props.nameTypeMap[item] === 'tree' || item.indexOf('.') === -1 { this.props.nameTypeMap[item] === 'tree' || item.indexOf('.') === -1
? <a ? <a
onClick={() => fetchRepo(index + 1)} onClick={this.props.tpmComment===true?"":() => fetchRepo(index + 1)}
className="color-blue"> className={this.props.tpmComment===true?"color888":"color-blue"}
>
{item}</a> {item}</a>
: :
<a > <a className={this.props.tpmComment===true?"color888":""}>
{item}</a> {item}</a>
} }
{index !== pathArray.length - 1 && <span className="ml3 mr3">/</span>} {index !== pathArray.length - 1 && <span className={this.props.tpmComment===true?"color888 ml3 mr3":"ml3 mr3"}>/</span>}
</React.Fragment> </React.Fragment>
) )
}) })

Loading…
Cancel
Save