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