dev_forum
parent
6c444d975f
commit
2019f4cb5d
@ -1,204 +1,204 @@
|
|||||||
import React,{ Component } from "react";
|
import React,{ Component } from "react";
|
||||||
import {Menu} from "antd";
|
import {Menu} from "antd";
|
||||||
|
|
||||||
|
|
||||||
import CoursesListType from '../coursesPublic/CoursesListType';
|
import CoursesListType from '../coursesPublic/CoursesListType';
|
||||||
import { WordsBtn } from 'educoder'
|
import { WordsBtn } from 'educoder'
|
||||||
import PollTabFirst from './PollDetailTabFirst'
|
import PollTabFirst from './PollDetailTabFirst'
|
||||||
import PollTabSecond from './PollDetailTabSecond'
|
import PollTabSecond from './PollDetailTabSecond'
|
||||||
import PollTabThird from './PollDetailTabThird'
|
import PollTabThird from './PollDetailTabThird'
|
||||||
import PollTabForth from './PollDetailTabForth'
|
import PollTabForth from './PollDetailTabForth'
|
||||||
|
|
||||||
import DownloadMessage from '../../modals/DownloadMessage';
|
import DownloadMessage from '../../modals/DownloadMessage';
|
||||||
|
|
||||||
import ImmediatelyPublish from './pollPublicBtn/ImmediatelyPublish'
|
import ImmediatelyPublish from './pollPublicBtn/ImmediatelyPublish'
|
||||||
import ImmediatelyEnd from './pollPublicBtn/ImmediatelyEnd'
|
import ImmediatelyEnd from './pollPublicBtn/ImmediatelyEnd'
|
||||||
import CancelPublish from './pollPublicBtn/CancelPublish'
|
import CancelPublish from './pollPublicBtn/CancelPublish'
|
||||||
|
|
||||||
import '../css/members.css'
|
import '../css/members.css'
|
||||||
import '../css/busyWork.css'
|
import '../css/busyWork.css'
|
||||||
|
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
|
|
||||||
const map={1:"未发布",2:"提交中",3:"已截止"}
|
const map={1:"未发布",2:"提交中",3:"已截止",4:"已结束"}
|
||||||
class PollDetailIndex extends Component{
|
class PollDetailIndex extends Component{
|
||||||
constructor(props){
|
constructor(props){
|
||||||
super(props);
|
super(props);
|
||||||
this.state={
|
this.state={
|
||||||
tab:["0"],
|
tab:["0"],
|
||||||
pollDetail:undefined,
|
pollDetail:undefined,
|
||||||
user_permission:undefined
|
user_permission:undefined
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getPollInfo=()=>{
|
getPollInfo=()=>{
|
||||||
console.log(this.props);
|
console.log(this.props);
|
||||||
let pollId=this.props.match.params.pollId;
|
let pollId=this.props.match.params.pollId;
|
||||||
let url=`/polls/${pollId}/common_header.json`
|
let url=`/polls/${pollId}/common_header.json`
|
||||||
axios.get(url).then((result)=>{
|
axios.get(url).then((result)=>{
|
||||||
if(result.status==200){
|
if(result.status==200){
|
||||||
this.setState({
|
this.setState({
|
||||||
pollDetail:result.data,
|
pollDetail:result.data,
|
||||||
user_permission:result.data.user_permission
|
user_permission:result.data.user_permission
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}).catch((error)=>{
|
}).catch((error)=>{
|
||||||
console.log(error);
|
console.log(error);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount(){
|
componentDidMount(){
|
||||||
const query =this.props.location.search;
|
const query =this.props.location.search;
|
||||||
if(query.indexOf("?")!=-1){
|
if(query.indexOf("?")!=-1){
|
||||||
const type = query.split('?');
|
const type = query.split('?');
|
||||||
let name = type[1].split("tab=");
|
let name = type[1].split("tab=");
|
||||||
name = String(name).split(",");
|
name = String(name).split(",");
|
||||||
name = decodeURI(name[1]);
|
name = decodeURI(name[1]);
|
||||||
if(name!=undefined && name!="" && name!="undefined"){
|
if(name!=undefined && name!="" && name!="undefined"){
|
||||||
this.setState({
|
this.setState({
|
||||||
tab:[name]
|
tab:[name]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.getPollInfo();
|
this.getPollInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
//切换tab
|
//切换tab
|
||||||
changeTab=(e)=>{
|
changeTab=(e)=>{
|
||||||
this.setState({
|
this.setState({
|
||||||
tab:e.key
|
tab:e.key
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
confirmysl(url){
|
confirmysl(url){
|
||||||
this.refs.DownloadMessage.confirmysl(url);
|
this.refs.DownloadMessage.confirmysl(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
render(){
|
render(){
|
||||||
let {tab,pollDetail,user_permission}=this.state;
|
let {tab,pollDetail,user_permission}=this.state;
|
||||||
|
|
||||||
const isAdmin =this.props.isAdmin();
|
const isAdmin =this.props.isAdmin();
|
||||||
const isStudent = this.props.isStudent();
|
const isStudent = this.props.isStudent();
|
||||||
return(
|
return(
|
||||||
<div className="newMain">
|
<div className="newMain">
|
||||||
<DownloadMessage {...this.props} ref="DownloadMessage" />
|
<DownloadMessage {...this.props} ref="DownloadMessage" />
|
||||||
<div className="educontent mt10 mb50">
|
<div className="educontent mt10 mb50">
|
||||||
<p className="clearfix mb20">
|
<p className="clearfix mb20">
|
||||||
<WordsBtn style="grey" className="fl" to={`/courses/${this.props.match.params.coursesId}/students`}>{this.props.coursedata.name}</WordsBtn>
|
<WordsBtn style="grey" className="fl" to={`/courses/${this.props.match.params.coursesId}/students`}>{this.props.coursedata.name}</WordsBtn>
|
||||||
<span className="color-grey-9 fl ml3 mr3">></span>
|
<span className="color-grey-9 fl ml3 mr3">></span>
|
||||||
<WordsBtn style="grey" className="fl" to={`/courses/${this.props.match.params.coursesId}/polls/${user_permission && user_permission.left_banner_id}`}>问卷</WordsBtn>
|
<WordsBtn style="grey" className="fl" to={`/courses/${this.props.match.params.coursesId}/polls/${user_permission && user_permission.left_banner_id}`}>问卷</WordsBtn>
|
||||||
<span className="color-grey-9 fl ml3 mr3">></span>
|
<span className="color-grey-9 fl ml3 mr3">></span>
|
||||||
<span>问卷详情</span>
|
<span>问卷详情</span>
|
||||||
</p>
|
</p>
|
||||||
<p className="clearfix mb20 lineh-25">
|
<p className="clearfix mb20 lineh-25">
|
||||||
<span className="color-grey-3 font-24 fl task-hide break-word" style={{maxWidth:"900px",lineHeight:"25px"}} title={`${pollDetail && pollDetail.polls_name}`}>{pollDetail && pollDetail.polls_name}</span>
|
<span className="color-grey-3 font-24 fl task-hide break-word" style={{maxWidth:"900px",lineHeight:"25px"}} title={`${pollDetail && pollDetail.polls_name}`}>{pollDetail && pollDetail.polls_name}</span>
|
||||||
<span className="mt3 fl" style={{height:"25px"}}>
|
<span className="mt3 fl" style={{height:"25px"}}>
|
||||||
<CoursesListType typelist={[`${map[pollDetail && pollDetail.polls_status]}`]} typesylename={""} />
|
<CoursesListType typelist={[`${map[pollDetail && pollDetail.polls_status]}`]} typesylename={""} />
|
||||||
</span>
|
</span>
|
||||||
<WordsBtn className="fr font-16 mt2" style="grey" onClick={()=>this.props.history.goBack()}>返回</WordsBtn>
|
<WordsBtn className="fr font-16 mt2" style="grey" onClick={()=>this.props.history.goBack()}>返回</WordsBtn>
|
||||||
</p>
|
</p>
|
||||||
<div>
|
<div>
|
||||||
<div className="clearfix edu-back-white pl30 pr30 bor-bottom-greyE">
|
<div className="clearfix edu-back-white pl30 pr30 bor-bottom-greyE">
|
||||||
<div className="fl task_menu_ul">
|
<div className="fl task_menu_ul">
|
||||||
<Menu mode="horizontal" selectedKeys={tab} onClick={this.changeTab}>
|
<Menu mode="horizontal" selectedKeys={tab} onClick={this.changeTab}>
|
||||||
<Menu.Item key="0">答题列表</Menu.Item>
|
<Menu.Item key="0">答题列表</Menu.Item>
|
||||||
{
|
{
|
||||||
(isAdmin || (isStudent && pollDetail && pollDetail.show_result == 1 && pollDetail.polls_status == 3 && user_permission && user_permission.current_status==1)) && <Menu.Item key="1">统计结果</Menu.Item>
|
(isAdmin || (isStudent && pollDetail && pollDetail.show_result == 1 && pollDetail.polls_status == 3 && user_permission && user_permission.current_status==1)) && <Menu.Item key="1">统计结果</Menu.Item>
|
||||||
}
|
}
|
||||||
{ isAdmin && <Menu.Item key="2">问卷预览</Menu.Item> }
|
{ isAdmin && <Menu.Item key="2">问卷预览</Menu.Item> }
|
||||||
<Menu.Item key="3">设置</Menu.Item>
|
<Menu.Item key="3">设置</Menu.Item>
|
||||||
</Menu>
|
</Menu>
|
||||||
</div>
|
</div>
|
||||||
{
|
{
|
||||||
isAdmin &&
|
isAdmin &&
|
||||||
<span className="fr mt22">
|
<span className="fr mt22">
|
||||||
<WordsBtn style="blue" to={`/courses/${this.props.match.params.coursesId}/polls/${this.props.match.params.pollId}/edit`} className="fl mr20 font-16">编辑问卷</WordsBtn>
|
<WordsBtn style="blue" to={`/courses/${this.props.match.params.coursesId}/polls/${this.props.match.params.pollId}/edit`} className="fl mr20 font-16">编辑问卷</WordsBtn>
|
||||||
{/* 立即发布 */}
|
{/* 立即发布 */}
|
||||||
{
|
{
|
||||||
user_permission && user_permission.poll_unpublish_count > 0 ?
|
user_permission && user_permission.poll_unpublish_count > 0 ?
|
||||||
<li className="fl mr20">
|
<li className="fl mr20">
|
||||||
<ImmediatelyPublish
|
<ImmediatelyPublish
|
||||||
{...this.props}
|
{...this.props}
|
||||||
{...this.state}
|
{...this.state}
|
||||||
style="blue"
|
style="blue"
|
||||||
className={"font-16"}
|
className={"font-16"}
|
||||||
checkBoxValues={[this.props.match.params.pollId]}
|
checkBoxValues={[this.props.match.params.pollId]}
|
||||||
action={this.getPollInfo}
|
action={this.getPollInfo}
|
||||||
single={true}
|
single={true}
|
||||||
></ImmediatelyPublish>
|
></ImmediatelyPublish>
|
||||||
</li>
|
</li>
|
||||||
:""
|
:""
|
||||||
}
|
}
|
||||||
{/* 立即截止、撤销发布 */}
|
{/* 立即截止、撤销发布 */}
|
||||||
{
|
{
|
||||||
user_permission && user_permission.poll_publish_count > 0 ?
|
user_permission && user_permission.poll_publish_count > 0 ?
|
||||||
<li className="fl mr20">
|
<li className="fl mr20">
|
||||||
<ImmediatelyEnd
|
<ImmediatelyEnd
|
||||||
{...this.props}
|
{...this.props}
|
||||||
{...this.state}
|
{...this.state}
|
||||||
style="blue"
|
style="blue"
|
||||||
className={"font-16"}
|
className={"font-16"}
|
||||||
checkBoxValues={[this.props.match.params.pollId]}
|
checkBoxValues={[this.props.match.params.pollId]}
|
||||||
action={this.getPollInfo}
|
action={this.getPollInfo}
|
||||||
single={true}
|
single={true}
|
||||||
></ImmediatelyEnd>
|
></ImmediatelyEnd>
|
||||||
</li>
|
</li>
|
||||||
:""
|
:""
|
||||||
}
|
}
|
||||||
{/* {
|
{/* {
|
||||||
user_permission && user_permission.poll_publish_count>0 ?
|
user_permission && user_permission.poll_publish_count>0 ?
|
||||||
<li className="fl mr20">
|
<li className="fl mr20">
|
||||||
<CancelPublish
|
<CancelPublish
|
||||||
{...this.props}
|
{...this.props}
|
||||||
{...this.state}
|
{...this.state}
|
||||||
style="blue"
|
style="blue"
|
||||||
checkBoxValues={[this.props.match.params.pollId]}
|
checkBoxValues={[this.props.match.params.pollId]}
|
||||||
action={this.getPollInfo}
|
action={this.getPollInfo}
|
||||||
></CancelPublish>
|
></CancelPublish>
|
||||||
</li>
|
</li>
|
||||||
:""
|
:""
|
||||||
} */}
|
} */}
|
||||||
<a className="fl color-blue font-16" onClick={()=>this.confirmysl("/polls/"+this.props.match.params.pollId+"/commit_result.xlsx")} href="javascript:void(0);">导出统计</a>
|
<a className="fl color-blue font-16" onClick={()=>this.confirmysl("/polls/"+this.props.match.params.pollId+"/commit_result.xlsx")} href="javascript:void(0);">导出统计</a>
|
||||||
</span>
|
</span>
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
isStudent &&
|
isStudent &&
|
||||||
<span className="fr mt22 font-16">
|
<span className="fr mt22 font-16">
|
||||||
{
|
{
|
||||||
user_permission && user_permission.current_status!=3 ?
|
user_permission && user_permission.current_status!=3 ?
|
||||||
<WordsBtn style="blue" to={`/courses/${this.props.match.params.coursesId}/polls/${this.props.match.params.pollId}/users/${this.props.current_user.login}`}>
|
<WordsBtn style="blue" to={`/courses/${this.props.match.params.coursesId}/polls/${this.props.match.params.pollId}/users/${this.props.current_user.login}`}>
|
||||||
{ user_permission && user_permission.current_status ==0 ? "继续答题" : user_permission.current_status == 1 ? "查看答题" : "开始答题" }
|
{ user_permission && user_permission.current_status ==0 ? "继续答题" : user_permission.current_status == 1 ? "查看答题" : "开始答题" }
|
||||||
</WordsBtn>
|
</WordsBtn>
|
||||||
:""
|
:""
|
||||||
}
|
}
|
||||||
</span>
|
</span>
|
||||||
}
|
}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{
|
{
|
||||||
// 答题列表
|
// 答题列表
|
||||||
parseInt(tab[0])==0 && <PollTabFirst {...this.props} {...this.state}></PollTabFirst>
|
parseInt(tab[0])==0 && <PollTabFirst {...this.props} {...this.state}></PollTabFirst>
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
// 统计结果
|
// 统计结果
|
||||||
parseInt(tab[0])==1 && <PollTabSecond {...this.props} {...this.state}></PollTabSecond>
|
parseInt(tab[0])==1 && <PollTabSecond {...this.props} {...this.state}></PollTabSecond>
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
//问卷预览
|
//问卷预览
|
||||||
parseInt(tab[0])==2 && <PollTabThird {...this.props} {...this.state}></PollTabThird>
|
parseInt(tab[0])==2 && <PollTabThird {...this.props} {...this.state}></PollTabThird>
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
//设置
|
//设置
|
||||||
parseInt(tab[0])==3 && <PollTabForth {...this.props} {...this.state} user_permission={user_permission} getPollInfo={this.getPollInfo}></PollTabForth>
|
parseInt(tab[0])==3 && <PollTabForth {...this.props} {...this.state} user_permission={user_permission} getPollInfo={this.getPollInfo}></PollTabForth>
|
||||||
}
|
}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export default PollDetailIndex
|
export default PollDetailIndex
|
Loading…
Reference in new issue