Merge branch 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun
commit
5f2562013b
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
@ -1,115 +1,131 @@
|
|||||||
import React,{ Component } from "react";
|
import React,{ Component } from "react";
|
||||||
import {Tooltip} from 'antd'
|
import {Tooltip} from 'antd'
|
||||||
import moment from 'moment'
|
import moment from 'moment'
|
||||||
import { getUrl, WordsBtn } from 'educoder'
|
import { getUrl, WordsBtn } from 'educoder'
|
||||||
class BoardsListItem extends Component{
|
class BoardsListItem extends Component{
|
||||||
constructor(props){
|
constructor(props){
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onTitleClick = (discussMessage) => {
|
onTitleClick = (discussMessage) => {
|
||||||
const isAdminOrStudent = this.props.isAdminOrStudent();
|
if(this.props.checkIfLogin()===false){
|
||||||
if (!isAdminOrStudent && discussMessage.is_public == false) {
|
this.props.showLoginDialog()
|
||||||
// 没有权限访问
|
return
|
||||||
return;
|
}
|
||||||
}
|
if(this.props.checkIfProfileCompleted()===false){
|
||||||
const cid = this.props.match.params.coursesId
|
this.setState({
|
||||||
const board_id = this.props.match.params.boardId
|
AccountProfiletype:true
|
||||||
this.props.toDetailPage(cid, board_id, discussMessage.id)
|
})
|
||||||
}
|
return
|
||||||
render(){
|
}
|
||||||
let { addGroup } = this.state;
|
if(this.props.checkIfProfessionalCertification()===false){
|
||||||
const isAdmin = this.props.isAdmin()
|
this.props.showProfileCompleteDialog()
|
||||||
const isAdminOrStudent = this.props.isAdminOrStudent()
|
return
|
||||||
const { checkBox, discussMessage, onSticky, onItemClick, current_user } = this.props;
|
}
|
||||||
if (!discussMessage || !discussMessage.author) {
|
|
||||||
return '';
|
const isAdminOrStudent = this.props.isAdminOrStudent();
|
||||||
}
|
if (!isAdminOrStudent && discussMessage.is_public == false) {
|
||||||
let canNotLink = !isAdminOrStudent && discussMessage.is_public == false
|
// 没有权限访问
|
||||||
|
return;
|
||||||
return(
|
}
|
||||||
<div className="panel-inner-fourm boardsList">
|
const cid = this.props.match.params.coursesId
|
||||||
<style>{`
|
const board_id = this.props.match.params.boardId
|
||||||
.boardsList .panel-list-img {
|
this.props.toDetailPage(cid, board_id, discussMessage.id)
|
||||||
width: 50px;
|
}
|
||||||
height: 50px;
|
render(){
|
||||||
}
|
let { addGroup } = this.state;
|
||||||
`}</style>
|
const isAdmin = this.props.isAdmin()
|
||||||
{ checkBox }
|
const isAdminOrStudent = this.props.isAdminOrStudent()
|
||||||
<a href={`/users/${discussMessage.author.login}`} alt="用户" style={{"width":"50px","height":"50px","display":"block", margin: "0 10px"}}>
|
const { checkBox, discussMessage, onSticky, onItemClick, current_user } = this.props;
|
||||||
{/* /images/avatars/User/1?1529221779 */}
|
if (!discussMessage || !discussMessage.author) {
|
||||||
<img
|
return '';
|
||||||
alt="1?1529221779" className="panel-list-img mr15" height="50"
|
}
|
||||||
src={`${getUrl()}/images/${discussMessage.author.image_url}`} width="50"
|
let canNotLink = !isAdminOrStudent && discussMessage.is_public == false
|
||||||
></img>
|
|
||||||
</a>
|
return(
|
||||||
<div className="clearfix ds pr pt5 contentSection" onClick={() => onItemClick(discussMessage)}>
|
<div className="panel-inner-fourm boardsList">
|
||||||
<h6>
|
<style>{`
|
||||||
<a href="javascript:void(0)" className="panel-list-title hide fl mt5 color-dark font-bd"
|
.boardsList .panel-list-img {
|
||||||
style={{ fontWeight: 'bold', cursor: (canNotLink ? 'default' : 'poninter'), maxWidth: '700px' }}
|
width: 50px;
|
||||||
onClick={canNotLink ? () => {} : () => this.onTitleClick(discussMessage)}
|
height: 50px;
|
||||||
title={`${discussMessage.subject.length > 40 ? discussMessage.subject : ''}`}
|
}
|
||||||
>{discussMessage.subject}</a>
|
`}</style>
|
||||||
{ !!discussMessage.sticky && <span className="btn-cir btn-cir-red fl mt5 ml5">置顶</span> }
|
{ checkBox }
|
||||||
{
|
<a href={`/users/${discussMessage.author.login}`} alt="用户" style={{"width":"50px","height":"50px","display":"block", margin: "0 10px"}}>
|
||||||
|
{/* /images/avatars/User/1?1529221779 */}
|
||||||
discussMessage.is_public == false ? (<Tooltip title={`${isAdminOrStudent ? '私有属性' : '私有属性,非课堂成员不能访问'}`}>
|
<img
|
||||||
<i className="iconfont icon-guansuo color-grey-c ml10 font-16 fl mt4"></i>
|
alt="1?1529221779" className="panel-list-img mr15" height="50"
|
||||||
</Tooltip>) : ""
|
src={`${getUrl()}/images/${discussMessage.author.image_url}`} width="50"
|
||||||
}
|
></img>
|
||||||
</h6>
|
</a>
|
||||||
|
<div className="clearfix ds pr pt5 contentSection" onClick={() => onItemClick(discussMessage)}>
|
||||||
<div className="cl"></div>
|
<h6>
|
||||||
<p className="color-grey panel-lightgrey mt18 fl">
|
<Tooltip title={canNotLink?"私有属性,非课堂成员不能访问":`${discussMessage.subject.length > 40 ? discussMessage.subject : ''}`} placement="bottom">
|
||||||
<span className="mr50">
|
<a className="panel-list-title hide fl mt5 color-dark font-bd pointer"
|
||||||
<a href={`/users/${discussMessage.author.login}`} className="panel-name-small hide fl mr15 mr30 color-grey3 font-14">{discussMessage.author.name}</a>
|
style={{ fontWeight: 'bold', cursor: (canNotLink ? 'poninter' : 'poninter'), maxWidth: '700px' }}
|
||||||
|
onClick={canNotLink ? () => {} : () => this.onTitleClick(discussMessage)}
|
||||||
{ discussMessage.total_replies_count != 0 && <span className="mr15 color-grey9 font-14">{discussMessage.total_replies_count} 回复</span> }
|
>{discussMessage.subject}</a>
|
||||||
{ discussMessage.praises_count != 0 && <span className="mr15 color-grey9 font-14">{discussMessage.praises_count} 点赞</span> }
|
</Tooltip>
|
||||||
{ discussMessage.visits != 0 && <span className="mr15 color-grey9 font-14">{discussMessage.visits} 浏览</span> }
|
{ !!discussMessage.sticky && <span className="btn-cir btn-cir-red fl mt5 ml5">置顶</span> }
|
||||||
|
{
|
||||||
<span className="mr15 color-light-grey-C font-14">{moment(discussMessage.created_on).fromNow()} </span>
|
|
||||||
</span>
|
discussMessage.is_public == false ? (<Tooltip title={`${isAdminOrStudent ? '私有属性' : '私有属性,非课堂成员不能访问'}`} placement="bottom">
|
||||||
</p>
|
<i className="iconfont icon-guansuo color-grey-c ml10 font-16 fl mt4"></i>
|
||||||
<div className="fr mt15">
|
</Tooltip>) : ""
|
||||||
{(isAdmin || discussMessage.author.login == current_user.login) &&
|
}
|
||||||
<WordsBtn style="blue" className="fl font-16 ml28"
|
</h6>
|
||||||
onClick={(e) => { this.props.toEditPage(this.props.match.params.coursesId, this.props.match.params.boardId, discussMessage.id )} }>编辑</WordsBtn> }
|
|
||||||
|
<div className="cl"></div>
|
||||||
{ isAdmin && <WordsBtn style="blue" className="fl font-16 ml28"
|
<p className="color-grey panel-lightgrey mt18 fl">
|
||||||
onClick={(e) => { debugger; onSticky(discussMessage); e.cancelBubble = true; e.stopPropagation();}}>
|
<span className="mr50">
|
||||||
{ discussMessage.sticky ? '取消置顶' : '置顶' }</WordsBtn> }
|
<a href={`/users/${discussMessage.author.login}`} className="panel-name-small hide fl mr15 mr30 color-grey3 font-14">{discussMessage.author.name}</a>
|
||||||
</div>
|
|
||||||
|
{ discussMessage.total_replies_count != 0 && <span className="mr15 color-grey9 font-14">{discussMessage.total_replies_count} 回复</span> }
|
||||||
|
{ discussMessage.praises_count != 0 && <span className="mr15 color-grey9 font-14">{discussMessage.praises_count} 点赞</span> }
|
||||||
|
{ discussMessage.visits != 0 && <span className="mr15 color-grey9 font-14">{discussMessage.visits} 浏览</span> }
|
||||||
|
|
||||||
|
<span className="mr15 color-light-grey-C font-14">{moment(discussMessage.created_on).fromNow()} </span>
|
||||||
{/* { (isAdmin || discussMessage.author.login == current_user.login) &&
|
</span>
|
||||||
<div className="homepagePostSetting" style={{"right":"4px","top":"5px","display":"block"}}>
|
</p>
|
||||||
<ul>
|
<div className="fr mt15">
|
||||||
<li className="edu-position edu-position-hidebox">
|
{(isAdmin || discussMessage.author.login == current_user.login) &&
|
||||||
<i className="fa fa-bars color-grey-b"></i>
|
<WordsBtn style="blue" className="fl font-16 ml28"
|
||||||
<ul className="edu-position-hide undis">
|
onClick={(e) => { this.props.toEditPage(this.props.match.params.coursesId, this.props.match.params.boardId, discussMessage.id )} }>编辑</WordsBtn> }
|
||||||
{(isAdmin || discussMessage.author.login == current_user.login) && <li><a href="javascript:void(0)" onClick={(e) => {
|
|
||||||
this.props.toEditPage(this.props.match.params.coursesId, this.props.match.params.boardId, discussMessage.id )} } >编辑</a></li>
|
{ isAdmin && <WordsBtn style="blue" className="fl font-16 ml28"
|
||||||
}
|
onClick={(e) => { debugger; onSticky(discussMessage); e.cancelBubble = true; e.stopPropagation();}}>
|
||||||
{isAdmin && <li><a href="javascript:void(0)" onClick={(e) => { debugger; onSticky(discussMessage); e.cancelBubble = true; e.stopPropagation();} }>
|
{ discussMessage.sticky ? '取消置顶' : '置顶' }</WordsBtn> }
|
||||||
{ discussMessage.sticky ? '取消置顶' : '置顶' }
|
</div>
|
||||||
</a></li>
|
|
||||||
}
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
{/* { (isAdmin || discussMessage.author.login == current_user.login) &&
|
||||||
} */}
|
<div className="homepagePostSetting" style={{"right":"4px","top":"5px","display":"block"}}>
|
||||||
|
<ul>
|
||||||
|
<li className="edu-position edu-position-hidebox">
|
||||||
</div>
|
<i className="fa fa-bars color-grey-b"></i>
|
||||||
</div>
|
<ul className="edu-position-hide undis">
|
||||||
)
|
{(isAdmin || discussMessage.author.login == current_user.login) && <li><a href="javascript:void(0)" onClick={(e) => {
|
||||||
}
|
this.props.toEditPage(this.props.match.params.coursesId, this.props.match.params.boardId, discussMessage.id )} } >编辑</a></li>
|
||||||
}
|
}
|
||||||
|
{isAdmin && <li><a href="javascript:void(0)" onClick={(e) => { debugger; onSticky(discussMessage); e.cancelBubble = true; e.stopPropagation();} }>
|
||||||
|
{ discussMessage.sticky ? '取消置顶' : '置顶' }
|
||||||
|
</a></li>
|
||||||
|
}
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
} */}
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
export default BoardsListItem;
|
export default BoardsListItem;
|
Loading…
Reference in new issue