Merge branches 'dev_aliyun' and 'develop' of https://bdgit.educoder.net/Hjqreturn/educoder into develop

dev_auth
杨树明 6 years ago
commit c125c81eef

@ -80,6 +80,21 @@ $(document).on('turbolinks:load', function(){
}) })
}); });
// reset user login times
$('.users-list-container').on('click', '.reset-login-times-action', function(){
var $action = $(this);
var userId = $action.data('id');
$.ajax({
url: '/admins/users/' + userId + '/reset_login_times',
method: 'POST',
dataType: 'json',
success: function() {
showSuccessNotify();
}
});
});
// ***************** reward grade modal ***************** // ***************** reward grade modal *****************
var $rewardGradeModal = $('.admin-users-reward-grade-modal'); var $rewardGradeModal = $('.admin-users-reward-grade-modal');
var $form = $rewardGradeModal.find('form.admin-users-reward-grade-form'); var $form = $rewardGradeModal.find('form.admin-users-reward-grade-form');

@ -52,6 +52,12 @@ class Admins::UsersController < Admins::BaseController
render_ok(grade: user.grade) render_ok(grade: user.grade)
end end
def reset_login_times
User.find(params[:id]).reset_login_times!
render_ok
end
private private
def update_params def update_params

@ -78,7 +78,7 @@ class Competitions::CompetitionTeamsController < Competitions::BaseController
end end
render_ok render_ok
rescue Competitions::CreatePersonalTeamService::Error => ex rescue ApplicationService::Error => ex
render_error(ex.message) render_error(ex.message)
end end

@ -31,7 +31,7 @@ class Competitions::CompetitionsController < Competitions::BaseController
def show def show
@competition = current_competition @competition = current_competition
current_competition.increment(:visits) current_competition.increment!(:visits)
end end
def update def update
@ -44,6 +44,8 @@ class Competitions::CompetitionsController < Competitions::BaseController
@competition = current_competition @competition = current_competition
@competition_modules = @competition.unhidden_competition_modules @competition_modules = @competition.unhidden_competition_modules
@user = current_user @user = current_user
current_competition.increment!(:visits)
end end
def informs def informs

@ -440,6 +440,7 @@ class HomeworkCommonsController < ApplicationController
@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)) @course_groups = @course.course_groups.where(id: @course.charge_group_ids(@user))
@shixun = @homework.shixuns.take if @homework.homework_type == "practice"
end end
def update_settings def update_settings

@ -11,6 +11,6 @@ class Users::AuthenticationAppliesController < Users::BaseAccountController
private private
def create_params def create_params
params.permit(:name, :id_number, :upload_image) params.permit(:name, :gender, :id_number, :upload_image)
end end
end end

@ -32,6 +32,7 @@ class LimitForbidControl::Base
# 锁定 # 锁定
if value >= allow_times.to_i if value >= allow_times.to_i
Rails.logger.info("[LimitForbidControl] Lock #{cache_key}")
Rails.cache.write(forbid_cache_key, true, expires_in: forbid_expires) Rails.cache.write(forbid_cache_key, true, expires_in: forbid_expires)
Rails.cache.delete(cache_key) Rails.cache.delete(cache_key)
else else
@ -40,6 +41,7 @@ class LimitForbidControl::Base
end end
def clear def clear
Rails.logger.info("[LimitForbidControl] Clear #{cache_key}")
Rails.cache.delete(forbid_cache_key) Rails.cache.delete(forbid_cache_key)
Rails.cache.delete(cache_key) Rails.cache.delete(cache_key)
end end

@ -46,6 +46,15 @@ class Challenge < ApplicationRecord
#self.challenge_chooses.pluck(:score).sum #self.challenge_chooses.pluck(:score).sum
end end
def challenge_difficulty
case difficulty
when 1 then "简单"
when 2 then "中等"
when 3 then "困难"
else ''
end
end
# 关卡总分 # 关卡总分
def all_score def all_score
self.score self.score

@ -47,6 +47,10 @@ class Competition < ApplicationRecord
sponsor_schools.map{|sponsor| sponsor.school.name} sponsor_schools.map{|sponsor| sponsor.school.name}
end end
def region_schools_name
region_schools.map{|region| region.school.name}
end
def competition_status def competition_status
if !status if !status
com_status = "nearly_published" com_status = "nearly_published"

@ -660,6 +660,10 @@ class User < ApplicationRecord
end end
end end
def reset_login_times!
LimitForbidControl::UserLogin.new(self).clear
end
protected protected
def validate_password_length def validate_password_length
# 管理员的初始密码是5位 # 管理员的初始密码是5位

