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

@ -22,179 +22,169 @@ import axios from 'axios'
const map={1:"未发布",2:"提交中",3:"已截止",4:"已结束"}
class PollDetailIndex extends Component{
constructor(props){
super(props);
this.state={
tab:["0"],
pollDetail:undefined,
user_permission:undefined,
DownloadType:false,
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);
constructor(props){
super(props);
this.state={
tab:["0"],
pollDetail:undefined,
user_permission:undefined,
DownloadType:false,
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
})
}
render(){
let {tab,pollDetail,user_permission}=this.state;
const isAdmin =this.props.isAdmin();
const isStudent = this.props.isStudent();
return(
<div className="newMain">
<DownloadMessageysl
{...this.props}
value={this.state.DownloadMessageval}
modalCancel={this.Downloadcal}
modalsType={this.state.DownloadType}
/>
<div className="educontent mt10 mb50">
<p className="clearfix mb20">
<a style="grey" className="fl" onClick={()=>this.goback()}>{this.props.coursedata.name}</a>
<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>
<span className="color-grey-9 fl ml3 mr3">&gt;</span>
<span>问卷详情</span>
</p>
<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="mt3 fl" style={{height:"25px"}}>
render(){
let {tab,pollDetail,user_permission}=this.state;
const isAdmin =this.props.isAdmin();
const isStudent = this.props.isStudent();
return(
<div className="newMain">
<DownloadMessageysl
{...this.props}
value={this.state.DownloadMessageval}
modalCancel={this.Downloadcal}
modalsType={this.state.DownloadType}
/>
<div className="educontent mt10 mb50">
<p className="clearfix mb20">
<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>
<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>问卷详情</span>
</p>
<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="mt3 fl" style={{height:"25px"}}>
<CoursesListType typelist={[`${map[pollDetail && pollDetail.polls_status]}`]} typesylename={""} />
</span>
<WordsBtn className="fr font-16 mt2" style="grey" onClick={()=>this.goback()}>返回</WordsBtn>
</p>
<div>
<div className="clearfix edu-back-white pl30 pr30 bor-bottom-greyE">
<div className="fl task_menu_ul">
<Menu mode="horizontal" selectedKeys={tab} onClick={this.changeTab}>
<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 && <Menu.Item key="2">问卷预览</Menu.Item> }
<Menu.Item key="3">设置</Menu.Item>
</Menu>
</div>
{
isAdmin &&
<span className="fr mt22">
<WordsBtn className="fr font-16 mt2" style="grey" onClick={()=>this.props.history.goBack()}>返回</WordsBtn>
</p>
<div>
<div className="clearfix edu-back-white pl30 pr30 bor-bottom-greyE">
<div className="fl task_menu_ul">
<Menu mode="horizontal" selectedKeys={tab} onClick={this.changeTab}>
<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 && <Menu.Item key="2">问卷预览</Menu.Item> }
<Menu.Item key="3">设置</Menu.Item>
</Menu>
</div>
{
isAdmin &&
<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>
{/* 立即发布 */}
{
user_permission && user_permission.poll_unpublish_count > 0 ?
<li className="fl mr20">
<ImmediatelyPublish
{...this.props}
{...this.state}
style="blue"
className={"font-16"}
checkBoxValues={[this.props.match.params.pollId]}
action={this.getPollInfo}
single={true}
></ImmediatelyPublish>
</li>
:""
}
{/* 立即截止、撤销发布 */}
{
user_permission && user_permission.poll_publish_count > 0 ?
<li className="fl mr20">
<ImmediatelyEnd
{...this.props}
{...this.state}
style="blue"
className={"font-16"}
checkBoxValues={[this.props.match.params.pollId]}
action={this.getPollInfo}
single={true}
></ImmediatelyEnd>
</li>
:""
}
{/* {
{/* 立即发布 */}
{
user_permission && user_permission.poll_unpublish_count > 0 ?
<li className="fl mr20">
<ImmediatelyPublish
{...this.props}
{...this.state}
style="blue"
className={"font-16"}
checkBoxValues={[this.props.match.params.pollId]}
action={this.getPollInfo}
single={true}
></ImmediatelyPublish>
</li>
:""
}
{/* 立即截止、撤销发布 */}
{
user_permission && user_permission.poll_publish_count > 0 ?
<li className="fl mr20">
<ImmediatelyEnd
{...this.props}
{...this.state}
style="blue"
className={"font-16"}
checkBoxValues={[this.props.match.params.pollId]}
action={this.getPollInfo}
single={true}
></ImmediatelyEnd>
</li>
:""
}
{/* {
user_permission && user_permission.poll_publish_count>0 ?
<li className="fl mr20">
<CancelPublish
@ -207,46 +197,46 @@ class PollDetailIndex extends Component{
</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>
}
{
isStudent &&
<span className="fr mt22 font-16">
}
{
isStudent &&
<span className="fr mt22 font-16">
{
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}`}>
{ user_permission && user_permission.current_status ==0 ? "继续答题" : user_permission.current_status == 1 ? "查看答题" : "开始答题" }
</WordsBtn>
:""
}
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}`}>
{ user_permission && user_permission.current_status ==0 ? "继续答题" : user_permission.current_status == 1 ? "查看答题" : "开始答题" }
</WordsBtn>
:""
}
</span>
}
</div>
{
// 答题列表
parseInt(tab[0])==0 && <PollTabFirst {...this.props} {...this.state}></PollTabFirst>
}
{
// 统计结果
parseInt(tab[0])==1 && <PollTabSecond {...this.props} {...this.state}></PollTabSecond>
}
{
//问卷预览
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>
}
</div>
</div>
</div>
)
}
}
</div>
{
// 答题列表
parseInt(tab[0])==0 && <PollTabFirst {...this.props} {...this.state}></PollTabFirst>
}
{
// 统计结果
parseInt(tab[0])==1 && <PollTabSecond {...this.props} {...this.state}></PollTabSecond>
}
{
//问卷预览
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>
}
</div>
</div>
</div>
)
}
}
export default PollDetailIndex

@ -402,7 +402,7 @@ class DetailCardsEditAndAdd extends Component{
<div className="df mb30">
<span className="mr30 color-orange pt10">*</span>
<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>
<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