dev_aliyun_beta
杨树林 5 years ago
commit 5493c0f7a6

@ -354,6 +354,7 @@ class ExercisesController < ApplicationController
# question_bank = QuestionBank.new ques_params
# question_bank.save
# end
exercise.update_attributes!(exercise_bank_id: current_ex_bank.id)
end
# 试卷的问题的输入
exercise.exercise_questions.each do |q|

@ -301,6 +301,7 @@ class GraduationTasksController < ApplicationController
course_list_id: @course.course_list_id)
task_bank.save!
task.update_attributes!(gtask_bank_id: task_bank.id)
end
task.attachments.each do |attachment|
att = attachment.copy

@ -1322,6 +1322,8 @@ class HomeworkCommonsController < ApplicationController
else
new_homework_bank = add_to_homework_bank_f homework
new_homework_bank.save!
homework.update_attributes!(homework_bank_id: new_homework_bank.id)
end
rescue Exception => e

@ -562,6 +562,7 @@ class PollsController < ApplicationController
question_bank = QuestionBank.new ques_params
question_bank.save
end
poll.update_attributes!(exercise_bank_id: current_ex_bank.id)
end
# 问卷的问题的输入
poll.poll_questions.each do |f|

@ -541,7 +541,7 @@ class StudentWorksController < ApplicationController
def destroy_score
score = @work.student_works_scores.find_by(id: params[:score_id])
tip_exception("该评阅记录不存在") unless score.present?
tip_exception("该评阅记录不能删除") unless score.allow_delete(@current_user, @user_course_identity)
tip_exception("该评阅记录不能删除") unless score.allow_delete(current_user)
begin
score.destroy
normal_status(0,"删除成功")

@ -13,9 +13,8 @@ belongs_to :student_work
identity < Course::STUDENT || self.user == user || self.reviewer_role != 3
end
def allow_delete current_user, identity
self.is_invalid && (current_user == self.user || identity < Course::STUDENT) ||
(self.score.nil? && current_user == self.user)
def allow_delete current_user
(self.is_invalid || self.score.nil?) && (current_user == self.user || current_user.admin?)
end
# 匿评分

@ -15,7 +15,7 @@ json.comment_scores @comment_scores do |score|
json.score score.score
json.content score.comment
json.is_invalid score.is_invalid
json.delete @current_user == score.user && (score.is_invalid || score.score.nil?)
json.delete (@current_user == score.user || @current_user.admin?) && (score.is_invalid || score.score.nil?)
json.attachments score.attachments do |atta|
json.partial! "attachments/attachment_simple", locals: {attachment: atta, delete: false}
end

@ -23,7 +23,7 @@ json.comment_scores @comment_scores do |score|
json.content score.comment
json.appeal_status score.appeal_status
json.is_invalid score.is_invalid
json.delete score.allow_delete(@current_user, @user_course_identity)
json.delete score.allow_delete(@current_user)
json.attachments score.attachments do |atta|
json.partial! "attachments/attachment_simple", locals: {attachment: atta, delete: false}
end

