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

dev_sync_trustie
杨树林 5 years ago
commit 677791ad36

@ -0,0 +1,23 @@
$(document).on('turbolinks:load', function(){
if ($('body.admins-competition-settings-index-page').length > 0) {
var baseOptions = {
autoclose: true,
language: 'zh-CN',
format: 'yyyy-mm-dd',
startDate: '2017-04-01',
endDate: '-1d'
};
var defineDateRangeSelect = function(element){
var options = $.extend({inputs: $(element).find('.start-date, .end-date')}, baseOptions);
$(element).datepicker(options);
$(element).find('.start-date').datepicker().on('changeDate', function(e){
$(element).find('.end-date').datepicker('setStartDate', e.date);
});
};
defineDateRangeSelect('.teaching-mode-date');
}
});

@ -3,7 +3,7 @@ $(document).on('turbolinks:load', function() {
let search_form = $(".search-form"); let search_form = $(".search-form");
//导出 //导出
$(".competition-enroll-list-form").on("click","#enroll-lists-export",function () { $(".competition-enroll-list-form").on("click","#enroll-lists-export",function () {
window.location.href = "/admins/competitions/"+$(this).attr("data-competition-id")+"/enroll_lists.xls?" + search_form.serialize(); window.location.href = "/admins/competitions/"+$(this).attr("data-competition-id")+"/enroll_lists/export.xlsx?" + search_form.serialize();
}); });
} }
}); });

@ -0,0 +1,21 @@
.admins-competition-settings-index-page {
.competition-mode-container {
.row {
height: 35px;
}
.des-row {
height: auto;
}
.form-control {
font-size: 14px;
}
//.mode-input {
// input {
// width: 40%;
// }
//}
}
}

@ -1,5 +1,5 @@
class Admins::CompetitionSettingsController < Admins::BaseController class Admins::CompetitionSettingsController < Admins::BaseController
def show def index
@competition = current_competition @competition = current_competition
end end

@ -22,7 +22,9 @@ class Admins::EnrollListsController < Admins::BaseController
def export def export
default_sort('created_at', 'desc') default_sort('created_at', 'desc')
@enroll_lists = Admins::CompetitionEnrollListQuery.call(current_competition, params) @enroll_lists = Admins::CompetitionEnrollListQuery.call(current_competition, params)
@enroll_lists = @enroll_lists.preload(competition_team: [:user, :teachers], user: { user_extension: :school })
@competition_scores = current_competition.competition_scores.where(competition_stage_id: 0).order("score desc, cost_time desc").pluck(:competition_team_id)
@personal = current_competition.personal?
filename = ["#{current_competition.name}竞赛报名列表", Time.zone.now.strftime('%Y-%m-%d%H:%M:%S')].join('-') << '.xlsx' filename = ["#{current_competition.name}竞赛报名列表", Time.zone.now.strftime('%Y-%m-%d%H:%M:%S')].join('-') << '.xlsx'
render xlsx: 'export', filename: filename render xlsx: 'export', filename: filename
end end

@ -106,13 +106,8 @@ class Competitions::CompetitionsController < Competitions::BaseController
@stage = @competition.competition_stages.find_by(id: params[:stage_id]) @stage = @competition.competition_stages.find_by(id: params[:stage_id])
end end
if @competition.identifier == "gcc-annotation-2018" @records = @competition.competition_teams.joins(:competition_scores).where(competition_scores: {competition_stage_id: @stage&.id.to_i})
@records = @competition.competition_teams.joins(:competition_scores) .select("competition_teams.*, score, cost_time").order("score desc, cost_time desc")
.select("competition_teams.*, score, cost_time").order("score desc, cost_time desc")
else
@records = @competition.competition_teams.joins(:competition_scores).where(competition_scores: {competition_stage_id: @stage&.id.to_i})
.select("competition_teams.*, score, cost_time").order("score desc, cost_time desc")
end
current_team_ids = @competition.team_members.where(user_id: current_user.id).pluck(:competition_team_id).uniq current_team_ids = @competition.team_members.where(user_id: current_user.id).pluck(:competition_team_id).uniq
@user_ranks = @records.select{|com_team| current_team_ids.include?(com_team.id)} @user_ranks = @records.select{|com_team| current_team_ids.include?(com_team.id)}

@ -439,6 +439,7 @@ class HomeworkCommonsController < ApplicationController
def settings def settings
@user = current_user @user = current_user
@work = @homework.user_work(current_user.id) if @user_course_identity == Course::STUDENT @work = @homework.user_work(current_user.id) if @user_course_identity == Course::STUDENT
@course_groups = @course.course_groups.where(id: @course.charge_group_ids(@user))
end end
def update_settings def update_settings

@ -1,8 +1,10 @@
class Weapps::CodeSessionsController < Weapps::BaseController class Weapps::CodeSessionsController < Weapps::BaseController
def create def create
logged = false
return render_error('code不能为空') if params[:code].blank? return render_error('code不能为空') if params[:code].blank?
reset_session
logged = false
result = Wechat::Weapp.jscode2session(params[:code]) result = Wechat::Weapp.jscode2session(params[:code])
# 能根据 code 拿到 unionid # 能根据 code 拿到 unionid

@ -25,7 +25,7 @@ class CourseAddStudentCreateWorksJob < ApplicationJob
student_ids.each do |user_id| student_ids.each do |user_id|
same_attrs = {user_id: user_id} same_attrs = {user_id: user_id}
course.homework_commons.where(homework_type: %i[normal group practice]).each do |homework| course.homework_commons.where(homework_type: %i[normal group practice]).each do |homework|
next if homework.student_works.where(user_id: user_id).any? next if StudentWork.where(user_id: user_id, homework_common_id: homework.id).any?
worker.add same_attrs.merge(homework_common_id: homework.id) worker.add same_attrs.merge(homework_common_id: homework.id)
end end
end end
@ -36,7 +36,7 @@ class CourseAddStudentCreateWorksJob < ApplicationJob
student_ids.each do |user_id| student_ids.each do |user_id|
same_attrs = {user_id: user_id} same_attrs = {user_id: user_id}
course.exercises.each do |exercise| course.exercises.each do |exercise|
next if exercise.exercise_users.where(user_id: user_id).any? next if ExerciseUser.where(user_id: user_id, exercise_id: exercise.id).any?
worker.add same_attrs.merge(exercise_id: exercise.id) worker.add same_attrs.merge(exercise_id: exercise.id)
end end
end end
@ -47,7 +47,7 @@ class CourseAddStudentCreateWorksJob < ApplicationJob
student_ids.each do |user_id| student_ids.each do |user_id|
same_attrs = {user_id: user_id} same_attrs = {user_id: user_id}
course.polls.each do |poll| course.polls.each do |poll|
next if poll.poll_users.where(user_id: user_id).any? next if PollUser.where(user_id: user_id, poll_id: poll.id).any?
worker.add same_attrs.merge(poll_id: poll.id) worker.add same_attrs.merge(poll_id: poll.id)
end end
end end
@ -58,7 +58,7 @@ class CourseAddStudentCreateWorksJob < ApplicationJob
student_ids.each do |user_id| student_ids.each do |user_id|
same_attrs = {user_id: user_id, course_id: course.id} same_attrs = {user_id: user_id, course_id: course.id}
course.graduation_tasks.each do |task| course.graduation_tasks.each do |task|
next if task.graduation_works.where(user_id: user_id).any? next if GraduationWork.where(user_id: user_id, graduation_task_id: task.id).any?
worker.add same_attrs.merge(graduation_task_id: task.id) worker.add same_attrs.merge(graduation_task_id: task.id)
end end
end end

@ -28,9 +28,9 @@ class Competition < ApplicationRecord
def mode_type def mode_type
case mode case mode
when 1 when 1
"课堂"
when 2
"实训" "实训"
when 2
"课堂"
when 3 when 3
"教学" "教学"
when 4 when 4
@ -94,9 +94,9 @@ class Competition < ApplicationRecord
GROUP BY competition_stage_id order by competition_stage_id") GROUP BY competition_stage_id order by competition_stage_id")
end end
def awards_count # def awards_count
competition_awards.pluck(:num)&.sum > 0 ? competition_awards.pluck(:num)&.sum : 20 # competition_awards.pluck(:num)&.sum > 0 ? competition_awards.pluck(:num)&.sum : 20
end # end
private private

@ -36,8 +36,8 @@ class Admins::UserStatisticQuery < ApplicationQuery
study_myshixun = Myshixun.where(user_id: ids) study_myshixun = Myshixun.where(user_id: ids)
finish_myshixun = Myshixun.where(user_id: ids, status: 1) finish_myshixun = Myshixun.where(user_id: ids, status: 1)
study_challenge = Game.joins(:myshixun).where(myshixuns: { user_id: ids }).where(status: [0, 1, 2]) study_challenge = Game.where(user_id: ids).where(status: [0, 1, 2])
finish_challenge = Game.joins(:myshixun).where(myshixuns: { user_id: ids }).where(status: 2) finish_challenge = Game.where(user_id: ids).where(status: 2)
if time_range.present? if time_range.present?
study_myshixun = study_myshixun.where(updated_at: time_range) study_myshixun = study_myshixun.where(updated_at: time_range)
@ -106,12 +106,12 @@ class Admins::UserStatisticQuery < ApplicationQuery
when 'finish_challenge_count' then when 'finish_challenge_count' then
users = users =
if time_range.present? if time_range.present?
users.joins('LEFT JOIN myshixuns ON myshixuns.user_id = users.id') users#.joins('LEFT JOIN myshixuns ON myshixuns.user_id = users.id')
.joins("LEFT JOIN games ON games.myshixun_id = myshixuns.id "\ .joins("LEFT JOIN games ON games.user_id = users.id "\
"AND games.status = 2 AND games.updated_at BETWEEN '#{time_range.min}' AND '#{time_range.max}'") "AND games.status = 2 AND games.updated_at BETWEEN '#{time_range.min}' AND '#{time_range.max}'")
else else
users.joins('LEFT JOIN myshixuns ON myshixuns.user_id = users.id') users#.joins('LEFT JOIN myshixuns ON myshixuns.user_id = users.id')
.joins("LEFT JOIN games ON games.myshixun_id = myshixuns.id AND games.status = 2") .joins("LEFT JOIN games ON games.user_id = users.id AND games.status = 2")
end end
users.select("#{base_query_column}, COUNT(*) finish_challenge_count") users.select("#{base_query_column}, COUNT(*) finish_challenge_count")

@ -20,7 +20,7 @@ class Competitions::CreatePersonalTeamService < ApplicationService
raise Error, '您已报名该竞赛' if enrolled && multiple_limited raise Error, '您已报名该竞赛' if enrolled && multiple_limited
ActiveRecord::Base.transaction do ActiveRecord::Base.transaction do
team = competition.competition_teams.create!(name: user.show_name, user_id: user.id) team = competition.competition_teams.create!(name: user.real_name, user_id: user.id)
team.team_members.create!(competition_id: competition, user_id: user.id, role: 1, is_teacher: is_teacher) team.team_members.create!(competition_id: competition, user_id: user.id, role: 1, is_teacher: is_teacher)
end end
end end

@ -0,0 +1,119 @@
<%
define_admin_breadcrumbs do
add_admin_breadcrumb('竞赛列表', admins_competitions_path)
add_admin_breadcrumb(@competition.name)
end
%>
<div class="card mb-5">
<div class="card-header d-flex justify-content-between align-items-center">
<span class="flex-1">基础设置</span>
</div>
<div class="card-body row">
<%= form_tag(admins_competition_competition_settings_path(unsafe_params), method: :post, class: 'basic-setting-form flex-1', remote: true) do %>
<div class="container competition-mode-container">
<div class="row align-items-center mb-1">
<div class="col-1 text-right">
竞赛模式
</div>
<div class="col-5 text-left">
<%= radio_button_tag(:mode, 1, @competition.mode == 1, class: 'form-radio-input') %>
<label class="form-radio-label mb-0" for="mode_1">实训模式(参赛者报名参赛,挑战实训,系统评审)</label>
</div>
</div>
<div class="row align-items-center mb-1">
<div class="col-1 text-right">
</div>
<div class="col-5 text-left">
<%= radio_button_tag(:mode, 2, @competition.mode == 2, class: 'form-radio-input') %>
<label class="form-radio-label mb-0" for="mode_2">课堂模式(参赛者加入课堂,提交作品,评委评审)</label>
</div>
<div class="col-6">
<%= text_field_tag(:course_id, @competition.competition_mode_setting&.course_id, autocomplete: 'off', class: 'form-control', placeholder: '课堂id') %>
</div>
</div>
<div class="row align-items-center mb-1">
<div class="col-1 text-right">
</div>
<div class="col-5 text-left">
<%= radio_button_tag(:mode, 3, @competition.mode == 3, class: 'form-radio-input') %>
<label class="form-radio-label mb-0" for="mode_3">教学模式(参赛者报名参赛,统计战队课堂和实训数据)</label>
</div>
<div class="col-6 teaching-mode-date d-flex">
<%= text_field_tag :start_time, @competition.competition_mode_setting&.start_time, autocomplete: 'off', class: 'form-control start-date mx-0 mr-2', placeholder: '统计数据的开始时间' %>
<%= text_field_tag :end_time, @competition.competition_mode_setting&.end_time, autocomplete: 'off', class: 'form-control end-date mx-0', placeholder: '统计数据的结束时间' %>
</div>
</div>
<div class="row align-items-center mb-1">
<div class="col-1 text-right">
</div>
<div class="col-5 text-left">
<%= radio_button_tag(:mode, 4, @competition.mode == 4, class: 'form-radio-input') %>
<label class="form-radio-label mb-0" for="mode_4">托管模式(参赛者报名参赛,在其他平台完成任务)</label>
</div>
</div>
<div class="row align-items-center mb-1">
<div class="col-1 text-right">
URL
</div>
<div class="col-5 text-left mode-input">
<%= text_field_tag(:identifier, @competition.identifier, autocomplete: 'off', class: 'form-control', placeholder: '请输入url赛事网址') %>
</div>
</div>
<div class="row align-items-center mb-1">
<div class="col-1 text-right">
主办方
</div>
<div class="col-5 text-left">
</div>
</div>
<div class="row align-items-center mb-1">
<div class="col-1 text-right">
奖金
</div>
<div class="col-5 text-left input-group">
<div class="input-group-prepend">
<div class="input-group-text">¥</div>
</div>
<%= number_field_tag(:bonus, @competition.bonus, autocomplete: 'off', step: 1, min: 0, class: 'form-control', placeholder: '请输入总奖金额') %>
</div>
</div>
<div class="row align-items-center mb-1">
<div class="col-1 text-right">
获奖人数
</div>
<div class="col-5 text-left">
<%= number_field_tag(:bonus, @competition.bonus, autocomplete: 'off', step: 1, min: 0, class: 'form-control', placeholder: '请输入总奖金额') %>
</div>
</div>
<div class="row des-row align-items-center mb-1">
<div class="col-1 text-right">
描述
</div>
<div class="col-11 text-left">
<%= text_area_tag(:description, @competition.description, class: 'form-control', placeholder: '请输入赛事简介') %>
</div>
</div>
<div class="row des-row align-items-center mb-1">
<div class="col-1 text-right">
</div>
<div class="col-5 text-left">
<%= javascript_void_link '保存', class: 'btn btn-primary submit-btn' %>
</div>
</div>
</div>
<% end %>
</div>
</div>

