Merge remote-tracking branch 'origin/topic_bank' into topic_bank

dev_aliyun_beta
杨树明 5 years ago
commit d0f5cabcb6

@ -3,6 +3,7 @@ $(document).on('turbolinks:load', function() {
if ($refuseModal.length > 0) {
var $form = $refuseModal.find('form.admin-common-refuse-form');
var $applyIdInput = $refuseModal.find('.modal-body input[name="apply_id"]');
var $applyTitle = $refuseModal.find('.modal-title');
$form.validate({
errorElement: 'span',
@ -21,9 +22,19 @@ $(document).on('turbolinks:load', function() {
var applyId = $link.data('id');
var url = $link.data('url');
var title = $link.data('title');
var type = $link.data('type');
var form_method = "POST";
if(typeof title !== 'undefined'){
$applyTitle.html(title)
}
if(typeof type !== 'undefined'){
form_method = type;
}
$applyIdInput.val(applyId);
$form.data('url', url);
$form.data('type', form_method);
});
// modal visited fire
$refuseModal.on('shown.bs.modal', function(){
@ -40,9 +51,10 @@ $(document).on('turbolinks:load', function() {
if ($form.valid()) {
var url = $form.data('url');
var form_method = $form.data('type');
$.ajax({
method: 'POST',
method: form_method,
dataType: 'script',
url: url,
data: $form.serialize(),

@ -0,0 +1,22 @@
$(document).on('turbolinks:load', function() {
var $editModal = $('.department-apply-edit-modal');
if($editModal.length > 0){
var $form = $editModal.find('form.department-apply-form');
var $applyIdInput = $form.find('input[name="id"]');
$editModal.on('show.bs.modal', function (event) {
var $link = $(event.relatedTarget);
var applyId = $link.data('id');
$applyIdInput.val(applyId);
});
$editModal.on('click', '.submit-btn', function(){
$.ajax({
method: "PUT",
dataType: 'script',
url: "/admins/department_applies/"+ $applyIdInput.val(),
data: $form.serialize(),
}).done(function(){
$editModal.modal('hide');
});
});
}
});

@ -0,0 +1,71 @@
class Admins::DepartmentAppliesController < Admins::BaseController
before_action :get_apply,only:[:agree,:edit,:update,:destroy]
def index
params[:status] ||= 0
params[:sort_by] = params[:sort_by].presence || 'created_at'
params[:sort_direction] = params[:sort_direction].presence || 'desc'
applies = Admins::DepartmentApplyQuery.call(params)
@depart_applies = paginate applies.preload(:school,user: :user_extension)
end
def agree
ActiveRecord::Base.transaction do
@depart_apply.update_attribute("status",1)
@depart_apply&.applied_messages&.update_all(status:1)
@depart_apply&.department&.update_attribute("is_auth",1)
@depart_apply&.user&.user_extension&.update_attribute("department_id",@depart_apply.department_id)
render_success_js
end
end
def update
depart_name = params[:name]
ActiveRecord::Base.transaction do
@depart_apply.update_attribute("name",depart_name)
@depart_apply&.department&.update_attribute("name",depart_name)
extra = depart_name + "(#{@depart_apply&.department&.school&.try(:name)})"
tiding_params = {
user_id: @depart_apply.user_id,
trigger_user_id: 0,
container_id: @depart_apply.id,
container_type: 'ApplyAddDepartment',
belong_container_id: @depart_apply.department.school_id,
belong_container_type: "School",
tiding_type: "System",
status: 3,
extra: extra
}
Tiding.create(tiding_params)
render_success_js
end
end
def destroy
ActiveRecord::Base.transaction do
@depart_apply.update_attribute("status",3)
@depart_apply&.applied_messages&.update_all(status:3)
@depart_apply&.department&.destroy
@depart_apply&.user&.user_extension&.update_attribute("department_id", nil)
tiding_params = {
user_id: @depart_apply.user_id,
trigger_user_id: 0,
container_id: @depart_apply.id,
container_type: 'ApplyAddDepartment',
belong_container_id: @depart_apply.department.school_id,
belong_container_type: "School",
tiding_type: "System",
status: 2,
extra: params[:reason]
}
Tiding.create(tiding_params)
render_success_js
end
end
private
def get_apply
@depart_apply = ApplyAddDepartment.find_by(id:params[:id])
end
end

@ -27,7 +27,7 @@ class CoursesController < ApplicationController
:attahcment_category_list,:export_member_scores_excel, :duplicate_course,
:switch_to_teacher, :switch_to_assistant, :switch_to_student, :exit_course,
:informs, :update_informs, :online_learning, :update_task_position, :tasks_list,
:join_excellent_course, :export_couser_info, :export_member_act_score, :new_informs]
:join_excellent_course, :export_couser_info, :export_member_act_score, :new_informs, :delete_informs]
before_action :user_course_identity, except: [:join_excellent_course, :index, :create, :new, :apply_to_join_course,
:search_course_list, :get_historical_course_students, :mine, :search_slim, :board_list]
before_action :teacher_allowed, only: [:update, :destroy, :settings, :search_teacher_candidate,
@ -36,7 +36,7 @@ class CoursesController < ApplicationController
:add_teacher, :export_couser_info, :export_member_act_score]
before_action :admin_allowed, only: [:set_invite_code_halt, :set_public_or_private, :change_course_admin,
:set_course_group, :create_group_by_importing_file, :update_informs, :new_informs,
:update_task_position, :tasks_list]
:update_task_position, :tasks_list, :delete_informs]
before_action :teacher_or_admin_allowed, only: [:graduation_group_list, :create_graduation_group, :join_graduation_group,
:change_course_teacher, :course_group_list,
:teacher_application_review, :apply_teachers, :delete_course_teacher]
@ -257,6 +257,12 @@ class CoursesController < ApplicationController
normal_status("更新成功")
end
def delete_informs
inform = @course.informs.find_by(id: params[:inform_id])
inform.destroy!
normal_status("删除成功")
end
def online_learning
@subject = @course.subject
@stages = @subject&.stages

@ -82,8 +82,7 @@ class HomeworkCommonsController < ApplicationController
end
@task_count = @homework_commons.size
@homework_commons = @homework_commons.order("IF(ISNULL(homework_commons.publish_time),0,1), homework_commons.publish_time DESC,
homework_commons.created_at DESC").page(page).per(15)
@homework_commons = @homework_commons.order("position DESC").page(page).per(15)
if @homework_type == 4
@homework_commons = @homework_commons.includes(:homework_detail_manual, :published_settings, :shixuns)

@ -1,5 +1,6 @@
class Users::QuestionBanksController < Users::BaseController
before_action :require_login
before_action :private_user_resources!
before_action :check_query_params!
before_action :check_user_permission!

@ -108,6 +108,8 @@ module CoursesHelper
course_board.present? ? course_board.messages.size : 0
when "course_group"
course.course_groups_count
when "announcement"
course.informs.count
end
end

@ -0,0 +1,25 @@
class Admins::DepartmentApplyQuery < ApplicationQuery
include CustomSortable
attr_reader :params
sort_columns :created_at, default_by: :created_at, default_direction: :desc
def initialize(params)
@params = params
end
def call
status = params[:status]
applies = ApplyAddDepartment.where(status: status) if status.present?
# 关键字模糊查询
keyword = params[:keyword].to_s.strip
if keyword.present?
applies = applies.where('name LIKE :keyword', keyword: "%#{keyword}%")
end
custom_sort(applies, params[:sort_by], params[:sort_direction])
end
end

@ -46,6 +46,7 @@ class Admins::ImportUserService < ApplicationService
department = school.departments.find_by(name: data.department_name)
attr = {
type: 'User',
status: User::STATUS_ACTIVE,
login: "#{prefix}#{data.student_id}",
firstname: '',
@ -54,7 +55,9 @@ class Admins::ImportUserService < ApplicationService
professional_certification: 1,
certification: 1,
password: '12345678',
phone: data.phone
phone: data.phone,
mail: "#{prefix}#{data.student_id}@qq.com",
profile_completed: true
}
ActiveRecord::Base.transaction do
user = User.create!(attr)
@ -66,8 +69,8 @@ class Admins::ImportUserService < ApplicationService
extension_attr[:technical_title] =
case data.identity.to_i
when 0 then %w(教授 副教授 讲师 助教).include?(data.technical_title) || '讲师'
when 2 then %w(企业管理者 部门管理者 高级工程师 工程师 助理工程师).include?(data.technical_title) || '助理工程师'
when 0 then %w(教授 副教授 讲师 助教).include?(data.technical_title) ? data.technical_title : '讲师'
when 2 then %w(企业管理者 部门管理者 高级工程师 工程师 助理工程师).include?(data.technical_title) ? data.technical_title : '助理工程师'
else nil
end

@ -0,0 +1,2 @@
//$("#apply-id-<%= @depart_apply.id %>").remove()
//pop_box_new("批准成功", 400, 248);

@ -0,0 +1,18 @@
<% define_admin_breadcrumbs do %>
<% add_admin_breadcrumb('部门审批') %>
<% end %>
<div class="box search-form-container flex-column mb-0 pb-0 department-applies-list-form">
<%= form_tag(admins_department_applies_path(unsafe_params), method: :get, class: 'form-inline search-form mt-3', remote: true) do %>
<%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-sm-2 ml-3', placeholder: '部门名称检索') %>
<%= submit_tag('搜索', class: 'btn btn-primary ml-3','data-disable-with':"搜索中...") %>
<%= link_to "清除",admins_department_applies_path(keyword:nil),class:"btn btn-default",remote:true %>
<% end %>
</div>
<div class="box department-applies-list-container">
<%= render(partial: 'admins/department_applies/shared/list', locals: { applies: @depart_applies }) %>
</div>
<%= render(partial: 'admins/shared/admin_common_refuse_modal') %>
<%= render partial: 'admins/department_applies/shared/edit_modal' %>

@ -0,0 +1 @@
$(".department-applies-list-container").html("<%= j render partial: "admins/department_applies/shared/list",locals: {applies:@depart_applies} %>")

@ -0,0 +1,26 @@
<div class="modal fade department-apply-edit-modal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">修改为</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<form class="department-apply-form" data-remote="true">
<%= hidden_field_tag(:id, nil) %>
<div class="form-group">
<label for="grade" class="col-form-label">名称:</label>
<%= text_field_tag(:name,nil,class:"form-control",placeholder:"输入新的名称") %>
</div>
<div class="error text-danger"></div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
<button type="button" class="btn btn-primary submit-btn">确认</button>
</div>
</div>
</div>
</div>

@ -0,0 +1,40 @@
<table class="table table-hover text-center department_applies-list-table">
<thead class="thead-light">
<tr>
<th width="9%">ID</th>
<th width="25%" class="edu-txt-left">部门名称</th>
<th width="20%" class="edu-txt-left">单位名称</th>
<th width="15%">创建者</th>
<th width="15%"><%= sort_tag('创建于', name: 'created_at', path: admins_department_applies_path) %></th>
<th>操作</th>
</tr>
</thead>
<tbody>
<% if applies.present? %>
<% applies.each do |apply| %>
<tr class="department-apply-<%= apply.id %>">
<td><%= apply.id %></td>
<td class="edu-txt-left"> <%= apply.name %></td>
<td class="edu-txt-left"> <%= apply.school.try(:name) %></td>
<td><%= apply.user.show_real_name %></td>
<td><%= format_time apply.created_at %></td>
<td class="action-container">
<%= agree_link '批准', agree_admins_department_apply_path(apply, element: ".department-apply-#{apply.id}"), 'data-confirm': '确认批准通过?' %>
<%= javascript_void_link('删除', class: 'action refuse-action',
data: {
toggle: 'modal', target: '.admin-common-refuse-modal', id: apply.id, title: "删除原因", type: "delete",
url: admins_department_apply_path(apply, element: ".department-apply-#{apply.id}")
}) %>
<%= javascript_void_link('修改', class: 'action department-apply-action', data: { toggle: 'modal', target: '.department-apply-edit-modal', id: apply.id }) %>
</td>
</tr>
<% end %>
<% else %>
<%= render 'admins/shared/no_data_for_table' %>
<% end %>
</tbody>
</table>
<%= render partial: 'admins/shared/paginate', locals: { objects: applies } %>

@ -56,15 +56,14 @@
<%= sidebar_item_group('#apply-review-submenu', '审核', icon: 'gavel') do %>
<li><%= sidebar_item(admins_identity_authentications_path, '实名认证', icon: 'id-card-o', controller: 'admins-identity_authentications') %></li>
<li><%= sidebar_item(admins_professional_authentications_path, '职业认证', icon: 'drivers-license', controller: 'admins-professional_authentications') %></li>
<li><%= sidebar_item(admins_department_applies_path, '部门审批', icon: 'building', controller: 'admins-department_applies') %></li>
<li><%= sidebar_item(admins_shixun_authorizations_path, '实训发布', icon: 'object-ungroup', controller: 'admins-shixun_authorizations') %></li>
<li><%= sidebar_item(admins_subject_authorizations_path, '实践课程发布', icon: 'object-group', controller: 'admins-subject_authorizations') %></li>
<li><%= sidebar_item(admins_library_applies_path, '教学案例发布', icon: 'language', controller: 'admins-library_applies') %></li>
<li><%= sidebar_item(admins_project_package_applies_path, '众包需求发布', icon: 'joomla', controller: 'admins-project_package_applies') %></li>
<li><%= sidebar_item(admins_video_applies_path, '视频发布', icon: 'film', controller: 'admins-video_applies') %></li>
<% end %>
<li><%= sidebar_item(admins_subject_authorizations_path, '实践课程发布', icon: 'object-group', controller: 'admins-subject_authorizations') %></li>
<li><%= sidebar_item(admins_library_applies_path, '教学案例发布', icon: 'language', controller: 'admins-library_applies') %></li>
<li><%= sidebar_item(admins_project_package_applies_path, '众包需求发布', icon: 'joomla', controller: 'admins-project_package_applies') %></li>
<li><%= sidebar_item(admins_video_applies_path, '视频发布', icon: 'film', controller: 'admins-video_applies') %></li>
<% end %>
</li>
<li><%= sidebar_item('/', '返回主站', icon: 'sign-out', controller: 'root') %></li>
</ul>
</nav>

@ -353,6 +353,7 @@ Rails.application.routes.draw do
get 'informs'
post 'update_informs'
post 'new_informs'
delete 'delete_informs'
get 'online_learning'
post 'join_excellent_course'
get 'tasks_list'
@ -850,18 +851,21 @@ Rails.application.routes.draw do
end
resources :shixuns, only: [:index,:destroy]
resources :shixun_settings, only: [:index,:update]
resources :department_applies,only: [:index,:edit,:update,:destroy] do
member do
post :agree
end
end
resources :mirror_repositories, only: [:index, :new, :create, :edit, :update, :destroy] do
collection do
post :merge
get :for_select
end
resources :mirror_scripts, only: [:index, :new, :create, :edit, :update, :destroy]
end
resources :choose_mirror_repositories, only: [:new, :create]
resources :departments, only: [:index, :create, :edit, :update, :destroy] do
resource :department_member, only: [:create, :update, :destroy]
post :merge, on: :collection
end
resources :myshixuns, only: [:index]

File diff suppressed because one or more lines are too long

@ -128079,6 +128079,7 @@ $(document).on('turbolinks:load', function() {
if ($refuseModal.length > 0) {
var $form = $refuseModal.find('form.admin-common-refuse-form');
var $applyIdInput = $refuseModal.find('.modal-body input[name="apply_id"]');
var $applyTitle = $refuseModal.find('.modal-title');
$form.validate({
errorElement: 'span',
@ -128097,9 +128098,19 @@ $(document).on('turbolinks:load', function() {
var applyId = $link.data('id');
var url = $link.data('url');
var title = $link.data('title');
var type = $link.data('type');
var form_method = "POST";
if(typeof title !== 'undefined'){
$applyTitle.html(title)
}
if(typeof type !== 'undefined'){
form_method = type;
}
$applyIdInput.val(applyId);
$form.data('url', url);
$form.data('type', form_method);
});
// modal visited fire
$refuseModal.on('shown.bs.modal', function(){
@ -128116,9 +128127,10 @@ $(document).on('turbolinks:load', function() {
if ($form.valid()) {
var url = $form.data('url');
var form_method = $form.data('type');
$.ajax({
method: 'POST',
method: form_method,
dataType: 'script',
url: url,
data: $form.serialize(),
@ -128208,6 +128220,28 @@ $(document).on('turbolinks:load', function() {
// });
}
});
$(document).on('turbolinks:load', function() {
var $editModal = $('.department-apply-edit-modal');
if($editModal.length > 0){
var $form = $editModal.find('form.department-apply-form');
var $applyIdInput = $form.find('input[name="id"]');
$editModal.on('show.bs.modal', function (event) {
var $link = $(event.relatedTarget);
var applyId = $link.data('id');
$applyIdInput.val(applyId);
});
$editModal.on('click', '.submit-btn', function(){
$.ajax({
method: "PUT",
dataType: 'script',
url: "/admins/department_applies/"+ $applyIdInput.val(),
data: $form.serialize(),
}).done(function(){
$editModal.modal('hide');
});
});
}
});
$(document).on('turbolinks:load', function() {
if ($('body.admins-departments-index-page').length > 0) {
var $searchContainer = $('.department-list-form');

File diff suppressed because one or more lines are too long

@ -40,15 +40,17 @@ class AccessoryModal extends Component{
}
// 附件相关 START
handleChange = (info) => {
let fileList = info.fileList;
console.log(fileList)
// for(var list of fileList ){
// console.log(fileList)
// }
this.setState({
fileList:fileList,
Errormessage:false,
});
if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') {
let fileList = info.fileList;
console.log(fileList)
// for(var list of fileList ){
// console.log(fileList)
// }
this.setState({
fileList:fileList,
Errormessage:false,
});
}
}
onAttachmentRemove = (file) => {

@ -545,7 +545,7 @@ class ExerciseReviewAndAnswer extends Component{
width:100%;
cursor:pointer;
}
.setRadioStyle span:last-child{
.setRadioStyle > span:last-child{
flex:1;
display:flex;
}

@ -122,44 +122,44 @@ class GraduationTasksSubmitedit extends Component{
}
}
//onAttachmentRemove = (file) => {
// confirm({
// title: '确定要删除这个附件吗?',
// okText: '确定',
// cancelText: '取消',
// // content: 'Some descriptions',
// onOk: () => {
// this.deleteAttachment(file)
// },
// onCancel() {
// console.log('Cancel');
// },
// });
// return false;
// this.setState({
// Modalstype:true,
// Modalstopval:'确定要删除这个附件吗?',
// ModalSave: ()=>this.deleteAttachment(file),
// ModalCancel:this.cancelAttachment
// })
// return false;
//}
onAttachmentRemove = (file) => {
if(!file.percent || file.percent == 100){
this.setState({
Modalstype:true,
Modalstopval:'确定要删除这个附件吗?',
ModalSave: ()=>this.deleteAttachment(file),
ModalCancel:this.cancelAttachment
})
return false;
}
}
onAttachmentRemoves = (file) => {
if(!file.percent || file.percent == 100){
this.setState({
Modalstype:true,
Modalstopval:'确定要删除这个附件吗?',
ModalSave: ()=>this.deleteAttachments(file),
ModalCancel:this.cancelAttachment
})
return false;
}
}
cancelAttachment=()=>{
this.setState({
Modalstype:false,
Modalstopval:'确定要删除这个附件吗?',
Modalstopval:'',
ModalSave:"",
ModalCancel:""
})
}
onAttachmentRemove = (file) => {
if(!file.percent || file.percent == 100){
deleteAttachments = (id) => {
let {attachments,fileList}=this.state;
const url = `/attachments/${file}.json`
const url = `/attachments/${id}.json`
axios.delete(url, {
})
.then((response) => {
@ -168,25 +168,66 @@ class GraduationTasksSubmitedit extends Component{
if (response.data.status === 0) {
console.log('--- success')
let newattachments=attachments;
if(file.uid===undefined){
for(var i=0; i<newattachments.length; i++){
if(newattachments[i].id===file.id){
if(newattachments[i].id===id){
newattachments.splice(i, 1);
}
}
}
this.setState({
Modalstype:true,
Modalstopval:response.data.message,
ModalSave:this.cancelAttachment,
Loadtype:true,
attachments:newattachments
})
this.cancelAttachment();
this.setState((state) => {
const index = state.fileList.indexOf(id);
const newFileList = state.fileList.slice();
newFileList.splice(index, 1);
return {
fileList: newFileList
};
});
}
}
})
.catch(function (error) {
console.log(error);
});
}
deleteAttachment = (file) => {
if(!file.percent || file.percent == 100){
let {attachments,fileList}=this.state;
let id=file.response ==undefined ? file.id : file.response.id;
const url = `/attachments/${id}.json`
axios.delete(url, {
})
.then((response) => {
if (response.data) {
// const { status } = response.data;
if (response.data.status === 0) {
console.log('--- success')
let newattachments=attachments;
if(file.uid===undefined){
for(var i=0; i<newattachments.length; i++){
if(newattachments[i].id===file.id){
newattachments.splice(i, 1);
}
}
}
// this.setState({
// Modalstype:true,
// Modalstopval:response.data.message,
// ModalSave:this.cancelAttachment,
// Loadtype:true,
// attachments:newattachments
// })
this.cancelAttachment();
this.setState((state) => {
const index = state.fileList.indexOf(file);
const newFileList = state.fileList.slice();
@ -578,7 +619,7 @@ class GraduationTasksSubmitedit extends Component{
{/*<Link to={"/courses/"+courseId+"/graduation/graduation_tasks/"+category_id} className="color-grey-6">{workslist&&workslist.task_name}</Link>*/}
{/*<span className="color-grey-9 ml3 mr3">&gt;</span>*/}
{/*</WordsBtn>*/}
<span>{this.props.user&&this.props.user.username} 提交作品</span>
<span>{this.props.user&&this.props.user.username} 修改作品</span>
</p>
<div style={{ width:'100%',height:'75px'}} >
@ -653,7 +694,7 @@ class GraduationTasksSubmitedit extends Component{
{item.delete===true?
<i className="font-14 iconfont icon-guanbi "
id={item.id}
onClick={()=>this.onAttachmentRemove(item.id)}
onClick={()=>this.onAttachmentRemoves(item.id)}
aria-hidden="true">
</i>:""}
</div>

@ -161,43 +161,46 @@ class GraduationTasksSubmitnew extends Component{
cancelAttachment=()=>{
this.setState({
Modalstype:false,
Modalstopval:'确定要删除这个附件吗?',
Modalstopval:'',
ModalSave:"",
ModalCancel:""
})
}
deleteAttachment = (file) => {
const url = `/attachments/${file}.json`
axios.delete(url, {
})
.then((response) => {
if (response.data) {
// const { status } = response.data;
if (response.data.status === 0) {
console.log('--- success')
this.setState({
Modalstype:true,
Modalstopval:response.data.message,
ModalSave:this.cancelAttachment,
Loadtype:true,
})
this.setState((state) => {
const index = state.fileList.indexOf(file);
const newFileList = state.fileList.slice();
newFileList.splice(index, 1);
return {
fileList: newFileList,
};
});
}
}
})
.catch(function (error) {
console.log(error);
});
if(!file.percent || file.percent == 100){
let id = file.response == undefined ? file.id : file.response.id;
const url = `/attachments/${id}.json`
axios.delete(url, {})
.then((response) => {
if (response.data) {
// const { status } = response.data;
if (response.data.status === 0) {
console.log('--- success')
// this.setState({
// Modalstype: true,
// Modalstopval: response.data.message,
// ModalSave: this.cancelAttachment,
// Loadtype: true,
// })
this.cancelAttachment();
this.setState((state) => {
const index = state.fileList.indexOf(file);
const newFileList = state.fileList.slice();
newFileList.splice(index, 1);
return {
fileList: newFileList,
};
});
}
}
})
.catch(function (error) {
console.log(error);
});
}
}
inputSearchValue=(e)=>{

@ -84,8 +84,10 @@ class GraduationTasksappraiseMainEditor extends Component{
componentDidMount(){
}
handleUploadChange = (info) => {
let fileList = info.fileList;
this.setState({ fileList });
if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') {
let fileList = info.fileList;
this.setState({ fileList });
}
}
onAttachmentRemove = (file, stateName) => {
if(!file.percent || file.percent == 100){

@ -103,7 +103,7 @@ class GraduationTasksedit extends Component{
}
// 附件相关 START
handleChange = (info) => {
if(info.file.status == "done" || info.file.status == "uploading"){
if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') {
let fileList = info.fileList;
// console.log(fileList)
// for(var list of fileList ){

@ -2,11 +2,12 @@ import React, {Component} from "React";
import {Form, Select, Input, Button, Checkbox, Upload, Icon, message, Modal} from "antd";
import {Link} from 'react-router-dom';
import TPMMDEditor from '../../../tpm/challengesnew/TPMMDEditor';
import {WordsBtn, getUrl,bytesToSize,appendFileSizeToUploadFileAll} from 'educoder';
import {WordsBtn, getUrl,bytesToSize,appendFileSizeToUploadFileAll , getUploadActionUrl} from 'educoder';
import axios from 'axios';
import Modals from '../../../modals/Modals';
import '../../css/Courses.css';
const {Option} = Select;
const CheckboxGroup = Checkbox.Group;
const confirm = Modal.confirm;
@ -127,7 +128,7 @@ class GraduationTasksnew extends Component {
}
// 附件相关 START
handleChange = (info) => {
if(info.file.status == "done" || info.file.status == "uploading"){
if(info.file.status == "done" || info.file.status == "uploading" || info.file.status === 'removed'){
let fileList = info.fileList;
// for(var list of fileList ){
@ -174,7 +175,26 @@ class GraduationTasksnew extends Component {
onAttachmentRemove = (file) => {
if(!file.percent || file.percent == 100){
const url = `/attachments/${file.response ? file.response.id : file.uid}.json`
this.props.confirm({
content: '确定要删除这个附件吗?',
okText: '确定',
cancelText: '取消',
// content: 'Some descriptions',
onOk: () => {
this.deleteAttachment(file)
},
onCancel() {
console.log('Cancel');
},
});
return false;
}
}
deleteAttachment = (file) =>{
const url = `/attachments/${file.response ? file.response.id : file.uid}.json`
// const url = `/attachments/${file}.json`
axios.delete(url, {})
.then((response) => {
@ -198,8 +218,6 @@ class GraduationTasksnew extends Component {
.catch(function (error) {
console.log(error);
});
}
}
//滚动
@ -267,7 +285,7 @@ class GraduationTasksnew extends Component {
// https://github.com/ant-design/ant-design/issues/15505
// showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。
// showUploadList: false,
action: `${getUrl()}/api/attachments.json`,
action: `${getUploadActionUrl()}`,
onChange: this.handleChange,
onRemove: this.onAttachmentRemove,
beforeUpload: (file) => {

@ -11,7 +11,7 @@ import {getUrl} from 'educoder';
import "../../common/formCommon.css"
import '../style.css'
import '../../css/Courses.css'
import { WordsBtn, City } from 'educoder'
import { WordsBtn, City , getUploadActionUrl } from 'educoder'
import {Link} from 'react-router-dom'
// import City from './City'
@ -211,14 +211,16 @@ class GraduateTopicNew extends Component{
// 附件相关 START
handleChange = (info) => {
let fileList = info.fileList;
this.setState({ fileList });
if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') {
let fileList = info.fileList;
this.setState({ fileList });
}
}
onAttachmentRemove = (file) => {
if(!file.percent || file.percent == 100){
confirm({
title: '确定要删除这个附件吗?',
this.props.confirm({
content: '确定要删除这个附件吗?',
okText: '确定',
cancelText: '取消',
// content: 'Some descriptions',
@ -307,7 +309,7 @@ class GraduateTopicNew extends Component{
// https://github.com/ant-design/ant-design/issues/15505
// showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。
// showUploadList: false,
action: `${getUrl()}/api/attachments.json`,
action: `${getUploadActionUrl()}`,
onChange: this.handleChange,
onRemove: this.onAttachmentRemove,
beforeUpload: (file) => {

@ -159,8 +159,10 @@ class GraduateTopicPostWorksNew extends Component{
}
// 附件相关 START
handleChange = (info) => {
let fileList = info.fileList;
this.setState({ fileList });
if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') {
let fileList = info.fileList;
this.setState({ fileList });
}
}
onAttachmentRemove = (file) => {
if(!file.percent || file.percent == 100){

@ -49,7 +49,7 @@
background: rgba(255,255,255,1);
/* border: 1px solid rgba(205,205,205,1); */
opacity: 1;
margin-left:142px;
margin-left:120px;
}
.orderfonttop{

@ -151,6 +151,7 @@ class Ordering extends Component{
datas:datas,
newtask_ids:[]
});
this.goback()
}else{
this.setState({
isSpin:false,
@ -186,7 +187,7 @@ class Ordering extends Component{
let positiontype=null;
if(windowsscrollTop===true){
positiontype={position:'fixed',zIndex:'9000',left:'20%',top: '0px'}
positiontype={position:'fixed',zIndex:'1000',top: '0px'}
}else{
positiontype={}
}

@ -831,20 +831,7 @@ class PollNew extends Component {
//保存并继续,即提交本题的新建并继续创建一个相同的题(该新题处于编辑模式,题目和选项不要清空)
Deleteadddomtwo = (indexo, object,bool) => {
var thiss = this;
if(bool === true){
this.setState({
q_countst: 1,
bindingid:undefined,
Newdisplay:false,
newoption: false,
})
}else {
this.setState({
q_countst: 1,
Newdisplay:false,
newoption: false,
})
}
var poll_questionslength = this.state.poll_questions.length;
// console.log("deleteadddomtwo|||||||||||||||||||||||||||||||||||||||||\\");
@ -988,7 +975,6 @@ class PollNew extends Component {
if(object.question.max_choices>0){
if (object.question.max_choices < object.question.min_choices) {
this.props.showNotification(`可选的最大限制不能小于最小限制`);
return;
}
}
@ -999,11 +985,11 @@ class PollNew extends Component {
if(object.question.max_choices>0){
if(object.question.min_choices){
if(object.question.min_choices===0){
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
return;
}
}else {
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
return;
}
@ -1015,82 +1001,69 @@ class PollNew extends Component {
if(object.question.min_choices>0){
if(object.question.max_choices){
if(object.question.max_choices===0){
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
return;
}
}else {
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
return;
}
}
}
var questiontwo = {};
var other = [];
var option = [];
var answerstwos = [];
var answerstwoss = [];
for (var y = 0; y < object.question.answers.length; y++) {
if (object.question.answers[y].answer_text === "其他") {
var dataone = {
"answer_id": object.question.answers[y].answer_id,
"answer_position": object.question.answers[y].answer_position,
"answer_text": object.question.answers[y].answer_text
}
other.push(object.question.answers[y].answer_text);
answerstwos.push(dataone);
} else {
var datatwo = {
"answer_id": object.question.answers[y].answer_id,
"answer_position": object.question.answers[y].answer_position,
"answer_text": object.question.answers[y].answer_text
var questiontwo = {};
var other = [];
var option = [];
var answerstwos = [];
var answerstwoss = [];
for (var y = 0; y < object.question.answers.length; y++) {
if (object.question.answers[y].answer_text === "其他") {
var dataone = {
"answer_id": object.question.answers[y].answer_id,
"answer_position": object.question.answers[y].answer_position,
"answer_text": object.question.answers[y].answer_text
}
other.push(object.question.answers[y].answer_text);
answerstwos.push(dataone);
} else {
var datatwo = {
"answer_id": object.question.answers[y].answer_id,
"answer_position": object.question.answers[y].answer_position,
"answer_text": object.question.answers[y].answer_text
}
option.push(object.question.answers[y].answer_text)
answerstwoss.push(datatwo);
}
option.push(object.question.answers[y].answer_text)
answerstwoss.push(datatwo);
}
}
var arrc = option.concat(other);
var answers = answerstwoss.concat(answerstwos);
// var id
// try {
// id = newarrpoll[newarrpoll.length - 1].question.id + 1;
// } catch (e) {
// id = 1;
// }
questiontwo = {
"id": null,
"is_necessary": object.question.is_necessary,
"question_number": 2,
"question_title": object.question.question_title,
"question_type": 2,
"max_choices": object.question.max_choices,
"min_choices": object.question.min_choices,
"new": "",
"answers": answers
};
question = {"question": questiontwo};
var insindex = null;
if (this.state.problemtopicbool === true) {
insindex = this.state.problemtopic;
}
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("选择题的最大可选项不能大于选项数")
// this.props.showNotification(`选择题的最大可选项不能大于选项数`);
//
// return;
// }
// if (object.question.min_choices === 0) {
// // console.log("选择题的最大可选项不能小于2项目")
// this.props.showNotification(`选择题的最大可选项不能小于2项目`);
//
// return;
//
// }
// newarrpoll.push(question);
newarrpoll.splice(thiss.state.Insertposition, 0, question);
var arrc = option.concat(other);
var answers = answerstwoss.concat(answerstwos);
// var id
// try {
// id = newarrpoll[newarrpoll.length - 1].question.id + 1;
// } catch (e) {
// id = 1;
// }
questiontwo = {
"id": null,
"is_necessary": object.question.is_necessary,
"question_number": 2,
"question_title": object.question.question_title,
"question_type": 2,
"max_choices": object.question.max_choices,
"min_choices": object.question.min_choices,
"new": "",
"answers": answers
};
question = {"question": questiontwo};
var insindex = null;
if (this.state.problemtopicbool === true) {
insindex = this.state.problemtopic;
}
this.createquestionsandanswers(object, 2, arrc, null, object.question.max_choices, object.question.min_choices, insindex,object.question.answers.length);
newarrpoll.splice(thiss.state.Insertposition, 0, question);
} else if (object.question.question_type === 3) {
//插入主观题
var answers = [];
@ -1222,7 +1195,6 @@ class PollNew extends Component {
if(object.question.max_choices>0){
if (object.question.max_choices < object.question.min_choices) {
this.props.showNotification(`可选的最大限制不能小于最小限制`);
return;
}
}
@ -1233,11 +1205,11 @@ class PollNew extends Component {
if(object.question.max_choices>0){
if(object.question.min_choices){
if(object.question.min_choices===0){
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
return;
}
}else {
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
return;
}
@ -1249,11 +1221,11 @@ class PollNew extends Component {
if(object.question.min_choices>0){
if(object.question.max_choices){
if(object.question.max_choices===0){
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
return;
}
}else {
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
return;
}
@ -1266,69 +1238,56 @@ class PollNew extends Component {
//
// return;
// }
var questiontwo = {};
var other = [];
var option = [];
var answerstwos = [];
var answerstwoss = [];
for (var y = 0; y < object.question.answers.length; y++) {
if (object.question.answers[y].answer_text === "其他") {
var dataone = {
"answer_id": object.question.answers[y].answer_id,
"answer_position": object.question.answers[y].answer_position,
"answer_text": object.question.answers[y].answer_text
var questiontwo = {};
var other = [];
var option = [];
var answerstwos = [];
var answerstwoss = [];
for (var y = 0; y < object.question.answers.length; y++) {
if (object.question.answers[y].answer_text === "其他") {
var dataone = {
"answer_id": object.question.answers[y].answer_id,
"answer_position": object.question.answers[y].answer_position,
"answer_text": object.question.answers[y].answer_text
}
other.push(object.question.answers[y].answer_text);
answerstwos.push(dataone);
} else {
var datatwo = {
"answer_id": object.question.answers[y].answer_id,
"answer_position": object.question.answers[y].answer_position,
"answer_text": object.question.answers[y].answer_text
}
option.push(object.question.answers[y].answer_text)
answerstwoss.push(datatwo);
}
other.push(object.question.answers[y].answer_text);
answerstwos.push(dataone);
}
var arrc = option.concat(other);
var answers = answerstwoss.concat(answerstwos);
questiontwo = {
"id": object.question.id,
"is_necessary": object.question.is_necessary,
"question_number": 2,
"question_title": object.question.question_title,
"question_type": 2,
"max_choices": object.question.max_choices,
"min_choices": object.question.min_choices,
"new": "",
"answers": answers
};
question = {"question": questiontwo};
if (uuk !== -1) {
// console.log("修改")
this.edittotheserver(object, 2, arrc, null, object.question.max_choices, object.question.min_choices,object.question.answers.length);
newarrpoll.splice(uuk, 1, question);
} else {
var datatwo = {
"answer_id": object.question.answers[y].answer_id,
"answer_position": object.question.answers[y].answer_position,
"answer_text": object.question.answers[y].answer_text
}
option.push(object.question.answers[y].answer_text)
answerstwoss.push(datatwo);
// console.log("删除")
this.createquestionsandanswers(object, 2, arrc, null, object.question.max_choices, object.question.min_choices, object.question.id,object.question.answers.length);
newarrpoll.push(question);
}
}
var arrc = option.concat(other);
var answers = answerstwoss.concat(answerstwos);
questiontwo = {
"id": object.question.id,
"is_necessary": object.question.is_necessary,
"question_number": 2,
"question_title": object.question.question_title,
"question_type": 2,
"max_choices": object.question.max_choices,
"min_choices": object.question.min_choices,
"new": "",
"answers": answers
};
question = {"question": questiontwo};
//插入多选题
// if (object.question.max_choices > arrc.length) {
// // console.log("选择题的最大可选项不能大于答案数")
// this.props.showNotification('选择题的最大可选项不能大于选项数!');
//
// return;
// }
// if (object.question.min_choices === 0) {
// // console.log("选择题的最大可选项不能小于2项目")
// this.props.showNotification('选择题的最大可选项不能小于2项目');
//
// return;
//
// }
if (uuk !== -1) {
// console.log("修改")
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,object.question.answers.length);
newarrpoll.push(question);
}
// console.log(newarrpoll)
newarr[indexo].question.new = "new"
// console.log(newarrpoll)
newarr[indexo].question.new = "new"
} else if (object.question.question_type === 3) {
//插入主观题
var answers = [];
@ -1393,6 +1352,20 @@ class PollNew extends Component {
this.state.mymainsint = this.state.mymainsint + 1;
}
if(bool === true){
this.setState({
q_countst: 1,
bindingid:undefined,
Newdisplay:false,
newoption: false,
})
}else {
this.setState({
q_countst: 1,
Newdisplay:false,
newoption: false,
})
}
this.setState({
// poll_questions: newarrpoll,
adddom: newarr,
@ -1411,11 +1384,6 @@ class PollNew extends Component {
// indexo 第几个数组
//object 单个数组数据
Deleteadddomthree = (indexo, object,bool) => {
if(bool === true) {
this.setState({
bindingid:undefined,
})
}
this.setState({
Newdisplay:false,
newoption: false,
@ -1556,11 +1524,11 @@ class PollNew extends Component {
if(object.question.max_choices>0){
if(object.question.min_choices){
if(object.question.min_choices===0){
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
return;
}
}else {
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
return;
}
@ -1572,11 +1540,11 @@ class PollNew extends Component {
if(object.question.min_choices>0){
if(object.question.max_choices){
if(object.question.max_choices===0){
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
return;
}
}else {
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
return;
}
@ -1590,56 +1558,56 @@ class PollNew extends Component {
//
// return;
// }
var questiontwo = {};
var other = [];
var option = [];
var answerstwos = [];
var answerstwoss = [];
for (var y = 0; y < object.question.answers.length; y++) {
if (object.question.answers[y].answer_text === "其他") {
var dataone = {
"answer_id": object.question.answers[y].answer_id,
"answer_position": object.question.answers[y].answer_position,
"answer_text": object.question.answers[y].answer_text
}
other.push(object.question.answers[y].answer_text);
answerstwos.push(dataone);
} else {
var datatwo = {
"answer_id": object.question.answers[y].answer_id,
"answer_position": object.question.answers[y].answer_position,
"answer_text": object.question.answers[y].answer_text
}
option.push(object.question.answers[y].answer_text)
answerstwoss.push(datatwo);
}
}
var arrc = option.concat(other);
var answers = answerstwoss.concat(answerstwos);
questiontwo = {
"id": null,
"is_necessary": object.question.is_necessary,
"question_number": 2,
"question_title": object.question.question_title,
"question_type": 2,
"max_choices": object.question.max_choices,
"min_choices": object.question.min_choices,
"new": "",
"answers": answers
};
question = {"question": questiontwo};
var insindex = null;
if (this.state.problemtopicbool === true) {
insindex = this.state.problemtopic;
}
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) {
var questiontwo = {};
var other = [];
var option = [];
var answerstwos = [];
var answerstwoss = [];
for (var y = 0; y < object.question.answers.length; y++) {
if (object.question.answers[y].answer_text === "其他") {
var dataone = {
"answer_id": object.question.answers[y].answer_id,
"answer_position": object.question.answers[y].answer_position,
"answer_text": object.question.answers[y].answer_text
}
other.push(object.question.answers[y].answer_text);
answerstwos.push(dataone);
} else {
var datatwo = {
"answer_id": object.question.answers[y].answer_id,
"answer_position": object.question.answers[y].answer_position,
"answer_text": object.question.answers[y].answer_text
}
option.push(object.question.answers[y].answer_text)
answerstwoss.push(datatwo);
}
}
var arrc = option.concat(other);
var answers = answerstwoss.concat(answerstwos);
questiontwo = {
"id": null,
"is_necessary": object.question.is_necessary,
"question_number": 2,
"question_title": object.question.question_title,
"question_type": 2,
"max_choices": object.question.max_choices,
"min_choices": object.question.min_choices,
"new": "",
"answers": answers
};
question = {"question": questiontwo};
var insindex = null;
if (this.state.problemtopicbool === true) {
insindex = this.state.problemtopic;
}
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) {
newarrpoll.splice(thiss.state.Insertposition, 0, question);
newarrpoll.splice(thiss.state.Insertposition, 0, question);
} else if (object.question.question_type === 3) {
//插入主观题
var answers = [];
@ -1758,7 +1726,6 @@ class PollNew extends Component {
if(object.question.max_choices>0){
if (object.question.max_choices < object.question.min_choices) {
this.props.showNotification(`可选的最大限制不能小于最小限制`);
return;
}
}
@ -1768,11 +1735,11 @@ class PollNew extends Component {
if(object.question.max_choices>0){
if(object.question.min_choices){
if(object.question.min_choices===0){
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
return;
}
}else {
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
return;
}
@ -1784,66 +1751,66 @@ class PollNew extends Component {
if(object.question.min_choices>0){
if(object.question.max_choices){
if(object.question.max_choices===0){
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
return;
}
}else {
this.props.showNotification(`最小和最大限制须同时为数值或者“--"`);
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
return;
}
}
}
var questiontwo = {};
var other = [];
var option = [];
var answerstwos = [];
var answerstwoss = [];
for (var y = 0; y < object.question.answers.length; y++) {
if (object.question.answers[y].answer_text === "其他") {
var dataone = {
"answer_id": object.question.answers[y].answer_id,
"answer_position": object.question.answers[y].answer_position,
"answer_text": object.question.answers[y].answer_text
var questiontwo = {};
var other = [];
var option = [];
var answerstwos = [];
var answerstwoss = [];
for (var y = 0; y < object.question.answers.length; y++) {
if (object.question.answers[y].answer_text === "其他") {
var dataone = {
"answer_id": object.question.answers[y].answer_id,
"answer_position": object.question.answers[y].answer_position,
"answer_text": object.question.answers[y].answer_text
}
other.push(object.question.answers[y].answer_text);
answerstwos.push(dataone);
} else {
var datatwo = {
"answer_id": object.question.answers[y].answer_id,
"answer_position": object.question.answers[y].answer_position,
"answer_text": object.question.answers[y].answer_text
}
option.push(object.question.answers[y].answer_text)
answerstwoss.push(datatwo);
}
other.push(object.question.answers[y].answer_text);
answerstwos.push(dataone);
}
var arrc = option.concat(other);
var answers = answerstwoss.concat(answerstwos);
questiontwo = {
"id": object.question.id,
"is_necessary": object.question.is_necessary,
"question_number": 2,
"question_title": object.question.question_title,
"question_type": 2,
"max_choices": object.question.max_choices,
"min_choices": object.question.min_choices,
"new": "",
"answers": answers
};
question = {"question": questiontwo};
//插入多选题
if (uuk !== -1) {
// console.log("修改")
this.edittotheserver(object, 2, arrc, null, object.question.max_choices, object.question.min_choices,object.question.answers.length);
newarrpoll.splice(uuk, 1, question);
} else {
var datatwo = {
"answer_id": object.question.answers[y].answer_id,
"answer_position": object.question.answers[y].answer_position,
"answer_text": object.question.answers[y].answer_text
}
option.push(object.question.answers[y].answer_text)
answerstwoss.push(datatwo);
// console.log("删除")
this.createquestionsandanswers(object, 2, arrc, null, object.question.max_choices, object.question.min_choices, object.question.id,object.question.answers.length);
newarrpoll.push(question);
}
}
var arrc = option.concat(other);
var answers = answerstwoss.concat(answerstwos);
questiontwo = {
"id": object.question.id,
"is_necessary": object.question.is_necessary,
"question_number": 2,
"question_title": object.question.question_title,
"question_type": 2,
"max_choices": object.question.max_choices,
"min_choices": object.question.min_choices,
"new": "",
"answers": answers
};
question = {"question": questiontwo};
//插入多选题
if (uuk !== -1) {
// console.log("修改")
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,object.question.answers.length);
newarrpoll.push(question);
}
// console.log(newarrpoll)
} else if (object.question.question_type === 3) {
//插入主观题
@ -1915,6 +1882,11 @@ class PollNew extends Component {
q_countst: 0,
})
}
if(bool === true) {
this.setState({
bindingid:undefined,
})
}
this.Deleteadddom(indexo);
// console.log(indexo)
}
@ -2096,6 +2068,7 @@ class PollNew extends Component {
thiss.thisinitializationdatanew();
}
})
}
//上下移到服务器中
@ -2892,7 +2865,7 @@ class PollNew extends Component {
console.log(this.state.poll_questions);
console.log(this.state.adddom);
let resultDom;
resultDom = <div>
resultDom = <div >
<p className="clearfix font-16">
<span className="color-grey-6 fl">{index + 1}</span>
<span
@ -2902,7 +2875,7 @@ class PollNew extends Component {
{
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>
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>
: ""
}
@ -2988,7 +2961,7 @@ class PollNew extends Component {
resultDomtwo =
<div >
<span
className="font-16 color-grey-6 mb20">{itemo.question.question_type === 1 ? "单选题" : itemo.question.question_type === 2 ? "多选题" : "主观题"}
className="font-16 color-grey-6 mb20" id={"yslproblms3"}>{itemo.question.question_type === 1 ? "单选题" : itemo.question.question_type === 2 ? "多选题" : "主观题"}
<Checkbox value={itemo.question.is_necessary}
checked={itemo.question.is_necessary === 1 ? true : false}
onChange={(e) => this.OnCheckAllChange(e, indexo)}
@ -3056,7 +3029,7 @@ class PollNew extends Component {
<div className="df">
{itemo.question.question_type === 1 ? (
<div>
<div className="ml10">
<div style={{minWidth: "1100px"}}>
{this.state.polls_status === undefined || this.state.polls_status === 1 ?
<ActionBtn style="grey" className="mr20 mt5"
@ -3091,7 +3064,7 @@ class PollNew extends Component {
<div style={{minWidth: "1100px"}}>
<div>
<span
className="color-grey-6 mr20 font-16 lineh-40 fl">可选</span>
className="color-grey-6 mr20 ml10 font-16 lineh-40 fl">可选</span>
<div className="mr40 flex1 ">
{/*可选最小1*/}
<style>
@ -3150,11 +3123,11 @@ class PollNew extends Component {
}
</div>
<div>
<div >
{itemo.question.question_type === 2 ?
(
this.state.polls_status === undefined || this.state.polls_status === 1 ?
<div className="clearfix mt30" >
<div className="clearfix mt30 ml10" >
<div><ActionBtn style="grey" className="mr20 fl mt5"
onClick={() => this.Ewoption(itemo.question.id, itemo)}>新增选项</ActionBtn>
@ -3230,7 +3203,7 @@ class PollNew extends Component {
resultDomtwo =
<div >
<span
className="font-16 color-grey-6 mb20">{itemo.question.question_type === 1 ? "单选题" : itemo.question.question_type === 2 ? "多选题" : "主观题"}
className="font-16 color-grey-6 mb20" id={"yslproblms2"}>{itemo.question.question_type === 1 ? "单选题" : itemo.question.question_type === 2 ? "多选题" : "主观题"}
<Checkbox value={itemo.question.is_necessary}
checked={itemo.question.is_necessary === 1 ? true : false}
onChange={(e) => this.OnCheckAllChange(e, indexo)}
@ -3298,7 +3271,7 @@ class PollNew extends Component {
<div className="df">
{itemo.question.question_type === 1 ? (
<div>
<div className="ml10">
<div style={{minWidth: "1100px"}}>
{this.state.polls_status === undefined || this.state.polls_status === 1 ?
<ActionBtn style="grey" className="mr20 mt5"
@ -3396,7 +3369,7 @@ class PollNew extends Component {
{itemo.question.question_type === 2 ?
(
this.state.polls_status === undefined || this.state.polls_status === 1 ?
<div className="clearfix mt30" >
<div className="clearfix mt30 ml10" >
<div><ActionBtn style="grey" className="mr20 fl mt5"
onClick={() => this.Ewoption(itemo.question.id, itemo)}>新增选项</ActionBtn>
@ -3481,7 +3454,7 @@ class PollNew extends Component {
resultDomtwo =
<div className="problemShow">
<span
className="font-16 color-grey-6 mb20">{itemo.question.question_type === 1 ? "单选题" : itemo.question.question_type === 2 ? "多选题" : "主观题"}
className="font-16 color-grey-6 mb20" id={"yslproblms"}>{itemo.question.question_type === 1 ? "单选题" : itemo.question.question_type === 2 ? "多选题" : "主观题"}
<Checkbox value={itemo.question.is_necessary}
checked={itemo.question.is_necessary === 1 ? true : false}
onChange={(e) => this.OnCheckAllChange(e, indexo)}
@ -3549,7 +3522,7 @@ class PollNew extends Component {
<div className="df">
{itemo.question.question_type === 1 ? (
<div>
<div className="ml10">
<div style={{minWidth: "1100px"}}>
{polls_status === undefined || polls_status === 1 ?
<ActionBtn style="grey" className="mr20 mt5"
@ -3647,7 +3620,7 @@ class PollNew extends Component {
{itemo.question.question_type === 2 ?
(
polls_status === undefined || polls_status === 1 ?
<div className="clearfix mt30" >
<div className="clearfix mt30 ml10" >
<div><ActionBtn style="grey" className="mr20 fl mt5"
onClick={() => this.Ewoption(itemo.question.id, itemo)}>新增选项</ActionBtn>

@ -1037,12 +1037,12 @@ class ShixunHomework extends Component{
{/*<span className="font-18 fl color-dark-21">{datas&&datas.category_name===undefined||datas&&datas.category_name===null?datas&&datas.main_category_name:datas&&datas.category_name+" 作业列表"}</span>*/}
<span className="font-18 fl color-dark-21">实训作业</span>
<li className="fr">
{this.props.isAdmin()===true?datas&&datas.category_name===undefined||datas&&datas.category_name===null?
{datas===undefined?"":datas.homeworks && datas.homeworks.length>1?this.props.isClassManagement()===true?datas&&datas.category_name===undefined||datas&&datas.category_name===null?
<span>
<WordsBtn style="blue" className={"mr30 font-16"}>
<Link className="color4CACFF" to={`/courses/${this.props.match.params.coursesId}/ordering/shixun_homework/${main_id&&main_id}`}>调整排序</Link>
</WordsBtn>
</span>:"":""}
</span>:"":"":""}
{this.props.isAdmin()===true?datas&&datas.category_name===undefined||datas&&datas.category_name===null?
<span>

@ -1373,14 +1373,15 @@ export default class TPMsettings extends Component {
}
handleChange = (info) => {
console.log("handleChange1");
let {fileList}=this.state;
if(fileList.length===0){
let fileLists = info.fileList;
this.setState({ fileList:fileLists,
deleteisnot:false});
if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') {
console.log("handleChange1");
let {fileList}=this.state;
if(fileList.length===0){
let fileLists = info.fileList;
this.setState({ fileList:fileLists,
deleteisnot:false});
}
}
}
onAttachmentRemove = (file) => {

@ -760,15 +760,17 @@ class Newshixuns extends Component {
// 附件相关 START
handleChange = (info) => {
let {fileList}=this.state;
console.log("handleChange1");
if(fileList.length===0){
if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') {
let {fileList}=this.state;
console.log("handleChange1");
if(fileList.length===0){
let fileLists = info.fileList;
this.setState({
// fileList:appendFileSizeToUploadFileAll(fileList),
fileList:fileLists,
deleteisnot:false});
}
}
}
}
onAttachmentRemove = (file) => {

@ -1106,6 +1106,12 @@ class LoginRegisterComponent extends Component {
.mymimasysl {
border-right: none !important;
}
.ant-input-group-addon{
background-color: #fff;s
}
.ant-input-group .ant-input:hover {
z-index: 0 !important;
}
`
}
</style>

@ -376,7 +376,7 @@ class AccountBasic extends Component {
this.getSchoolList(this.props.basicInfo, name);
this.props.form.setFieldsValue({
name: name
org: name
})
}

Loading…
Cancel
Save