@ -46,12 +46,12 @@ class Admins::UserStatisticQuery < ApplicationQuery
finish_challenge = finish_challenge.where(updated_at: time_range) finish_challenge = finish_challenge.where(updated_at: time_range)
end end
study_myshixun_map = study_myshixun.group(:user_id).count study_myshixun_map = study_myshixun.reorder(nil).group(:user_id).count
finish_myshixun_map = finish_myshixun.group(:user_id).count finish_myshixun_map = finish_myshixun.reorder(nil).group(:user_id).count
study_challenge_map = study_challenge.group(:user_id).count study_challenge_map = study_challenge.reorder(nil).group(:user_id).count
finish_challenge_map = finish_challenge.group(:user_id).count finish_challenge_map = finish_challenge.reorder(nil).group(:user_id).count
evaluate_count_map = study_challenge.group(:user_id).sum(:evaluate_count) evaluate_count_map = study_challenge.reorder(nil).group(:user_id).sum(:evaluate_count)
cost_time_map = study_challenge.group(:user_id).sum(:cost_time) cost_time_map = study_challenge.reorder(nil).group(:user_id).sum(:cost_time)
users.each do |user| users.each do |user|
user._extra_data = { user._extra_data = {

@ -1,5 +1,4 @@
class Competitions::CreatePersonalTeamService < ApplicationService class Competitions::CreatePersonalTeamService < ApplicationService
Error = Class.new(StandardError)
attr_reader :competition, :user attr_reader :competition, :user

@ -11,6 +11,8 @@ class Competitions::SaveTeamService < ApplicationService
end end
def call def call
raise Error, '本竞赛只面向部分学校/单位开放,你暂时没有参赛资格' unless competition.open?(creator)
Competitions::SaveTeamForm.new(form_params).validate! Competitions::SaveTeamForm.new(form_params).validate!
new_record = team.new_record? new_record = team.new_record?

@ -22,6 +22,8 @@ class Users::ApplyAuthenticationService < ApplicationService
user.authentication = false user.authentication = false
user.save! user.save!
user.user_extension.update!(gender: params[:gender].to_i) if params[:gender].present?
user.apply_user_authentication.create!(auth_type: 1, status: 0) user.apply_user_authentication.create!(auth_type: 1, status: 0)
move_image_file! unless params[:upload_image].to_s == 'false' move_image_file! unless params[:upload_image].to_s == 'false'

@ -1,7 +1,7 @@
class Users::CourseService class Users::CourseService
include CustomSortable include CustomSortable
sort_columns :updated_at, default_by: :updated_at, default_direction: :desc sort_columns :created_at, :updated_at, default_by: :updated_at, default_direction: :desc
attr_reader :user, :params attr_reader :user, :params
@ -15,7 +15,7 @@ class Users::CourseService
courses = status_filter(courses) courses = status_filter(courses)
custom_sort(courses, :updated_at, params[:sort_direction]) custom_sort(courses, params[:sort_by], params[:sort_direction])
end end
private private

@ -1,7 +1,7 @@
class Users::ProjectService class Users::ProjectService
include CustomSortable include CustomSortable
sort_columns :updated_on, default_by: :updated_on, default_direction: :desc sort_columns :created_on, :updated_on, default_by: :updated_on, default_direction: :desc
attr_reader :user, :params attr_reader :user, :params
@ -21,7 +21,7 @@ class Users::ProjectService
projects = category_filter(projects) projects = category_filter(projects)
projects = status_filter(projects) projects = status_filter(projects)
custom_sort(projects, :updated_on, params[:sort_direction]) custom_sort(projects, params[:sort_by], params[:sort_direction])
end end
private private

@ -77,6 +77,10 @@ class Users::ShixunService
sort_by = sort_by&.downcase sort_by = sort_by&.downcase
sort_direction = sort_direction&.downcase sort_direction = sort_direction&.downcase
if sort_by.blank? || !%w(updated_at created_at).include?(sort_by)
sort_by = 'updated_at'
end
if sort_direction.blank? || !%w(desc asc).include?(sort_direction) if sort_direction.blank? || !%w(desc asc).include?(sort_direction)
sort_direction = 'desc' sort_direction = 'desc'
end end
@ -87,11 +91,11 @@ class Users::ShixunService
case params[:category] case params[:category]
when 'study' then when 'study' then
relations.order("myshixuns.updated_at #{sort_direction}") relations.order("myshixuns.#{sort_by} #{sort_direction}")
when 'manage' then when 'manage' then
relations.order("shixuns.updated_at #{sort_direction}") relations.order("shixuns.#{sort_by} #{sort_direction}")
else else
relations.order("shixuns.created_at #{sort_direction}") relations.order("shixuns.#{sort_by} #{sort_direction}")
end end
end end
end end

@ -1,7 +1,7 @@
class Users::SubjectService class Users::SubjectService
include CustomSortable include CustomSortable
sort_columns :updated_at, default_by: :updated_at, default_direction: :desc sort_columns :created_at, :updated_at, default_by: :updated_at, default_direction: :desc
attr_reader :user, :params attr_reader :user, :params
@ -14,7 +14,7 @@ class Users::SubjectService
subjects = category_scope_subjects subjects = category_scope_subjects
subjects = user_policy_filter(subjects) subjects = user_policy_filter(subjects)
custom_sort(subjects.distinct, :updated_at, params[:sort_direction]) custom_sort(subjects.distinct, params[:sort_by], params[:sort_direction])
end end
private private

@ -2,15 +2,15 @@
<thead class="thead-light"> <thead class="thead-light">
<tr> <tr>
<th width="10%" class="text-left">真实姓名</th> <th width="10%" class="text-left">真实姓名</th>
<th width="16%">邮件地址</th> <th width="15%">邮件地址</th>
<th width="10%">手机号码</th> <th width="10%">手机号码</th>
<th width="14%">单位</th> <th width="14%">单位</th>
<th width="8%">角色</th> <th width="7%">角色</th>
<th width="10%"><%= sort_tag('创建于', name: 'created_on', path: admins_users_path) %></th> <th width="10%"><%= sort_tag('创建于', name: 'created_on', path: admins_users_path) %></th>
<th width="10%"><%= sort_tag('最后登录', name: 'last_login_on', path: admins_users_path) %></th> <th width="10%"><%= sort_tag('最后登录', name: 'last_login_on', path: admins_users_path) %></th>
<th width="6%"><%= sort_tag('经验值', name: 'experience', path: admins_users_path) %></th> <th width="6%"><%= sort_tag('经验值', name: 'experience', path: admins_users_path) %></th>
<th width="6%"><%= sort_tag('金币', name: 'grade', path: admins_users_path) %></th> <th width="6%"><%= sort_tag('金币', name: 'grade', path: admins_users_path) %></th>
<th width="12%">操作</th> <th width="14%">操作</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -33,8 +33,6 @@
<td class="action-container"> <td class="action-container">
<%= link_to '编辑', edit_admins_user_path(user), class: 'action' %> <%= link_to '编辑', edit_admins_user_path(user), class: 'action' %>
<%= javascript_void_link('奖励', class: 'action reward-grade-action', data: { toggle: 'modal', target: '.admin-users-reward-grade-modal', id: user.id }) %>
<%= javascript_void_link '解锁', class: 'action unlock-action', data: { id: user.id }, style: user.locked? ? '' : 'display: none;' %> <%= javascript_void_link '解锁', class: 'action unlock-action', data: { id: user.id }, style: user.locked? ? '' : 'display: none;' %>
<% if user.registered? %> <% if user.registered? %>
@ -45,7 +43,14 @@
<%= javascript_void_link '加锁', class: 'action lock-action', data: { id: user.id }, style: user.locked? || user.registered? ? 'display: none;' : '' %> <%= javascript_void_link '加锁', class: 'action lock-action', data: { id: user.id }, style: user.locked? || user.registered? ? 'display: none;' : '' %>
<% end %> <% end %>
<%= delete_link '删除', admins_user_path(user, element: ".user-item-#{user.id}"), class: 'delete-user-action' %> <%= javascript_void_link('更多', class: 'action dropdown-toggle', 'data-toggle': 'dropdown', 'aria-haspopup': true, 'aria-expanded': false) %>
<div class="dropdown-menu more-action-dropdown">
<%= javascript_void_link('奖励', class: 'dropdown-item reward-grade-action', data: { toggle: 'modal', target: '.admin-users-reward-grade-modal', id: user.id }) %>
<%= javascript_void_link '恢复禁密账号', class: 'dropdown-item reset-login-times-action', data: { id: user.id } %>
<%= delete_link '删除', admins_user_path(user, element: ".user-item-#{user.id}"), class: 'dropdown-item delete-user-action' %>
</div>
</td> </td>
</tr> </tr>
<% end %> <% end %>

@ -12,6 +12,8 @@ json.published @competition.published?
json.nearly_published @competition.published_at.present? json.nearly_published @competition.published_at.present?
json.competition_status @competition.competition_status json.competition_status @competition.competition_status
json.region_schools @competition.region_schools_name
json.avatar_url url_to_avatar(@competition) json.avatar_url url_to_avatar(@competition)
json.competition_modules @competition_modules do |com_module| json.competition_modules @competition_modules do |com_module|

@ -25,3 +25,4 @@ json.excellent @course.excellent
if @course.is_end == 0 if @course.is_end == 0
json.days_remaining (@course.end_date.to_date - Time.now.to_date).to_i json.days_remaining (@course.end_date.to_date - Time.now.to_date).to_i
end end
json.teacher_applies_count CourseMessage.unhandled_join_course_requests_by_course(@course).size if @user_course_identity < Course::ASSISTANT_PROFESSOR

@ -15,17 +15,19 @@ json.group_settings @course_groups do |group|
end end
if @homework.homework_type == "practice" if @homework.homework_type == "practice"
json.shixun_identifier @homework.shixuns.first.try(:identifier) json.shixun_identifier @shixun.try(:identifier)
json.task_pass @shixun&.task_pass
json.(@homework, :work_efficiency, :eff_score) json.(@homework, :work_efficiency, :eff_score)
json.(@homework.homework_detail_manual, :answer_open_evaluation, :shixun_evaluation) json.(@homework.homework_detail_manual, :answer_open_evaluation, :shixun_evaluation)
total_exp = 0 total_exp = 0
json.challenge_settings @homework.shixuns.first.try(:challenges).each do |challenge| json.challenge_settings @shixun.try(:challenges).each do |challenge|
json.challenge_id challenge.id json.challenge_id challenge.id
json.challenge_name challenge.subject json.challenge_name challenge.subject
json.checked challenge_setting(@homework, challenge.id).present? json.checked challenge_setting(@homework, challenge.id).present?
json.challenge_score challenge_setting(@homework, challenge.id).try(:score).to_f json.challenge_score challenge_setting(@homework, challenge.id).try(:score).to_f
json.challenge_exp challenge.score json.challenge_exp challenge.score
json.difficulty challenge.challenge_difficulty
total_exp += challenge.score total_exp += challenge.score
end end

@ -906,6 +906,7 @@ Rails.application.routes.draw do
post :lock post :lock
post :unlock post :unlock
post :active post :active
post :reset_login_times
end end
end end
resource :import_users, only: [:create] resource :import_users, only: [:create]

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -138762,6 +138762,21 @@ $(document).on('turbolinks:load', function(){
}) })
}); });
// reset user login times
$('.users-list-container').on('click', '.reset-login-times-action', function(){
var $action = $(this);
var userId = $action.data('id');
$.ajax({
url: '/admins/users/' + userId + '/reset_login_times',
method: 'POST',
dataType: 'json',
success: function() {
showSuccessNotify();
}
});
});
// ***************** reward grade modal ***************** // ***************** reward grade modal *****************
var $rewardGradeModal = $('.admin-users-reward-grade-modal'); var $rewardGradeModal = $('.admin-users-reward-grade-modal');
var $form = $rewardGradeModal.find('form.admin-users-reward-grade-form'); var $form = $rewardGradeModal.find('form.admin-users-reward-grade-form');

