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

dev_auth
杨树明 5 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 *****************
var $rewardGradeModal = $('.admin-users-reward-grade-modal');
var $form = $rewardGradeModal.find('form.admin-users-reward-grade-form');

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

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

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

@ -440,6 +440,7 @@ class HomeworkCommonsController < ApplicationController
@user = current_user
@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))
@shixun = @homework.shixuns.take if @homework.homework_type == "practice"
end
def update_settings

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

@ -32,6 +32,7 @@ class LimitForbidControl::Base
# 锁定
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.delete(cache_key)
else
@ -40,6 +41,7 @@ class LimitForbidControl::Base
end
def clear
Rails.logger.info("[LimitForbidControl] Clear #{cache_key}")
Rails.cache.delete(forbid_cache_key)
Rails.cache.delete(cache_key)
end

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

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

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

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

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

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

@ -22,6 +22,8 @@ class Users::ApplyAuthenticationService < ApplicationService
user.authentication = false
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)
move_image_file! unless params[:upload_image].to_s == 'false'

@ -1,7 +1,7 @@
class Users::CourseService
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
@ -15,7 +15,7 @@ class Users::CourseService
courses = status_filter(courses)
custom_sort(courses, :updated_at, params[:sort_direction])
custom_sort(courses, params[:sort_by], params[:sort_direction])
end
private

@ -1,7 +1,7 @@
class Users::ProjectService
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
@ -21,7 +21,7 @@ class Users::ProjectService
projects = category_filter(projects)
projects = status_filter(projects)
custom_sort(projects, :updated_on, params[:sort_direction])
custom_sort(projects, params[:sort_by], params[:sort_direction])
end
private

@ -77,6 +77,10 @@ class Users::ShixunService
sort_by = sort_by&.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)
sort_direction = 'desc'
end
@ -87,11 +91,11 @@ class Users::ShixunService
case params[:category]
when 'study' then
relations.order("myshixuns.updated_at #{sort_direction}")
relations.order("myshixuns.#{sort_by} #{sort_direction}")
when 'manage' then
relations.order("shixuns.updated_at #{sort_direction}")
relations.order("shixuns.#{sort_by} #{sort_direction}")
else
relations.order("shixuns.created_at #{sort_direction}")
relations.order("shixuns.#{sort_by} #{sort_direction}")
end
end
end

@ -1,7 +1,7 @@
class Users::SubjectService
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
@ -14,7 +14,7 @@ class Users::SubjectService
subjects = category_scope_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
private

@ -2,15 +2,15 @@
<thead class="thead-light">
<tr>
<th width="10%" class="text-left">真实姓名</th>
<th width="16%">邮件地址</th>
<th width="15%">邮件地址</th>
<th width="10%">手机号码</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: '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: 'grade', path: admins_users_path) %></th>
<th width="12%">操作</th>
<th width="14%">操作</th>
</tr>
</thead>
<tbody>
@ -33,8 +33,6 @@
<td class="action-container">
<%= 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;' %>
<% 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;' : '' %>
<% 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>
</tr>
<% end %>

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

@ -24,4 +24,5 @@ json.course_identity @user_course_identity
json.excellent @course.excellent
if @course.is_end == 0
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
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.homework_detail_manual, :answer_open_evaluation, :shixun_evaluation)
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_name challenge.subject
json.checked challenge_setting(@homework, challenge.id).present?
json.challenge_score challenge_setting(@homework, challenge.id).try(:score).to_f
json.challenge_exp challenge.score
json.difficulty challenge.challenge_difficulty
total_exp += challenge.score
end

@ -906,6 +906,7 @@ Rails.application.routes.draw do
post :lock
post :unlock
post :active
post :reset_login_times
end
end
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 *****************
var $rewardGradeModal = $('.admin-users-reward-grade-modal');
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.');
} else {
// hash跳转
var hash = window.location.hash;
if (hash) {
hashTimeout && window.clearTimeout(hashTimeout)
hashTimeout = setTimeout(() => {
var element = document.querySelector(hash);
if (element) {
element.scrollIntoView();
}
}, 400)
}
// var hash = window.location.hash;
// if (hash) {
// hashTimeout && window.clearTimeout(hashTimeout)
// hashTimeout = setTimeout(() => {
// var element = document.querySelector(hash);
// if (element) {
// element.scrollIntoView();
// }
// }, 400)
// }
}
// if(response.data.status === 401){
// console.log("401401401")

