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

dev_aliyun_beta
cxt 6 years ago
commit c474b5f944

@ -31,6 +31,7 @@ $(document).on('turbolinks:load', function() {
});
$refuseModal.on('hide.bs.modal', function () {
$applyIdInput.val('');
$refuseModal.find('.modal-body input[name="reason"]').val('');
$form.data('url', '');
})

@ -1,6 +1,6 @@
$(document).on('turbolinks:load', function() {
if ($('body.admins-shixun-settings-index-page').length > 0) {
$(".shixun-settings-list-container").on("change", '.shixun-settings-select', function () {
$(".shixun-settings-list-form").on("change", '.shixun-settings-select', function () {
var s_value = $(this).val();
var s_name = $(this).attr("name");
var json = {};

@ -240,7 +240,7 @@ class ApplicationController < ActionController::Base
uid_logger("user_setup: " + (User.current.logged? ? "#{User.current.try(:login)} (id=#{User.current.try(:id)})" : "anonymous"))
if !User.current.logged? && Rails.env.development?
User.current = User.find 1
# User.current = User.find 1
end

@ -8,14 +8,14 @@
</button>
</div>
<div class="modal-body">
<form class="admin-common-refuse-form">
<%= form_tag(admins_path, method: :post, class: 'admin-common-refuse-form') do %>
<%= hidden_field_tag(:apply_id, nil) %>
<div class="form-group">
<label for="reason" class="col-form-label">原因:</label>
<%= text_area_tag(:reason, nil, class: 'form-control', placeholder: '我得说点儿什么最多200字') %>
</div>
<div class="error text-danger"></div>
</form>
<% end %>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>

File diff suppressed because one or more lines are too long

@ -37601,6 +37601,7 @@ $(document).on('turbolinks:load', function() {
});
$refuseModal.on('hide.bs.modal', function () {
$applyIdInput.val('');
$refuseModal.find('.modal-body input[name="reason"]').val('');
$form.data('url', '');
})
@ -38423,7 +38424,7 @@ $(document).on('turbolinks:load', function() {
;
$(document).on('turbolinks:load', function() {
if ($('body.admins-shixun-settings-index-page').length > 0) {
$(".shixun-settings-list-container").on("change", '.shixun-settings-select', function () {
$(".shixun-settings-list-form").on("change", '.shixun-settings-select', function () {
var s_value = $(this).val();
var s_name = $(this).attr("name");
var json = {};

@ -37601,6 +37601,7 @@ $(document).on('turbolinks:load', function() {
});
$refuseModal.on('hide.bs.modal', function () {
$applyIdInput.val('');
$refuseModal.find('.modal-body input[name="reason"]').val('');
$form.data('url', '');
})
@ -38423,7 +38424,7 @@ $(document).on('turbolinks:load', function() {
;
$(document).on('turbolinks:load', function() {
if ($('body.admins-shixun-settings-index-page').length > 0) {
$(".shixun-settings-list-container").on("change", '.shixun-settings-select', function () {
$(".shixun-settings-list-form").on("change", '.shixun-settings-select', function () {
var s_value = $(this).val();
var s_name = $(this).attr("name");
var json = {};

@ -975,18 +975,23 @@ class PollNew extends Component {
if (this.state.problemtopicbool === true) {
insindex = this.state.problemtopic;
}
this.createquestionsandanswers(object, 1, arrc, null, 0, 0, insindex);
this.createquestionsandanswers(object, 1, arrc, null, 0, 0, insindex,0);
// newarrpoll.push(question);
newarrpoll.splice(thiss.state.Insertposition, 0, question);
} else if (object.question.question_type === 2) {
//插入多选题
if (object.question.max_choices < object.question.min_choices) {
this.props.showNotification(`可选的最大限制不能小于最小限制`);
if(object.question.max_choices){
if(object.question.max_choices>0){
if (object.question.max_choices < object.question.min_choices) {
this.props.showNotification(`可选的最大限制不能小于最小限制`);
return;
return;
}
}
}
var questiontwo = {};
var other = [];
var option = [];
@ -1035,7 +1040,7 @@ class PollNew extends Component {
if (this.state.problemtopicbool === true) {
insindex = this.state.problemtopic;
}
this.createquestionsandanswers(object, 2, arrc, null, object.question.max_choices, object.question.min_choices, insindex);
this.createquestionsandanswers(object, 2, arrc, null, object.question.max_choices, object.question.min_choices, insindex,object.question.answers.length);
//插入多选题
// if (object.question.max_choices > arrc.length) {
// // console.log("选择题的最大可选项不能大于选项数")
@ -1105,7 +1110,7 @@ class PollNew extends Component {
if (this.state.problemtopicbool === true) {
insindex = this.state.problemtopic;
}
this.createquestionsandanswers(object, 3, null, null, 0, 0, insindex);
this.createquestionsandanswers(object, 3, null, null, 0, 0, insindex,0);
// newarrpoll.push(question);
newarrpoll.splice(thiss.state.Insertposition, 0, question);
}
@ -1168,23 +1173,31 @@ class PollNew extends Component {
question = {"question": questiontwo};
if (uuk !== -1) {
// console.log("修改")
this.edittotheserver(object, 1, arrc, null, 0, 0);
this.edittotheserver(object, 1, arrc, null, 0, 0,0);
newarrpoll.splice(uuk, 1, question);
} else {
// console.log("他原来的删除掉了")
this.createquestionsandanswers(object, 1, arrc, null, 0, 0, object.question.id);
this.createquestionsandanswers(object, 1, arrc, null, 0, 0, object.question.id,0);
newarrpoll.push(question);
}
newarr[indexo].question.new = "new"
// console.log(newarrpoll)
} else if (object.question.question_type === 2) {
//插入多选题
if(object.question.max_choices){
if(object.question.max_choices>0){
if (object.question.max_choices < object.question.min_choices) {
this.props.showNotification(`可选的最大限制不能小于最小限制`);
if (object.question.max_choices < object.question.min_choices) {
this.props.showNotification('可选的最大限制不能小于最小限制!');
return;
return;
}
}
}
// if (object.question.max_choices < object.question.min_choices) {
// this.props.showNotification('可选的最大限制不能小于最小限制!');
//
// return;
// }
var questiontwo = {};
var other = [];
var option = [];
@ -1239,11 +1252,11 @@ class PollNew extends Component {
// }
if (uuk !== -1) {
// console.log("修改")
this.edittotheserver(object, 2, arrc, null, object.question.max_choices, object.question.min_choices);
this.edittotheserver(object, 2, arrc, null, object.question.max_choices, object.question.min_choices,object.question.answers.length);
newarrpoll.splice(uuk, 1, question);
} else {
// console.log("删除")
this.createquestionsandanswers(object, 2, arrc, null, object.question.max_choices, object.question.min_choices, object.question.id);
this.createquestionsandanswers(object, 2, arrc, null, object.question.max_choices, object.question.min_choices, object.question.id,object.question.answers.length);
newarrpoll.push(question);
}
// console.log(newarrpoll)
@ -1285,11 +1298,11 @@ class PollNew extends Component {
if (uuk !== -1) {
// console.log("修改")
this.edittotheserver(object, 3, null, null, 0, 0);
this.edittotheserver(object, 3, null, null, 0, 0,0);
newarrpoll.splice(uuk, 1, question);
} else {
// console.log("删除")
this.createquestionsandanswers(object, 3, null, null, 0, 0, object.question.id);
this.createquestionsandanswers(object, 3, null, null, 0, 0, object.question.id,0);
newarrpoll.push(question);
}
// console.log(newarrpoll)
@ -1457,15 +1470,24 @@ class PollNew extends Component {
if (this.state.problemtopicbool === true) {
insindex = this.state.problemtopic;
}
this.createquestionsandanswers(object, 1, arrc, null, 0, 0, insindex);
this.createquestionsandanswers(object, 1, arrc, null, 0, 0, insindex,0);
newarrpoll.splice(thiss.state.Insertposition, 0, question);
} else if (object.question.question_type === 2) {
//插入多选题
if (object.question.max_choices < object.question.min_choices) {
this.props.showNotification(`可选的最大限制不能小于最小限制`);
if(object.question.max_choices){
if(object.question.max_choices>0){
if (object.question.max_choices < object.question.min_choices) {
this.props.showNotification(`可选的最大限制不能小于最小限制`);
return;
return;
}
}
}
// if (object.question.max_choices < object.question.min_choices) {
// this.props.showNotification(`可选的最大限制不能小于最小限制`);
//
// return;
// }
var questiontwo = {};
var other = [];
@ -1511,7 +1533,7 @@ class PollNew extends Component {
if (this.state.problemtopicbool === true) {
insindex = this.state.problemtopic;
}
this.createquestionsandanswers(object, 2, arrc, null, object.question.max_choices, object.question.min_choices, insindex);
this.createquestionsandanswers(object, 2, arrc, null, object.question.max_choices, object.question.min_choices, insindex,object.question.answers.length);
//插入多选题
// if (object.question.max_choices > arrc.length) {
@ -1559,7 +1581,7 @@ class PollNew extends Component {
if (this.state.problemtopicbool === true) {
insindex = this.state.problemtopic;
}
this.createquestionsandanswers(object, 3, null, null, 0, 0, insindex);
this.createquestionsandanswers(object, 3, null, null, 0, 0, insindex,0);
// newarrpoll.push(question);
newarrpoll.splice(thiss.state.Insertposition, 0, question);
}
@ -1620,21 +1642,30 @@ class PollNew extends Component {
question = {"question": questiontwo};
if (uuk !== -1) {
// console.log("修改")
this.edittotheserver(object, 1, arrc, null, 0, 0);
this.edittotheserver(object, 1, arrc, null, 0, 0,0);
newarrpoll.splice(uuk, 1, question);
} else {
// console.log("删除")
this.createquestionsandanswers(object, 1, arrc, null, 0, 0, object.question.id);
this.createquestionsandanswers(object, 1, arrc, null, 0, 0, object.question.id,0);
newarrpoll.push(question);
}
// console.log(newarrpoll)
} else if (object.question.question_type === 2) {
//插入多选题
if (object.question.max_choices < object.question.min_choices) {
this.props.showNotification(`可选的最大限制不能小于最小限制`);
if(object.question.max_choices){
if(object.question.max_choices>0){
if (object.question.max_choices < object.question.min_choices) {
this.props.showNotification(`可选的最大限制不能小于最小限制`);
return;
return;
}
}
}
// if (object.question.max_choices < object.question.min_choices) {
// this.props.showNotification(`可选的最大限制不能小于最小限制`);
//
// return;
// }
var questiontwo = {};
var other = [];
var option = [];
@ -1676,11 +1707,11 @@ class PollNew extends Component {
//插入多选题
if (uuk !== -1) {
// console.log("修改")
this.edittotheserver(object, 2, arrc, null, object.question.max_choices, object.question.min_choices);
this.edittotheserver(object, 2, arrc, null, object.question.max_choices, object.question.min_choices,object.question.answers.length);
newarrpoll.splice(uuk, 1, question);
} else {
// console.log("删除")
this.createquestionsandanswers(object, 2, arrc, null, object.question.max_choices, object.question.min_choices, object.question.id);
this.createquestionsandanswers(object, 2, arrc, null, object.question.max_choices, object.question.min_choices, object.question.id,object.question.answers.length);
newarrpoll.push(question);
}
// console.log(newarrpoll)
@ -1721,11 +1752,11 @@ class PollNew extends Component {
question = {"question": questiontwo};
if (uuk !== -1) {
// console.log("修改")
this.edittotheserver(object, 3, null, null, 0, 0);
this.edittotheserver(object, 3, null, null, 0, 0,0);
newarrpoll.splice(uuk, 1, question);
} else {
// console.log("删除")
this.createquestionsandanswers(object, 3, null, null, 0, 0, object.question.id);
this.createquestionsandanswers(object, 3, null, null, 0, 0, object.question.id,0);
newarrpoll.push(question);
}
// console.log(newarrpoll)
@ -1761,7 +1792,8 @@ class PollNew extends Component {
////新增到服务器中
createquestionsandanswers = (object, number, option, other, max_choices, min_choices, insert_id) => {
createquestionsandanswers = (object, number, option, other, max_choices, min_choices, insert_id,length) => {
var thiss = this;
var poll_id = this.state.pollid;
var urlly = `/polls/${poll_id}/poll_questions.json`
@ -1774,13 +1806,16 @@ class PollNew extends Component {
max_choicess = max_choices;
min_choicess = min_choices;
}
console.log("createquestionsandanswers");
console.log(max_choicess);
console.log(min_choicess);
console.log(length);
axios.post(urlly, {
question_title: object.question.question_title,
question_type: number,
is_necessary: object.question.is_necessary,
max_choices: max_choicess===undefined?null:max_choicess===null?null:max_choicess===0?null:max_choicess,
min_choices: min_choicess===undefined?null:min_choicess===null?null:min_choicess===0?null:min_choicess,
max_choices: max_choicess===undefined?length:max_choicess===null?length:max_choicess===0?length:max_choicess,
min_choices: min_choicess===undefined?2:min_choicess===null?2:min_choicess===0?2:min_choicess,
question_answers: option,
question_other_answer: null,
insert_id: insert_id
@ -1811,17 +1846,30 @@ class PollNew extends Component {
}
///编辑修改到服务器当中
edittotheserver = (object, number, option, other, max_choices, min_choices) => {
edittotheserver = (object, number, option, other, max_choices, min_choices,length) => {
// console.log("调用了edittotheserver")
var url = `/poll_questions/${object.question.id}.json`
var thiss = this;
var max_choicess = null;
var min_choicess = null;
if (max_choices === 0 && min_choices === 0) {
max_choicess = null;
min_choicess = null;
} else {
max_choicess = max_choices;
min_choicess = min_choices;
}
console.log("createquestionsandanswers");
console.log(max_choicess);
console.log(min_choicess);
console.log(length);
axios.put(url, {
// debug: true,
question_title: object.question.question_title,
question_type: number,
is_necessary: object.question.is_necessary,
max_choices: max_choices,
min_choices: min_choices,
max_choices: max_choicess===undefined?length:max_choicess===null?length:max_choicess===0?length:max_choicess,
min_choices: min_choicess===undefined?2:min_choicess===null?2:min_choicess===0?2:min_choicess,
question_answers: option,
question_other_answer: null,
}).then((result) => {
@ -2133,11 +2181,11 @@ class PollNew extends Component {
//最小值
HandleGradationGroupChangee = (value, index, max, length) => {
console.log("最小值");
console.log(value);
console.log(index);
console.log(max);
console.log(length);
// console.log("最小值");
// console.log(value);
// console.log(index);
// console.log(max);
// console.log(length);
// debugger
var minbool = false;
@ -2179,11 +2227,11 @@ class PollNew extends Component {
// console.log("2112");
// console.log(value);
// console.log(minchoices);
console.log("最大值");
console.log(value);
console.log(index);
console.log(minchoices);
console.log(length);
// console.log("最大值");
// console.log(value);
// console.log(index);
// console.log(minchoices);
// console.log(length);
let arr = this.state.adddom;
for (var i = 0; i < arr.length; i++) {
if (index === i) {

Loading…
Cancel
Save