This commit is contained in:
caicai8 2020-04-07 15:54:55 +08:00
parent cc35070e7b
commit 1090f473ea
3 changed files with 142 additions and 115 deletions

View File

@ -242,24 +242,25 @@ class Detail extends Component{
const { project_id } = this.state;
const url = `/projects/${project_id}/forks.json`;
axios.post(url).then(result=>{
if (result) {
if (result.data.status === 0) {
if (result && result.data.status === 0) {
// if (result.data.status === 0) {
this.props.history.push(`/projects/${result.data.id}/coders`);
this.props.showNotification(result.data.message);
}
// }
this.setState({
isSpin:false
})
} else {
if(result.data.status !== 401){
this.props.showNotification(result.data.message);
}else{
this.setState({
isSpin:false
})
this.props.showNotification(`服务器开小差了`);
}
}
// else {
// if(result.data.status !== 401){
// this.props.showNotification(result.data.message);
// }else{
// this.setState({
// isSpin:false
// })
// this.props.showNotification(`服务器开小差了`);
// }
// }
}).catch(error=>{
this.setState({
isSpin:false

View File

@ -366,82 +366,85 @@ class Detail extends Component{
journalsdata.issue_journals.map((item,key)=>{
return(
<li key={key}>
<div className="df">
<img className="user_img" src={getImageUrl(`images/${item.user_picture && item.user_picture}`)} alt=""/>
<div className="detail_context" >
<div className="topWrapper_detali">
<p className="ml6 detail_p lineH40">
{item.user_name}
<span className="color-grey-9 ml3 mr3">评论于</span>
<Tooltip title={item.format_time} placement="bottom">
<span>{item.created_at}</span>
</Tooltip>
</p>
<div className="detail_right" style={{display: current_user && isedit === undefined && (current_user.admin || current_user.login === item.user_login) ? "block" : "none"}}>
<span onClick={()=>this.editdetail(item.content,item.id)} className="detail_edit_action">编辑</span>
<Popconfirm placement="bottom" title={'确定要删除当前评论吗?'} okText="是" cancelText="否" onConfirm={()=>this.deleteorder(item.id)}>
<span className="detail_edit_action">删除</span>
</Popconfirm>
</div>
</div>
<div className="detail_ptitlecount">
<div style={{display: (isedit && isedit === item.id) ? "none" : "block"}} >
{
item.content ?
this.commentCtx(item.content)
:
<div>
{this.renderJournalList(item.journal_details)}
</div>
}
{
item && item.attachments && item.attachments.length > 0 ?
<Attachments attachments={item.attachments} showNotification={this.props.showNotification} canDelete={current_user && (current_user.admin || current_user.login === item.user_login)}/>
:
""
}
{
key > 0&&
<div className="order_line" style={{marginLeft:80}}></div>
}
<div className="df">
<img className="user_img" src={getImageUrl(`images/${item.user_picture && item.user_picture}`)} alt=""/>
<div className="detail_context" >
<div className="topWrapper_detali">
<p className="ml6 detail_p lineH40">
{item.user_name}
<span className="color-grey-9 ml3 mr3">评论于</span>
<Tooltip title={item.format_time} placement="bottom">
<span>{item.created_at}</span>
</Tooltip>
</p>
<div className="detail_right" style={{display: current_user && isedit === undefined && (current_user.admin || current_user.login === item.user_login) ? "block" : "none"}}>
<span onClick={()=>this.editdetail(item.content,item.id)} className="detail_edit_action">编辑</span>
<Popconfirm placement="bottom" title={'确定要删除当前评论吗?'} okText="是" cancelText="否" onConfirm={()=>this.deleteorder(item.id)}>
<span className="detail_edit_action">删除</span>
</Popconfirm>
</div>
<div style={{display: (isedit && isedit === item.id) ? "block" : "none"}}>
<div className="quillContent mt20">
<QuillForEditor
wrapStyle={{
height: '220px',
opacity:1,
}}
autoFocus={true}
style={{ height: '170px' }}
placeholder="添加评论..."
options={options}
value={countvalue}
onContentChange={this.onEditContentChange}
// showUploadImage={this.handleShowImage}
/>
<p className="quillFlag">
{ quillFlag && <span className="">请输入评论内容</span>}
</div>
<div className="detail_ptitlecount">
<div style={{display: (isedit && isedit === item.id) ? "none" : "block"}} >
{
item.content ?
this.commentCtx(item.content)
:
<div>
{this.renderJournalList(item.journal_details)}
</div>
}
{
item && item.attachments && item.attachments.length > 0 ?
<Attachments attachments={item.attachments} showNotification={this.props.showNotification} canDelete={current_user && (current_user.admin || current_user.login === item.user_login)}/>
:
""
}
</div>
<div style={{display: (isedit && isedit === item.id) ? "block" : "none"}}>
<div className="quillContent mt20">
<QuillForEditor
wrapStyle={{
height: '220px',
opacity:1,
}}
autoFocus={true}
style={{ height: '170px' }}
placeholder="添加评论..."
options={options}
value={countvalue}
onContentChange={this.onEditContentChange}
// showUploadImage={this.handleShowImage}
/>
<p className="quillFlag">
{ quillFlag && <span className="">请输入评论内容</span>}
</p>
</div>
{/*<TextArea style={{height:"200px"}} value={this.state.countvalue} onChange={this.changmodelname}/>*/}
<p className="clearfix mt15">
<a className="topWrapper_btn fr" type="submit" onClick={()=>this.updatedetail(item.id)}>保存</a>
<a className="a_btn cancel_btn fr" type="submit" onClick={()=>this.editdetail(item.content,undefined)}>取消</a>
</p>
</div>
{/*<TextArea style={{height:"200px"}} value={this.state.countvalue} onChange={this.changmodelname}/>*/}
<p className="clearfix mt15">
<a className="topWrapper_btn fr" type="submit" onClick={()=>this.updatedetail(item.id)}>保存</a>
<a className="a_btn cancel_btn fr" type="submit" onClick={()=>this.editdetail(item.content,undefined)}>取消</a>
</p>
</div>
</div>
<div style={{display: this.state.display}}>
<div className="div_line" ></div>
{/* <List
grid={{ gutter: 16, column: 6 }}
dataSource={valuse}
renderItem={obj => (
<List.Item>
<img class="list_img" onClick={this.imgshow} src="https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=1608431072,669449145&fm=27&gp=0.jpg" alt=""/>
</List.Item>
)}
/> */}
<div style={{display: this.state.display}}>
<div className="div_line" ></div>
{/* <List
grid={{ gutter: 16, column: 6 }}
dataSource={valuse}
renderItem={obj => (
<List.Item>
<img class="list_img" onClick={this.imgshow} src="https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=1608431072,669449145&fm=27&gp=0.jpg" alt=""/>
</List.Item>
)}
/> */}
</div>
</div>
</div>
</div>
</div>
<div className="order_line" style={{marginLeft:80}}></div>
</li>
)
})
@ -524,42 +527,50 @@ class Detail extends Component{
</Spin>
{ Paginations }
{
current_user && current_user.login ?
<React.Fragment>
<div className="order_line" style={{marginLeft:80}}></div>
<div className="df">
<img className="user_img" src={getImageUrl(`images/${current_user && current_user.image_url}`)} alt=""/>
<div className="new_context">
<div className="quillContent">
<QuillForEditor
<div className="df">
<img className="user_img" src={getImageUrl(`images/${current_user && current_user.image_url}`)} alt=""/>
<div className="new_context">
<div className="quillContent">
<QuillForEditor
wrapStyle={{
height: '220px',
opacity:1,
}}
autoFocus={true}
style={{ height: '150px' }}
placeholder="添加评论..."
options={options}
value={quillValue}
onContentChange={this.onContentChange}
// showUploadImage={this.handleShowImage}
/>
<p className="quillFlag">
{ quillFlag && <span className="">请输入评论内容</span>}
wrapStyle={{
height: '220px',
opacity:1,
}}
autoFocus={true}
style={{ height: '150px' }}
placeholder="添加评论..."
options={options}
value={quillValue}
onContentChange={this.onContentChange}
// showUploadImage={this.handleShowImage}
/>
<p className="quillFlag">
{ quillFlag && <span className="">请输入评论内容</span>}
</p>
</div>
<UploadComponent load={this.UploadFunc} isComplete={showFiles} changeIsComplete={this.changeIsComplete}></UploadComponent>
<p className="clearfix mt15">
<a className="topWrapper_btn fr" type="submit" onClick={this.addjournals}>评论</a>
{
data && data.user_permission ?
<a className="Closeor_btn fr" type="submit"
onClick={() => this.closedetail(data && data.issue_status === "关闭" ? 2 : 5)}>{data && data.issue_status === "关闭" ? "重新开启" : "关闭"}</a>
:
""
}
</p>
</div>
<UploadComponent load={this.UploadFunc} isComplete={showFiles} changeIsComplete={this.changeIsComplete}></UploadComponent>
<p className="clearfix mt15">
<a className="topWrapper_btn fr" type="submit" onClick={this.addjournals}>评论</a>
{
data && data.user_permission ?
<a className="Closeor_btn fr" type="submit"
onClick={() => this.closedetail(data && data.issue_status === "关闭" ? 2 : 5)}>{data && data.issue_status === "关闭" ? "重新开启" : "关闭"}</a>
:
""
}
</p>
</div>
</div>
</React.Fragment>
:
<div className="loginDiv"><Link to={`/login`}>登录</Link></div>
}
</div>
<div className="list-left DetailRight mt10" style={{backgroundColor:"#fff"}}>
<p>

View File

@ -453,6 +453,21 @@
.inputcount{
width: 40%;
}
.loginDiv{
border: 1px solid #f7c977;
background: rgb(255, 204, 113,0.3);
text-align: center;
padding:8px 0px;
border-radius: 4px;
width: 100%;
color: #999;
margin-top: 15px;
}
.loginDiv a{
text-decoration: underline;
color: #4CACFF;
margin-right: 3px;
}
.tagdiv{
padding: 15px;