@ -129,20 +129,21 @@ class CommonWorkDetailIndex extends Component{
})
}
}else {
this.props.showNotification(`正在下载中`);
this.setState({ donwloading: true })
downloadFile({
url: url,
successCallback: (url) => {
this.setState({ donwloading: false })
console.log('successCallback')
},
failCallback: (responseHtml, url) => {
this.setState({ donwloading: false })
console.log('failCallback')
}
})
this.props.slowDownload(url)
// this.props.showNotification(`正在下载中`);
// this.setState({ donwloading: true })
// downloadFile({
// url: url,
// successCallback: (url) => {
// this.setState({ donwloading: false })
// console.log('successCallback')
// },
// failCallback: (responseHtml, url) => {
// this.setState({ donwloading: false })
// console.log('failCallback')
// }
// })
// window.open("/api"+url, '_blank');
}
}).catch((error) => {

@ -81,11 +81,7 @@ class CommonWorkQuestion extends Component{
let category_id=this.props.match.params.category_id;
let task_Id=this.props.match.params.task_Id;
const isGroup = this.props.isGroup()
/**
<React.Fragment>
<a className={"fr color-blue font-16"} href={exportResultUrl}>导出成绩</a>
</React.Fragment>
*/
return(
<React.Fragment>

@ -63,8 +63,9 @@ class TabRightComponents extends Component{
})
}
}else {
this.props.showNotification(`正在下载中`);
window.open("/api"+url, '_blank');
this.props.slowDownload(url)
// this.props.showNotification(`正在下载中`);
// window.open("/api"+url, '_blank');
}
}).catch((error) => {
console.log(error)

@ -600,7 +600,7 @@ class studentsList extends Component{
font-size: 14px;
}
.drop_down_menu {
width: 93px;
/*width: 93px;*/
}
.drop_down_menu li {
width:100%;

@ -995,6 +995,37 @@ class PollNew extends Component {
}
if(object.question.max_choices){
if(object.question.max_choices>0){
if(object.question.min_choices){
if(object.question.min_choices===0){
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
}else {
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
}
}
if(object.question.min_choices){
if(object.question.min_choices>0){
if(object.question.max_choices){
if(object.question.max_choices===0){
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
}else {
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
}
}
var questiontwo = {};
var other = [];
var option = [];
@ -1196,6 +1227,40 @@ class PollNew extends Component {
}
}
}
if(object.question.max_choices){
if(object.question.max_choices>0){
if(object.question.min_choices){
if(object.question.min_choices===0){
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
}else {
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
}
}
if(object.question.min_choices){
if(object.question.min_choices>0){
if(object.question.max_choices){
if(object.question.max_choices===0){
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
}else {
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
}
}
// if (object.question.max_choices < object.question.min_choices) {
// this.props.showNotification('可选的最大限制不能小于最小限制!');
//
@ -1482,11 +1547,44 @@ class PollNew extends Component {
if(object.question.max_choices>0){
if (object.question.max_choices < object.question.min_choices) {
this.props.showNotification(`可选的最大限制不能小于最小限制`);
return;
}
}
}
if(object.question.max_choices){
if(object.question.max_choices>0){
if(object.question.min_choices){
if(object.question.min_choices===0){
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
}else {
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
}
}
if(object.question.min_choices){
if(object.question.min_choices>0){
if(object.question.max_choices){
if(object.question.max_choices===0){
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
}else {
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
}
}
// if (object.question.max_choices < object.question.min_choices) {
// this.props.showNotification(`可选的最大限制不能小于最小限制`);
//
@ -1665,11 +1763,38 @@ class PollNew extends Component {
}
}
}
// if (object.question.max_choices < object.question.min_choices) {
// this.props.showNotification(`可选的最大限制不能小于最小限制`);
//
// return;
// }
if(object.question.max_choices){
if(object.question.max_choices>0){
if(object.question.min_choices){
if(object.question.min_choices===0){
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
}else {
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
}
}
if(object.question.min_choices){
if(object.question.min_choices>0){
if(object.question.max_choices){
if(object.question.max_choices===0){
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
}else {
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
return;
}
}
}
var questiontwo = {};
var other = [];
var option = [];
@ -2240,34 +2365,34 @@ class PollNew extends Component {
var minbool = false;
var maxbool = false;
let arr = this.state.adddom;
if (parseInt(value) === 0 || parseInt(value) === "0" || parseInt(value) === null || parseInt(value) === undefined || parseInt(value) < 1) {
minbool = true;
}
if (max === 0 || max === "0" || max === null || max === undefined) {
maxbool = true;
}
if (minbool === true && maxbool === true) {
for (var i = 0; i < arr.length; i++) {
if (index === i) {
arr[i].question.min_choices = parseInt(value);
}
}
this.setState({
adddom: arr
})
} else {
// if (parseInt(value) === 0 || parseInt(value) === "0" || parseInt(value) === null || parseInt(value) === undefined || parseInt(value) < 1) {
// minbool = true;
// }
// if (max === 0 || max === "0" || max === null || max === undefined) {
// maxbool = true;
// }
//
// if (minbool === true && maxbool === true) {
// for (var i = 0; i < arr.length; i++) {
// if (index === i) {
// arr[i].question.min_choices = parseInt(value);
// }
// }
// this.setState({
// adddom: arr
// })
// } else {
for (var i = 0; i < arr.length; i++) {
if (index === i) {
arr[i].question.min_choices = parseInt(value);
arr[i].question.max_choices = length;
// arr[i].question.max_choices = length;
break;
}
}
this.setState({
adddom: arr
})
}
// }
}
@ -2284,21 +2409,21 @@ class PollNew extends Component {
let arr = this.state.adddom;
for (var i = 0; i < arr.length; i++) {
if (index === i) {
if(parseInt(value)===0&&parseInt(minchoices)===0){
arr[i].question.min_choices= parseInt(0);
arr[i].question.max_choices = parseInt(0);
}else if(parseInt(minchoices)===0){
arr[i].question.min_choices= parseInt(2);
arr[i].question.max_choices = parseInt(value);
}
else if(parseInt(value)===0&&parseInt(minchoices)>0){
arr[i].question.min_choices= parseInt(minchoices);
arr[i].question.max_choices = parseInt(value);
}
else {
arr[i].question.min_choices= minchoices===null?2:minchoices===undefined?2:minchoices===0?2:parseInt(minchoices);
// if(parseInt(value)===0&&parseInt(minchoices)===0){
// arr[i].question.min_choices= parseInt(0);
// arr[i].question.max_choices = parseInt(0);
// }else if(parseInt(minchoices)===0){
// arr[i].question.min_choices= parseInt(2);
// arr[i].question.max_choices = parseInt(value);
// }
// else if(parseInt(value)===0&&parseInt(minchoices)>0){
// arr[i].question.min_choices= parseInt(minchoices);
// arr[i].question.max_choices = parseInt(value);
// }
// else {
// arr[i].question.min_choices= minchoices===null?2:minchoices===undefined?2:minchoices===0?2:parseInt(minchoices);
arr[i].question.max_choices = parseInt(value);
}
// }
}
}
// console.log(2119);
@ -2774,8 +2899,13 @@ class PollNew extends Component {
className="color-grey-9 fl">{item.question.question_type === 1 ? "(单选题)" : item.question.question_type === 2 ? "(多选题)" : "(主观题)"}</span>
<span
className="selectAnswer ml10">{item.question.is_necessary === 1 ? "必答" : item.question.question_type === 2 ? "选答" : "选答"}</span>
<span style={{color: "#4B4B4B"}}
className="font-16 mt10 ml10">{(item.question.min_choices === undefined && item.question.max_choices === undefined ? "不限制" : item.question.min_choices === null && item.question.max_choices === null ? "不限制" : item.question.min_choices === 0 && item.question.max_choices === 0 ? "": item.question.min_choices === "null" && item.question.max_choices === "null" ? "不限制" : "可选" + item.question.min_choices + "-" + (item.question.max_choices===undefined||item.question.max_choices===null||item.question.max_choices===""||item.question.max_choices==="null"?item.question.answers.length:item.question.max_choices) + "项")}</span>
{
item.question.question_type === 2?
<span style={{color: "#4B4B4B"}}
className="font-16 mt10 ml10">{(item.question.min_choices === undefined && item.question.max_choices === undefined ? "不限制" : item.question.min_choices === null && item.question.max_choices === null ? "不限制" : item.question.min_choices === 0 && item.question.max_choices === 0 ? "": item.question.min_choices === "null" && item.question.max_choices === "null" ? "不限制" : item.question.min_choices === item.question.max_choices && item.question.max_choices === item.question.min_choices ? "可选"+(item.question.max_choices)+"项" : "可选" +(item.question.min_choices===undefined||item.question.min_choices===null||item.question.min_choices===""||item.question.min_choices==="null"?2:item.question.min_choices) + "-" + (item.question.max_choices===undefined||item.question.max_choices===null||item.question.max_choices===""||item.question.max_choices==="null"?item.question.answers.length:item.question.max_choices) + "项")}</span>
: ""
}
{
polls_status === undefined || polls_status === 1 ?
<span className="fr">
@ -2963,7 +3093,7 @@ class PollNew extends Component {
<span
className="color-grey-6 mr20 font-16 lineh-40 fl">可选</span>
<div className="mr40 flex1 ">
{/*可选最小2*/}
{/*可选最小1*/}
<style>
{
`
@ -3205,7 +3335,7 @@ class PollNew extends Component {
<span
className="color-grey-6 mr20 font-16 lineh-40 fl">可选</span>
<div className="mr40 flex1 ">
{/*可选最小1*/}
{/*可选最小*/}
<style>
{
`
@ -3234,7 +3364,7 @@ class PollNew extends Component {
</Select>
<span
className="ml10 mr10 color-grey-6 lineh-40 fl">~</span>
{/*可选最大1*/}
{/*可选最大*/}
<Select className="fl w100"
onChange={(value) => this.HandleGradationGroupChangeee(value, indexo,itemo.question.min_choices,itemo.question.answers.length)}
value={itemo.question.max_choices === null || itemo.question.max_choices === undefined ||itemo.question.max_choices === "null"|| itemo.question.max_choices === 0 || itemo.question.max_choices === "0"?"0": itemo.question.max_choices}
@ -3456,7 +3586,7 @@ class PollNew extends Component {
<span
className="color-grey-6 mr20 font-16 lineh-40 fl">可选</span>
<div className="mr40 flex1 ">
{/*可选最小3*/}
{/*可选最小*/}
<style>
{
`
@ -3485,7 +3615,7 @@ class PollNew extends Component {
</Select>
<span
className="ml10 mr10 color-grey-6 lineh-40 fl">~</span>
{/*可选最大3*/}
{/*可选最大*/}
<Select className="fl w100"
onChange={(value) => this.HandleGradationGroupChangeee(value, indexo,itemo.question.min_choices,itemo.question.answers.length)}
value={itemo.question.max_choices === null || itemo.question.max_choices === undefined ||itemo.question.max_choices === "null"|| itemo.question.max_choices === 0 || itemo.question.max_choices === "0"?"0": itemo.question.max_choices}

@ -584,7 +584,7 @@ class MessagSub extends Component{
`
}
</style>
<p className="color-grey-6 break_word_firefox yslspansk markdown-body mt10" style={{wordBreak: "break-word"}} dangerouslySetInnerHTML={{__html: markdownToHTML(item.content).replace(/▁/g, "▁▁▁")}} ></p>
<p className="color-grey-6 yslspansk markdown-body mt10" style={{wordBreak: "break-word"}} dangerouslySetInnerHTML={{__html: markdownToHTML(item.content).replace(/▁/g, "▁▁▁")}} ></p>
</div>
<span className={item.new_tiding===true?"new-point fr mr40 mt22":""}></span>

@ -471,6 +471,9 @@ export function TPMIndexHOC(WrappedComponent) {
.indexHOC > .ant-spin-nested-loading {
background: #000;
}
.indexHOC > .ant-spin-nested-loading > div > .ant-spin .ant-spin-dot {
top: 50% !important;
}
.globalSpin .ant-spin-text {
text-shadow: none !important;

Loading…
Cancel
Save