forgeplus-react/src/modules/tpm/shixunchild/Repository/RepositoryCombinePath.js

107 lines
3.3 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import React, { Component } from 'react';
import axios from 'axios';
import { trace_collapse, WordsBtn } from 'educoder'
import { message, Input } from 'antd';
import Repositoryfile from "./Repositoryfile";
const $ = window.$;
class RepositoryCombinePath extends Component {
constructor(props) {
super(props)
this.state = {
value: this.props.secret_dir_path || '',
newvalue:'',
isEdit: false,
}
}
onSave = (value) => {
const { shixunId, pathArray } = this.props;
const url = `/shixuns/${shixunId}/set_secret_dir.json`
axios.post(url, {
secret_dir_path:value
}
).then((response) => {
if (response.data) {
this.setState({
newvalue:value
})
// message.success('保存成功');
}
})
}
// onChange = (e) => {
// const { value } = e.target;
// this.setState({ value })
// }
// onEdit = () => {
// this.setState({isEdit: true}, () => {
// window.$('.combinePathEditRow input')[0].focus()
// });
// }
Selectfiledirectory=()=>{
this.setState({
visibles:true
})
}
hideNewFolder=()=>{
this.setState({
visibles:false
})
}
render() {
const { fileContent, match, saveCode } = this.props;
const { newvalue, value } = this.state;
return (
<div className="combinePathEditRow">
<style>{`
.combinePathEditRow {
margin: 4px 0;
}
.combinePathEditRow input {
flex: 0 0 300px;
border: none;
}
.combinePathEditRow .wordsBtn {
margin-left: 24px;
}
`}</style>
{this.state.visibles===true?<Repositoryfile
titles={"选择文件目录"}
evaluationvisible={this.state.visibles}
hideNewFolder={this.hideNewFolder}
{...this.state}
{...this.props}
RepositoryCombinePath={true}
selectupfilspath={(value)=>this.onSave(value)}
/>:""}
<div className={"mt2"}>合并版本库路径</div>
<div className={"df"}>
{/*<span className={"mt2"}> {!isEdit?"源路径:":"目标路径:"}</span><span><Input disabled={!isEdit} value={value} onChange={this.onChange}></Input></span>*/}
<span className={"mt3"}> <span>源路径</span><span>{value}</span></span> <span><i className={"iconfont icon-youjiang color-grey-8 ml20"}></i></span>
<span className={"mt4 ml20"}> <span>目标路径</span><span>{newvalue}</span></span>
<WordsBtn className="wordsBtn mt4" onClick={this.Selectfiledirectory} style="blue">选择文件目录</WordsBtn>
{/*{isEdit && <WordsBtn className="wordsBtn" onClick={this.onSave} style="blue">保存</WordsBtn>}*/}
</div>
</div>
);
}
}
export default RepositoryCombinePath;