试卷的调分

dev_cs
SylorHuang 6 years ago
commit 5d422f2d23

@ -5,6 +5,6 @@ class ShixunListsController < ApplicationController
private private
def search_params def search_params
params.permit(:keyword, :type, :page, :per_page, :order, :type, :status, :diff) params.permit(:keyword, :type, :page, :limit, :order, :type, :status, :diff)
end end
end end

@ -42,7 +42,7 @@ class ShixunSearchService < ApplicationService
def search_options def search_options
model_options = { model_options = {
includes: Shixun.searchable_includes includes: [ :shixun_info, :challenges, :subjects, user: { user_extension: :school } ]
} }
model_options.merge!(where: { id: @shixuns.pluck(:id) }) model_options.merge!(where: { id: @shixuns.pluck(:id) })
model_options.merge!(order: {"myshixuns_count" => sort_str}) model_options.merge!(order: {"myshixuns_count" => sort_str})

@ -22,18 +22,15 @@ class NewShixunModel extends Component{
} }
} }
componentDidMount() { componentDidMount() {
let{page,type,keyword,order,diff,limit}=this.state; let{page,type,keyword,order,diff,limit,status}=this.state;
let status=this.props.statustype===undefined?'all':'published';
this.setState({
status:status
})
this.getdatalist(page,type,status,keyword,order,diff,limit) this.getdatalist(page,type,status,keyword,order,diff,limit)
} }
getdatalist=(page,type,status,keyword,order,diff,limit,pagetype)=>{ getdatalist=(page,type,newstatus,keyword,order,diff,limit,pagetype)=>{
this.setState({ this.setState({
isspinning:true isspinning:true
}) })
let status=this.props.statustype===undefined?newstatus:'published';
let url="/shixun_lists.json" let url="/shixun_lists.json"
axios.get(url,{params:{ axios.get(url,{params:{
page, page,
@ -141,7 +138,8 @@ class NewShixunModel extends Component{
belongto=(value)=>{ belongto=(value)=>{
this.setState({ this.setState({
type:value type:value,
keyword:undefined
}) })
let{page,status,keyword,order,diff,limit}=this.state; let{page,status,keyword,order,diff,limit}=this.state;
this.getdatalist(page,value,status,keyword,order,diff,limit) this.getdatalist(page,value,status,keyword,order,diff,limit)
@ -426,7 +424,21 @@ class NewShixunModel extends Component{
</a> </a>
<div className="cl"></div> <div className="cl"></div>
{JSON.stringify(item.description) == "{}"?"":<div className="newshixunmodelmidfont" dangerouslySetInnerHTML={{__html: item.description}}> <style>
{
`
.newradioStyles{
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
max-height: 42px;
}
`
}
</style>
{JSON.stringify(item.description) == "{}"?"":<div className="newshixunmodelmidfont newradioStyles" title={item.description} dangerouslySetInnerHTML={{__html: item.description}}>
</div>} </div>}
{item.challenge_names.length===0?"":<div className="newshixunmodelbotfont"> {item.challenge_names.length===0?"":<div className="newshixunmodelbotfont">
@ -515,4 +527,28 @@ class NewShixunModel extends Component{
} }
} }
export default NewShixunModel; export default NewShixunModel;
// {JSON.stringify(item.content) == "{}"?<div className="newshixunmodelmidfont newradioStyles" title={item.description} dangerouslySetInnerHTML={{__html: item.description}}>
// </div>:<div className="newshixunmodelbotfont">
// {item.content.description === undefined || item.content.description===0?"":item.content.description.map((item,key)=>{
// return(
// <span dangerouslySetInnerHTML={{__html: item}}>{}</span>
// )
// })}
// </div>}
//
// {JSON.stringify(item.content) == "{}"?item.challenge_names.length===0?"":<div className="newshixunmodelbotfont">
// {item.challenge_names.map((item,key)=>{
// return(
// <span>第{key+1}关:{item}</span>
// )
// })}
// </div>:<div className="newshixunmodelbotfont">
// {item.content.challenge_names === undefined || item.content.challenge_names===0?"":item.content.challenge_names.map((item,key)=>{
// return(
// <span dangerouslySetInnerHTML={{__html: item}}>{}</span>
// )
// })}
// </div>}

@ -149,16 +149,12 @@
color: #999999; color: #999999;
margin-top: 15px; margin-top: 15px;
margin-left: 30px; margin-left: 30px;
max-width: 1100px;
overflow: hidden; overflow: hidden;
-o-text-overflow: ellipsis;
text-overflow: ellipsis; text-overflow: ellipsis;
max-width: 1100px; display: -webkit-box;
display: -webkit-box !important; -webkit-line-clamp: 2;
overflow: hidden !important; -webkit-box-orient: vertical;
text-overflow: ellipsis !important;
display: -webkit-box !important;
-webkit-line-clamp: 2 !important;
-webkit-box-orient: vertical !important;
} }
.newshixunmodelbotfont{ .newshixunmodelbotfont{

@ -268,8 +268,8 @@ class ExerciseReviewAndAnswer extends Component{
exercise_questions : update(prevState.exercise_questions, {[key]: { setScore: {$set: flag == undefined || flag==false ? true : false}}}) exercise_questions : update(prevState.exercise_questions, {[key]: { setScore: {$set: flag == undefined || flag==false ? true : false}}})
}),()=>{ }),()=>{
if (position && type && (flag == undefined || flag==false)) { if (position && type && (flag == undefined || flag==false)) {
$("#input_"+position+"_"+type).focus();
$("html").animate({ scrollTop: $("#Anchor_"+position+"_"+type).offset().top - 150 }); $("html").animate({ scrollTop: $("#Anchor_"+position+"_"+type).offset().top - 150 });
if(id){ if(id){
let { ajustSore } = this.state; let { ajustSore } = this.state;
let obj = ajustSore.filter(obj => obj.id === id).length > 0; let obj = ajustSore.filter(obj => obj.id === id).length > 0;
@ -332,7 +332,7 @@ class ExerciseReviewAndAnswer extends Component{
) )
} }
//确认调分 //确认调分
setAction=(key,q_id,maxScore)=>{ setAction=(key,q_id,maxScore,oldScore)=>{
let {ajustSore}=this.state; let {ajustSore}=this.state;
let list = ajustSore.filter(obj => obj.id == q_id); let list = ajustSore.filter(obj => obj.id == q_id);
let index = ajustSore.map(function (item) { return item.id; }).indexOf(q_id); let index = ajustSore.map(function (item) { return item.id; }).indexOf(q_id);
@ -382,21 +382,26 @@ class ExerciseReviewAndAnswer extends Component{
}).then((result)=>{ }).then((result)=>{
if(result.status==200){ if(result.status==200){
this.props.showNotification('调分成功'); this.props.showNotification('调分成功');
this.getInfo();
// let statusScore = score==0 ? 0 : score > 0 && score < maxScore ? 2 : 1;
let statusScore = score==0 ? 0 : score > 0 && score < maxScore ? 2 : 1; // this.setState(
// (prevState) => ({
this.setState( // exercise_questions : update(prevState.exercise_questions, {[key]: { user_score: {$set: parseFloat(score).toFixed(1)},answer_status : {$set: statusScore},question_comments:{$set:result.data.question_comments} }}),
(prevState) => ({ // })
exercise_questions : update(prevState.exercise_questions, {[key]: { user_score: {$set: parseFloat(score).toFixed(1)},answer_status : {$set: statusScore},question_comments:{$set:result.data.question_comments} }}), // )
})
)
this.setState( // this.setState(
(prevState) => ({ // (prevState) => ({
ajustSore : update(prevState.ajustSore, {[index]: { desc: {$set: undefined},inputSore:{ $set:undefined }}}) // ajustSore : update(prevState.ajustSore, {[index]: { desc: {$set: undefined},inputSore:{ $set:undefined }}})
}) // })
) // )
this.showSetScore(key,true); // let {exerciseTotalScore} = this.state;
// let newScore = parseFloat(parseFloat(exerciseTotalScore)+parseFloat(score)-parseFloat(oldScore)).toFixed(1);
// this.setState({
// exerciseTotalScore:newScore
// })
// this.showSetScore(key,true);
} }
}).catch((error)=>{ }).catch((error)=>{
console.log(error); console.log(error);
@ -781,7 +786,6 @@ class ExerciseReviewAndAnswer extends Component{
<div> <div>
{ {
exercise_questions && exercise_questions.map((item,key)=>{ exercise_questions && exercise_questions.map((item,key)=>{
debugger;
let list = ajustSore && ajustSore.filter(obj => obj.id === item.question_id); let list = ajustSore && ajustSore.filter(obj => obj.id === item.question_id);
return( return(
<div className="bor-top-greyE pt30 pb30" id={"Anchor_"+parseInt(key+1)}> <div className="bor-top-greyE pt30 pb30" id={"Anchor_"+parseInt(key+1)}>
@ -928,12 +932,13 @@ class ExerciseReviewAndAnswer extends Component{
precision={1} precision={1}
className={ list && list.length>0 && list[0].setTip !="" ? "edu-txt-center winput-115-40 fl mt3 noticeTip inputNumber30" : "edu-txt-center winput-115-40 fl mt3 inputNumber30"} className={ list && list.length>0 && list[0].setTip !="" ? "edu-txt-center winput-115-40 fl mt3 noticeTip inputNumber30" : "edu-txt-center winput-115-40 fl mt3 inputNumber30"}
onChange={(value)=>this.inputScore(value,item.question_id)} onChange={(value)=>this.inputScore(value,item.question_id)}
id={`${"input_"+item.q_position+"_"+item.question_type}`}
></InputNumber> ></InputNumber>
<span className="ml5"></span> <span className="ml5"></span>
{ {
parseInt(item.answer_status) == 0 && item.question_type == 4 ? <span className="color-red ml10 font-16">未评分</span> : '' parseInt(item.answer_status) == 0 && item.question_type == 4 ? <span className="color-red ml10 font-16">未评分</span> : ''
} }
<ActionBtn style="blue" className="middle ml20" onClick={()=>this.setAction(key,item.question_id,item.question_score)}>确认</ActionBtn> <ActionBtn style="blue" className="middle ml20" onClick={()=>this.setAction(key,item.question_id,item.question_score,item.user_score)}>确认</ActionBtn>
</p> </p>
{ {
list && list.length > 0 && list[0].setTip !="" ? <p className="color-red edu-txt-left">{ list[0].setTip }</p> :"" list && list.length > 0 && list[0].setTip !="" ? <p className="color-red edu-txt-left">{ list[0].setTip }</p> :""

Loading…
Cancel
Save