@ -68,7 +68,8 @@ class Registration extends React.Component {
mutiple_limited: false,
teamutiple_limited: false,
members_count: 0,
mode: 0
mode: 0,
region_schools: [],
}
}
@ -82,8 +83,8 @@ class Registration extends React.Component {
// //// //////console.log(this.props.isAdmin())
try {
const {keyword, page, per_page} = this.state;
this.Getdata(keyword, page, per_page, this.props.user.admin);
this.GetenrollmentAPI();
this.Getdata(keyword, page, per_page, this.props.user.admin);// 获取列表数据
this.GetenrollmentAPI();//获取我的报名配置
} catch (e) {
// const {keyword, page, per_page} = this.state;
// 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.GetenrollmentAPI();
//取模式
this.Getdataheader();
}
}
@ -116,6 +119,7 @@ class Registration extends React.Component {
if (result.data) {
this.setState({
mode: result.data.mode,
region_schools: result.data.region_schools
})
}
@ -454,6 +458,37 @@ class Registration extends React.Component {
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) {
try {
@ -541,6 +576,34 @@ class Registration extends React.Component {
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) {

@ -124,7 +124,7 @@ class CompetitionsIndex extends Component{
size="large"
dataSource={datas&&datas}
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"?
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
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"}>
<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}
>{item.name}{item.sub_title===null?"":`——${item.sub_title}`}</a>
{/*<span>{item.sub_title===null?"":*/}

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

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

@ -30,6 +30,7 @@ class CompetitionContents extends Component{
}).catch((error) => {
console.log(error)
})
this.props.MdifHasAnchorJustScorll();
}
derivefun=(url)=>{
@ -65,6 +66,7 @@ class CompetitionContents extends Component{
});
}
render() {
this.props.MdifHasAnchorJustScorll();
const operations = <div>
<Button className={"fr"} type="primary" ghost onClick={()=>this.props.Competitionedit()}>编辑</Button>
<Button className={"fr mr20"} type="primary" ghost>
@ -76,40 +78,40 @@ class CompetitionContents extends Component{
title: 'usersum',
dataIndex: 'usersum',
key: 'name',
render: text => <a className={"color-blue"}>{text}</a>,
render: text => <span className={"color-blue"}>{text}</span>,
},
{
title: 'userimg',
dataIndex: 'userimg',
key: 'userimg',
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}`)}/>
</a>),
</span>),
},
{
title: 'username',
dataIndex: 'username',
key: 'username',
render: text => <a title={text}>{text}</a>,
render: text => <span title={text}>{text}</span>,
},
{
title: 'school',
dataIndex: 'school',
key: 'school',
render: text => <a title={text}>{text}</a>,
render: text => <span title={text}>{text}</span>,
},
{
title: 'spendtime',
dataIndex: 'spendtime',
key: 'spendtime',
render: text => <a>{text}</a>,
render: text => <span>{text}</span>,
},
{
title: 'score',
dataIndex: 'score',
key: 'score',
render: text => <a className={"color-blue"}>{text}</a>,
render: text => <span className={"color-blue"}>{text}</span>,
},
];

@ -477,8 +477,9 @@ class CoursesBanner extends Component {
render() {
let { Addcoursestypes, coursedata,excellent, modalsType, modalsTopval, loadtype,modalsBottomval,antIcon,is_guide,AccountProfiletype,modalstrsvalue} = this.state;
const isCourseEnd = this.props.isCourseEnd()
document.title=coursedata===undefined || coursedata.status===401 || coursedata.status===407?"":coursedata.name;
const isCourseEnd = this.props.isCourseEnd();
document.title=coursedata===undefined || coursedata.status===401 || coursedata.status===407?"":coursedata.name;
return (
<div>
{/*{*/}
@ -705,18 +706,29 @@ class CoursesBanner extends Component {
`}
</style>
<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
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")}
>
<span className="color-grey-c font-16"><span className={"mr10 ml10"}>学生</span> <span className={"mr10"}>{coursedata.student_count}</span></span>
</Breadcrumb.Item>
<Breadcrumb.Item>{coursedata.credit===null?"":
<span className="color-grey-c font-16"><span className={"mr10 ml10"}>学分</span> <span className={"mr10"}>{coursedata.credit}</span></span>
}</Breadcrumb.Item>
</Breadcrumb>
{/*<li className={"mt7 teachersbox"} >*/}

@ -391,9 +391,8 @@ class OneSelfOrderModal extends Component{
{this.props.modaltype===undefined||this.props.modaltype===2
|| this.props.usingCheckBeforePost ?"":<div className="clearfix edu-txt-center lineh-40 F4FAFF">
<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":"right","color":"#05101A"}} className="task-hide color-grey-name mr70">截止时间</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>
</li>
</div>}
{this.props.modaltype===undefined||this.props.modaltype===2

@ -1744,4 +1744,9 @@ input.ant-input-number-input:focus {
line-height: 62px;
color: #fff;
margin: 0 auto;
}
.daishenp{
color: #F79946 !important;
text-decoration: underline !important;
}

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

@ -421,8 +421,8 @@ class Testpapersettinghomepage extends Component{
className={"btn fr color-blue font-16 mt20 mr20"}
checkBoxValues={[parseInt(this.props.match.params.Id)]}
Exercisetype={"exercise"}
// single={true}
action={this.Commonheadofthetestpaper}
single={true}
></ImmediatelyEnd>:"":""}
{isAdmin === true?Commonheadofthetestpaper!==undefined&&Commonheadofthetestpaper.user_permission.exercise_unpublish_count>0? <ImmediatelyPublish
{...this.props}

@ -299,7 +299,18 @@ class studentsList extends Component{
this.setState({
isSpin:true
})
this.fetchAll(1);
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);
const isAdminOrTeacher = this.props.isAdminOrTeacher()
const isAdmin = this.props.isAdmin()
@ -385,6 +396,8 @@ class studentsList extends Component{
this.fetchAll()
}
fetchAll = async (argPage) => {
let { searchValue, filterKey }=this.state
this.setState({
isSpin:true
})
@ -395,7 +408,7 @@ class studentsList extends Component{
const sortedInfo = this.state.sortedInfo;
let page = argPage || this.state.page
let { searchValue, filterKey }=this.state
let order = 1;
if (sortedInfo.columnKey == 'role') {
order = 1;
@ -654,7 +667,9 @@ class studentsList extends Component{
const isSuperAdmin = this.props.isSuperAdmin()
const hasGraduationModule = this.hasGraduationModule()
const coursesId = this.props.match.params.coursesId
return(
<React.Fragment>
{/* <AddTeacherModal ref="addTeacherModal"
@ -693,7 +708,7 @@ class studentsList extends Component{
}
secondRowLeft={
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="2">待审批({apply_size})</Menu.Item>
</Menu>

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

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

@ -14,6 +14,7 @@ export function ImageLayerOfCommentHOC(options = {}) {
imageSrc: ''
}
}
onDelegateClick = (event) => {
const imageSrc = event.target.src || event.target.getAttribute('src') || event.target.getAttribute('href')
// 判断imageSrc是否是图片
@ -35,6 +36,7 @@ export function ImageLayerOfCommentHOC(options = {}) {
return false;
}
}
// jQuery._data( $('.newMain')[0], "events" )
componentDidMount() {
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);
}, 1200)
}
componentWillUnmount() {
$(options.parentSelector || ".commentsDelegateParent", 'click', this.onDelegateClick)
}
@ -55,9 +58,24 @@ export function ImageLayerOfCommentHOC(options = {}) {
imageSrc: '',
})
}
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 (
<React.Fragment>
<ImageLayer {...this.state} onImageLayerClose={this.onImageLayerClose}></ImageLayer>

@ -609,6 +609,21 @@ export function TPMIndexHOC(WrappedComponent) {
hideGlobalLoading = () => {
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() {
let{Headertop,Footerdown, isRender, AccountProfiletype,mygetHelmetapi}=this.state;
const common = {
@ -643,6 +658,7 @@ export function TPMIndexHOC(WrappedComponent) {
hideGlobalLoading: this.hideGlobalLoading,
yslslowCheckresults:this.yslslowCheckresults,
yslslowCheckresultsNo:this.yslslowCheckresultsNo,
MdifHasAnchorJustScorll:this.MdifHasAnchorJustScorll
};
// console.log("this.props.mygetHelmetapi");

Loading…
Cancel
Save