issue评论

forge
caicai8 5 years ago
parent 90f882cf99
commit 874ee23c0f

@ -329,7 +329,7 @@ class ApplicationController < ActionController::Base
def current_user def current_user
# User.current # User.current
if Rails.env.development? if Rails.env.development?
user_id = 36390 user_id = 50207
else else
user_id = 130328 user_id = 130328
end end

@ -47,15 +47,8 @@ export function initAxiosInterceptors(props) {
// TODO 读取到package.json中的配置 // TODO 读取到package.json中的配置
var //proxy = "http://localhost:3000" var //proxy = "http://localhost:3000"
//proxy = "http://testbdweb.trustie.net" // proxy="http://123.59.135.93:56666"
//proxy = "http://testbdweb.educoder.net" proxy="http://localhost:3000"
// 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://test-jupyterweb.educoder.net"
//proxy="http://192.168.2.63:3001"
proxy="http://123.59.135.93:56666"
// 在这里使用requestMap控制避免用户通过双击等操作发出重复的请求 // 在这里使用requestMap控制避免用户通过双击等操作发出重复的请求
// 如果需要支持重复的请求考虑config里面自定义一个allowRepeat参考来控制 // 如果需要支持重复的请求考虑config里面自定义一个allowRepeat参考来控制

@ -85,8 +85,7 @@ class Detail extends Component{
}).then(result=>{ }).then(result=>{
if(result){ if(result){
this.props.form.setFieldsValue({ this.props.form.setFieldsValue({
content: "", content: ""
attachments_ids: undefined
}); });
this.setState({ this.setState({
showFiles: false showFiles: false
@ -117,7 +116,6 @@ class Detail extends Component{
search_count:result.data.journals_count, search_count:result.data.journals_count,
isSpin:false, isSpin:false,
fileList:undefined, fileList:undefined,
showFiles: true
}) })
} }
}).catch(error=>{ }).catch(error=>{
@ -161,7 +159,6 @@ class Detail extends Component{
//修改评论 //修改评论
updatedetail=(id)=>{ updatedetail=(id)=>{
console.log("updtedetail", this.state)
const {page, limit } = this.state; const {page, limit } = this.state;
const {orderId} = this.props.match.params; const {orderId} = this.props.match.params;
const url = `/issues/${orderId}/journals/${id}.json`; const url = `/issues/${orderId}/journals/${id}.json`;
@ -276,6 +273,13 @@ class Detail extends Component{
this.getjournalslist(page,limit); this.getjournalslist(page,limit);
} }
// 判断是否重新上传文件
changeIsComplete=(flag)=>{
this.setState({
showFiles:flag
})
}
render(){ render(){
const { projectsId,orderId} = this.props.match.params; const { projectsId,orderId} = this.props.match.params;
const { data,journalsdata, page, limit, search_count, isSpin, isedit, showFiles } = this.state; const { data,journalsdata, page, limit, search_count, isSpin, isedit, showFiles } = this.state;
@ -423,8 +427,7 @@ class Detail extends Component{
{ Paginations } { Paginations }
<div className="df"> <div className="df">
<Link to={``}><img className="user_img" <Link to={``}><img className="user_img" src={getImageUrl(`images/${current_user && current_user.image_url}`)} alt=""/></Link>
src={getImageUrl(`images/${current_user && current_user.image_url}`)} alt=""/></Link>
<div className="new_context"> <div className="new_context">
<Form.Item> <Form.Item>
{getFieldDecorator('content', { {getFieldDecorator('content', {
@ -435,7 +438,7 @@ class Detail extends Component{
<TextArea placeholder="添加评论..." style={{height: "200px"}}/> <TextArea placeholder="添加评论..." style={{height: "200px"}}/>
)} )}
</Form.Item> </Form.Item>
<UploadComponent load={this.UploadFunc} isComplete={showFiles}></UploadComponent> <UploadComponent load={this.UploadFunc} isComplete={showFiles} changeIsComplete={this.changeIsComplete}></UploadComponent>
<p className="clearfix mt15"> <p className="clearfix mt15">
<a className="topWrapper_btn fr" type="submit" onClick={this.addjournals}>评论</a> <a className="topWrapper_btn fr" type="submit" onClick={this.addjournals}>评论</a>
<a className="Closeor_btn fr" type="submit" <a className="Closeor_btn fr" type="submit"

@ -29,6 +29,7 @@ class Index extends Component{
} }
deleteAttachment = (file) => { deleteAttachment = (file) => {
const url = `/attachments/${file.response ? file.response.id : file.uid}.json` const url = `/attachments/${file.response ? file.response.id : file.uid}.json`
axios.delete(url, { axios.delete(url, {
}).then((response) => { }).then((response) => {
@ -54,6 +55,8 @@ class Index extends Component{
handleChange = (info) => { handleChange = (info) => {
const { changeIsComplete } = this.props;
changeIsComplete && changeIsComplete(true);
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;
@ -71,30 +74,26 @@ class Index extends Component{
} }
render(){ render(){
//判断是否已经提交,如已提交评论则上一条评论数据清除
const { isComplete } = this.props;
const { fileList } = this.state; const { fileList } = this.state;
let list = isComplete === true ? fileList : undefined;
const upload = { const upload = {
name: 'file', name: 'file',
fileList, fileList:list,
action: `${getUploadActionUrl()}`, action: `${getUploadActionUrl()}`,
onChange:this.handleChange, onChange:this.handleChange,
onRemove: this.onAttachmentRemove, onRemove: this.onAttachmentRemove,
}; };
return( return(
<div> <div>
<Dragger {...upload} <Dragger {...upload} >
>
<Icon type="inbox" /> <Icon type="inbox" />
<p className="ant-upload-text">拖动文件或者点击此处上传</p> <p className="ant-upload-text">拖动文件或者点击此处上传</p>
</Dragger> </Dragger>
</div> </div>
// <Upload {...upload}>
// <Button>
// <Icon type="upload" />上传文件
// </Button>
// </Upload>
) )
} }
} }

Loading…
Cancel
Save