Merge remote-tracking branch 'origin/dev_aliyun' into dev_aliyun

dev_forum
杨树林 5 years ago
commit 72a15bfad9

@ -192,7 +192,7 @@ class CoursesNew extends Component {
).then((response) => { ).then((response) => {
// debugger // debugger
if (response.data.status === 0) { if (response.data.status === 0) {
this.goback this.goback()
} }
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
@ -235,9 +235,7 @@ class CoursesNew extends Component {
} }
).then((response) => { ).then((response) => {
if (response.status === 200) { if (response.status === 200) {
if (response.data.course_id != undefined) { this.goback()
window.location.href = "/courses/" + response.data.course_id+"/students";
}
} }
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)

@ -22,179 +22,169 @@ import axios from 'axios'
const map={1:"未发布",2:"提交中",3:"已截止",4:"已结束"} 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,
DownloadType:false, DownloadType:false,
DownloadMessageval:undefined, DownloadMessageval:undefined,
}
}
getPollInfo=()=>{
console.log(this.props);
let pollId=this.props.match.params.pollId;
let url=`/polls/${pollId}/common_header.json`
axios.get(url).then((result)=>{
if(result.status==200){
this.setState({
pollDetail:result.data,
user_permission:result.data.user_permission
})
}
}).catch((error)=>{
console.log(error);
})
}
componentDidMount(){
const query =this.props.location.search;
if(query.indexOf("?")!=-1){
const type = query.split('?');
let name = type[1].split("tab=");
name = String(name).split(",");
name = decodeURI(name[1]);
if(name!=undefined && name!="" && name!="undefined"){
this.setState({
tab:[name]
})
}
}
this.getPollInfo();
}
//切换tab
changeTab=(e)=>{
this.setState({
tab:e.key
})
}
/// 确认是否下载
confirmysl(url){
axios.get(url).then((response) => {
if(response.data.status&&response.data.status===-1){
}else if(response.data.status&&response.data.status===-2){
if(response.data.message === "100"){
// 已超出文件导出的上限数量100 ),建议:
this.setState({
DownloadType:true,
DownloadMessageval:100
})
}else {
//因附件资料超过500M
this.setState({
DownloadType:true,
DownloadMessageval:500
})
}
}else {
this.props.showNotification(`正在下载中`);
window.open("/api"+url, '_blank');
}
}).catch((error) => {
console.log(error)
});
}
Downloadcal=()=>{
this.setState({
DownloadType:false,
DownloadMessageval:undefined
})
}
goback=()=>{
let courseId=this.props.match.params.coursesId;
if(courseId===undefined){
this.props.history.push("/courses");
}else{
this.props.history.push(this.props.current_user.first_category_url);
} }
}
getPollInfo=()=>{
console.log(this.props);
let pollId=this.props.match.params.pollId;
let url=`/polls/${pollId}/common_header.json`
axios.get(url).then((result)=>{
if(result.status==200){
this.setState({
pollDetail:result.data,
user_permission:result.data.user_permission
})
}
}).catch((error)=>{
console.log(error);
})
}
componentDidMount(){
const query =this.props.location.search;
if(query.indexOf("?")!=-1){
const type = query.split('?');
let name = type[1].split("tab=");
name = String(name).split(",");
name = decodeURI(name[1]);
if(name!=undefined && name!="" && name!="undefined"){
this.setState({
tab:[name]
})
}
}
this.getPollInfo();
}
//切换tab
changeTab=(e)=>{
this.setState({
tab:e.key
})
}
/// 确认是否下载
confirmysl(url){
axios.get(url).then((response) => {
if(response.data.status&&response.data.status===-1){
}else if(response.data.status&&response.data.status===-2){
if(response.data.message === "100"){
// 已超出文件导出的上限数量100 ),建议:
this.setState({
DownloadType:true,
DownloadMessageval:100
})
}else {
//因附件资料超过500M
this.setState({
DownloadType:true,
DownloadMessageval:500
})
}
}else {
this.props.showNotification(`正在下载中`);
window.open("/api"+url, '_blank');
}
}).catch((error) => {
console.log(error)
});
}
Downloadcal=()=>{
this.setState({
DownloadType:false,
DownloadMessageval:undefined
})
} }
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">
<DownloadMessageysl <DownloadMessageysl
{...this.props} {...this.props}
value={this.state.DownloadMessageval} value={this.state.DownloadMessageval}
modalCancel={this.Downloadcal} modalCancel={this.Downloadcal}
modalsType={this.state.DownloadType} modalsType={this.state.DownloadType}
/> />
<div className="educontent mt10 mb50"> <div className="educontent mt10 mb50">
<p className="clearfix mb20"> <p className="clearfix mb20">
<a style="grey" className="fl" onClick={()=>this.goback()}>{this.props.coursedata.name}</a> <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">&gt;</span> <span className="color-grey-9 fl ml3 mr3">&gt;</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">&gt;</span> <span className="color-grey-9 fl ml3 mr3">&gt;</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.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
@ -207,46 +197,46 @@ class PollDetailIndex extends Component{
</li> </li>
:"" :""
} */} } */}
<a className="fl color-blue font-16" onClick={(url)=>this.confirmysl("/polls/"+this.props.match.params.pollId+"/commit_result.xlsx")} href="javascript:void(0);">导出统计</a> <a className="fl color-blue font-16" onClick={(url)=>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

@ -402,7 +402,7 @@ class DetailCardsEditAndAdd extends Component{
<div className="df mb30"> <div className="df mb30">
<span className="mr30 color-orange pt10">*</span> <span className="mr30 color-orange pt10">*</span>
<div className="flex1 mr20"> <div className="flex1 mr20">
<input type="text" style={{width:'670px'}} className={stage_nametype===false?"input-100-45 greyInput":"input-100-45 greyInput bor-red"} name="stage_name" value={stage_names} onInput={this.updatastage_names} placeholder={"请输入第"+this.props.sum+"阶段名称"}/> <input maxLength="10" type="text" style={{width:'670px'}} className={stage_nametype===false?"input-100-45 greyInput":"input-100-45 greyInput bor-red"} name="stage_name" value={stage_names} onInput={this.updatastage_names} placeholder={"请输入第"+this.props.sum+"阶段名称"}/>
<div className={stage_nametype===true?"red":'none'}>名称不能为空</div> <div className={stage_nametype===true?"red":'none'}>名称不能为空</div>
</div> </div>
<div style={{"width":"60px"}}><span className="color-orange fl mt8 none" id="stage_name_notice"><i className="iconfont icon-tishi font-14 mr3"></i></span></div> <div style={{"width":"60px"}}><span className="color-orange fl mt8 none" id="stage_name_notice"><i className="iconfont icon-tishi font-14 mr3"></i></span></div>

Loading…
Cancel
Save