@ -1,16 +0,0 @@
<%
define_admin_breadcrumbs do
add_admin_breadcrumb('竞赛列表', admins_competitions_path)
add_admin_breadcrumb(@competition.name)
end
%>
<div class="card mb-5">
<div class="card-header d-flex justify-content-between align-items-center">
<span class="flex-1">基础设置</span>
</div>
<div class="card-body row">
</div>
</div>

@ -0,0 +1,29 @@
wb = xlsx_package.workbook
wb.add_worksheet(name: '报名列表') do |sheet|
sheet.add_row %w(序号 战队ID 战队名称 创建者 指导老师 队员姓名 职业 手机号 邮箱 学号 实名认证 职业认证 队员学校 地区 报名时间 排名)
@enroll_lists.each_with_index do |member, index|
team = member.competition_team
member_user = member.user
rank = @competition_scores.length > 0 ? @competition_scores.index(member.competition_team_id).to_i + 1 : "--"
data = [
index + 1,
member.competition_team_id,
@personal ? "--" : team.name,
team.user.real_name,
@personal ? "--" : team.teachers_info,
member_user.real_name,
member_user.identity,
member_user.phone,
member_user.mail,
member_user.student_id,
member_user.authentication ? "√" : "",
member_user.professional_certification ? "√" : "",
member_user.school_name,
member_user.school_province,
member.created_at.strftime('%Y-%m-%d %H:%M'),
rank
]
sheet.add_row(data)
end
end

@ -24,7 +24,7 @@
<%= link_to "清除", admins_competition_enroll_lists_path(@competition), class: "btn btn-default",'data-disable-with': '清除中...' %> <%= link_to "清除", admins_competition_enroll_lists_path(@competition), class: "btn btn-default",'data-disable-with': '清除中...' %>
<% end %> <% end %>
<a href="javascript:void(0)" class="btn btn-primary mt-3" id="enroll-lists-export" data-competition-id="<%= @competition.id %>" data-disable-with = '导出中...'>导出</a> <a href="javascript:void(0)" class="btn btn-primary mt-3" id="enroll-lists-export" data-competition-id="<%= @competition.id %>">导出</a>
</div> </div>
</div> </div>

@ -17,14 +17,10 @@
<% myshixuns.each do |myshixun| %> <% myshixuns.each do |myshixun| %>
<tr class="myshixun-item-<%= myshixun.id %>"> <tr class="myshixun-item-<%= myshixun.id %>">
<td><%= myshixun.id %></td> <td><%= myshixun.id %></td>
<td> <td><%= myshixun.identifier %></td>
<td class="text-left">
<% current_task = myshixun.last_executable_task || myshixun.last_task %> <% current_task = myshixun.last_executable_task || myshixun.last_task %>
<%= link_to "/myshixuns/#{myshixun.identifier}/stages/#{current_task.identifier}", target: '_blank' do %> <%= link_to "/myshixuns/#{myshixun.identifier}/stages/#{current_task.identifier}", target: '_blank' do %>
<%= myshixun.identifier %>
<% end %>
</td>
<td class="text-left">
<%= link_to "/shixuns/#{myshixun.shixun.identifier}", target: '_blank' do %>
<%= overflow_hidden_span myshixun.shixun.name, width: 280 %> <%= overflow_hidden_span myshixun.shixun.name, width: 280 %>
<% end %> <% end %>
</td> </td>

@ -3,8 +3,8 @@
<tr> <tr>
<th width="14%" class="text-left">姓名</th> <th width="14%" class="text-left">姓名</th>
<th width="22%" class="text-left">单位部门</th> <th width="22%" class="text-left">单位部门</th>
<th width="10%"><%= sort_tag('学习关卡数', name: 'study_challenge_count', path: admins_user_statistics_path) %></th> <th width="10%">学习关卡数<%#= sort_tag('学习关卡数', name: 'study_challenge_count', path: admins_user_statistics_path) %></th>
<th width="10%"><%= sort_tag('完成关卡数', name: 'finish_challenge_count', path: admins_user_statistics_path) %></th> <th width="10%">完成关卡数<%#= sort_tag('完成关卡数', name: 'finish_challenge_count', path: admins_user_statistics_path) %></th>
<th width="10%"><%= sort_tag('学习实训数', name: 'study_shixun_count', path: admins_user_statistics_path) %></th> <th width="10%"><%= sort_tag('学习实训数', name: 'study_shixun_count', path: admins_user_statistics_path) %></th>
<th width="10%"><%= sort_tag('完成实训数', name: 'finish_shixun_count', path: admins_user_statistics_path) %></th> <th width="10%"><%= sort_tag('完成实训数', name: 'finish_shixun_count', path: admins_user_statistics_path) %></th>
<th width="10%">评测次数</th> <th width="10%">评测次数</th>

@ -21,7 +21,7 @@
</div> </div>
</div> </div>
<%= f.input :link, as: :url, label: '跳转地址', placeholder: '请输入跳转地址' %> <%= f.input :link, label: '跳转地址', placeholder: '请输入跳转地址' %>
<div class="error text-danger"></div> <div class="error text-danger"></div>
<% end %> <% end %>

@ -21,7 +21,7 @@
</div> </div>
</div> </div>
<%= f.input :link, as: :url, label: '跳转地址', placeholder: '请输入跳转地址' %> <%= f.input :link, label: '跳转地址', placeholder: '请输入跳转地址' %>
<div class="error text-danger"></div> <div class="error text-danger"></div>
<% end %> <% end %>

