Merge branch 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

dev_home
杨树明 6 years ago
commit 9de53b3a85

@ -180,17 +180,19 @@ module ExercisesHelper
elsif ex.question_type == Exercise::COMPLETION #填空题 elsif ex.question_type == Exercise::COMPLETION #填空题
ex_ordered = ex.is_ordered ex_ordered = ex.is_ordered
null_standard_answer = ex.exercise_standard_answers null_standard_answer = ex.exercise_standard_answers
null_stand_choice = null_standard_answer.pluck(:exercise_choice_id) #一个exercise_choice_id可能对应多个answer_text null_stand_choice = null_standard_answer.pluck(:exercise_choice_id).uniq #一个exercise_choice_id可能对应多个answer_text
null_stand_text = null_standard_answer.pluck(:answer_text) null_stand_text = null_standard_answer.pluck(:answer_text)
standard_answer_count = 0 standard_answer_count = 0
each_null_score = null_stand_choice.size > 0 ? (ex&.question_score.to_f / null_stand_choice.uniq.size).round(3) : 0.0 each_null_score = null_stand_choice.size > 0 ? (ex&.question_score.to_f / null_stand_choice.uniq.size).round(3) : 0.0
all_user_count = 0 all_user_count = 0
null_stand_choice.each_with_index do |s,index| null_stand_choice.each_with_index do |s,index|
user_count = 0 user_count = 0
s_choice_text = null_stand_text[index]
if ex_ordered #有序排列 if ex_ordered #有序排列
s_choice_text = null_stand_text[index]
user_count = user_count + effictive_users.select{|answer| answer.exercise_choice_id == s && answer.answer_text == s_choice_text}.size user_count = user_count + effictive_users.select{|answer| answer.exercise_choice_id == s && answer.answer_text == s_choice_text}.size
else else
null_stand_text = null_stand_text.uniq
s_choice_text = null_stand_text[index]
user_count = user_count + effictive_users.select{|answer| answer.answer_text == s_choice_text }.size #回答了标准答案的用户 user_count = user_count + effictive_users.select{|answer| answer.answer_text == s_choice_text }.size #回答了标准答案的用户
end end
@ -211,7 +213,7 @@ module ExercisesHelper
# percent = commit_user_ids > 0 ? (all_user_count / commit_user_ids.to_f).round(3)*100 : 0.0 # percent = commit_user_ids > 0 ? (all_user_count / commit_user_ids.to_f).round(3)*100 : 0.0
user_wrong_count = (effictive_users_count - all_user_count ) user_wrong_count = (effictive_users_count - all_user_count)
if effictive_users_count > 0 && user_wrong_count >= 0 if effictive_users_count > 0 && user_wrong_count >= 0
wrong_percent = (user_wrong_count / effictive_users_count.to_f ).round(3) wrong_percent = (user_wrong_count / effictive_users_count.to_f ).round(3)

@ -355,7 +355,9 @@ class ModulationModal_exercise extends Component {
"" ""
} }
<div className="mexertwo"> <div className="mexertwo" style={{
marginTop: "20px",
}}>
<p className="mexeheigth2">客观题成绩:</p> <p className="mexeheigth2">客观题成绩:</p>
<Input <Input
@ -382,6 +384,13 @@ class ModulationModal_exercise extends Component {
}}>{Inputsvaltests}</p> }}>{Inputsvaltests}</p>
: "" : ""
} }
<div className="minbuttionte">
<a className="task-btn color-white mr30" style={{width: "72px",}}
onClick={this.props.Cancel}>{this.props.Cancelname || '取消'}</a>
<a className="task-btn task-btn-orange" style={{width: "72px",}}
onClick={this.Saves}>{this.props.Savesname || '保存'}</a>
</div>
</div> </div>
: :
<div className="mt20"> <div className="mt20">