File diff suppressed because one or more lines are too long

@ -150,16 +150,16 @@ export function initAxiosInterceptors(props) {
throw new axios.Cancel('Operation canceled by the user.'); throw new axios.Cancel('Operation canceled by the user.');
} else { } else {
// hash跳转 // hash跳转
var hash = window.location.hash; // var hash = window.location.hash;
if (hash) { // if (hash) {
hashTimeout && window.clearTimeout(hashTimeout) // hashTimeout && window.clearTimeout(hashTimeout)
hashTimeout = setTimeout(() => { // hashTimeout = setTimeout(() => {
var element = document.querySelector(hash); // var element = document.querySelector(hash);
if (element) { // if (element) {
element.scrollIntoView(); // element.scrollIntoView();
} // }
}, 400) // }, 400)
} // }
} }
// if(response.data.status === 401){ // if(response.data.status === 401){
// console.log("401401401") // console.log("401401401")

@ -68,7 +68,8 @@ class Registration extends React.Component {
mutiple_limited: false, mutiple_limited: false,
teamutiple_limited: false, teamutiple_limited: false,
members_count: 0, members_count: 0,
mode: 0 mode: 0,
region_schools: [],
} }
} }
@ -82,8 +83,8 @@ class Registration extends React.Component {
// //// //////console.log(this.props.isAdmin()) // //// //////console.log(this.props.isAdmin())
try { try {
const {keyword, page, per_page} = this.state; const {keyword, page, per_page} = this.state;
this.Getdata(keyword, page, per_page, this.props.user.admin); this.Getdata(keyword, page, per_page, this.props.user.admin);// 获取列表数据
this.GetenrollmentAPI(); this.GetenrollmentAPI();//获取我的报名配置
} catch (e) { } catch (e) {
// const {keyword, page, per_page} = this.state; // const {keyword, page, per_page} = this.state;
// this.Getdata(keyword, page, per_page, this.props.isAdmin()); // this.Getdata(keyword, page, per_page, this.props.isAdmin());
@ -104,6 +105,8 @@ class Registration extends React.Component {
this.Getdata(keyword, page, per_page, this.props.user.admin); this.Getdata(keyword, page, per_page, this.props.user.admin);
//取报名配置 //取报名配置
this.GetenrollmentAPI(); this.GetenrollmentAPI();
//取模式
this.Getdataheader();
} }
} }
@ -116,6 +119,7 @@ class Registration extends React.Component {
if (result.data) { if (result.data) {
this.setState({ this.setState({
mode: result.data.mode, mode: result.data.mode,
region_schools: result.data.region_schools
}) })
} }
@ -454,6 +458,37 @@ class Registration extends React.Component {
return return
} }
let {region_schools} = this.state;
//判断是否是否是同一个学校数组元素为0就不用判断
try {
if (region_schools.length > 0) {
let i = 0;
for (var r = 0; r < region_schools.length; r++) {
if (region_schools[r] === this.props.user.user_school) {
// 终止循环
break;
}
i = i + 1;
}
if (i === region_schools.length) {
//如果i 等于region_schools.length说明本次循环中没有相同的学校本人不支持报名
try {
this.props.showNotification(`本竞赛只面向部分学校/单位开放,你暂时没有参赛资格!`);
} catch (e) {
}
this.Getdataheader();
return
}
}
} catch (e) {
}
if (this.props.user.is_teacher === true) { if (this.props.user.is_teacher === true) {
try { try {
@ -541,6 +576,34 @@ class Registration extends React.Component {
return return
} }
let {region_schools} = this.state;
//判断是否是否是同一个学校数组元素为0就不用判断
try {
if (region_schools.length > 0) {
let i = 0;
for (var r = 0; r < region_schools.length; r++) {
if (region_schools[r] === this.props.user.user_school) {
// 终止循环
break;
}
i = i + 1;
}
if (i === region_schools.length) {
//如果i 等于region_schools.length说明本次循环中没有相同的学校本人不支持报名
try {
this.props.showNotification(`本竞赛只面向部分学校/单位开放,你暂时没有参赛资格!`);
} catch (e) {
}
this.Getdataheader();
return
}
}
} catch (e) {
}
if (this.props.user.is_teacher === true) { if (this.props.user.is_teacher === true) {

@ -124,7 +124,7 @@ class CompetitionsIndex extends Component{
size="large" size="large"
dataSource={datas&&datas} dataSource={datas&&datas}
renderItem={(item,key) => ( renderItem={(item,key) => (
<a href={item.competition_status==="ended"?`/competitions/${item.identifier}/common_header`:item.competition_status==="nearly_published"? this.props.current_user&&this.props.current_user.business===true?`/competitions/${item.identifier}/common_header`:this.props.current_user&&this.props.current_user.admin===true?`/competitions/${item.identifier}/common_header`:null:item.competition_status==="progressing"?`/competitions/${item.identifier}/common_header`:null} <a target="_blank" href={item.competition_status==="ended"?`/competitions/${item.identifier}/common_header`:item.competition_status==="nearly_published"? this.props.current_user&&this.props.current_user.business===true?`/competitions/${item.identifier}/common_header`:this.props.current_user&&this.props.current_user.admin===true?`/competitions/${item.identifier}/common_header`:null:item.competition_status==="progressing"?`/competitions/${item.identifier}/common_header`:null}
className={item.competition_status==="ended"?"competitionstitlesshou":item.competition_status==="nearly_published"? className={item.competition_status==="ended"?"competitionstitlesshou":item.competition_status==="nearly_published"?
this.props.current_user&&this.props.current_user.admin===true?"competitionstitlesshou":this.props.current_user&&this.props.current_user.business===true?"competitionstitlesshou":"endedfont":"competitionstitlesshou"} this.props.current_user&&this.props.current_user.admin===true?"competitionstitlesshou":this.props.current_user&&this.props.current_user.business===true?"competitionstitlesshou":"endedfont":"competitionstitlesshou"}
> >
@ -181,7 +181,7 @@ class CompetitionsIndex extends Component{
<List.Item.Meta <List.Item.Meta
title={<a className={item.competition_status==="ended"?"competitionstitlesshou":item.competition_status==="nearly_published"? title={<a className={item.competition_status==="ended"?"competitionstitlesshou":item.competition_status==="nearly_published"?
this.props.current_user&&this.props.current_user.admin===true?"competitionstitlesshou":this.props.current_user&&this.props.current_user.business===true?"competitionstitlesshou":"endedfont":"competitionstitlesshou"}> this.props.current_user&&this.props.current_user.admin===true?"competitionstitlesshou":this.props.current_user&&this.props.current_user.business===true?"competitionstitlesshou":"endedfont":"competitionstitlesshou"}>
<a className={"competitionstitles"} <a target="_blank" className={"competitionstitles"}
href={item.competition_status==="ended"?`/competitions/${item.identifier}/common_header`:item.competition_status==="nearly_published"? this.props.current_user&&this.props.current_user.business===true?`/competitions/${item.identifier}/common_header`:this.props.current_user&&this.props.current_user.admin===true?`/competitions/${item.identifier}/common_header`:null:item.competition_status==="progressing"?`/competitions/${item.identifier}/common_header`:null} href={item.competition_status==="ended"?`/competitions/${item.identifier}/common_header`:item.competition_status==="nearly_published"? this.props.current_user&&this.props.current_user.business===true?`/competitions/${item.identifier}/common_header`:this.props.current_user&&this.props.current_user.admin===true?`/competitions/${item.identifier}/common_header`:null:item.competition_status==="progressing"?`/competitions/${item.identifier}/common_header`:null}
>{item.name}{item.sub_title===null?"":`——${item.sub_title}`}</a> >{item.name}{item.sub_title===null?"":`——${item.sub_title}`}</a>
{/*<span>{item.sub_title===null?"":*/} {/*<span>{item.sub_title===null?"":*/}

@ -31,6 +31,9 @@ class CompetitionCommon extends Component{
window.document.title = '竞赛'; window.document.title = '竞赛';
if(this.props.match.params.identifier!=null){ if(this.props.match.params.identifier!=null){
this.getbannerdata(); this.getbannerdata();
// this.setState({
// thiskeys:this.props.location.search.replace('?menu=', '')
// })
// let url=`/competitions/${this.props.match.params.identifier}.json`; // let url=`/competitions/${this.props.match.params.identifier}.json`;
// axios.get(url).then((response) => { // axios.get(url).then((response) => {
// if(response.status===200){ // if(response.status===200){
@ -45,19 +48,34 @@ class CompetitionCommon extends Component{
} }
getbannerdata=()=>{ getbannerdata=()=>{
let menuid=this.props.location.search.replace('?menu=', '');
let url=`/competitions/${this.props.match.params.identifier}/common_header.json`; let url=`/competitions/${this.props.match.params.identifier}/common_header.json`;
axios.get(url).then((response) => { axios.get(url).then((response) => {
if(response.status===200){ if(response.status===200){
this.setState({ this.setState({
data:response.data, data:response.data,
thiskeys:response.data.competition_modules[0].id thiskeys:menuid===undefined||menuid===""?response.data.competition_modules[0].id:menuid
}) })
if(menuid===undefined||menuid===""){
this.getrightdata( this.getrightdata(
response.data.competition_modules[0].id, response.data.competition_modules[0].id,
response.data.competition_modules[0].module_type, response.data.competition_modules[0].module_type,
response.data.competition_modules[0].module_url, response.data.competition_modules[0].module_url,
response.data.competition_modules[0].has_url response.data.competition_modules[0].has_url
) )
}else{
let newlist=response.data.competition_modules;
newlist.map((item,key)=>{
if(`${item.id}`===`${menuid}`){
this.getrightdata(
item.id,
item.module_type,
item.module_url,
item.has_url
)
}
})
}
} }
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
@ -83,6 +101,7 @@ class CompetitionCommon extends Component{
getrightdatas=(e)=>{ getrightdatas=(e)=>{
let keys=parseInt(e.key); let keys=parseInt(e.key);
this.getlistdata(keys) this.getlistdata(keys)
this.props.history.replace(`?menu=${keys}`);
} }
getlistdata=(keys,listkey)=>{ getlistdata=(keys,listkey)=>{
@ -121,6 +140,7 @@ class CompetitionCommon extends Component{
} }
getrightdata=(id,typeid,module_url,has_url,listkey)=>{ getrightdata=(id,typeid,module_url,has_url,listkey)=>{
// if(typeid==="enroll"){ // if(typeid==="enroll"){
// this.props.history.replace(`/competitions/${this.props.match.params.identifier}/enroll`); // this.props.history.replace(`/competitions/${this.props.match.params.identifier}/enroll`);
// return // return
@ -234,7 +254,7 @@ class CompetitionCommon extends Component{
} }
render() { render() {
let {data,has_url,module_type,Competitionedittype,mdContentdata}=this.state; let {data,thiskeys,Competitionedittype}=this.state;
return ( return (
data===undefined?"":<div className={"educontent clearfix mt20 "}> data===undefined?"":<div className={"educontent clearfix mt20 "}>
@ -327,7 +347,7 @@ class CompetitionCommon extends Component{
<Layout className={'teamsLayout mt40'}> <Layout className={'teamsLayout mt40'}>
<Sider> <Sider>
<Menu mode="inline" className="CompetitionMenu" defaultSelectedKeys={[`${this.state.thiskeys}`]} onClick={(e)=>this.getrightdatas(e)}> <Menu mode="inline" className="CompetitionMenu" selectedKeys={[`${this.state.thiskeys}`]} onClick={(e)=>this.getrightdatas(e)}>
{data&&data.competition_modules.map((item,key)=>{ {data&&data.competition_modules.map((item,key)=>{
if(item.module_type!="enroll"){ if(item.module_type!="enroll"){
return( return(

@ -9,20 +9,19 @@ class CompetitionContents extends Component{
constructor(props) { constructor(props) {
super(props) super(props)
this.state={ this.state={
hash:undefined
} }
} }
componentDidMount(){ componentDidMount(){
window.document.title = '竞赛'; window.document.title = '竞赛';
this.props.MdifHasAnchorJustScorll();
} }
render() { render() {
let{mdContentdata}=this.props; let{mdContentdata}=this.props;
// //mdhash滚动
this.props.MdifHasAnchorJustScorll();
return ( return (
<div className={"fr"}> <div className={"fr"}>

@ -30,6 +30,7 @@ class CompetitionContents extends Component{
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
}) })
this.props.MdifHasAnchorJustScorll();
} }
derivefun=(url)=>{ derivefun=(url)=>{
@ -65,6 +66,7 @@ class CompetitionContents extends Component{
}); });
} }
render() { render() {
this.props.MdifHasAnchorJustScorll();
const operations = <div> const operations = <div>
<Button className={"fr"} type="primary" ghost onClick={()=>this.props.Competitionedit()}>编辑</Button> <Button className={"fr"} type="primary" ghost onClick={()=>this.props.Competitionedit()}>编辑</Button>
<Button className={"fr mr20"} type="primary" ghost> <Button className={"fr mr20"} type="primary" ghost>
@ -76,40 +78,40 @@ class CompetitionContents extends Component{
title: 'usersum', title: 'usersum',
dataIndex: 'usersum', dataIndex: 'usersum',
key: 'name', key: 'name',
render: text => <a className={"color-blue"}>{text}</a>, render: text => <span className={"color-blue"}>{text}</span>,
}, },
{ {
title: 'userimg', title: 'userimg',
dataIndex: 'userimg', dataIndex: 'userimg',
key: 'userimg', key: 'userimg',
render: (text, record) =>( render: (text, record) =>(
<a href={`/users/${record.user_login}`} className="color-dark"> <span href={`/users/${record.user_login}`} className="color-dark">
<img className={"Competitionuserimg"} src={getImageUrl(`images/${record.userimg===null?`avatars/User/0?1442652658`:record.userimg}`)}/> <img className={"Competitionuserimg"} src={getImageUrl(`images/${record.userimg===null?`avatars/User/0?1442652658`:record.userimg}`)}/>
</a>), </span>),
}, },
{ {
title: 'username', title: 'username',
dataIndex: 'username', dataIndex: 'username',
key: 'username', key: 'username',
render: text => <a title={text}>{text}</a>, render: text => <span title={text}>{text}</span>,
}, },
{ {
title: 'school', title: 'school',
dataIndex: 'school', dataIndex: 'school',
key: 'school', key: 'school',
render: text => <a title={text}>{text}</a>, render: text => <span title={text}>{text}</span>,
}, },
{ {
title: 'spendtime', title: 'spendtime',
dataIndex: 'spendtime', dataIndex: 'spendtime',
key: 'spendtime', key: 'spendtime',
render: text => <a>{text}</a>, render: text => <span>{text}</span>,
}, },
{ {
title: 'score', title: 'score',
dataIndex: 'score', dataIndex: 'score',
key: 'score', key: 'score',
render: text => <a className={"color-blue"}>{text}</a>, render: text => <span className={"color-blue"}>{text}</span>,
}, },
]; ];

@ -477,7 +477,8 @@ class CoursesBanner extends Component {
render() { render() {
let { Addcoursestypes, coursedata,excellent, modalsType, modalsTopval, loadtype,modalsBottomval,antIcon,is_guide,AccountProfiletype,modalstrsvalue} = this.state; let { Addcoursestypes, coursedata,excellent, modalsType, modalsTopval, loadtype,modalsBottomval,antIcon,is_guide,AccountProfiletype,modalstrsvalue} = this.state;
const isCourseEnd = this.props.isCourseEnd()
const isCourseEnd = this.props.isCourseEnd();
document.title=coursedata===undefined || coursedata.status===401 || coursedata.status===407?"":coursedata.name; document.title=coursedata===undefined || coursedata.status===401 || coursedata.status===407?"":coursedata.name;
return ( return (
<div> <div>
@ -705,18 +706,29 @@ class CoursesBanner extends Component {
`} `}
</style> </style>
<Breadcrumb separator="|" className={"mt5"}> <Breadcrumb separator="|" className={"mt5"}>
<Breadcrumb.Item onClick={()=>this.setHistoryFun("/courses/"+this.props.match.params.coursesId+"/teachers")} className={"pointer"}>
<span className="color-grey-c font-16"><span className={"mr10"}>教师</span> <span className={"mr10"}>{coursedata.teacher_count}</span></span> <Breadcrumb.Item className={"pointer"}>
<Tooltip visible={coursedata.teacher_applies_count===undefined?false:coursedata.teacher_applies_count>0?true:false}
placement="topLeft"
title={<pre>{coursedata.teacher_applies_count===undefined?"":coursedata.teacher_applies_count>0?<span>您有{coursedata.teacher_applies_count}条新的加入申请<a className={"daishenp"} onClick={()=>this.setHistoryFun("/courses/"+this.props.match.params.coursesId+"/teachers?tab=2")}>待审批</a></span>:""}</pre>}>
<span className="color-grey-c font-16" onClick={()=>this.setHistoryFun("/courses/"+this.props.match.params.coursesId+"/teachers")}>
<span className={"mr10"}>教师</span>
<span className={"mr10"}>{coursedata.teacher_count}</span>
</span>
</Tooltip>
</Breadcrumb.Item> </Breadcrumb.Item>
<Breadcrumb.Item <Breadcrumb.Item
className={excellent===true&&coursedata.course_end === true?this.props.isAdminOrTeacher()===true?"pointer":"":"pointer"} className={excellent===true&&coursedata.course_end === true?this.props.isAdminOrTeacher()===true?"pointer":"":"pointer"}
onClick={excellent===true&&coursedata.course_end === true?this.props.isAdminOrTeacher()===true?()=>this.setHistoryFun("/courses/"+this.props.match.params.coursesId+"/students"):"":()=>this.setHistoryFun("/courses/"+this.props.match.params.coursesId+"/students")} onClick={excellent===true&&coursedata.course_end === true?this.props.isAdminOrTeacher()===true?()=>this.setHistoryFun("/courses/"+this.props.match.params.coursesId+"/students"):"":()=>this.setHistoryFun("/courses/"+this.props.match.params.coursesId+"/students")}
> >
<span className="color-grey-c font-16"><span className={"mr10 ml10"}>学生</span> <span className={"mr10"}>{coursedata.student_count}</span></span> <span className="color-grey-c font-16"><span className={"mr10 ml10"}>学生</span> <span className={"mr10"}>{coursedata.student_count}</span></span>
</Breadcrumb.Item> </Breadcrumb.Item>
<Breadcrumb.Item>{coursedata.credit===null?"": <Breadcrumb.Item>{coursedata.credit===null?"":
<span className="color-grey-c font-16"><span className={"mr10 ml10"}>学分</span> <span className={"mr10"}>{coursedata.credit}</span></span> <span className="color-grey-c font-16"><span className={"mr10 ml10"}>学分</span> <span className={"mr10"}>{coursedata.credit}</span></span>
}</Breadcrumb.Item> }</Breadcrumb.Item>
</Breadcrumb> </Breadcrumb>
{/*<li className={"mt7 teachersbox"} >*/} {/*<li className={"mt7 teachersbox"} >*/}

@ -391,9 +391,8 @@ class OneSelfOrderModal extends Component{
{this.props.modaltype===undefined||this.props.modaltype===2 {this.props.modaltype===undefined||this.props.modaltype===2
|| this.props.usingCheckBeforePost ?"":<div className="clearfix edu-txt-center lineh-40 F4FAFF"> || this.props.usingCheckBeforePost ?"":<div className="clearfix edu-txt-center lineh-40 F4FAFF">
<li style={{ width: '100%',padding: "0px 10px"}} className={"mb10"}> <li style={{ width: '100%',padding: "0px 10px"}} className={"mb10"}>
<span style={{"float":"left","color":"#05101A"}} className="task-hide color-grey-name ml50">分班名称</span> <span style={{"float":"left","color":"#05101A"}} className="task-hide color-grey-name color-grey-9">分班名称</span>
<span style={{"float":"right","color":"#05101A","margin-right": "145px"}} className="task-hide color-grey-name color-grey-9">截止时间</span>
<span style={{"float":"right","color":"#05101A"}} className="task-hide color-grey-name mr70">截止时间</span>
</li> </li>
</div>} </div>}
{this.props.modaltype===undefined||this.props.modaltype===2 {this.props.modaltype===undefined||this.props.modaltype===2

@ -1745,3 +1745,8 @@ input.ant-input-number-input:focus {
color: #fff; color: #fff;
margin: 0 auto; margin: 0 auto;
} }
.daishenp{
color: #F79946 !important;
text-decoration: underline !important;
}

@ -542,6 +542,7 @@ class Exercise extends Component{
{...this.props} {...this.props}
{...this.state} {...this.state}
style="grey" style="grey"
single={true}
checkBoxValues={this.state.checkBoxValues} checkBoxValues={this.state.checkBoxValues}
action={this.reloadList} action={this.reloadList}
></ImmediatelyEnd> ></ImmediatelyEnd>

@ -421,8 +421,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"}
// single={true}
action={this.Commonheadofthetestpaper} action={this.Commonheadofthetestpaper}
single={true}
></ImmediatelyEnd>:"":""} ></ImmediatelyEnd>:"":""}
{isAdmin === true?Commonheadofthetestpaper!==undefined&&Commonheadofthetestpaper.user_permission.exercise_unpublish_count>0? <ImmediatelyPublish {isAdmin === true?Commonheadofthetestpaper!==undefined&&Commonheadofthetestpaper.user_permission.exercise_unpublish_count>0? <ImmediatelyPublish
{...this.props} {...this.props}

@ -299,6 +299,17 @@ class studentsList extends Component{
this.setState({ this.setState({
isSpin:true isSpin:true
}) })
let newmenuid=this.props.location.search.replace('?tab=', '');
if(newmenuid===undefined||newmenuid===""||newmenuid==="1"||newmenuid===1){
this.setState({
filterKey:'1'
})
}else{
this.setState({
filterKey:'2'
})
}
this.fetchAll(1); this.fetchAll(1);
const isAdminOrTeacher = this.props.isAdminOrTeacher() const isAdminOrTeacher = this.props.isAdminOrTeacher()
const isAdmin = this.props.isAdmin() const isAdmin = this.props.isAdmin()
@ -385,6 +396,8 @@ class studentsList extends Component{
this.fetchAll() this.fetchAll()
} }
fetchAll = async (argPage) => { fetchAll = async (argPage) => {
let { searchValue, filterKey }=this.state
this.setState({ this.setState({
isSpin:true isSpin:true
}) })
@ -395,7 +408,7 @@ class studentsList extends Component{
const sortedInfo = this.state.sortedInfo; const sortedInfo = this.state.sortedInfo;
let page = argPage || this.state.page let page = argPage || this.state.page
let { searchValue, filterKey }=this.state
let order = 1; let order = 1;
if (sortedInfo.columnKey == 'role') { if (sortedInfo.columnKey == 'role') {
order = 1; order = 1;
@ -655,6 +668,8 @@ class studentsList extends Component{
const hasGraduationModule = this.hasGraduationModule() const hasGraduationModule = this.hasGraduationModule()
const coursesId = this.props.match.params.coursesId const coursesId = this.props.match.params.coursesId
return( return(
<React.Fragment> <React.Fragment>
{/* <AddTeacherModal ref="addTeacherModal" {/* <AddTeacherModal ref="addTeacherModal"
@ -693,7 +708,7 @@ class studentsList extends Component{
} }
secondRowLeft={ secondRowLeft={
isAdminOrTeacher ? <div className="fl mt6 task_menu_ul " style={{ width: '600px' }}> isAdminOrTeacher ? <div className="fl mt6 task_menu_ul " style={{ width: '600px' }}>
<Menu mode="horizontal" defaultSelectedKeys="1" onClick={this.selectedStatus}> <Menu mode="horizontal" selectedKeys={[`${this.state.filterKey}`]} onClick={this.selectedStatus}>
<Menu.Item key="1">已审批({total_count})</Menu.Item> <Menu.Item key="1">已审批({total_count})</Menu.Item>
<Menu.Item key="2">待审批({apply_size})</Menu.Item> <Menu.Item key="2">待审批({apply_size})</Menu.Item>
</Menu> </Menu>

@ -563,6 +563,7 @@ class Poll extends Component{
{...this.props} {...this.props}
{...this.state} {...this.state}
style="grey" style="grey"
single={true}
checkBoxValues={this.state.checkBoxValues} checkBoxValues={this.state.checkBoxValues}
action={this.successFun} action={this.successFun}
></ImmediatelyEnd> ></ImmediatelyEnd>

@ -202,7 +202,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}
single={true} // single={true}
></ImmediatelyEnd> ></ImmediatelyEnd>
</li> </li>
:"" :""

@ -347,7 +347,11 @@ class Listofworksstudentone extends Component {
<span style={{ <span style={{
width: '99px', width: '99px',
}}> }}>
<span style={{color: '#07111B',textAlign: "center", width:'99px'}}>{record.completion+"/"+this.state.challenges_count}</span> <span style={{
color: '#07111B',
textAlign: "center",
width: '99px'
}}>{record.completion + "/" + this.state.challenges_count}</span>
</span> </span>
), ),
}, },
@ -695,7 +699,11 @@ class Listofworksstudentone extends Component {
<span style={{ <span style={{
width: '99px', width: '99px',
}}> }}>
<span style={{color: '#07111B',textAlign: "center", width:'99px'}}>{record.completion+"/"+this.state.challenges_count}</span> <span style={{
color: '#07111B',
textAlign: "center",
width: '99px'
}}>{record.completion + "/" + this.state.challenges_count}</span>
</span> </span>
), ),
}, },
@ -854,7 +862,8 @@ class Listofworksstudentone extends Component {
className: 'font-14 maxnamewidth100', className: 'font-14 maxnamewidth100',
width: '100px', width: '100px',
render: (text, record) => ( render: (text, record) => (
<a className="maxnamewidth100" title={record.name} style={{color: '#07111B', textAlign: "center"}}>{record.name}</a> <a className="maxnamewidth100" title={record.name}
style={{color: '#07111B', textAlign: "center"}}>{record.name}</a>
) )
}, },
{ {
@ -908,7 +917,15 @@ class Listofworksstudentone extends Component {
className: 'font-14', className: 'font-14',
render: (text, record) => ( render: (text, record) => (
<span> <span>
{record.classroom === undefined ?<span className="ysltable" style={{color: '#07111B', textAlign: "center"}}> --</span> : record.classroom === "" ? <span className="ysltable" style={{color: '#07111B',textAlign: "center"}}>--</span>: record.classroom === null ? <span className="ysltable" style={{color: '#07111B', textAlign: "center"}}>--</span> : <span className="ysltable" style={{color: '#07111B',textAlign: "center"}}>{record.classroom}</span>} {record.classroom === undefined ? <span className="ysltable" style={{
color: '#07111B',
textAlign: "center"
}}> --</span> : record.classroom === "" ? <span className="ysltable" style={{
color: '#07111B',
textAlign: "center"
}}>--</span> : record.classroom === null ?
<span className="ysltable" style={{color: '#07111B', textAlign: "center"}}>--</span> :
<span className="ysltable" style={{color: '#07111B', textAlign: "center"}}>{record.classroom}</span>}
</span> </span>
) )
}, },
@ -990,7 +1007,10 @@ class Listofworksstudentone extends Component {
<div>已通过{record.completion}{this.state.challenges_count}</div> <div>已通过{record.completion}{this.state.challenges_count}</div>
<div>完成任务评测之前查看了参考答案{record.view_answer_count}</div> <div>完成任务评测之前查看了参考答案{record.view_answer_count}</div>
</div>}> </div>}>
<span style={{color: '#07111B', "text-align": "center"}}>{record.completion+"/"+this.state.challenges_count} </span> <span style={{
color: '#07111B',
"text-align": "center"
}}>{record.completion + "/" + this.state.challenges_count} </span>
</Tooltip> </Tooltip>
</span> </span>
@ -1077,7 +1097,8 @@ class Listofworksstudentone extends Component {
record.ultimate_score === true ? record.ultimate_score === true ?
<Tooltip placement="bottom" title={<div> <Tooltip placement="bottom" title={<div>
<div>{record.user_name}{record.user_login}</div> <div>{record.user_name}{record.user_login}</div>
<div>{record.finalscore === "--"?<span>最终调整成绩0</span> :<span>{record.finalscore}</span>}</div> <div>{record.finalscore === "--" ? <span>最终调整成绩0</span> :
<span>最终调整成绩{record.finalscore}</span>}</div>
</div>}> </div>}>
{ {
record.finalscore && record.finalscore === "--" ? record.finalscore && record.finalscore === "--" ?
@ -1103,10 +1124,14 @@ class Listofworksstudentone extends Component {
<Tooltip placement="bottom" title={<div> <Tooltip placement="bottom" title={<div>
<div>{record.user_name}{record.user_login}</div> <div>{record.user_name}{record.user_login}</div>
<div>完成任务评测之前查看了参考答案{record.view_answer_count}</div> <div>完成任务评测之前查看了参考答案{record.view_answer_count}</div>
<div>{record.levelscore === "--"?<span>关卡得分0</span> :<span>{record.levelscore}</span>}</div> <div>{record.levelscore === "--" ? <span>关卡得分0</span> :
<div>{record.efficiencyscore === "--"?<span>效率评分0</span> :<span>{record.efficiencyscore}</span>}</div> <span>关卡得分{record.levelscore}</span>}</div>
<div>{record.late_penalty === "--"?<span>迟交扣分0</span> :<span>{record.late_penalty}</span>}</div> <div>{record.efficiencyscore === "--" ? <span>效率评分0</span> :
<div>{record.finalscore === "--"?<span>当前成绩0</span> :<span>{record.finalscore}</span>}</div> <span>效率评分{record.efficiencyscore}</span>}</div>
<div>{record.late_penalty === "--" ? <span>迟交扣分0</span> :
<span>迟交扣分{record.late_penalty}</span>}</div>
<div>{record.finalscore === "--" ? <span>当前成绩0</span> :
<span>当前成绩{record.finalscore}</span>}</div>
</div>}> </div>}>
{ {
record.finalscore && record.finalscore === "--" ? record.finalscore && record.finalscore === "--" ?
@ -1144,7 +1169,7 @@ class Listofworksstudentone extends Component {
record.submitstate === "未提交" ? <span style={{color: '#9A9A9A'}}>--</span> : record.submitstate === "未提交" ? <span style={{color: '#9A9A9A'}}>--</span> :
<span> <span>
<a style={{textAlign: "center"}} className="color-blue" <a style={{textAlign: "center"}} className="color-blue"
onClick={() => this.Viewstudenttraininginformationt(record)}>评阅</a> onClick={() => this.Viewstudenttraininginformationt(record)}>查看</a>
</span> </span>
) )
}, },
@ -1169,7 +1194,8 @@ class Listofworksstudentone extends Component {
className: 'font-14 maxnamewidth100', className: 'font-14 maxnamewidth100',
width: '100px', width: '100px',
render: (text, record) => ( render: (text, record) => (
<a className="maxnamewidth100" title={record.name} style={{color: '#07111B', "text-align": "center"}}>{record.name}</a> <a className="maxnamewidth100" title={record.name}
style={{color: '#07111B', "text-align": "center"}}>{record.name}</a>
) )
}, },
{ {
@ -1223,7 +1249,15 @@ class Listofworksstudentone extends Component {
className: 'font-14', className: 'font-14',
render: (text, record) => ( render: (text, record) => (
<span> <span>
{record.classroom === undefined ?<span className="ysltable" style={{color: '#07111B',textAlign: "center"}}> --</span> : record.classroom === "" ? <span className="ysltable" style={{color: '#07111B', textAlign: "center"}}>--</span>: record.classroom === null ? <span className="ysltable" style={{color: '#07111B', textAlign: "center"}}>--</span> : <span className="ysltable" style={{color: '#07111B', textAlign: "center"}}>{record.classroom}</span>} {record.classroom === undefined ? <span className="ysltable" style={{
color: '#07111B',
textAlign: "center"
}}> --</span> : record.classroom === "" ? <span className="ysltable" style={{
color: '#07111B',
textAlign: "center"
}}>--</span> : record.classroom === null ?
<span className="ysltable" style={{color: '#07111B', textAlign: "center"}}>--</span> :
<span className="ysltable" style={{color: '#07111B', textAlign: "center"}}>{record.classroom}</span>}
</span> </span>
) )
}, },
@ -1298,7 +1332,10 @@ class Listofworksstudentone extends Component {
<div>已通过{record.completion}{this.state.challenges_count}</div> <div>已通过{record.completion}{this.state.challenges_count}</div>
<div>完成任务评测之前查看了参考答案{record.view_answer_count}</div> <div>完成任务评测之前查看了参考答案{record.view_answer_count}</div>
</div>}> </div>}>
<span style={{color: '#07111B',textAlign: "center"}}>{record.completion+"/"+this.state.challenges_count} </span> <span style={{
color: '#07111B',
textAlign: "center"
}}>{record.completion + "/" + this.state.challenges_count} </span>
</Tooltip> </Tooltip>
</span> </span>
@ -1385,7 +1422,8 @@ class Listofworksstudentone extends Component {
record.ultimate_score === true ? record.ultimate_score === true ?
<Tooltip placement="bottom" title={<div> <Tooltip placement="bottom" title={<div>
<div>{record.user_name}{record.user_login}</div> <div>{record.user_name}{record.user_login}</div>
<div>{record.finalscore === "--"?<span>最终调整成绩0</span> :<span>{record.finalscore}</span>}</div> <div>{record.finalscore === "--" ? <span>最终调整成绩0</span> :
<span>最终调整成绩{record.finalscore}</span>}</div>
</div>}> </div>}>
{ {
record.finalscore && record.finalscore === "--" ? record.finalscore && record.finalscore === "--" ?
@ -1411,10 +1449,14 @@ class Listofworksstudentone extends Component {
<Tooltip placement="bottom" title={<div> <Tooltip placement="bottom" title={<div>
<div>{record.user_name}{record.user_login}</div> <div>{record.user_name}{record.user_login}</div>
<div>完成任务评测之前查看了参考答案{record.view_answer_count}</div> <div>完成任务评测之前查看了参考答案{record.view_answer_count}</div>
<div>{record.levelscore === "--"?<span>关卡得分0</span> :<span>{record.levelscore}</span>}</div> <div>{record.levelscore === "--" ? <span>关卡得分0</span> :
<div>{record.efficiencyscore === "--"?<span>效率评分0</span> :<span>{record.efficiencyscore}</span>}</div> <span>关卡得分{record.levelscore}</span>}</div>
<div>{record.late_penalty === "--"?<span>迟交扣分0</span> :<span>{record.late_penalty}</span>}</div> <div>{record.efficiencyscore === "--" ? <span>效率评分0</span> :
<div>{record.finalscore === "--"?<span>当前成绩0</span> :<span>{record.finalscore}</span>}</div> <span>效率评分{record.efficiencyscore}</span>}</div>
<div>{record.late_penalty === "--" ? <span>迟交扣分0</span> :
<span>迟交扣分{record.late_penalty}</span>}</div>
<div>{record.finalscore === "--" ? <span>当前成绩0</span> :
<span>当前成绩{record.finalscore}</span>}</div>
</div>}> </div>}>
{ {
record.finalscore && record.finalscore === "--" ? record.finalscore && record.finalscore === "--" ?
@ -1463,12 +1505,14 @@ class Listofworksstudentone extends Component {
} }
} }
componentDidCatch(error, info) { componentDidCatch(error, info) {
// console.log("-----------------------------905错误信息"); // console.log("-----------------------------905错误信息");
// console.log(error); // console.log(error);
// console.log(info); // console.log(info);
} }
// componentWillReceiveProps(nextProps) { // componentWillReceiveProps(nextProps) {
// console.log("+++++++++916"); // console.log("+++++++++916");
// console.log(nextProps); // console.log(nextProps);
@ -1493,6 +1537,7 @@ class Listofworksstudentone extends Component {
// console.log(this.props.isAdmin()) // console.log(this.props.isAdmin())
this.student(); this.student();
} }
isupdatas = () => { isupdatas = () => {
var homeworkid = this.props.match.params.homeworkid; var homeworkid = this.props.match.params.homeworkid;
// this.Gettitleinformation(homeworkid); // this.Gettitleinformation(homeworkid);
@ -1706,17 +1751,14 @@ class Listofworksstudentone extends Component {
} }
if (item.title === "学号") { if (item.title === "学号") {
continue continue
} } else {
else{
arr.push(item); arr.push(item);
} }
} } else {
else{
if (work_efficiency === false) { if (work_efficiency === false) {
if (item.title === "关卡得分") { if (item.title === "关卡得分") {
continue continue
} } else if (item.title === "效率分") {
else if(item.title==="效率分"){
continue continue
} else { } else {
@ -1743,17 +1785,14 @@ class Listofworksstudentone extends Component {
} }
if (item.title === "学号") { if (item.title === "学号") {
continue continue
} } else {
else{
arr2.push(item); arr2.push(item);
} }
} } else {
else{
if (work_efficiency === false) { if (work_efficiency === false) {
if (item.title === "关卡得分") { if (item.title === "关卡得分") {
continue continue
} } else if (item.title === "效率分") {
else if(item.title==="效率分"){
continue continue
} else { } else {
@ -2300,7 +2339,6 @@ class Listofworksstudentone extends Component {
}) })
} }
@ -2420,8 +2458,7 @@ class Listofworksstudentone extends Component {
} }
if (item.title === "效率分") { if (item.title === "效率分") {
continue continue
} } else {
else {
columns2js.push(item); columns2js.push(item);
} }
} }
@ -2495,8 +2532,6 @@ class Listofworksstudentone extends Component {
} }
} else { } else {
// console.log("1849"); // console.log("1849");
// console.log(this.props.isNotMember()); // console.log(this.props.isNotMember());
@ -3093,7 +3128,6 @@ class Listofworksstudentone extends Component {
} }
confirmysl(url) { confirmysl(url) {
axios.get(url + '&export=true').then((response) => { axios.get(url + '&export=true').then((response) => {
if (response === undefined) { if (response === undefined) {
@ -3133,6 +3167,7 @@ class Listofworksstudentone extends Component {
DownloadMessageval: undefined DownloadMessageval: undefined
}) })
} }
render() { render() {
let {columns, course_groupysls, datajs, isAdmin, homework_status, course_groupyslstwo, unlimited, unlimitedtwo, course_group_info, orders, task_status, checkedValuesine, searchtext, teacherlist, visible, visibles, game_list, columnsstu, columnsstu2, limit, experience, boolgalist, viewtrainingdata, teacherdata, page, data, jobsettingsdata, styletable, datas, order, loadingstate, computeTimetype} = this.state; let {columns, course_groupysls, datajs, isAdmin, homework_status, course_groupyslstwo, unlimited, unlimitedtwo, course_group_info, orders, task_status, checkedValuesine, searchtext, teacherlist, visible, visibles, game_list, columnsstu, columnsstu2, limit, experience, boolgalist, viewtrainingdata, teacherdata, page, data, jobsettingsdata, styletable, datas, order, loadingstate, computeTimetype} = this.state;
@ -3318,7 +3353,6 @@ class Listofworksstudentone extends Component {
{/*<span className="fl mr10 color-grey-6 ">计算成绩时间:{teacherdata&&teacherdata.calculation_time==null?"--": moment(teacherdata&&teacherdata.calculation_time).format('YYYY-MM-DD HH:mm')}</span>*/} {/*<span className="fl mr10 color-grey-6 ">计算成绩时间:{teacherdata&&teacherdata.calculation_time==null?"--": moment(teacherdata&&teacherdata.calculation_time).format('YYYY-MM-DD HH:mm')}</span>*/}
</li> </li>
<li className="clearfix mt10"> <li className="clearfix mt10">
@ -3427,9 +3461,12 @@ class Listofworksstudentone extends Component {
{orders === "update_time" ? "时间" : orders === "work_score" ? "成绩" : orders === "student_id" ? "学号" : ""}排序</a> {orders === "update_time" ? "时间" : orders === "work_score" ? "成绩" : orders === "student_id" ? "学号" : ""}排序</a>
<i className="iconfont icon-xiajiantou ml5 font-12 "></i> <i className="iconfont icon-xiajiantou ml5 font-12 "></i>
<ul className="edu-position-hide undis mt10"> <ul className="edu-position-hide undis mt10">
<li> <a onClick={(e) => this.funordert("update_time")} data-remote="true" className=" font-12" style={{textAlign: "center"}}>更新时间</a></li> <li><a onClick={(e) => this.funordert("update_time")} data-remote="true"
<li> <a onClick={(e) => this.funordert("work_score")} data-remote="true" className=" font-12" style={{textAlign: "center"}}>当前成绩</a></li> className=" font-12" style={{textAlign: "center"}}>更新时间</a></li>
<li> <a onClick={(e) => this.funordert("student_id")} data-remote="true" className=" font-12" style={{textAlign: "center"}}>学生学号</a></li> <li><a onClick={(e) => this.funordert("work_score")} data-remote="true"
className=" font-12" style={{textAlign: "center"}}>当前成绩</a></li>
<li><a onClick={(e) => this.funordert("student_id")} data-remote="true"
className=" font-12" style={{textAlign: "center"}}>学生学号</a></li>
</ul> </ul>
</li> </li>
</ul> </ul>
@ -3626,10 +3663,16 @@ class Listofworksstudentone extends Component {
textAlign: "center;" textAlign: "center;"
}}> }}>
<span className="fl color-grey-6 font-12"> <span className="fl font-12">
<span className="color-grey-9">已开始做题</span>
<span className=" ml3 mr3 color-grey-9">
{teacherdata === undefined ? "0" : teacherdata.commit_count === undefined ? "0" : teacherdata.commit_count}
</span><span className="color-grey-9"></span>
<span className="ml10 color-grey-9">未开始做题</span>
<span <span
className="color-orange-tip">{teacherdata === undefined ? "0" : teacherdata.commit_count === undefined ? "0" : teacherdata.commit_count}</span><span className="ml3 mr3 color-grey-9">{teacherdata === undefined ? "0" : teacherdata.uncommit_count}</span><span
className="ml10">{teacherdata === undefined ? "0" : teacherdata.uncommit_count}</span><span></span> className="color-grey-9"></span>
<span style={{color: "#666"}}>
{teacherdata === undefined ? "" : teacherdata.left_time === undefined ? "" : teacherdata.left_time === null ? "" : {teacherdata === undefined ? "" : teacherdata.left_time === undefined ? "" : teacherdata.left_time === null ? "" :
<span className="ml20">{teacherdata.left_time.status}</span> <span className="ml20">{teacherdata.left_time.status}</span>
} }
@ -3637,6 +3680,7 @@ class Listofworksstudentone extends Component {
<span className="ml20" <span className="ml20"
style={{color: '#FF6800'}}>{teacherdata.left_time.time}</span> style={{color: '#FF6800'}}>{teacherdata.left_time.time}</span>
} }
</span>
</span> </span>
<div className="fr"> <div className="fr">
@ -3816,17 +3860,23 @@ class Listofworksstudentone extends Component {
lineHeight: "31px !important;", lineHeight: "31px !important;",
textAlign: "center;" textAlign: "center;"
}}> }}>
<span className="fl color-grey-6 font-12"> <span className="fl font-12">
<span className="color-orange-tip"> <span style={{color: "#999999"}}>已开始做题</span>
<span className=" ml3 mr3 " style={{color: "#999999"}}>
{teacherdata === undefined ? "0" : teacherdata.commit_count === undefined ? "0" : teacherdata.commit_count} {teacherdata === undefined ? "0" : teacherdata.commit_count === undefined ? "0" : teacherdata.commit_count}
</span> </span><span style={{color: "#999999"}}></span>
<span className="ml10">{teacherdata === undefined ? "0" : teacherdata.uncommit_count}</span><span></span> <span className="ml10 " style={{color: "#999999"}}>未开始做题</span>
<span
className="ml3 mr3 "
style={{color: "#999999"}}>{teacherdata === undefined ? "0" : teacherdata.uncommit_count}</span><span
style={{color: "#999999"}}></span>
<span style={{color: "#666"}}>
{teacherdata === undefined ? "" : teacherdata.left_time === undefined ? "" : teacherdata.left_time === null ? "" : {teacherdata === undefined ? "" : teacherdata.left_time === undefined ? "" : teacherdata.left_time === null ? "" :
<span className="ml20">{teacherdata.left_time.status}</span>} <span className="ml20">{teacherdata.left_time.status}</span>}
{teacherdata === undefined ? "0" : teacherdata.left_time === undefined ? "0" : teacherdata.left_time === null ? "0" : {teacherdata === undefined ? "0" : teacherdata.left_time === undefined ? "0" : teacherdata.left_time === null ? "0" :
<span className="ml20" <span className="ml20"
style={{color: '#FF6800'}}>{teacherdata.left_time.time}</span>} style={{color: '#FF6800'}}>{teacherdata.left_time.time}</span>}
</span>
</span> </span>
<style> <style>
{` {`

@ -14,6 +14,7 @@ export function ImageLayerOfCommentHOC(options = {}) {
imageSrc: '' imageSrc: ''
} }
} }
onDelegateClick = (event) => { onDelegateClick = (event) => {
const imageSrc = event.target.src || event.target.getAttribute('src') || event.target.getAttribute('href') const imageSrc = event.target.src || event.target.getAttribute('src') || event.target.getAttribute('href')
// 判断imageSrc是否是图片 // 判断imageSrc是否是图片
@ -35,6 +36,7 @@ export function ImageLayerOfCommentHOC(options = {}) {
return false; return false;
} }
} }
// jQuery._data( $('.newMain')[0], "events" ) // jQuery._data( $('.newMain')[0], "events" )
componentDidMount() { componentDidMount() {
this.props.wrappedComponentRef && this.props.wrappedComponentRef(this.refs['wrappedComponentRef']) this.props.wrappedComponentRef && this.props.wrappedComponentRef(this.refs['wrappedComponentRef'])
@ -45,6 +47,7 @@ export function ImageLayerOfCommentHOC(options = {}) {
.delegate(options.imgSelector || ".J_Comment_Reply .comment_content img, .J_Comment_Reply .childrenCommentsView img","click", this.onDelegateClick); .delegate(options.imgSelector || ".J_Comment_Reply .comment_content img, .J_Comment_Reply .childrenCommentsView img","click", this.onDelegateClick);
}, 1200) }, 1200)
} }
componentWillUnmount() { componentWillUnmount() {
$(options.parentSelector || ".commentsDelegateParent", 'click', this.onDelegateClick) $(options.parentSelector || ".commentsDelegateParent", 'click', this.onDelegateClick)
} }
@ -56,8 +59,23 @@ export function ImageLayerOfCommentHOC(options = {}) {
}) })
} }
render() { MdifHasAnchorJustScorll=()=>{
//mdhash滚动
let anchor = decodeURI(this.props.location.hash).replace('#', '');
// 对应id的话, 滚动到相应位置
if (!!anchor) {
let anchorElement = document.getElementsByName(anchor);
if (anchorElement) {
if (anchorElement.length!=0) {
anchorElement[anchorElement.length-1].scrollIntoView();
}
}
}
}
render() {
this.MdifHasAnchorJustScorll();
return ( return (
<React.Fragment> <React.Fragment>
<ImageLayer {...this.state} onImageLayerClose={this.onImageLayerClose}></ImageLayer> <ImageLayer {...this.state} onImageLayerClose={this.onImageLayerClose}></ImageLayer>

@ -609,6 +609,21 @@ export function TPMIndexHOC(WrappedComponent) {
hideGlobalLoading = () => { hideGlobalLoading = () => {
this.setState({ globalLoading: false }) this.setState({ globalLoading: false })
} }
MdifHasAnchorJustScorll=()=>{
//mdhash滚动
let anchor = decodeURI(this.props.location.hash).replace('#', '');
// 对应id的话, 滚动到相应位置
if (!!anchor) {
let anchorElement = document.getElementsByName(anchor);
if (anchorElement) {
if (anchorElement.length>0){
anchorElement[anchorElement.length-1].scrollIntoView();
}
}
}
}
render() { render() {
let{Headertop,Footerdown, isRender, AccountProfiletype,mygetHelmetapi}=this.state; let{Headertop,Footerdown, isRender, AccountProfiletype,mygetHelmetapi}=this.state;
const common = { const common = {
@ -643,6 +658,7 @@ export function TPMIndexHOC(WrappedComponent) {
hideGlobalLoading: this.hideGlobalLoading, hideGlobalLoading: this.hideGlobalLoading,
yslslowCheckresults:this.yslslowCheckresults, yslslowCheckresults:this.yslslowCheckresults,
yslslowCheckresultsNo:this.yslslowCheckresultsNo, yslslowCheckresultsNo:this.yslslowCheckresultsNo,
MdifHasAnchorJustScorll:this.MdifHasAnchorJustScorll
}; };
// console.log("this.props.mygetHelmetapi"); // console.log("this.props.mygetHelmetapi");

Loading…
Cancel
Save