@ -7,7 +7,7 @@ json.partial! "student_btn_check", locals: {identity: @user_course_identity, hom
json.(@homework, :unified_setting, :publish_time, :end_time, :late_penalty, :allow_late, :late_time, :work_public, json.(@homework, :unified_setting, :publish_time, :end_time, :late_penalty, :allow_late, :late_time, :work_public,
:score_open, :answer_public) :score_open, :answer_public)
json.group_settings @course.course_groups do |group| json.group_settings @course_groups do |group|
json.group_id group.id json.group_id group.id
json.group_name group.name json.group_name group.name
json.publish_time group_homework_setting(@homework, group.id).try(:publish_time) json.publish_time group_homework_setting(@homework, group.id).try(:publish_time)

@ -787,7 +787,7 @@ Rails.application.routes.draw do
resources :competitions, only: [:index, :show, :update] do resources :competitions, only: [:index, :show, :update] do
resources :competition_modules, only: [:index, :show, :update] resources :competition_modules, only: [:index, :show, :update]
resource :competition_staff resource :competition_staff
resources :competition_teams, only: [:index, :show] do resources :competition_teams, only: [:index, :show, :create, :update] do
post :join, on: :collection post :join, on: :collection
post :leave, on: :member post :leave, on: :member
get :course_detail, on: :member get :course_detail, on: :member
@ -1023,7 +1023,9 @@ Rails.application.routes.draw do
end end
resources :competition_settings, only: [:index, :update] resources :competition_settings, only: [:index, :update]
resources :enroll_lists, only: [:index] resources :enroll_lists, only: [:index] do
get :export, on: :collection
end
end end
resources :weapp_carousels, only: [:index, :create, :update, :destroy] do resources :weapp_carousels, only: [:index, :create, :update, :destroy] do

@ -0,0 +1,7 @@
class MigrateCompetitionScoreStageId < ActiveRecord::Migration[5.2]
def change
change_column_default :competition_scores, :competition_stage_id, 0
CompetitionScore.where("competition_stage_id is null").update_all(competition_stage_id: 0)
end
end

@ -0,0 +1,6 @@
class MigrateCompetitionModeDefault < ActiveRecord::Migration[5.2]
def change
change_column_default :competitions, :mode, from: 0, to: 1
Competition.all.update_all(mode: 1)
end
end

@ -0,0 +1,5 @@
class AddAwardsCountToCompetition < ActiveRecord::Migration[5.2]
def change
add_column :competitions, :awards_count, :integer, default: 0
end
end

@ -4,13 +4,8 @@ import {Link} from 'react-router-dom';
import {BrowserRouter as Router,Route,Switch} from 'react-router-dom'; import {BrowserRouter as Router,Route,Switch} from 'react-router-dom';
import Loadable from 'react-loadable'; import Loadable from 'react-loadable';
import Loading from '../../../Loading'; import Loading from '../../../Loading';
import { CNotificationHOC } from '../common/CNotificationHOC'
import { RouteHOC } from './common'
import locale from 'antd/lib/date-picker/locale/zh_CN';
import { WordsBtn, MarkdownToHtml, trigger, queryString, downloadFile } from 'educoder'; import { WordsBtn, MarkdownToHtml, trigger, queryString, downloadFile } from 'educoder';
import axios from 'axios'; import axios from 'axios';
import Modals from '../../modals/Modals';
import CoursesListType from '../coursesPublic/CoursesListType'; import CoursesListType from '../coursesPublic/CoursesListType';
import AccessoryModal from "../coursesPublic/AccessoryModal"; import AccessoryModal from "../coursesPublic/AccessoryModal";
import PublishRightnow from './PublishRightnow' import PublishRightnow from './PublishRightnow'

@ -1,7 +1,8 @@
import React,{ Component } from "react"; import React,{ Component } from "react";
import { Input,Checkbox,Menu,Pagination } from "antd"; import { Input,Checkbox,Menu,Pagination } from "antd";
import HomeworkModal from '../coursesPublic/HomeworkModal' import HomeworkModal from '../coursesPublic/HomeworkModal';
import OneSelfOrderModal from "../coursesPublic/OneSelfOrderModal";
import axios from 'axios' import axios from 'axios'
import moment from 'moment' import moment from 'moment'
import { getNextHalfHourOfMoment } from 'educoder' import { getNextHalfHourOfMoment } from 'educoder'
@ -32,9 +33,12 @@ class PublishRightnow extends Component{
} }
homeworkstart=()=>{ homeworkstart=()=>{
const isPublish = this.props.isPublish; const isPublish = this.props.isPublish;
const isPublishtype = this.props.isPublishtype;
let showdatatypes=isPublish===true||isPublishtype===1;
if (!this.props.checkBoxValues || this.props.checkBoxValues.length == 0) { if (!this.props.checkBoxValues || this.props.checkBoxValues.length == 0) {
this.props.showNotification(`请先选择要立即${isPublish ? "发布" : "截止"}的作业`) this.props.showNotification(`请先选择要立即${showdatatypes? "发布" : "截止"}的作业`)
return; return;
} }
@ -42,27 +46,30 @@ class PublishRightnow extends Component{
} }
showDialog = () => { showDialog = (course_groups) => {
const isPublish = this.props.isPublish; const isPublish = this.props.isPublish;
const isPublishtype = this.props.isPublishtype;
const dateFormat = 'YYYY-MM-DD HH:mm'; const dateFormat = 'YYYY-MM-DD HH:mm';
let showdatatype=isPublish===true&&isPublishtype===undefined;
// getNextHalfHourOfMoment let showdatatypes=isPublish===true||isPublishtype===1;
// getNextHalfHourOfMoment
const startMoment = (moment()); const startMoment = (moment());
this.setState({ this.setState({
modalname: isPublish ? "立即发布" : "立即截止", modalname: showdatatypes ? "立即发布" : "立即截止",
modaltype:1, modaltype:course_groups.length> 0 ? 1 : 2,
visible:true, visible:showdatatype?false:true,
Topval: isPublish ? "学生将立即收到作业" : "学生将不能再提交作品", OneSelftype:showdatatype?true:false,
Topval:showdatatypes ? "学生将立即收到作业" : "学生将不能再提交作品",
// Botvalleft: isPublish ? "暂不发布" : "暂不截止", // Botvalleft: isPublish ? "暂不发布" : "暂不截止",
Botval: this.props.fromListPage ? (isPublish ? "本操作只对“未发布”的分班有效" : "本操作只对“提交中”的分班有效") : '', Botval: this.props.fromListPage ? (showdatatypes ? "本操作只对“未发布”的分班有效" : "本操作只对“提交中”的分班有效") : '',
starttime: isPublish ? `发布时间:${startMoment.format(dateFormat)}` : '', starttime: showdatatypes? `发布时间:${startMoment.format(dateFormat)}` : '',
starttimes:isPublish ? `${startMoment.format(dateFormat)}` : '', starttimes:showdatatypes? `${startMoment.format(dateFormat)}` : '',
endtime: isPublish ? `截止时间:${startMoment.add(1, 'months').add(1, 'hours').minutes(0).format(dateFormat)}` : '', endtime:showdatatypes ? `截止时间:${startMoment.add(1, 'months').add(1, 'hours').minutes(0).format(dateFormat)}` : '',
Cancelname:isPublish ? "暂不发布" : "暂不截止", Cancelname:showdatatypes ? "暂不发布" : "暂不截止",
Savesname:isPublish ? "立即发布" : "立即截止", Savesname:showdatatypes ? "立即发布" : "立即截止",
Cancel:this.homeworkhide, Cancel:this.homeworkhide,
Saves:this.homeworkstartend, Saves:this.homeworkstartend,
typs:isPublish ? "start" : "end", typs:showdatatypes ? "start" : "end",
}) })
} }
homeworkhide=()=>{ homeworkhide=()=>{
@ -70,6 +77,7 @@ class PublishRightnow extends Component{
modalname:undefined, modalname:undefined,
modaltype:undefined, modaltype:undefined,
visible:false, visible:false,
OneSelftype:false,
Topval:undefined, Topval:undefined,
Topvalright:undefined, Topvalright:undefined,
Botvalleft:undefined, Botvalleft:undefined,
@ -106,19 +114,30 @@ class PublishRightnow extends Component{
this.props.showNotification('请至少选择一个分班'); this.props.showNotification('请至少选择一个分班');
return; return;
} }
let data={}
if(arg_group_ids.length===0){
data = {
homework_ids: this.props.checkBoxValues,
end_time: endtime==="Invalid date"?undefined:endtime,
}
}else{
data={
homework_ids: this.props.checkBoxValues,
group_ids: group_ids,
group_end_times:endtime,
detail:true
}
}
const isPublishtype = this.props.isPublishtype;
let showdatatypes=isPublish===true||isPublishtype===1;
let coursesId=this.props.match.params.coursesId; let coursesId=this.props.match.params.coursesId;
const url = `/courses/${coursesId}/homework_commons/${isPublish ? "publish_homework" : "end_homework"}.json` const url = `/courses/${coursesId}/homework_commons/${showdatatypes ? "publish_homework" : "end_homework"}.json`
axios.post(url, { axios.post(url, data)
group_ids,
homework_ids: this.props.checkBoxValues,
all_check: 0,
end_time:endtime==="Invalid date"?undefined:endtime
})
.then((response) => { .then((response) => {
if (response.data.status == 0) { if (response.data.status == 0) {
this.props.showNotification(isPublish ? "立即发布成功" : "立即截止成功") this.homeworkhide()
this.props.showNotification(showdatatypes ? "立即发布成功" : "立即截止成功")
this.props.doWhenSuccess && this.props.doWhenSuccess() this.props.doWhenSuccess && this.props.doWhenSuccess()
this.setState({ visible : false }) this.setState({ visible : false })
this.props.action && this.props.action() this.props.action && this.props.action()
@ -134,13 +153,16 @@ class PublishRightnow extends Component{
// } // }
// } // }
fetchCourseGroups = () => { fetchCourseGroups = () => {
const isPublish = this.props.isPublish;
const isPublishtype = this.props.isPublishtype;
let showdatatypes=isPublish===true||isPublishtype===1;
let coursesId=this.props.match.params.coursesId; let coursesId=this.props.match.params.coursesId;
// TODO 这里要改成单选作业,接口使用这个 https://www.showdoc.cc/127895880302646?page_id=2035541497546668 // TODO 这里要改成单选作业,接口使用这个 https://www.showdoc.cc/127895880302646?page_id=2035541497546668
// /homework_commons/:id/publish_groups.json // /homework_commons/:id/publish_groups.json
let url = `/courses/${coursesId}/all_course_groups.json` let url = `/courses/${coursesId}/all_course_groups.json`
if (this.props.checkBoxValues.length == 1) { if (this.props.checkBoxValues.length == 1) {
const isPublish = this.props.isPublish; const isPublish = this.props.isPublish;
url = `/homework_commons/${this.props.checkBoxValues[0]}/${ isPublish ? 'publish_groups' : 'end_groups'}.json` url = `/homework_commons/${this.props.checkBoxValues[0]}/${ showdatatypes ? 'publish_groups' : 'end_groups'}.json`
} }
axios.get(url, { axios.get(url, {
@ -150,9 +172,10 @@ class PublishRightnow extends Component{
this.setState({ visible : false }) this.setState({ visible : false })
return; return;
} }
this.showDialog() this.showDialog(response.data.course_groups)
this.setState({ this.setState({
course_groups: response.data.course_groups, course_groups: response.data.course_groups,
starttimesend:response.data.end_time===undefined||response.data.end_time===null||response.data.end_time===""?undefined:response.data.end_time,
}) })
}) })
.catch(function (error) { .catch(function (error) {
@ -162,6 +185,8 @@ class PublishRightnow extends Component{
render(){ render(){
const isPublish = this.props.isPublish; const isPublish = this.props.isPublish;
const isPublishtype = this.props.isPublishtype;
let showdatatypes=isPublish===true||isPublishtype===1;
let{ let{
Topvalright, Topvalright,
@ -184,6 +209,7 @@ class PublishRightnow extends Component{
const { showActionButton } = this.props const { showActionButton } = this.props
return( return(
<div> <div>
{/*立即截止*/}
{visible===true?<HomeworkModal {visible===true?<HomeworkModal
modaltype={modaltype} modaltype={modaltype}
modalname={modalname} modalname={modalname}
@ -204,7 +230,27 @@ class PublishRightnow extends Component{
onToPublishClick={this.props.onToPublishClick} onToPublishClick={this.props.onToPublishClick}
typs={this.state.typs} typs={this.state.typs}
/>:""} />:""}
{ showActionButton && <a href="javascript:void(0)" className="color-grey-9" onClick={this.homeworkstart}>{ isPublish ? "立即发布" : "立即截止" }</a> } {/*立即发布*/}
{this.state.OneSelftype===true?<OneSelfOrderModal
modaltype={this.state.modaltype}
modalname={this.state.modalname}
OneSelftype={this.state.OneSelftype}
Topval={this.state.Topval}
Topvalright={this.state.Topvalright}
Botvalleft={this.state.Botvalleft}
Botval={this.state.Botval}
starttime={this.state.starttime}
endtime={this.state.endtime}
Cancelname={this.state.Cancelname}
Savesname={this.state.Savesname}
Cancel={this.state.Cancel}
Saves={this.state.Saves}
course_groups={this.state.course_groups}
starttimes={this.state.starttimes}
starttimesend={this.state.starttimesend}
typs={this.state.typs}
/>:""}
{ showActionButton && <a href="javascript:void(0)" className="color-grey-9" onClick={this.homeworkstart}>{ showdatatypes ? "立即发布" : "立即截止" }</a> }
</div> </div>
) )
} }

@ -431,7 +431,9 @@ class commonWork extends Component{
></Titlesearchsection> ></Titlesearchsection>
<PublishRightnow ref="publishModalRef" showActionButton={true} {...this.props} checkBoxValues={checkBoxValues} <PublishRightnow ref="publishModalRef" showActionButton={true} {...this.props} checkBoxValues={checkBoxValues}
showActionButton={false} showActionButton={false}
isPublish={true} doWhenSuccess={this.doWhenSuccess} fromListPage={true}></PublishRightnow> isPublish={true}
isPublishtype={1}
doWhenSuccess={this.doWhenSuccess} fromListPage={true}></PublishRightnow>
{ {
mainList && mainList.course_identity < 5 && mainList.homeworks.length>0 && mainList && mainList.course_identity < 5 && mainList.homeworks.length>0 &&
<div className="mt20 edu-back-white padding20-30"> <div className="mt20 edu-back-white padding20-30">

@ -235,10 +235,14 @@ class HomeworkModal extends Component{
<style> <style>
{ {
` `
.ant-checkbox-wrapper { .HomeworkModal .ant-checkbox-wrapper {
margin-top: 0px; margin-top: 0px;
float: left; float: left;
} }
.width300{
width:300px;
display: inline-block;
}
` `
} }
</style> </style>
@ -251,7 +255,7 @@ class HomeworkModal extends Component{
<div className="clearfix edu-txt-center lineh-40" key={key}> <div className="clearfix edu-txt-center lineh-40" key={key}>
<li style={{ width: '100%',padding: "0px 10px"}}> <li style={{ width: '100%',padding: "0px 10px"}}>
<Checkbox <Checkbox
className="task-hide edu-txt-left" className="task-hide edu-txt-left width300"
name="shixun_homework[]" name="shixun_homework[]"
value={item.id} value={item.id}
key={item.id} key={item.id}

@ -33,52 +33,108 @@ class OneSelfOrderModal extends Component{
super(props); super(props);
this.state={ this.state={
group_ids:[], group_ids:[],
endtime:"" endtime:"",
course_groups:undefined,
Checkboxtype:true
} }
} }
componentDidMount() { componentDidMount() {
if(this.props.course_groups!=undefined&&this.props.course_groups.length!=0){ if(this.props.course_groups!=undefined&&this.props.course_groups.length!=0){
if(this.props.course_groups!=undefined) {
let arr=this.props.course_groups.map(item => item.id); let arr = this.props.course_groups.map(item => item.id);
this.shixunhomeworkedit(arr); let newarr = [];
let course_groups = this.props.course_groups;
course_groups.map((item, key) => {
if (item.end_time === null) {
// if(this.props.starttimesend===undefined){
// item.end_time = moment(moment(handleDateString(this.props.staytime)).add(1, 'week')).format("YYYY-MM-DD HH:mm");
// }else{
// item.end_time = moment(handleDateString(this.props.starttimesend)).format("YYYY-MM-DD HH:mm");
// }
item.end_time = moment(moment(handleDateString(this.props.staytime)).add(1, 'week')).format("YYYY-MM-DD HH:mm");
newarr.push(item)
} else {
newarr.push(item)
}
})
this.setState({
course_groups: newarr
})
this.shixunhomeworkedit(arr);
}
} }
if(this.props.starttimes===undefined||this.props.starttimes===""||this.props.starttimes===null){ if(this.props.starttimes===undefined||this.props.starttimes===""||this.props.starttimes===null){
this.setState({ if(this.props.starttimesend===undefined){
endtime:moment(moment(handleDateString(this.props.staytime)).add(1, 'months')).format("YYYY-MM-DD HH:mm") this.setState({
}) endtime:moment(moment(handleDateString(this.props.staytime)).add(1, 'week')).format("YYYY-MM-DD HH:mm")
})
}else{
this.setState({
endtime:moment(handleDateString(this.props.starttimesend)).format("YYYY-MM-DD HH:mm")
})
}
}else{ }else{
this.setState({ if(this.props.starttimesend===undefined){
endtime:moment(handleDateString(this.props.starttimes)).format("YYYY-MM-DD HH:mm") this.setState({
}) endtime:moment(moment(handleDateString(this.props.staytime)).add(1, 'week')).format("YYYY-MM-DD HH:mm")
})
}else{
this.setState({
endtime:moment(handleDateString(this.props.starttimesend)).format("YYYY-MM-DD HH:mm")
})
}
} }
} }
componentDidUpdate=(prevProps)=>{ componentDidUpdate=(prevProps)=>{
// if(prevProps.visible!=this.props.visible){
//
// if(this.props.course_groups!=undefined){
// let arr=this.props.course_groups.map(item => item.id);
// this.shixunhomeworkedit(arr);
// }
// }
if(prevProps.course_groups!=this.props.course_groups){ if(prevProps.course_groups!=this.props.course_groups){
if(this.props.course_groups!=undefined){ if(this.props.course_groups!=undefined){
let arr=this.props.course_groups.map(item => item.id); let arr=this.props.course_groups.map(item => item.id);
this.shixunhomeworkedit(arr); let newarr=[];
} let course_groups=this.props.course_groups;
course_groups.map((item,key)=>{
if(item.end_time===null){
item.end_time = moment(moment(handleDateString(this.props.staytime)).add(1, 'week')).format("YYYY-MM-DD HH:mm");
newarr.push(item)
}else{
newarr.push(item)
}
})
this.setState({
course_groups:newarr
})
this.shixunhomeworkedit(arr);
}
} }
if(prevProps.starttimes!=this.props.starttimes){ if(prevProps.starttimes!=this.props.starttimes){
if(this.props.starttimes===undefined||this.props.starttimes===""||this.props.starttimes===null){ if(this.props.starttimes===undefined||this.props.starttimes===""||this.props.starttimes===null){
this.setState({ if(this.props.starttimesend===undefined){
endtime:moment(moment(handleDateString(this.props.staytime)).add(1, 'months')).format("YYYY-MM-DD HH:mm") this.setState({
}) endtime:moment(moment(handleDateString(this.props.staytime)).add(1, 'week')).format("YYYY-MM-DD HH:mm")
})
}else{
this.setState({
endtime:moment(handleDateString(this.props.starttimesend)).format("YYYY-MM-DD HH:mm")
})
}
}else{ }else{
this.setState({ if(this.props.starttimesend===undefined){
endtime:moment(handleDateString(this.props.starttimes)).format("YYYY-MM-DD HH:mm") this.setState({
}) endtime:moment(moment(handleDateString(this.props.staytime)).add(1, 'week')).format("YYYY-MM-DD HH:mm")
})
}else{
this.setState({
endtime:moment(handleDateString(this.props.starttimesend)).format("YYYY-MM-DD HH:mm")
})
}
} }
} }
} }
@ -101,50 +157,140 @@ class OneSelfOrderModal extends Component{
} }
onChangeTimeendlist=(date, dateString,id)=>{
let {course_groups,endtimetypeid}=this.state;
if(endtimetypeid===id){
if(date!=null){
this.setState({
endtimetypeid:undefined
})
}
if(moment(dateString,"YYYY-MM-DD HH:mm") <= moment(this.props.starttime,"YYYY-MM-DD HH:mm")){}else{
if(date!=null){
this.setState({
endtimetypeid:undefined
})
}
}
}
let arr=course_groups;
arr.map((item,key)=>{
if(item.id===id){
item.end_time=date===null?"":moment(handleDateString(dateString)).format('YYYY-MM-DD HH:mm')
}
})
this.setState({
course_groups:arr
})
}
propsSaves=(ds,endtime)=>{ propsSaves=(ds,endtime)=>{
let {course_groups}=this.state;
if(ds.length ===0&&endtime === ""){ if(this.props.typs=="end"){
this.props.Saves() this.props.Saves()
}else{ }else{
if(this.props.typs!="end"){
if(endtime === ""||endtime===undefined||endtime===null){
if(this.props.typs!="end"){
if(!endtime){
this.setState({ this.setState({
endtimetype:true, endtimetype:true,
endtimetypevalue:"截止时间不能为空" endtimetypevalue:"截止时间不能为空"
}) })
return return
} }
if(moment(endtime,"YYYY-MM-DD HH:mm") <= moment(this.props.starttime,"YYYY-MM-DD HH:mm")){
if(moment(endtime,"YYYY-MM-DD HH:mm") <= moment(this.props.starttimes,"YYYY-MM-DD HH:mm")){
this.setState({ this.setState({
endtimetype:true, endtimetype:true,
endtimetypevalue:"必须晚于发布时间" endtimetypevalue:"必须晚于当前时间"
}) })
return return
} }
} }
this.props.Saves(ds,moment(handleDateString(endtime),"YYYY-MM-DD HH:mm").format("YYYY-MM-DD HH:mm"))
} let type=false
if(course_groups===undefined||course_groups.length===0){
this.props.Saves(ds,moment(handleDateString(endtime),"YYYY-MM-DD HH:mm").format("YYYY-MM-DD HH:mm"))
}else{
let arr=[]
ds.map((item,key)=>{
course_groups.map((items,key)=>{
if(item===items.id){
if(!items.end_time){
type=true
this.setState({
endtimetype:true,
endtimetypeid:items.id,
endtimetypevalue:"截止时间不能为空"
})
return
// arr.push(moment(moment(handleDateString(this.props.staytime)).add(1, 'week')).format("YYYY-MM-DD HH:mm"))
}else{
if(moment(items.end_time,"YYYY-MM-DD HH:mm") <= moment(this.props.starttime,"YYYY-MM-DD HH:mm")){
this.setState({
endtimetype:true,
endtimetypevalue:"必须晚于当前时间"
})
return
}
arr.push(items.end_time)
}
}
})
})
if(type===false){
this.props.Saves(ds,arr)
}
}
}
} }
render(){ Checkboxtype=(e)=>{
let {group_ids,endtime}=this.state;
let {course_groups}=this.props;
// console.log(this.props.starttimes) let {course_groups}=this.state;
// console.log(endtime)
// console.log(this.props.starttimes)
// console.log(this.state.endtime)
// console.log(this.props.starttime,this.props.endtime) let arr=[];
// TODO course_groups为空时的处理 if(e.target.checked==true){
course_groups.map((item,key)=>{
arr.push(item.id)
})
}else{
arr=[]
}
this.setState({
Checkboxtype:e.target.checked,
group_ids:arr
})
}
// let endtimelist=this.props.starttimes===undefined||this.props.starttimes===""?"":moment(handleDateString(endtime)).add(1,'months') render(){
let {group_ids,endtime,course_groups}=this.state;
console.log(this.props.modaltype)
let course_groupstype=course_groups===undefined||course_groups.length===0;
// TODO course_groups为空时的处理
return( return(
<div> <div>
<style>
{
`
.ant-input, .ant-input .ant-input-suffix{
background-color: #fff !important;
}
.width300{
width:300px;
display: inline-block;
}
`
}
</style>
{ {
this.props.OneSelftype===true?<style> this.props.OneSelftype===true?<style>
{ {
@ -186,22 +332,22 @@ class OneSelfOrderModal extends Component{
{this.props.Topval} {this.props.Topval}
<span className={"color-blue underline"}>{this.props.Topvalright}</span> <span className={"color-blue underline"}>{this.props.Topvalright}</span>
</p> </p>
<p className="task-popup-text-center font-16 mt10"> {/*<p className="task-popup-text-center font-16 mt10">*/}
{this.props.Botvalleft===undefined?"":<span className={"colorFF6800"}>"{this.props.Botvalleft}"</span>} {/*{this.props.Botvalleft===undefined?"":<span className={"colorFF6800"}>"{this.props.Botvalleft}"</span>}*/}
{this.props.Botval} {/*{this.props.Botval}*/}
</p> {/*</p>*/}
</React.Fragment> } </React.Fragment> }
{this.props.starttime===undefined|| {this.props.starttime===undefined||
this.props.starttime===""?"" this.props.starttime===""?""
: <p className="task-popup-text-center font-16 mt20"> : <p className="task-popup-text-center font-16 mt20 mb10">
<span className={"font-14 mr20 color979797"}> {/*<span className={"font-14 mr20 color979797"}>*/}
<span className={"mr10"}>发布时间:</span> {/*<span className={"mr10"}>发布时间:</span>*/}
{this.props.starttime}</span> {/*{this.props.starttime}</span>*/}
{this.props.modaltype===undefined||this.props.modaltype===2? <span className={"font-14 color979797"}> {this.props.modaltype===undefined||this.props.modaltype===2? <span className={"font-14 color979797"}>
{/*{this.props.endtime}*/} {/*{this.props.endtime}*/}
<span className={"mr10"}>截止时间:</span> <span className={"mr10"}>截止时间</span>
<DatePicker <DatePicker
dropdownClassName="hideDisable" dropdownClassName="hideDisable"
showTime={{ format: 'HH:mm' }} showTime={{ format: 'HH:mm' }}
@ -217,15 +363,17 @@ class OneSelfOrderModal extends Component{
onChange={this.onChangeTimeend} onChange={this.onChangeTimeend}
className={ this.state.endtimetype===true?"noticeTip":""} className={ this.state.endtimetype===true?"noticeTip":""}
/> />
{this.state.endtimetype===true?<div className={"color-red fr mr90 mt5"}>{this.state.endtimetypevalue}</div>:""}
{/*<div className={"fr mr90 mt5"}>(仅支持半点和整点)</div>*/}
</span>:""} </span>:""}
</p>} </p>}
{/* usingCheckBeforePost 为true的时候 全选所有分班 */} {/* usingCheckBeforePost 为true的时候 全选所有分班 */}
<style> <style>
{ {
` `
.ant-checkbox-wrapper { .HomeworkModal .ant-checkbox-wrapper {
margin-top: 0px; margin-top: 0px;
float: left; float: left;
} }
@ -249,7 +397,7 @@ class OneSelfOrderModal extends Component{
</li> </li>
</div>} </div>}
{this.props.modaltype===undefined||this.props.modaltype===2 {this.props.modaltype===undefined||this.props.modaltype===2
|| this.props.usingCheckBeforePost ?"":<ul className="upload_select_box fl clearfix mb30" || this.props.usingCheckBeforePost ?"":<ul className={this.state.endtimetypeid!=undefined&&this.state.endtimetype===true?"upload_select_box fl clearfix mb20":"upload_select_box fl clearfix mb30"}
style={{"overflow-y":"auto",padding:"10px 0px"}} style={{"overflow-y":"auto",padding:"10px 0px"}}
id="search_not_members_list" id="search_not_members_list"
@ -257,13 +405,13 @@ class OneSelfOrderModal extends Component{
{ <Checkbox.Group style={{ width: '100%' }} value={group_ids} onChange={this.shixunhomeworkedit}> { <Checkbox.Group style={{ width: '100%' }} value={group_ids} onChange={this.shixunhomeworkedit}>
{ {
course_groups.map((item,key)=>{ course_groups===undefined||course_groups.length===0?"":course_groups.map((item,key)=>{
return( return(
<div className="clearfix edu-txt-center lineh-40" key={key}> <div className="clearfix edu-txt-center lineh-40 mb10" key={key}>
<li style={{ width: '100%',padding: "0px 10px"}} className={"mb10"}> <li style={{ width: '100%',padding: "0px 10px"}} className={"mb10"}>
<Checkbox <Checkbox
className="task-hide edu-txt-left" className="task-hide edu-txt-left width300"
name="shixun_homework[]" name="shixun_homework[]"
value={item.id} value={item.id}
key={item.id} key={item.id}
@ -279,11 +427,10 @@ class OneSelfOrderModal extends Component{
locale={locale} locale={locale}
format={dateFormat} format={dateFormat}
placeholder="请选择截止时间" placeholder="请选择截止时间"
id={"endTime"}
width={"210px"} width={"210px"}
value={item.end_time===null||item.end_time===""?"":moment(item.end_time, dateFormat)} value={item.end_time===null||item.end_time===""?"":moment(handleDateString(item.end_time), dateFormat)}
onChange={this.onChangeTimeend} onChange={(e,data)=>this.onChangeTimeendlist(e,data,item.id)}
className={ this.state.endtimetype===true?"noticeTip fr":"fr"} className={ this.state.endtimetypeid===item.id&&this.state.endtimetype===true||moment(handleDateString(item.end_time),"YYYY-MM-DD HH:mm") <= moment(this.props.starttime,"YYYY-MM-DD HH:mm")?"noticeTip fr":"fr"}
/> />
</li> </li>
@ -295,11 +442,16 @@ class OneSelfOrderModal extends Component{
</ul> </ul>
} }
{this.state.endtimetype===true&&course_groupstype===true?<div className={"color-red"} style={{'text-align': 'center'}}>{this.state.endtimetypevalue}</div>:""}
<div className="clearfix mt30 edu-txt-center mb10"> {this.state.endtimetypeid!=undefined&&this.state.endtimetype===true?<div className={"color-red fl ml10 mb20"}>{this.state.endtimetypevalue}</div>:""}
{course_groupstype===true?<div className={this.state.endtimetype===true&&course_groupstype===true?"clearfix mt10 edu-txt-center mb10":"clearfix mt20 edu-txt-center mb10"}>
<a className="task-btn color-white mr30" onClick={this.props.Cancel}>{this.props.Cancelname}</a> <a className="task-btn color-white mr30" onClick={this.props.Cancel}>{this.props.Cancelname}</a>
<a className="task-btn task-btn-orange" onClick={()=>this.propsSaves(group_ids,this.state.endtime)}>{this.props.Savesname}</a> <a className="task-btn task-btn-orange" onClick={()=>this.propsSaves(group_ids,this.state.endtime)}>{this.props.Savesname}</a>
</div> </div>:<div className="clearfix mt30 edu-txt-center mb10">
{course_groupstype===true?"":<Checkbox className="fl ml10" checked={this.state.Checkboxtype} onChange={this.Checkboxtype}>全选</Checkbox>}
<a className="task-btn task-btn-orange fr" onClick={()=>this.propsSaves(group_ids,this.state.endtime)}>{this.props.Savesname}</a>
<a className="task-btn color-white mr30 fr" onClick={this.props.Cancel}>{this.props.Cancelname}</a>
</div>}
</div> </div>
</Modal>:""} </Modal>:""}

@ -430,7 +430,8 @@ class Testpapersettinghomepage extends Component{
className={"btn fr color-blue font-16 mt20 mr20"} className={"btn fr color-blue font-16 mt20 mr20"}
checkBoxValues={[parseInt(this.props.match.params.Id)]} checkBoxValues={[parseInt(this.props.match.params.Id)]}
Exercisetype={"exercise"} Exercisetype={"exercise"}
action={this.Commonheadofthetestpaper} pushtype={true}
action={this.Commonheadofthetestpaper}
single={true} single={true}
getsetdata={this.getsetdata} getsetdata={this.getsetdata}
></ImmediatelyPublish> ></ImmediatelyPublish>

@ -6,6 +6,7 @@ import Loadable from 'react-loadable';
import Loading from '../../../../Loading'; import Loading from '../../../../Loading';
import {BrowserRouter as Router,Route,Switch} from 'react-router-dom'; import {BrowserRouter as Router,Route,Switch} from 'react-router-dom';
import axios from 'axios'; import axios from 'axios';
import OneSelfOrderModal from "../../coursesPublic/OneSelfOrderModal";
import HomeworkModal from "../../coursesPublic/HomeworkModal"; import HomeworkModal from "../../coursesPublic/HomeworkModal";
import AccessoryModal from "../../coursesPublic/AccessoryModal"; import AccessoryModal from "../../coursesPublic/AccessoryModal";
import Associationmodel from '../../coursesPublic/Associationmodel'; import Associationmodel from '../../coursesPublic/Associationmodel';
@ -60,7 +61,8 @@ class GraduationTaskDetail extends Component{
Modalstopval:undefined, Modalstopval:undefined,
ModalCancel:undefined, ModalCancel:undefined,
ModalSave:undefined, ModalSave:undefined,
acrossVisible:undefined acrossVisible:undefined,
OneSelftype:false
} }
} }
componentDidMount(){ componentDidMount(){
@ -113,19 +115,28 @@ class GraduationTaskDetail extends Component{
// this.props.history.goBack() // this.props.history.goBack()
this.props.history.replace(`/courses/${this.state.questionslist.course_id}/graduation_tasks/${this.state.questionslist.graduation_id}`); this.props.history.replace(`/courses/${this.state.questionslist.course_id}/graduation_tasks/${this.state.questionslist.graduation_id}`);
} }
setend_time=(time)=>{
this.setState({
starttimesend:time===undefined||time===null||time===""?undefined:time,
})
}
//立即发布 //立即发布
publish=()=>{ publish=()=>{
let {questionslist}=this.state;
let starttime= this.props.getNowFormatDates(1,1); let starttime= this.props.getNowFormatDates(1,1);
let endtime=this.props.getNowFormatDates(2,1); let endtime=this.props.getNowFormatDates(2,1);
// this.homeworkstart() console.log(this.bindRef.end_time)
this.setState({ this.setState({
modalname:"立即发布", modalname:"立即发布",
visible:true, // visible:true,
OneSelftype:true,
Topval:"学生将立即收到毕设任务", Topval:"学生将立即收到毕设任务",
// Botvalleft:"点击修改", // Botvalleft:"点击修改",
// Botval:`本操作只对"未发布"的分班有效`, // Botval:`本操作只对"未发布"的分班有效`,
starttime:moment(moment(new Date())).format("YYYY-MM-DD HH:mm") , starttime:moment(moment(new Date())).format("YYYY-MM-DD HH:mm") ,
starttimes:this.props.getNowFormatDates(1), starttimes:questionslist.end_time,
staytime:this.props.getNowFormatDates(1),
typs:"start", typs:"start",
endtime:endtime, endtime:endtime,
Cancelname:"暂不发布", Cancelname:"暂不发布",
@ -169,7 +180,6 @@ class GraduationTaskDetail extends Component{
this.getdatas(); this.getdatas();
this.child && this.child.searchValue(); this.child && this.child.searchValue();
} }
// 立即截止 // 立即截止
end=()=>{ end=()=>{
// this.homeworkstart() // this.homeworkstart()
@ -212,6 +222,7 @@ class GraduationTaskDetail extends Component{
Modalstype:false, Modalstype:false,
Loadtype:false, Loadtype:false,
visible:false, visible:false,
OneSelftype:false,
Modulationtype:false, Modulationtype:false,
Allocationtype:false, Allocationtype:false,
Modalstopval:"", Modalstopval:"",
@ -317,7 +328,7 @@ class GraduationTaskDetail extends Component{
getdatas:this.getdatas getdatas:this.getdatas
} }
document.title=questionslist&&questionslist.course_name;
return( return(
<div className="newMain clearfix"> <div className="newMain clearfix">
{ {
@ -342,6 +353,34 @@ class GraduationTaskDetail extends Component{
modaltype={this.state.modaltype} modaltype={this.state.modaltype}
getcourse_groupslist={(id) => this.getcourse_groupslist(id)} getcourse_groupslist={(id) => this.getcourse_groupslist(id)}
/> />
{this.state.OneSelftype==true?<OneSelfOrderModal
{...this.props}
staytime={this.state.staytime}
starttimes={this.state.starttimes}
typs={this.state.typs}
modalname={this.state.modalname}
OneSelftype={this.state.OneSelftype}
Topval={this.state.Topval}
Topvalright={this.state.Topvalright}
Botvalleft={this.state.Botvalleft}
Botval={this.state.Botval}
starttime={this.state.starttime}
endtime={this.state.endtime}
Cancelname={this.state.Cancelname}
Savesname={this.state.Savesname}
Cancel={this.state.Cancel}
Saves={this.state.Saves}
course_groups={this.state.course_groups}
modaltype={this.state.modaltype}
getcourse_groupslist={(id) => this.getcourse_groupslist(id)}
starttimes={this.state.starttimes}
starttimesend={this.state.starttimesend}
typs={this.state.typs}
/>:""}
{/*关联项目*/} {/*关联项目*/}
{visibles===true? {visibles===true?
<Associationmodel <Associationmodel
@ -479,19 +518,19 @@ class GraduationTaskDetail extends Component{
<Route exact path="/courses/:coursesId/graduation_tasks/:category_id/detail/:task_Id/list" <Route exact path="/courses/:coursesId/graduation_tasks/:category_id/detail/:task_Id/list"
render={ render={
(props) => (<GraduationTaskslist {...this.props} {...props} {...this.state} {...commom} triggerRef={this.bindRef} tab={`list`}/>) (props) => (<GraduationTaskslist {...this.props} {...props} {...this.state} {...commom} triggerRef={this.bindRef} setend_time={(time)=>this.setend_time(time)} tab={`list`}/>)
} }
></Route> ></Route>
<Route exact path="/courses/:coursesId/graduation_tasks/:category_id/detail/:task_Id/setting" <Route exact path="/courses/:coursesId/graduation_tasks/:category_id/detail/:task_Id/setting"
render={ render={
(props) => (<GraduationTaskssetting {...this.props} {...props} {...this.state} {...commom} triggerRef={this.bindRef} tab={`setting`}/>) (props) => (<GraduationTaskssetting {...this.props} {...props} {...this.state} {...commom} triggerRef={this.bindRef} setend_time={(time)=>this.setend_time(time)} tab={`setting`}/>)
} }
></Route> ></Route>
<Route exact path="/courses/:coursesId/graduation_tasks/:category_id/detail/:task_Id/questions" <Route exact path="/courses/:coursesId/graduation_tasks/:category_id/detail/:task_Id/questions"
render={ render={
(props) => (<GraduationTasksquestions {...this.props} {...props} {...this.state} {...commom} triggerRef={this.bindRef} tab={`questions`}/>) (props) => (<GraduationTasksquestions {...this.props} {...props} {...this.state} {...commom} triggerRef={this.bindRef} setend_time={(time)=>this.setend_time(time)} tab={`questions`}/>)
}></Route> }></Route>
</Switch> </Switch>

@ -143,6 +143,7 @@ class GraduationTaskssettingapp extends Component{
commenttime:result.data.comment_time===null||result.data.comment_time=== ""?"":moment(moment(handleDateString(result.data.comment_time))).format("YYYY-MM-DD HH:mm"), commenttime:result.data.comment_time===null||result.data.comment_time=== ""?"":moment(moment(handleDateString(result.data.comment_time))).format("YYYY-MM-DD HH:mm"),
task_status: result.data.task_status task_status: result.data.task_status
}) })
this.props.setend_time(result.data.end_time)
} }
}).catch((error)=>{ }).catch((error)=>{

@ -151,7 +151,9 @@ class GraduationTaskssettinglist extends Component{
taskslistdata: result.data, taskslistdata: result.data,
data: datalist, data: datalist,
loadingstate: false, loadingstate: false,
end_time:result.data.end_time
}) })
this.props.setend_time(result.data.end_time)
} }
}).catch((error)=>{ }).catch((error)=>{
console.log(error) console.log(error)

@ -54,8 +54,10 @@ class GraduationTasksquestions extends Component{
axios.get(url).then((result)=>{ axios.get(url).then((result)=>{
if(result.status===200){ if(result.status===200){
this.setState({ this.setState({
questionslist:result.data questionslist:result.data,
end_time:result.data.end_time
}) })
this.props.setend_time(result.data.end_time)
} }
}).catch((error)=>{ }).catch((error)=>{
console.log(error) console.log(error)

@ -185,6 +185,7 @@ class PollDetailIndex extends Component{
className={"font-16"} className={"font-16"}
checkBoxValues={[this.props.match.params.pollId]} checkBoxValues={[this.props.match.params.pollId]}
action={this.getPollInfo} action={this.getPollInfo}
pushtype={true}
single={true} single={true}
></ImmediatelyPublish> ></ImmediatelyPublish>
</li> </li>

@ -4,13 +4,14 @@ import React,{ Component } from "react";
import Modals from '../../../modals/Modals' import Modals from '../../../modals/Modals'
import { WordsBtn } from 'educoder' import { WordsBtn } from 'educoder'
import HomeworkModal from "../../coursesPublic/HomeworkModal"; import HomeworkModal from "../../coursesPublic/HomeworkModal";
import OneSelfOrderModal from "../../coursesPublic/OneSelfOrderModal";
import axios from 'axios' import axios from 'axios'
import moment from 'moment'; import moment from 'moment';
class Immediatelypublish extends Component{ class Immediatelypublish extends Component{
constructor(props){ constructor(props){
super(props) super(props)
@ -39,104 +40,170 @@ class Immediatelypublish extends Component{
} }
//立即发布 //立即发布
homeworkstart=()=>{ homeworkstart=()=>{
let {checkBoxValues}=this.props let {checkBoxValues,pushtype}=this.props
// console.log(this.props.Exercisetype==="exercise") if(pushtype===true){
if(checkBoxValues.length==0){
this.props.showNotification("请先在列表中选择数据");
// this.setState({
// modalsType:true,
// modalsTopval:"请先在列表中选择数据",
// loadtype:true
// })
}else{
let coursesId=this.props.match.params.coursesId;
if(this.props.Exercisetype==="exercise"){
let url=`/exercises/${this.props.match.params.Id}/publish_groups.json`;
axios.get(url).then((response) => {
if(response.status===200){
this.setState({
modalname:"立即发布",
modaltype:response.data.course_groups===null||response.data.course_groups.length===0?2:1,
OneSelftype:true,
Topval:"学生将立即收到试卷",
// Botvalleft:"暂不发布",
Botval:this.props.single ? "":`本操作只对"未发布"的分班有效`,
starttime:moment(moment(new Date())).format("YYYY-MM-DD HH:mm"),
starttimes:this.props.getNowFormatDates(1),
endtime:"截止时间:"+this.props.getNowFormatDates(2),
Cancelname:"暂不发布",
Savesname:"立即发布",
Cancel:this.homeworkhide,
Saves:this.homeworkstartend,
course_groups:response.data.course_groups,
starttimesend:response.data.end_time===undefined||response.data.end_time===null||response.data.end_time===""?undefined:response.data.end_time,
})
}
}).catch((error) => {
console.log(error)
});
}else{
let url=`/polls/${this.props.match.params.pollId}/publish_groups.json`;
axios.get(url).then((response) => {
if(response){
if(checkBoxValues.length==0){ this.setState({
this.props.showNotification("请先在列表中选择数据"); modalname:"立即发布",
// this.setState({ modaltype:response.data.course_groups===null||response.data.course_groups.length===0?2:1,
// modalsType:true, OneSelftype:true,
// modalsTopval:"请先在列表中选择数据", Topval:"学生将立即收到问卷",
// loadtype:true // Botvalleft:"暂不发布",
// }) Botval:this.props.single ? "":`本操作只对"未发布"的分班有效`,
}else{ starttime:"发布时间:"+moment(moment(new Date())).format("YYYY-MM-DD HH:mm"),
let coursesId=this.props.match.params.coursesId; starttimes:this.props.getNowFormatDates(1),
if(this.props.Exercisetype==="exercise"){ endtime:"截止时间:"+this.props.getNowFormatDates(2),
let url=`/courses/${coursesId}/exercises/publish_modal.json`; Cancelname:"暂不发布",
axios.get(url,{ Savesname:"立即发布",
params:{ Cancel:this.homeworkhide,
check_ids:checkBoxValues Saves:this.homeworkstartend,
} course_groups:response.data.course_groups,
}).then((response) => { starttimesend:response.data.end_time===undefined||response.data.end_time===null||response.data.end_time===""?undefined:response.data.end_time,
if(response.status===200){ })
let list=[]; }
if(response.data.course_info){ }).catch((error) => {
for(var i=0;i<response.data.course_info.length;i++){ console.log(error)
list.push({ });
id:response.data.course_info[i].course_group_id,
name:response.data.course_info[i].course_group_name,
})
}
}
this.setState({
course_groups:list,
})
this.setState({
modalname:"立即发布",
modaltype:response.data.un_publish > 0 ? 1 : 2,
visible:true,
Topval:"学生将立即收到试卷",
// Botvalleft:"暂不发布",
Botval:this.props.single ? "":`本操作只对"未发布"的分班有效`,
starttime:"发布时间:"+moment(moment(new Date())).format("YYYY-MM-DD HH:mm"),
starttimes:this.props.getNowFormatDates(1),
endtime:"截止时间:"+this.props.getNowFormatDates(2),
Cancelname:"暂不发布",
Savesname:"立即发布",
Cancel:this.homeworkhide,
Saves:this.homeworkstartend,
})
} }
}).catch((error) => {
console.log(error)
});
}else{
let url=`/courses/${coursesId}/polls/publish_modal.json`;
axios.get(url,{
params:{
check_ids:checkBoxValues
}
}).then((response) => {
if(response){
let list=[];
if(response.data.course_info){
for(var i=0;i<response.data.course_info.length;i++){
list.push({
id:response.data.course_info[i].course_group_id,
name:response.data.course_info[i].course_group_name,
})
}
}
this.setState({
course_groups:list,
})
this.setState({
modalname:"立即发布",
modaltype:response.data.un_publish > 0 ? 1 : 2,
visible:true,
Topval:"学生将立即收到问卷",
// Botvalleft:"暂不发布",
Botval:this.props.single ? "":`本操作只对"未发布"的分班有效`,
starttime:"发布时间:"+moment(moment(new Date())).format("YYYY-MM-DD HH:mm"),
starttimes:this.props.getNowFormatDates(1),
endtime:"截止时间:"+this.props.getNowFormatDates(2),
Cancelname:"暂不发布",
Savesname:"立即发布",
Cancel:this.homeworkhide,
Saves:this.homeworkstartend,
})
}
}).catch((error) => {
console.log(error)
});
} }
}else{
if(checkBoxValues.length==0){
this.props.showNotification("请先在列表中选择数据");
// this.setState({
// modalsType:true,
// modalsTopval:"请先在列表中选择数据",
// loadtype:true
// })
}else{
let coursesId=this.props.match.params.coursesId;
if(this.props.Exercisetype==="exercise"){
let url=`/courses/${coursesId}/exercises/publish_modal.json`;
axios.get(url,{
params:{
check_ids:checkBoxValues
}
}).then((response) => {
if(response.status===200){
let list=[];
if(response.data.course_info){
for(var i=0;i<response.data.course_info.length;i++){
list.push({
id:response.data.course_info[i].course_group_id,
name:response.data.course_info[i].course_group_name,
})
}
}
this.setState({
course_groups:list,
})
this.setState({
modalname:"立即发布",
modaltype:response.data.un_publish > 0 ? 1 : 2,
visible:true,
Topval:"学生将立即收到试卷",
// Botvalleft:"暂不发布",
Botval:this.props.single ? "":`本操作只对"未发布"的分班有效`,
starttime:"发布时间:"+moment(moment(new Date())).format("YYYY-MM-DD HH:mm"),
starttimes:this.props.getNowFormatDates(1),
endtime:"截止时间:"+this.props.getNowFormatDates(2),
Cancelname:"暂不发布",
Savesname:"立即发布",
Cancel:this.homeworkhide,
Saves:this.homeworkstartend,
})
}
}).catch((error) => {
console.log(error)
});
}else{
let url=`/courses/${coursesId}/polls/publish_modal.json`;
axios.get(url,{
params:{
check_ids:checkBoxValues
}
}).then((response) => {
if(response){
let list=[];
if(response.data.course_info){
for(var i=0;i<response.data.course_info.length;i++){
list.push({
id:response.data.course_info[i].course_group_id,
name:response.data.course_info[i].course_group_name,
})
}
}
this.setState({
course_groups:list,
})
this.setState({
modalname:"立即发布",
modaltype:response.data.un_publish > 0 ? 1 : 2,
visible:true,
Topval:"学生将立即收到问卷",
// Botvalleft:"暂不发布",
Botval:this.props.single ? "":`本操作只对"未发布"的分班有效`,
starttime:"发布时间:"+moment(moment(new Date())).format("YYYY-MM-DD HH:mm"),
starttimes:this.props.getNowFormatDates(1),
endtime:"截止时间:"+this.props.getNowFormatDates(2),
Cancelname:"暂不发布",
Savesname:"立即发布",
Cancel:this.homeworkhide,
Saves:this.homeworkstartend,
})
}
}).catch((error) => {
console.log(error)
});
}
}
}
}
} }
@ -154,6 +221,7 @@ class Immediatelypublish extends Component{
modalname:undefined, modalname:undefined,
modaltype:undefined, modaltype:undefined,
visible:false, visible:false,
OneSelftype:false,
Topval:undefined, Topval:undefined,
Topvalright:undefined, Topvalright:undefined,
Botvalleft:undefined, Botvalleft:undefined,
@ -174,18 +242,42 @@ class Immediatelypublish extends Component{
// 确定立即发布 // 确定立即发布
homeworkstartend=(ids,endtime)=>{ homeworkstartend=(ids,endtime)=>{
let {checkBoxValues}=this.props let {checkBoxValues,pushtype}=this.props
let {chooseId}=this.state; let {chooseId}=this.state;
let coursesId=this.props.match.params.coursesId; let coursesId=this.props.match.params.coursesId;
let data={};
if(pushtype===true){
if(ids.length===0){
data = {
check_ids:checkBoxValues,
end_time: endtime,
}
}else{
data={
check_ids: checkBoxValues,
group_ids: ids,
group_end_times:endtime,
detail:true
}
}
}else{
data={
check_ids:checkBoxValues,
group_ids:chooseId,
end_time:endtime
}
}
if(this.props.Exercisetype==="exercise"){ if(this.props.Exercisetype==="exercise"){
let url=`/courses/${coursesId}/exercises/publish.json` let url=`/courses/${coursesId}/exercises/publish.json`
axios.post(url,{ axios.post(url,data).then((result)=>{
check_ids:checkBoxValues,
group_ids:chooseId,
end_time:endtime
}).then((result)=>{
if(result){ if(result){
this.props.showNotification(result.data.message); this.props.showNotification(result.data.message);
this.homeworkhide(); this.homeworkhide();
@ -210,11 +302,7 @@ class Immediatelypublish extends Component{
}else{ }else{
let url=`/courses/${coursesId}/polls/publish.json` let url=`/courses/${coursesId}/polls/publish.json`
axios.post(url,{ axios.post(url,data).then((result)=>{
check_ids:checkBoxValues,
group_ids:chooseId,
end_time:endtime
}).then((result)=>{
if(result){ if(result){
this.props.showNotification(result.data.message); this.props.showNotification(result.data.message);
this.homeworkhide(); this.homeworkhide();
@ -277,6 +365,29 @@ class Immediatelypublish extends Component{
course_groups={course_groups} course_groups={course_groups}
getcourse_groupslist={(id)=>this.getcourse_groupslist(id)} getcourse_groupslist={(id)=>this.getcourse_groupslist(id)}
/> />
{/*立即发布*/}
{this.state.OneSelftype===true?<OneSelfOrderModal
modaltype={this.state.modaltype}
modalname={this.state.modalname}
OneSelftype={this.state.OneSelftype}
Topval={this.state.Topval}
Topvalright={this.state.Topvalright}
Botvalleft={this.state.Botvalleft}
Botval={this.state.Botval}
starttime={this.state.starttime}
endtime={this.state.endtime}
Cancelname={this.state.Cancelname}
Savesname={this.state.Savesname}
Cancel={this.state.Cancel}
Saves={this.state.Saves}
course_groups={this.state.course_groups}
getcourse_groupslist={(id) => this.getcourse_groupslist(id)}
starttimes={this.state.starttimes}
starttimesend={this.state.starttimesend}
typs={this.state.typs}
/>:""}
{/* 公用的提示弹框 */} {/* 公用的提示弹框 */}
<Modals <Modals
modalsType={modalsType} modalsType={modalsType}

@ -32,6 +32,7 @@ import DownloadMessageysl from '../../modals/DownloadMessageysl';
import Startshixuntask from "../coursesPublic/Startshixuntask"; import Startshixuntask from "../coursesPublic/Startshixuntask";
import ModulationModal from "../coursesPublic/ModulationModal"; import ModulationModal from "../coursesPublic/ModulationModal";
import HomeworkModal from "../coursesPublic/HomeworkModal"; import HomeworkModal from "../coursesPublic/HomeworkModal";
import OneSelfOrderModal from "../coursesPublic/OneSelfOrderModal";
import ShixunWorkModal from "./Shixunworkdetails/ShixunWorkModal"; import ShixunWorkModal from "./Shixunworkdetails/ShixunWorkModal";
import NoneData from '../../../modules/courses/coursesPublic/NoneData'; import NoneData from '../../../modules/courses/coursesPublic/NoneData';
@ -1683,8 +1684,8 @@ class Listofworksstudentone extends Component {
} }
seacthdatas = (teacherdata,student_works) => { seacthdatas = (teacherdata,student_works) => {
console.log("1197"); // console.log("1197");
console.log(this.props.isNotMember()); // console.log(this.props.isNotMember());
let {page, limit,work_efficiency} = this.state; let {page, limit,work_efficiency} = this.state;
let datalist = []; let datalist = [];
let datalists = []; let datalists = [];
@ -1873,8 +1874,8 @@ class Listofworksstudentone extends Component {
} }
// 设置数据 // 设置数据
seacthdata = (teacherdata) => { seacthdata = (teacherdata) => {
console.log("1326"); // console.log("1326");
console.log(this.props.isNotMember()); // console.log(this.props.isNotMember());
let datalist = []; let datalist = [];
@ -2352,8 +2353,8 @@ class Listofworksstudentone extends Component {
if (work_efficiency === false) { if (work_efficiency === false) {
if(JSON.stringify(course_group_info) === "[]"|| course_group_info === undefined||course_group_info === null){ if(JSON.stringify(course_group_info) === "[]"|| course_group_info === undefined||course_group_info === null){
//这里没有分班 没有 关卡得分 没有效率分 //这里没有分班 没有 关卡得分 没有效率分
console.log("1739"); // console.log("1739");
console.log(this.props.isNotMember()); // console.log(this.props.isNotMember());
for(var i=0;i< this.state.columns.length;i++){ for(var i=0;i< this.state.columns.length;i++){
var item = this.state.columns[i]; var item = this.state.columns[i];
@ -2389,8 +2390,8 @@ class Listofworksstudentone extends Component {
}else{ }else{
console.log("1767"); // console.log("1767");
console.log(this.props.isNotMember()); // console.log(this.props.isNotMember());
if(course_group_info.length < 2){ if(course_group_info.length < 2){
for(var i=0;i< this.state.columns.length;i++){ for(var i=0;i< this.state.columns.length;i++){
var item = this.state.columns[i]; var item = this.state.columns[i];
@ -2427,8 +2428,8 @@ class Listofworksstudentone extends Component {
} }
}else { }else {
console.log("1795"); // console.log("1795");
console.log(this.props.isNotMember()); // console.log(this.props.isNotMember());
for(var i=0;i< this.state.columns.length;i++){ for(var i=0;i< this.state.columns.length;i++){
var item = this.state.columns[i]; var item = this.state.columns[i];
@ -2461,8 +2462,8 @@ class Listofworksstudentone extends Component {
} }
} }
}else { }else {
console.log("1821"); // console.log("1821");
console.log(this.props.isNotMember()); // console.log(this.props.isNotMember());
if(JSON.stringify(course_group_info) === "[]"|| course_group_info === undefined || course_group_info === null){ if(JSON.stringify(course_group_info) === "[]"|| course_group_info === undefined || course_group_info === null){
@ -2497,8 +2498,8 @@ class Listofworksstudentone extends Component {
}else { }else {
console.log("1849"); // console.log("1849");
console.log(this.props.isNotMember()); // console.log(this.props.isNotMember());
if(course_group_info.length < 2) { if(course_group_info.length < 2) {
for(var i=0;i< this.state.columns.length;i++){ for(var i=0;i< this.state.columns.length;i++){
var item = this.state.columns[i]; var item = this.state.columns[i];
@ -2804,11 +2805,12 @@ class Listofworksstudentone extends Component {
this.setState({ this.setState({
modalname: "立即发布", modalname: "立即发布",
modaltype: response.data.course_groups === null || response.data.course_groups.length === 0 ? 2 : 1, modaltype: response.data.course_groups === null || response.data.course_groups.length === 0 ? 2 : 1,
svisible: true, svisible: false,
OneSelftype:true,
Topval:"学生将立即收到作业", Topval:"学生将立即收到作业",
// Botvalleft:"暂不发布", // Botvalleft:"暂不发布",
Botval:`本操作只对"未发布"的分班有效`, Botval:`本操作只对"未发布"的分班有效`,
starttime: "发布时间:" + moment(moment(new Date())).format("YYYY-MM-DD HH:mm"), starttime: moment(moment(new Date())).format("YYYY-MM-DD HH:mm"),
endtime: "截止时间:" + endtime, endtime: "截止时间:" + endtime,
starttimes:starttime, starttimes:starttime,
starttimesend:response.data.end_time===undefined||response.data.end_time===null||response.data.end_time===""?undefined:response.data.end_time, starttimesend:response.data.end_time===undefined||response.data.end_time===null||response.data.end_time===""?undefined:response.data.end_time,
@ -2840,6 +2842,7 @@ class Listofworksstudentone extends Component {
modalname: "立即截止", modalname: "立即截止",
modaltype: response.data.course_groups === null || response.data.course_groups.length === 0 ? 2 : 1, modaltype: response.data.course_groups === null || response.data.course_groups.length === 0 ? 2 : 1,
svisible: true, svisible: true,
OneSelftype:false,
Topval:"学生将不能再提交作业", Topval:"学生将不能再提交作业",
// Botvalleft:"暂不截止", // Botvalleft:"暂不截止",
Botval:`本操作只对"提交中"的分班有效`, Botval:`本操作只对"提交中"的分班有效`,
@ -2860,15 +2863,44 @@ class Listofworksstudentone extends Component {
// 立即发布 // 立即发布
homeworkstartend = (ds,endtime) => { homeworkstartend = (ds,endtime) => {
var homeworkid = this.props.match.params.homeworkid; var homeworkid = this.props.match.params.homeworkid;
let {course_groupslist} = this.state;
let data={}
if(ds.length===0){
if(this.state.teacherdata.category.main===1){
data = {
homework_ids: [homeworkid],
end_time: endtime,
}
}else {
data = {
homework_ids: [homeworkid],
end_time: endtime,
category_id:this.state.teacherdata.category.category_id,
}
}
}else{
if(this.state.teacherdata.category.main===1){
data={
homework_ids: [homeworkid],
group_ids: ds,
group_end_times:endtime,
detail:true
}
}else{
data={
homework_ids: [homeworkid],
group_ids: ds,
group_end_times:endtime,
category_id:this.state.teacherdata.category.category_id,
detail:true
}
}
}
let coursesId = this.props.match.params.coursesId; let coursesId = this.props.match.params.coursesId;
let url = "/courses/" + coursesId + "/homework_commons/publish_homework.json"; let url = "/courses/" + coursesId + "/homework_commons/publish_homework.json";
axios.post(url, { axios.post(url, data).then((result) => {
homework_ids: [homeworkid],
group_ids: course_groupslist,
end_time:endtime,
}).then((result) => {
if (result) { if (result) {
if (result.data.status === 0) { if (result.data.status === 0) {
notification.open({ notification.open({
@ -2943,6 +2975,7 @@ class Listofworksstudentone extends Component {
modalname: undefined, modalname: undefined,
modaltype: undefined, modaltype: undefined,
svisible: false, svisible: false,
OneSelftype:false,
Topval: undefined, Topval: undefined,
Topvalright: undefined, Topvalright: undefined,
Botvalleft: undefined, Botvalleft: undefined,
@ -3163,12 +3196,33 @@ class Listofworksstudentone extends Component {
</div> </div>
: "" : ""
} }
{/*立即截止*/}
<HomeworkModal
modaltype={this.state.modaltype}
modalname={this.state.modalname}
visible={this.state.svisible}
Topval={this.state.Topval}
Topvalright={this.state.Topvalright}
Botvalleft={this.state.Botvalleft}
Botval={this.state.Botval}
starttime={this.state.starttime}
endtime={this.state.endtime}
Cancelname={this.state.Cancelname}
Savesname={this.state.Savesname}
Cancel={this.state.Cancel}
Saves={this.state.Saves}
course_groups={this.state.course_groups}
getcourse_groupslist={(id) => this.getcourse_groupslist(id)}
starttimes={this.state.starttimes}
starttimesend={this.state.starttimesend}
typs={this.state.typs}
/>
{/*立即发布*/} {/*立即发布*/}
<HomeworkModal {this.state.OneSelftype===true?<OneSelfOrderModal
modaltype={this.state.modaltype} modaltype={this.state.modaltype}
modalname={this.state.modalname} modalname={this.state.modalname}
visible={this.state.svisible} OneSelftype={this.state.OneSelftype}
Topval={this.state.Topval} Topval={this.state.Topval}
Topvalright={this.state.Topvalright} Topvalright={this.state.Topvalright}
Botvalleft={this.state.Botvalleft} Botvalleft={this.state.Botvalleft}
@ -3184,7 +3238,7 @@ class Listofworksstudentone extends Component {
starttimes={this.state.starttimes} starttimes={this.state.starttimes}
starttimesend={this.state.starttimesend} starttimesend={this.state.starttimesend}
typs={this.state.typs} typs={this.state.typs}
/> />:""}
{ {
homework_status&&homework_status.length===0? homework_status&&homework_status.length===0?
<div className="edu-back-white"> <div className="edu-back-white">

@ -62,9 +62,9 @@ class ShixunHomeworkPage extends Component {
} }
Getdataback = (jobsettingsdata, teacherdata) => { Getdataback = (jobsettingsdata, teacherdata) => {
console.log("ShixunHomeworkPage56"); // console.log("ShixunHomeworkPage56");
console.log(jobsettingsdata); // console.log(jobsettingsdata);
console.log(teacherdata); // console.log(teacherdata);
this.setState({ this.setState({
jobsettingsdatapage: jobsettingsdata.data.message===undefined?jobsettingsdata:undefined, jobsettingsdatapage: jobsettingsdata.data.message===undefined?jobsettingsdata:undefined,
@ -350,12 +350,7 @@ class ShixunHomeworkPage extends Component {
</div> </div>
</div> </div>
</div> </div>
{/*<DownloadMessageysl*/}
{/*{...this.props}*/}
{/*value={this.state.DownloadMessageval}*/}
{/*modalCancel={this.Downloadcal}*/}
{/*modalsType={this.state.DownloadType}*/}
{/*/>*/}
{parseInt(tab) === 0 ?<Listofworksstudentone triggerRef={this.bindRef} {...this.props} {...this.state} Getdataback={(jobsettingsdata, teacherdata) => this.Getdataback(jobsettingsdata, teacherdata)}></Listofworksstudentone>:""} {parseInt(tab) === 0 ?<Listofworksstudentone triggerRef={this.bindRef} {...this.props} {...this.state} Getdataback={(jobsettingsdata, teacherdata) => this.Getdataback(jobsettingsdata, teacherdata)}></Listofworksstudentone>:""}
{parseInt(tab) === 1 ?<Workquestionandanswer triggerRef={this.bindRef} {...this.props} {...this.state} Getdataback={(jobsettingsdata, teacherdata) => this.Getdataback(jobsettingsdata, teacherdata)} Showupdateinstructionsboolfalse={(i)=>this.Showupdateinstructionsboolfalse(i)}></Workquestionandanswer>:""} {parseInt(tab) === 1 ?<Workquestionandanswer triggerRef={this.bindRef} {...this.props} {...this.state} Getdataback={(jobsettingsdata, teacherdata) => this.Getdataback(jobsettingsdata, teacherdata)} Showupdateinstructionsboolfalse={(i)=>this.Showupdateinstructionsboolfalse(i)}></Workquestionandanswer>:""}
{parseInt(tab) === 2 ?<ShixunStudentWork triggerRef={this.bindRef} {...this.props} {...this.state} Getdataback={(jobsettingsdata, teacherdata) => this.Getdataback(jobsettingsdata, teacherdata)}></ShixunStudentWork>:""} {parseInt(tab) === 2 ?<ShixunStudentWork triggerRef={this.bindRef} {...this.props} {...this.state} Getdataback={(jobsettingsdata, teacherdata) => this.Getdataback(jobsettingsdata, teacherdata)}></ShixunStudentWork>:""}
@ -369,31 +364,3 @@ class ShixunHomeworkPage extends Component {
export default ShixunHomeworkPage; export default ShixunHomeworkPage;
// <div className="edu-back-white mt10" >
// <div className="stud-class-set bor-bottom-greyE ">
// <div className=" clearfix edu-back-white pl30 pr30">
// <div className="fl task_menu_ul">
// {this.props.isAdmin() === true ?
//
// <Menu mode="horizontal" selectedKeys={tab} onClick={(e)=>this.changeTab(e)}>
// <Menu.Item key="0">作品列表</Menu.Item>
// <Menu.Item key="1">作业回答</Menu.Item>
// <Menu.Item key="2">代码查重</Menu.Item>
// <Menu.Item key="3">设置</Menu.Item>
// </Menu>
// :
// <Menu mode="horizontal" selectedKeys={tab} onClick={(e)=>this.changeTab(e)}>
// <Menu.Item key="0">作品列表</Menu.Item>
// <Menu.Item key="1">作业回答</Menu.Item>
// <Menu.Item key="2">代码查重</Menu.Item>
// </Menu>
// }
//
// </div>
// </div>
{/* </div>*/
}
{/*</div>*/
}

@ -3,6 +3,7 @@ import CoursesListType from '../coursesPublic/CoursesListType';
import {WordsBtn,ActionBtn} from 'educoder'; import {WordsBtn,ActionBtn} from 'educoder';
import ShixunWorkModal from './Shixunworkdetails/ShixunWorkModal'; import ShixunWorkModal from './Shixunworkdetails/ShixunWorkModal';
import HomeworkModal from "../coursesPublic/HomeworkModal"; import HomeworkModal from "../coursesPublic/HomeworkModal";
import OneSelfOrderModal from "../coursesPublic/OneSelfOrderModal";
import DownloadMessageysl from '../../modals/DownloadMessageysl'; import DownloadMessageysl from '../../modals/DownloadMessageysl';
import NoneData from '../coursesPublic/NoneData'; import NoneData from '../coursesPublic/NoneData';
import { import {
@ -422,7 +423,7 @@ class ShixunStudentWork extends Component {
this.setState({ this.setState({
modalname:"立即发布", modalname:"立即发布",
modaltype:response.data.course_groups===null||response.data.course_groups.length===0?2:1, modaltype:response.data.course_groups===null||response.data.course_groups.length===0?2:1,
visible:true, OneSelftype:true,
Topval:"学生将立即收到作业", Topval:"学生将立即收到作业",
// Botvalleft:"暂不发布", // Botvalleft:"暂不发布",
Botval:`本操作只对"未发布"的分班有效`, Botval:`本操作只对"未发布"的分班有效`,
@ -476,15 +477,44 @@ class ShixunStudentWork extends Component {
// 立即发布 // 立即发布
homeworkstartend=(ds,endtime)=>{ homeworkstartend=(ds,endtime)=>{
var homeworkid = this.props.match.params.homeworkid; var homeworkid = this.props.match.params.homeworkid;
let {course_groupslist} = this.state;
let data={}
if(ds.length===0){
if(this.props.teacherdatapage.category.main===1){
data = {
homework_ids: [homeworkid],
end_time: endtime,
}
}else {
data = {
homework_ids: [homeworkid],
end_time: endtime,
category_id:this.props.teacherdatapage.category.category_id,
}
}
}else{
if(this.props.teacherdatapage.category.main===1){
data={
homework_ids: [homeworkid],
group_ids: ds,
group_end_times:endtime,
detail:true
}
}else{
data={
homework_ids: [homeworkid],
group_ids: ds,
group_end_times:endtime,
category_id:this.props.teacherdatapage.category.category_id,
detail:true
}
}
}
let coursesId=this.props.match.params.coursesId; let coursesId=this.props.match.params.coursesId;
let url ="/courses/"+coursesId+"/homework_commons/publish_homework.json"; let url ="/courses/"+coursesId+"/homework_commons/publish_homework.json";
axios.post(url,{ axios.post(url,data).then((result)=>{
homework_ids:[homeworkid],
group_ids:course_groupslist,
end_time:endtime,
}).then((result)=>{
if(result.status===200){ if(result.status===200){
if(result.data.status===0){ if(result.data.status===0){
notification.open({ notification.open({
@ -538,6 +568,7 @@ class ShixunStudentWork extends Component {
modalname:undefined, modalname:undefined,
modaltype:undefined, modaltype:undefined,
visible:false, visible:false,
OneSelftype:false,
Topval:undefined, Topval:undefined,
Topvalright:undefined, Topvalright:undefined,
Botvalleft:undefined, Botvalleft:undefined,
@ -739,7 +770,7 @@ class ShixunStudentWork extends Component {
{/* {...this.props}*/} {/* {...this.props}*/}
{/* refs="DownloadMessage"*/} {/* refs="DownloadMessage"*/}
{/*/>*/} {/*/>*/}
{/*立即发布*/} {/*立即截止*/}
<HomeworkModal <HomeworkModal
modaltype={this.state.modaltype} modaltype={this.state.modaltype}
modalname={this.state.modalname} modalname={this.state.modalname}
@ -760,6 +791,29 @@ class ShixunStudentWork extends Component {
starttimesend={this.state.starttimesend} starttimesend={this.state.starttimesend}
typs={this.state.typs} typs={this.state.typs}
/> />
{/*立即发布*/}
{this.state.OneSelftype===true?<OneSelfOrderModal
modaltype={this.state.modaltype}
modalname={this.state.modalname}
OneSelftype={this.state.OneSelftype}
Topval={this.state.Topval}
Topvalright={this.state.Topvalright}
Botvalleft={this.state.Botvalleft}
Botval={this.state.Botval}
starttime={this.state.starttime}
endtime={this.state.endtime}
Cancelname={this.state.Cancelname}
Savesname={this.state.Savesname}
Cancel={this.state.Cancel}
Saves={this.state.Saves}
course_groups={this.state.course_groups}
getcourse_groupslist={(id) => this.getcourse_groupslist(id)}
starttimes={this.state.starttimes}
starttimesend={this.state.starttimesend}
typs={this.state.typs}
/>:""}
<div className={"educontent "}> <div className={"educontent "}>
<div className="edu-back-white"> <div className="edu-back-white">

@ -414,7 +414,7 @@ class ShixunhomeWorkItem extends Component{
{ {
discussMessage && discussMessage.upper_category_name && discussMessage && discussMessage.upper_category_name &&
<ConditionToolTip title={discussMessage.upper_category_name} condition={ discussMessage.upper_category_name.length > 22 }> <ConditionToolTip title={discussMessage.upper_category_name} condition={ discussMessage.upper_category_name.length > 22 }>
{ <div className=" color-grey9 task-hide fr" style={discussMessage.time_status===1||discussMessage.time_status===2||discussMessage.time_status===3||discussMessage.time_status===4||discussMessage.time_status===5||discussMessage.time_status===6?{"maxWidth":"268px"}:{"maxWidth":"625px"}} title={discussMessage.upper_category_name}>所属目录{discussMessage.upper_category_name}</div>} { <div className=" color-grey9 task-hide fr" style={discussMessage.time_status===1||discussMessage.time_status===2||discussMessage.time_status===3||discussMessage.time_status===4||discussMessage.time_status===5||discussMessage.time_status===6?{"maxWidth":"268px"}:{"maxWidth":"550px"}} title={discussMessage.upper_category_name}>所属目录{discussMessage.upper_category_name}</div>}
</ConditionToolTip> </ConditionToolTip>
} }

@ -17,17 +17,20 @@ import {
import {Link} from 'react-router-dom'; import {Link} from 'react-router-dom';
import locale from 'antd/lib/date-picker/locale/zh_CN'; import locale from 'antd/lib/date-picker/locale/zh_CN';
import axios from 'axios'; import axios from 'axios';
import moment from 'moment';
import 'moment/locale/zh-cn';
import Modals from "../../modals/Modals";
import DownloadMessageysl from "../../modals/DownloadMessageysl";
import OneSelfOrderModal from "../coursesPublic/OneSelfOrderModal";
import '../css/members.css'; import '../css/members.css';
import "../common/formCommon.css"; import "../common/formCommon.css";
import '../css/Courses.css'; import '../css/Courses.css';
import './style.css'; import './style.css';
import '../css/busyWork.css' import '../css/busyWork.css'
import '../poll/pollStyle.css' import '../poll/pollStyle.css'
import moment from 'moment';
import 'moment/locale/zh-cn';
import Modals from "../../modals/Modals";
import Startshixuntask from "../coursesPublic/Startshixuntask"; import Startshixuntask from "../coursesPublic/Startshixuntask";
import DownloadMessageysl from "../../modals/DownloadMessageysl";
const RadioGroup = Radio.Group; const RadioGroup = Radio.Group;
//GraduationTaskssetting.js //GraduationTaskssetting.js
@ -1531,7 +1534,7 @@ class Trainingjobsetting extends Component {
this.setState({ this.setState({
modalname: "立即发布", modalname: "立即发布",
modaltype: response.data.course_groups === null || response.data.course_groups.length === 0 ? 2 : 1, modaltype: response.data.course_groups === null || response.data.course_groups.length === 0 ? 2 : 1,
visible: true, OneSelftype: true,
Topval:"学生将立即收到作业", Topval:"学生将立即收到作业",
// Botvalleft:"暂不发布", // Botvalleft:"暂不发布",
Botval:`本操作只对"未发布"的分班有效`, Botval:`本操作只对"未发布"的分班有效`,
@ -1587,15 +1590,44 @@ class Trainingjobsetting extends Component {
// 立即发布 // 立即发布
homeworkstartend = (ds,endtime) => { homeworkstartend = (ds,endtime) => {
var homeworkid = this.props.match.params.homeworkid; var homeworkid = this.props.match.params.homeworkid;
let {course_groupslist} = this.state;
let data={}
if(ds.length===0){
if(this.props.teacherdatapage.category.main===1){
data = {
homework_ids: [homeworkid],
end_time: endtime,
}
}else {
data = {
homework_ids: [homeworkid],
end_time: endtime,
category_id:this.props.teacherdatapage.category.category_id,
}
}
}else{
if(this.props.teacherdatapage.category.main===1){
data={
homework_ids: [homeworkid],
group_ids: ds,
group_end_times:endtime,
detail:true
}
}else{
data={
homework_ids: [homeworkid],
group_ids: ds,
group_end_times:endtime,
category_id:this.props.teacherdatapage.category.category_id,
detail:true
}
}
}
let coursesId = this.props.match.params.coursesId; let coursesId = this.props.match.params.coursesId;
let url = "/courses/" + coursesId + "/homework_commons/publish_homework.json"; let url = "/courses/" + coursesId + "/homework_commons/publish_homework.json";
axios.post(url, { axios.post(url,data).then((result) => {
homework_ids: [homeworkid],
group_ids: course_groupslist,
end_time:endtime,
}).then((result) => {
if (result.status === 200) { if (result.status === 200) {
if (result.data.status === 0) { if (result.data.status === 0) {
notification.open({ notification.open({
@ -1654,6 +1686,7 @@ class Trainingjobsetting extends Component {
modalname: undefined, modalname: undefined,
modaltype: undefined, modaltype: undefined,
visible: false, visible: false,
OneSelftype:false,
Topval: undefined, Topval: undefined,
Topvalright: undefined, Topvalright: undefined,
Botvalleft: undefined, Botvalleft: undefined,
@ -1799,8 +1832,8 @@ class Trainingjobsetting extends Component {
}; };
//一进来就是老师要用的编辑页面 //一进来就是老师要用的编辑页面
editSettings=(datas)=>{ editSettings=(datas)=>{
console.log("编辑页面"); // console.log("编辑页面");
console.log(datas); // console.log(datas);
try { try {
if (datas.data.is_end === true) { if (datas.data.is_end === true) {
this.setState({ this.setState({
@ -2127,6 +2160,30 @@ class Trainingjobsetting extends Component {
starttimesend={this.state.starttimesend} starttimesend={this.state.starttimesend}
typs={this.state.typs} typs={this.state.typs}
/> />
{/*立即发布*/}
{this.state.OneSelftype===true?<OneSelfOrderModal
modaltype={this.state.modaltype}
modalname={this.state.modalname}
OneSelftype={this.state.OneSelftype}
Topval={this.state.Topval}
Topvalright={this.state.Topvalright}
Botvalleft={this.state.Botvalleft}
Botval={this.state.Botval}
starttime={this.state.starttime}
endtime={this.state.endtime}
Cancelname={this.state.Cancelname}
Savesname={this.state.Savesname}
Cancel={this.state.Cancel}
Saves={this.state.Saves}
course_groups={this.state.course_groups}
getcourse_groupslist={(id) => this.getcourse_groupslist(id)}
starttimes={this.state.starttimes}
starttimesend={this.state.starttimesend}
typs={this.state.typs}
/>:""}
<Modals <Modals
modalsType={modalsType} modalsType={modalsType}
modalsTopval={modalsTopval} modalsTopval={modalsTopval}

@ -24,18 +24,21 @@ import {Link, Switch, Route, Redirect} from 'react-router-dom';
import moment from 'moment'; import moment from 'moment';
import 'moment/locale/zh-cn'; import 'moment/locale/zh-cn';
import axios from 'axios'; import axios from 'axios';
import CommonReply from "../common/comments/CommonReply";
import Homeworddescription from "../shixunHomework/Homeworddescription";
import ShixunWorkModal from './Shixunworkdetails/ShixunWorkModal';
import HomeworkModal from "../coursesPublic/HomeworkModal";
import DownloadMessageysl from "../../modals/DownloadMessageysl";
import OneSelfOrderModal from "../coursesPublic/OneSelfOrderModal";
import '../css/members.css' import '../css/members.css'
import "../common/formCommon.css" import "../common/formCommon.css"
import '../css/Courses.css' import '../css/Courses.css'
import './style.css' import './style.css'
import 'antd/lib/pagination/style/index.css'; import 'antd/lib/pagination/style/index.css';
import './Challenges.css' import './Challenges.css'
import CommonReply from "../common/comments/CommonReply";
import Homeworddescription from "../shixunHomework/Homeworddescription";
import ShixunWorkModal from './Shixunworkdetails/ShixunWorkModal';
import HomeworkModal from "../coursesPublic/HomeworkModal";
import Startshixuntask from "../coursesPublic/Startshixuntask"; import Startshixuntask from "../coursesPublic/Startshixuntask";
import DownloadMessageysl from "../../modals/DownloadMessageysl";
const TextArea = Input.TextArea const TextArea = Input.TextArea
//作业问答页面 //作业问答页面
@ -163,11 +166,11 @@ class Workquestionandanswer extends Component {
this.setState({ this.setState({
modalname: "立即发布", modalname: "立即发布",
modaltype: response.data.course_groups === null || response.data.course_groups.length === 0 ? 2 : 1, modaltype: response.data.course_groups === null || response.data.course_groups.length === 0 ? 2 : 1,
visible: true, OneSelftype: true,
Topval: "学生将立即收到作业", Topval: "学生将立即收到作业",
// Botvalleft:"暂不发布", // Botvalleft:"暂不发布",
Botval: `本操作只对"未发布"的分班有效`, Botval: `本操作只对"未发布"的分班有效`,
starttime: "发布时间:" + moment(moment(new Date())).format("YYYY-MM-DD HH:mm"), starttime: moment(moment(new Date())).format("YYYY-MM-DD HH:mm"),
endtime: "截止时间:" + endtime, endtime: "截止时间:" + endtime,
Cancelname: "暂不发布", Cancelname: "暂不发布",
Savesname: "立即发布", Savesname: "立即发布",
@ -218,15 +221,43 @@ class Workquestionandanswer extends Component {
// 立即发布 // 立即发布
homeworkstartend = (ds, endtime) => { homeworkstartend = (ds, endtime) => {
var homeworkid = this.props.match.params.homeworkid; var homeworkid = this.props.match.params.homeworkid;
let {course_groupslist} = this.state;
let data={}
if(ds.length===0){
if(this.state.category.main===1){
data = {
homework_ids: [homeworkid],
end_time: endtime,
}
}else {
data = {
homework_ids: [homeworkid],
end_time: endtime,
category_id:this.state.category.category_id,
}
}
}else{
if(this.state.category.main===1){
data={
homework_ids: [homeworkid],
group_ids: ds,
group_end_times:endtime,
detail:true
}
}else{
data={
homework_ids: [homeworkid],
group_ids: ds,
group_end_times:endtime,
category_id:this.state.category.category_id,
detail:true
}
}
}
let coursesId = this.props.match.params.coursesId; let coursesId = this.props.match.params.coursesId;
let url = "/courses/" + coursesId + "/homework_commons/publish_homework.json"; let url = "/courses/" + coursesId + "/homework_commons/publish_homework.json";
axios.post(url, { axios.post(url, data).then((result) => {
homework_ids: [homeworkid],
group_ids: course_groupslist,
end_time: endtime,
}).then((result) => {
if (result.status === 200) { if (result.status === 200) {
if (result.data.status === 0) { if (result.data.status === 0) {
notification.open({ notification.open({
@ -335,6 +366,7 @@ class Workquestionandanswer extends Component {
addnametab: undefined, addnametab: undefined,
typs: undefined, typs: undefined,
starttimes: undefined, starttimes: undefined,
OneSelftype:false,
}) })
} }
getcourse_groupslist = (id) => { getcourse_groupslist = (id) => {
@ -455,6 +487,28 @@ class Workquestionandanswer extends Component {
starttimesend={this.state.starttimesend} starttimesend={this.state.starttimesend}
typs={this.state.typs} typs={this.state.typs}
/> />
{/*立即发布*/}
{this.state.OneSelftype===true?<OneSelfOrderModal
modaltype={this.state.modaltype}
modalname={this.state.modalname}
OneSelftype={this.state.OneSelftype}
Topval={this.state.Topval}
Topvalright={this.state.Topvalright}
Botvalleft={this.state.Botvalleft}
Botval={this.state.Botval}
starttime={this.state.starttime}
endtime={this.state.endtime}
Cancelname={this.state.Cancelname}
Savesname={this.state.Savesname}
Cancel={this.state.Cancel}
Saves={this.state.Saves}
course_groups={this.state.course_groups}
getcourse_groupslist={(id) => this.getcourse_groupslist(id)}
starttimes={this.state.starttimes}
starttimesend={this.state.starttimesend}
typs={this.state.typs}
/>:""}
<div className={"educontent "}> <div className={"educontent "}>
<div className="edu-back-white" > <div className="edu-back-white" >

@ -94,6 +94,7 @@ class OfficialAcademicTranscript extends Component {
challenge_id: {id: item.challenge_id}, challenge_id: {id: item.challenge_id},
challenge_comment: item.challenge_comment, challenge_comment: item.challenge_comment,
challenge_comment_hidden: item.challenge_comment_hidden, challenge_comment_hidden: item.challenge_comment_hidden,
view_answer: item.view_answer,
// adjustmentminute:asdasd // adjustmentminute:asdasd
}) })
}) })
@ -172,15 +173,18 @@ class OfficialAcademicTranscript extends Component {
className: "edu-txt-center", className: "edu-txt-center",
render: (text, record) => { render: (text, record) => {
return ( return (
<span style={{cursor: "default"}}>{record.view_answer === true ? <Tooltip placement="bottom" title={ <span style={{cursor: "default"}}>
{record.view_answer === true ? <Tooltip placement="bottom" title={
<pre> <pre>
学生在完成任务评测之前是否看了参考答案 学生在完成任务评测之前是否看了参考答案
</pre> </pre>
}><span style={{cursor: "default"}}>已查看</span> </Tooltip> : <Tooltip placement="bottom" title={ }><span style={{cursor: "default"}}>已查看</span> </Tooltip>
: <Tooltip placement="bottom" title={
<pre> <pre>
学生在完成任务评测之前查是否看了参考答案 学生在完成任务评测之前是否查看了参考答案
</pre> </pre>
}><span style={{cursor: "default"}}>未查看</span> </Tooltip>}</span> }><span style={{cursor: "default"}}>未查看</span> </Tooltip>}
</span>
) )
} }
}, },

@ -111,7 +111,7 @@ class ShixunsHome extends Component {
} }
const MyRate = ({ defaultValue, ...rest }) => { const MyRate = ({ defaultValue, ...rest }) => {
let myValue = defaultValue; let myValue = defaultValue;
console.log(myValue-Math.floor(myValue)) // console.log(myValue-Math.floor(myValue))
// if (myValue < Math.ceil(myValue)) { // if (myValue < Math.ceil(myValue)) {
// myValue = Math.floor(myValue) + 0.5; // myValue = Math.floor(myValue) + 0.5;
// } // }

Loading…
Cancel
Save