@ -1031,8 +1031,8 @@ class Studentshavecompletedthelist extends Component {
render: (text, record) => ( render: (text, record) => (
<span> <span>
{record.finalscore==="--"? {record.finalscore==="--"?
<span style={{textAlign: "center", color: '#999999'}} <a style={{textAlign: "center"}} className="color-blue"
>--</span> target="_blank" onClick={() => this.Adjustment(record.user_id)}>评阅</a>
: :
<a style={{textAlign: "center"}} className="color-blue" <a style={{textAlign: "center"}} className="color-blue"
target="_blank" target="_blank"
@ -1227,8 +1227,8 @@ class Studentshavecompletedthelist extends Component {
render: (text, record) => ( render: (text, record) => (
<span> <span>
{record.finalscore==="--"? {record.finalscore==="--"?
<span style={{textAlign: "center", color: '#999999'}} <a style={{textAlign: "center"}} className="color-blue"
>--</span> target="_blank" onClick={() => this.Adjustment(record.user_id)}>评阅</a>
: :
<a style={{textAlign: "center"}} className="color-blue" <a style={{textAlign: "center"}} className="color-blue"
target="_blank" target="_blank"

@ -24,25 +24,28 @@ class Bullsubdirectory extends Component{
Modalstopval:"是否确认删除?", Modalstopval:"是否确认删除?",
ModalCancel:"", ModalCancel:"",
ModalSave:"", ModalSave:"",
index:0,
} }
//不能显示数据编辑的时候没有赋值
//没加initialValue 输入不能赋值到from 上
} }
componentDidMount() { componentDidMount() {
console.log("获取到数据"); console.log("获取到数据");
console.log(this.props); console.log(this.props);
let{id,myname,mydescription} =this.props let{id,myname,mydescription,index,item} =this.props
this.props.form.setFieldsValue({ this.props.form.setFieldsValue({
id:id, id:id,
eduintits:myname, eduintits:item.name,
description:mydescription, description:item.description,
}); });
// this.contentMdRef.current.setValue(mydescription);
this.setState({ this.setState({
id:id, id:id,
eduintits:myname, eduintits:item.name,
description:mydescription, description:item.description,
index:index
}) })
if(myname!=undefined){ if(myname!=undefined){
this.setState({ this.setState({
@ -108,10 +111,20 @@ class Bullsubdirectory extends Component{
} }
bianji = (bians)=>{ bianji = (bians,i)=>{
console.log("bianji");
console.log(this.props.myname);
console.log(this.props.mydescription);
this.setState({ this.setState({
whethertoeditysl:bians, whethertoeditysl:bians,
}) eduintits:this.props.myname,
description:this.props.mydescription,
index:i
});
this.props.form.setFieldsValue({
eduintits:this.props.myname,
description:this.props.mydescription,
});
if(bians===true){ if(bians===true){
this.props.getyslbooltrue(); this.props.getyslbooltrue();
}else { }else {
@ -143,6 +156,7 @@ class Bullsubdirectory extends Component{
handleSubmit=(e) => { handleSubmit=(e) => {
e.preventDefault(); e.preventDefault();
this.props.form.validateFields((err, values) => { this.props.form.validateFields((err, values) => {
debugger
if (!err) { if (!err) {
console.log(values.description); console.log(values.description);
if(values.eduintits === undefined|| values.eduintits === "" || values.eduintits ===null){ if(values.eduintits === undefined|| values.eduintits === "" || values.eduintits ===null){
@ -180,11 +194,11 @@ class Bullsubdirectory extends Component{
if(result){ if(result){
if(result.data){ if(result.data){
if(result.data.status === 0){ if(result.data.status === 0){
this.props.form.setFieldsValue({ // this.props.form.setFieldsValue({
id:this.state.id, // id:this.state.id,
eduintits:titname, // eduintits:titname,
description:values.description, // description:values.description,
}); // });
this.setState({ this.setState({
whethertoeditysl:false, whethertoeditysl:false,
id:this.state.id, id:this.state.id,
@ -266,111 +280,118 @@ class Bullsubdirectory extends Component{
render(){ render(){
let{description,whethertoeditysl,addonAfter,eduintits,informs,isSpinysl} =this.state; let{description,whethertoeditysl,addonAfter,eduintits,informs,isSpinysl,index} =this.state;
let{myname,mydescription,id}=this.props; let{myname,mydescription,id}=this.props;
const {getFieldDecorator} = this.props.form; const {getFieldDecorator} = this.props.form;
// console.log("Bullsubdirectory"); // console.log("Bullsubdirectory");
// console.log(this.props.isAdmin()); // console.log(this.props.isAdmin());
// console.log(this.props); console.log(this.props);
console.log(whethertoeditysl);
console.log(this.state.eduintits);
console.log(this.state.description);
return( return(
<React.Fragment > <React.Fragment key={this.props.index} id={this.props.id}>
<div > <div key={this.props.index} id={this.props.id}>
{this.state.Modalstype&&this.state.Modalstype===true?<Modals {this.state.Modalstype&&this.state.Modalstype===true?<Modals
modalsType={this.state.Modalstype} modalsType={this.state.Modalstype}
modalsTopval={this.state.Modalstopval} modalsTopval={this.state.Modalstopval}
modalCancel={this.state.ModalCancel} modalCancel={this.state.ModalCancel}
modalSave={this.state.ModalSave} modalSave={this.state.ModalSave}
/>:""} />:""}
<Spin size="large" spinning={isSpinysl} > <Spin size="large" spinning={isSpinysl} >
<div className="edu-back-white "> <div className="edu-back-white " id={
{ index
whethertoeditysl === false? }>
<div> {
<div className="fudonyingxiangysls"> whethertoeditysl === false?
<div className="fudonyingxiangysl"> <div id={this.props.index}>
<div style={{marginRight:"60px"}}> <div className="fudonyingxiangysls">
<span className="ysltitbt">{myname}</span> <div className="fudonyingxiangysl">
</div> <div style={{marginRight:"60px"}}>
<div> <span className="ysltitbt">{myname}</span>
</div>
<div>
<span className="fr yslbianji" style={{marginRight:"17px"}}> <span className="fr yslbianji" style={{marginRight:"17px"}}>
{ {
this.props.isAdmin() === true ? this.props.isAdmin() === true ?
(this.props.yslbool===false? (this.props.yslbool===false?
<Tooltip placement="bottom" title={<div> <Tooltip placement="bottom" title={<div>
编辑 编辑
</div>}> </div>}>
<i className="iconfont icon-bianji1 newbianji1" onClick={()=>this.bianji(true)}></i> <i className="iconfont icon-bianji1 newbianji1" onClick={()=>this.bianji(true,this.props.index)}></i>
</Tooltip> </Tooltip>
: :
"" ""
) )
:"" :""
} }
</span> </span>
<span className="fr yslbianji" style={{marginRight:"22px"}}> <span className="fr yslbianji" style={{marginRight:"22px"}}>
{ {
this.props.isAdmin() === true ? this.props.isAdmin() === true ?
(this.props.yslbool===false? (this.props.yslbool===false?
<Tooltip placement="bottom" title={<div> <Tooltip placement="bottom" title={<div>
删除 删除
</div>}> </div>}>
<i className="iconfont icon-shanchu newbianji1" style={{ color: "#4CACFF"}} onClick={()=>this.setModeltrue(true)}></i> <i className="iconfont icon-shanchu newbianji1" style={{ color: "#4CACFF"}} onClick={()=>this.setModeltrue(true)}></i>
</Tooltip> </Tooltip>
: :
"" ""
) )
:"" :""
} }
</span> </span>
{ {
this.props.length - 1 === this.props.index ? "" : this.props.length - 1 === this.props.index ? "" :
this.props.isAdmin() === true ? this.props.isAdmin() === true ?
(this.props.yslbool === false ? (this.props.yslbool === false ?
<a className="fr yslbianji mr30" <a className="fr yslbianji mr30"
style={{ style={{
lineHeight: "31px", lineHeight: "31px",
}} }}
onClick={() => this.Movedown(this.props.id)} onClick={() => this.Movedown(this.props.id)}
><Tooltip ><Tooltip
title="下移"><i title="下移"><i
style={{color: "#4CACFF"}} style={{color: "#4CACFF"}}
className=" font-18 iconfont icon-xiangxiayi"></i></Tooltip></a> className=" font-18 iconfont icon-xiangxiayi"></i></Tooltip></a>
: :
"" ""
) )
: "" : ""
} }
{ {
this.props.index === 0 ? "" : this.props.index === 0 ? "" :
this.props.isAdmin() === true ? this.props.isAdmin() === true ?
(this.props.yslbool === false ? (this.props.yslbool === false ?
<a className="fr yslbianji mr30" <a className="fr yslbianji mr30"
style={{ style={{
lineHeight: "31px", lineHeight: "31px",
}} }}
onClick={() => this.Moveupward(this.props.id)} onClick={() => this.Moveupward(this.props.id)}
><Tooltip ><Tooltip
title="上移"><i title="上移"><i
style={{color: "#4CACFF"}} style={{color: "#4CACFF"}}
className=" font-18 iconfont icon-xiangshangyi"></i></Tooltip></a> className=" font-18 iconfont icon-xiangshangyi"></i></Tooltip></a>
: :
"" ""
) )
: "" : ""
} }
</div>
<div className="yslclear"></div>
</div>
<div id="MakedownHTML"className="markdown-body fonttext yslmtopcg yslminHeigth markdownysltext" dangerouslySetInnerHTML={{__html: markdownToHTML(mydescription).replace(/▁/g, "▁▁▁")}}/>
</div> </div>
{parseInt(this.props&&this.props.informs.length)===parseInt(this.props&&this.props.index+1)?"":<div className="bor-bottom-greyE mr25 ml25"></div>} <div className="yslclear"></div>
</div> </div>
: <div id="MakedownHTML"className="markdown-body fonttext yslmtopcg yslminHeigth markdownysltext" dangerouslySetInnerHTML={{__html: markdownToHTML(mydescription).replace(/▁/g, "▁▁▁")}}/>
<div className="edu-back-white "> </div>
<Form layout='vertical' onSubmit={this.handleSubmit} > {parseInt(this.props&&this.props.informs.length)===parseInt(this.props&&this.props.index+1)?"":<div className="bor-bottom-greyE mr25 ml25"></div>}
<style> </div>
{ :
`.ant-form-item{ whethertoeditysl === true?
<div className="edu-back-white " key={this.props.index} id={this.props.id}>
<Form layout='vertical' onSubmit={this.handleSubmit} key={this.props.index}>
<style>
{
`.ant-form-item{
margin-bottom:0px !important; margin-bottom:0px !important;
} }
.chooseDestwo .ant-form-item{ .chooseDestwo .ant-form-item{
@ -385,49 +406,50 @@ class Bullsubdirectory extends Component{
} }
` `
} }
</style> </style>
<Form.Item <Form.Item
style={{"borderBottom":'none'}} style={{"borderBottom":'none'}}
className="chooseDestwo " className="chooseDestwo "
> key={this.props.index}
{getFieldDecorator('eduintits',{ initialValue: this.state.eduintits }, { >
rules: [{ {getFieldDecorator('eduintits', { initialValue: eduintits}, {
required: true, message: '请在此输入标题,最多60个字符', rules: [{
}], required: true, message: '请在此输入标题,最多60个字符',
})( }],
<div className="ysleduinwh"> })(
<div className="yslduinlefts"> <div className="ysleduinwh">
<span className="yslduincolorred">*</span> <div className="yslduinlefts">
</div> <span className="yslduincolorred">*</span>
<div className="yslduinleft"> </div>
<style>{ <div className="yslduinleft">
` <style>{
`
.ant-input{ .ant-input{
border-right: none !important; border-right: none !important;
height: 40px !important; height: 40px !important;
} }
` `
}</style> }</style>
<Input placeholder="请在此输入标题最多60个字符" maxLength="60" <Input placeholder="请在此输入标题最多60个字符" key={this.props.index} maxLength="60"
style={{ textAlign: "left",width:"100%",}} style={{ textAlign: "left",width:"100%",}}
onInput={this.changeTopicName} onInput={this.changeTopicName}
autoComplete="off" autoComplete="off"
addonAfter={String(addonAfter)+"/60"} addonAfter={String(addonAfter)+"/60"}
value={eduintits} value={eduintits}
className="searchViewAfter"></Input> className="searchViewAfter"></Input>
</div>
</div> </div>
)}
</Form.Item>
</div>
)}
</Form.Item>
<div className="edu-back-white ">
<div className={"yslmt16px"}> <div className="edu-back-white " key={this.props.index}>
<style> <div className={"yslmt16px"}>
{ <style>
` {
`
.ant-form-item-children { .ant-form-item-children {
position: unset; position: unset;
} }
@ -473,46 +495,52 @@ class Bullsubdirectory extends Component{
margin-bottom: 24px !important; margin-bottom: 24px !important;
} }
` `
} }
</style> </style>
<Form.Item <Form.Item
style={{"borderBottom":'none'}} style={{"borderBottom":'none'}}
className="chooseDes " className="chooseDes "
> key={this.props.index}
{getFieldDecorator('description', { initialValue: this.state.description },{ >
rules: [{ {getFieldDecorator('description', { initialValue: description},{
required: true, message: '请在此输入内容,最多5000个字符', rules: [{
}, { required: true, message: '请在此输入内容,最多5000个字符',
len: 5000, message: '最大限制为5000个字符', }, {
}], len: 5000, message: '最大限制为5000个字符',
})( }],
<TPMMDEditor ref={this.messageRef} })(
placeholder={'请在此输入内容,最多5000个字符'} <TPMMDEditor ref={this.messageRef}
initValue={description} key={this.props.index}
mdID={'courseMessageMD'} placeholder={'请在此输入内容,最多5000个字符'}
className="courseMessageMD " initValue={description}
height={518} mdID={'courseMessageMD'}
></TPMMDEditor> className="courseMessageMD "
)} height={518}
</Form.Item> ></TPMMDEditor>
</div>
</div>
)}
</Form.Item>
<Form.Item> </div>
<div className="clearfix mt28 fr pb50 mr25"> </div>
<a className="defalutCancelbtn fl mr20 " onClick={()=>this.bianji(false)}>取消</a>
<Button htmlType="submit" className="ant-btn defalutSubmitbtn fl ant-btn-primary">
<span> </span></Button>
</div>
</Form.Item>
</Form>
<div className="bor-bottom-greyE mr25 ml25"></div>
</div>
}
</div>
</Spin>
</div> <Form.Item>
<div className="clearfix mt28 fr pb50 mr25">
<a className="defalutCancelbtn fl mr20 " onClick={()=>this.bianji(false,this.props.index)}>取消</a>
<Button htmlType="submit" className="ant-btn defalutSubmitbtn fl ant-btn-primary">
<span> </span></Button>
</div>
</Form.Item>
</Form>
<div className="bor-bottom-greyE mr25 ml25"></div>
</div>
:""
}
</div>
</Spin>
</div>
</React.Fragment> </React.Fragment>
) )
} }

@ -497,6 +497,7 @@ class Eduinforms extends Component{
<Bullsubdirectory {...this.state} {...this.props} key={index} index={index} <Bullsubdirectory {...this.state} {...this.props} key={index} index={index}
length={informs.length} yslbool={yslbool} id={item.id} length={informs.length} yslbool={yslbool} id={item.id}
myname={item.name} mydescription={item.description} myname={item.name} mydescription={item.description}
item={item}
getyslbooltrue={()=>this.getyslbooltrue()} getyslbooltrue={()=>this.getyslbooltrue()}
getyslboolfalse={()=>this.getyslboolfalse()} getyslboolfalse={()=>this.getyslboolfalse()}
getinputdata={()=>this.getinputdata()} ></Bullsubdirectory> getinputdata={()=>this.getinputdata()} ></Bullsubdirectory>

@ -64,7 +64,7 @@ class PollDetailTabSecond extends Component{
let {page, limit, questions, questionsInfo , isSpin} = this.state; let {page, limit, questions, questionsInfo , isSpin} = this.state;
return( return(
<Spin size="large" spinning={ isSpin }> <Spin size="large" spinning={ isSpin }>
<div> <React.Fragment>
{ {
questions && questions.length>0 && questions.map((item,key)=>{ questions && questions.length>0 && questions.map((item,key)=>{
return( return(
@ -179,7 +179,7 @@ class PollDetailTabSecond extends Component{
}) })
} }
{ {
questions && questions.length == 0 && <NoneData></NoneData> questions && questions.length == 0 && <div className="edu-back-white"><NoneData></NoneData></div>
} }
{ {
questionsInfo && questionsInfo.q_counts > limit && questionsInfo && questionsInfo.q_counts > limit &&
@ -189,7 +189,7 @@ class PollDetailTabSecond extends Component{
</div> </div>
} }
</div> </React.Fragment>
</Spin> </Spin>
) )
} }

@ -1,6 +1,7 @@
import React,{ Component } from "react"; import React,{ Component } from "react";
import {Checkbox,Radio} from "antd"; import {Checkbox,Radio} from "antd";
import NoneData from "../coursesPublic/NoneData"
import '../css/members.css' import '../css/members.css'
import '../css/busyWork.css' import '../css/busyWork.css'
@ -26,31 +27,34 @@ class PollDetailTabThirdInfo extends Component{
pollDetail !== pollDetail.poll.polls_description && pollDetail !== pollDetail.poll.polls_description &&
<p style={{whiteSpace:"pre-wrap"}} className="color-grey-3 padding20-30">{ pollDetail.poll.polls_description }</p> <p style={{whiteSpace:"pre-wrap"}} className="color-grey-3 padding20-30">{ pollDetail.poll.polls_description }</p>
} }
<p className="padding20-30 clearfix edu-txt-left" style={{background:"#fafafa"}}>
{ !pollDetail || !pollDetail.question_types || pollDetail.question_types.q_counts===0 ? "" :
<span className="color-grey-3">
{
pollDetail && pollDetail.question_types && pollDetail.question_types.q_counts > 0 &&
<span>合计{pollDetail.question_types && pollDetail.question_types.q_counts}</span>
}
{
pollDetail && pollDetail.question_types.q_singles > 0 &&
<span className="mr15 color-grey-9">单选题{pollDetail.question_types.q_singles}</span>
}
{
pollDetail && pollDetail.question_types.q_doubles > 0 &&
<span className="mr15 color-grey-9">多选题{pollDetail.question_types.q_doubles}</span>
}
{
pollDetail && pollDetail.question_types.q_mains > 0 &&
<span className="color-grey-9">主观题{pollDetail.question_types.q_mains}</span>
}
</span>
}
</p>
{ {
pollDetail && pollDetail.questions && pollDetail.questions.map((item,key)=>{ pollDetail && pollDetail.questions && pollDetail.questions.length > 0 &&
<p className="padding20-30 clearfix edu-txt-left" style={{background:"#fafafa"}}>
{ !pollDetail || !pollDetail.question_types || pollDetail.question_types.q_counts===0 ? "" :
<span className="color-grey-3">
{
pollDetail && pollDetail.question_types && pollDetail.question_types.q_counts > 0 &&
<span>合计{pollDetail.question_types && pollDetail.question_types.q_counts}</span>
}
{
pollDetail && pollDetail.question_types.q_singles > 0 &&
<span className="mr15 color-grey-9">单选题{pollDetail.question_types.q_singles}</span>
}
{
pollDetail && pollDetail.question_types.q_doubles > 0 &&
<span className="mr15 color-grey-9">多选题{pollDetail.question_types.q_doubles}</span>
}
{
pollDetail && pollDetail.question_types.q_mains > 0 &&
<span className="color-grey-9">主观题{pollDetail.question_types.q_mains}</span>
}
</span>
}
</p>
}
{
pollDetail && pollDetail.questions && pollDetail.questions.length > 0 && pollDetail.questions.map((item,key)=>{
return( return(
<div className="previewList"> <div className="previewList">
<p className="pl30 pr30 pt30 pb15 font-16 clearfix"> <p className="pl30 pr30 pt30 pb15 font-16 clearfix">
@ -120,6 +124,10 @@ class PollDetailTabThirdInfo extends Component{
) )
}) })
} }
{
pollDetail && pollDetail.questions && pollDetail.questions.length == 0 && <NoneData></NoneData>
}
</div> </div>
: "" : ""
} }

Loading…
Cancel
Save