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

sso
cxt 5 years ago
commit 741ec3705d

@ -3,9 +3,10 @@ class SubjectsController < ApplicationController
# before_action :check_auth, except: [:index] # before_action :check_auth, except: [:index]
before_action :check_account, except: [:index, :show, :right_banner] before_action :check_account, except: [:index, :show, :right_banner]
before_action :find_subject, except: [:index, :create, :new, :append_to_stage, :add_shixun_to_stage] before_action :find_subject, except: [:index, :create, :new, :append_to_stage, :add_shixun_to_stage]
before_action :allowed, only: [:update, :edit, :destroy, :publish, :cancel_publish, :cancel_has_publish, before_action :allowed, only: [:update, :edit, :destroy, :publish, :cancel_publish, :cancel_has_publish, :apply_public,
:search_members, :add_subject_members, :statistics, :shixun_report, :school_report, :search_members, :add_subject_members, :statistics, :shixun_report, :school_report,
:up_member_position, :down_member_position, :update_team_title, :statistics_info] :cancel_has_public, :up_member_position, :down_member_position, :update_team_title,
:statistics_info, :cancel_public]
before_action :require_admin, only: [:copy_subject] before_action :require_admin, only: [:copy_subject]
before_action :shixun_marker, only: [:add_shixun_to_stage] before_action :shixun_marker, only: [:add_shixun_to_stage]
@ -33,16 +34,16 @@ class SubjectsController < ApplicationController
laboratory_join = " AND subjects.id in #{subject_ids} " laboratory_join = " AND subjects.id in #{subject_ids} "
if select if select
@subjects = Subject.find_by_sql("SELECT subjects.id, subjects.user_id, subjects.name, subjects.stages_count, subjects.repertoire_id, subjects.status, @subjects = Subject.find_by_sql("SELECT subjects.id, subjects.user_id, subjects.name, subjects.stages_count, subjects.repertoire_id, subjects.status, subjects.public,
subjects.shixuns_count, subjects.excellent, sum(shixuns.myshixuns_count) AS myshixun_member_count FROM subjects join stage_shixuns subjects.shixuns_count, subjects.excellent, sum(shixuns.myshixuns_count) AS myshixun_member_count FROM subjects join stage_shixuns
on stage_shixuns.subject_id = subjects.id join shixuns on shixuns.id = stage_shixuns.shixun_id where on stage_shixuns.subject_id = subjects.id join shixuns on shixuns.id = stage_shixuns.shixun_id where
subjects.hidden = 0 AND subjects.status = 2 AND subjects.name like '%#{search}%' #{laboratory_join} subjects.hidden = 0 AND subjects.public = 2 AND subjects.name like '%#{search}%' #{laboratory_join}
AND subjects.repertoire_id = #{select} GROUP BY subjects.id ORDER BY myshixun_member_count DESC") AND subjects.repertoire_id = #{select} GROUP BY subjects.id ORDER BY myshixun_member_count DESC")
else else
@subjects = Subject.find_by_sql("SELECT subjects.id, subjects.user_id, subjects.name, subjects.stages_count, subjects.repertoire_id, subjects.status, @subjects = Subject.find_by_sql("SELECT subjects.id, subjects.user_id, subjects.name, subjects.stages_count, subjects.repertoire_id, subjects.status, subjects.public,
subjects.shixuns_count, subjects.excellent, sum(shixuns.myshixuns_count) AS myshixun_member_count FROM subjects join stage_shixuns subjects.shixuns_count, subjects.excellent, sum(shixuns.myshixuns_count) AS myshixun_member_count FROM subjects join stage_shixuns
on stage_shixuns.subject_id = subjects.id join shixuns on shixuns.id = stage_shixuns.shixun_id where on stage_shixuns.subject_id = subjects.id join shixuns on shixuns.id = stage_shixuns.shixun_id where
subjects.hidden = 0 AND subjects.status = 2 AND subjects.name like '%#{search}%' #{laboratory_join} subjects.hidden = 0 AND subjects.public = 2 AND subjects.name like '%#{search}%' #{laboratory_join}
GROUP BY subjects.id ORDER BY myshixun_member_count DESC") GROUP BY subjects.id ORDER BY myshixun_member_count DESC")
end end
else else
@ -59,7 +60,7 @@ class SubjectsController < ApplicationController
elsif reorder == "publish_time" elsif reorder == "publish_time"
@subjects = @subjects.unhidden @subjects = @subjects.unhidden
else else
@subjects = @subjects.visible.unhidden @subjects = @subjects.publiced.unhidden
end end
# 类型 # 类型
@ -72,7 +73,7 @@ class SubjectsController < ApplicationController
end end
# 排序 # 排序
order_str = (reorder == "publish_time" ? "homepage_show desc, excellent desc, status = 2 desc, publish_time asc" : "homepage_show desc, excellent desc, updated_at desc") order_str = (reorder == "publish_time" ? "homepage_show desc, excellent desc, public = 2 desc, publish_time asc" : "homepage_show desc, excellent desc, updated_at desc")
@subjects = @subjects.reorder(order_str) @subjects = @subjects.reorder(order_str)
end end
@ -273,14 +274,44 @@ class SubjectsController < ApplicationController
end end
def publish def publish
@subject.update_attributes(status: 2)
end
def cancel_publish
begin
apply = ApplyAction.where(container_type: "ApplySubject", container_id: @subject.id).order("created_at desc").first
if apply && apply.status == 0
apply.update_attributes(status: 3)
apply.tidings.destroy_all
end
@subject.update_attributes(status: 0)
rescue => e
uid_logger_error(e.message)
tip_exception("撤销申请失败")
end
end
def cancel_has_publish
begin
@subject.update_attributes(:status => 0)
rescue => e
uid_logger_error(e.message)
tip_exception("撤销发布失败")
raise ActiveRecord::Rollback
end
end
# 申请公开
def apply_public
tip_exception(-1, "请先发布课程再申请公开") if @subject.status != 2
apply = ApplyAction.where(container_type: "ApplySubject", container_id: @subject.id).order("created_at desc").first apply = ApplyAction.where(container_type: "ApplySubject", container_id: @subject.id).order("created_at desc").first
if apply && apply.status == 0 if apply && apply.status == 0
@status = 0 @status = 0
else else
@subject.update_attributes(status: 1) @subject.update_attributes(public: 1)
ApplyAction.create(container_type: "ApplySubject", container_id: @subject.id, user_id: current_user.id, status: 0) ApplyAction.create(container_type: "ApplySubject", container_id: @subject.id, user_id: current_user.id, status: 0)
begin begin
status = Educoder::Sms.send(mobile: '18711011226', send_type:'publish_subject' , name: '管理员') Educoder::Sms.send(mobile: '18711011226', send_type:'publish_subject' , name: '管理员')
rescue => e rescue => e
uid_logger_error("发送验证码出错: #{e}") uid_logger_error("发送验证码出错: #{e}")
end end
@ -288,28 +319,28 @@ class SubjectsController < ApplicationController
end end
end end
def cancel_publish def cancel_public
begin begin
apply = ApplyAction.where(container_type: "ApplySubject", container_id: @subject.id).order("created_at desc").first apply = ApplyAction.where(container_type: "ApplySubject", container_id: @subject.id).order("created_at desc").first
if apply && apply.status == 0 if apply && apply.status == 0
apply.update_attributes(status: 3) apply.update_attributes(status: 3)
apply.tidings.destroy_all apply.tidings.destroy_all
end end
@subject.update_attributes(status: 0) @subject.update_attributes(public: 0)
render_ok
rescue => e rescue => e
uid_logger_error(e.message) uid_logger_error(e.message)
tip_exception("撤销申请失败") tip_exception("撤销申请失败")
raise ActiveRecord::Rollback
end end
end end
def cancel_has_publish def cancel_has_public
begin begin
@subject.update_attributes(:status => 0) @subject.update_attributes(:public => 0)
render_ok
rescue => e rescue => e
uid_logger_error(e.message) uid_logger_error(e.message)
tip_exception("撤销发布失败") tip_exception("撤销公开失败")
raise ActiveRecord::Rollback
end end
end end

@ -6,6 +6,6 @@ module Admins::SubjectsHelper
when 1 then 'text-warning' when 1 then 'text-warning'
when 2 then 'text-success' when 2 then 'text-success'
end end
raw content_tag(:span, t("subject.status.#{subject.status}"), class: style) raw content_tag(:span, t("subject.public.#{subject.public}"), class: style)
end end
end end

@ -1,12 +1,23 @@
module SubjectsHelper module SubjectsHelper
# 实训路径的发布状态 # 实训路径的发布状态
def publish_status subject, is_manager, user def publish_status subject, is_manager
status = -1 status = -1
if is_manager if is_manager
status = 0 if subject.status == 0 status = 0 if subject.status == 0
status = 1 if subject.status == 1 status = 1 if subject.status == 1
status = 2 if subject.status == 2 && user.admin? status = 2 if subject.status == 2
end
status
end
# 实训路径的公开状态
def public_status subject, is_manager, user
status = -1
if is_manager
status = 0 if subject.public == 0
status = 1 if subject.public == 1
status = 2 if subject.public == 2 && user.admin?
end end
status status
end end

@ -40,6 +40,7 @@ class Subject < ApplicationRecord
scope :visible, lambda{where(status: 2)} scope :visible, lambda{where(status: 2)}
scope :published, lambda{where(status: 1)} scope :published, lambda{where(status: 1)}
scope :unhidden, lambda{where(hidden: 0)} scope :unhidden, lambda{where(hidden: 0)}
scope :publiced, lambda{ where(public: 2) }
after_create :send_tiding after_create :send_tiding
def send_tiding def send_tiding

@ -21,7 +21,7 @@ class Admins::SubjectQuery < ApplicationQuery
when 'applying' then 1 when 'applying' then 1
when 'published' then 2 when 'published' then 2
end end
subjects = subjects.where(status: status) if status subjects = subjects.where(public: status) if status
# 创建者单位 # 创建者单位
if params[:school_id].present? if params[:school_id].present?

@ -8,7 +8,7 @@ class Weapps::SubjectQuery < ApplicationQuery
end end
def call def call
subjects = @current_laboratory.subjects.unhidden.visible subjects = @current_laboratory.subjects.unhidden.publiced
# 课程体系的过滤 # 课程体系的过滤
if params[:sub_discipline_id].present? if params[:sub_discipline_id].present?

@ -10,7 +10,7 @@ class Admins::SubjectAuths::AgreeApplyService < ApplicationService
def call def call
ActiveRecord::Base.transaction do ActiveRecord::Base.transaction do
apply.update!(status: 1, dealer_id: user.id) apply.update!(status: 1, dealer_id: user.id)
subject.update!(status: 2, publish_time: Time.now) subject.update!(public: 2, publish_time: Time.now)
deal_tiding! deal_tiding!
end end

@ -10,7 +10,7 @@ class Admins::SubjectAuths::RefuseApplyService < ApplicationService
def call def call
ActiveRecord::Base.transaction do ActiveRecord::Base.transaction do
subject.update!(status: 0) subject.update!(public: 0)
apply.update!(status: 2, reason: reason, dealer_id: user.id) apply.update!(status: 2, reason: reason, dealer_id: user.id)
deal_tiding! deal_tiding!

@ -41,7 +41,8 @@ class SearchService < ApplicationService
when 'shixun' then when 'shixun' then
{ where: { id: Laboratory.current.shixuns.where(public: 2, status: 2, fork_from: nil).or(Laboratory.current.shixuns.where(status: 2, id: User.current.shixuns)).pluck(:id) } } { where: { id: Laboratory.current.shixuns.where(public: 2, status: 2, fork_from: nil).or(Laboratory.current.shixuns.where(status: 2, id: User.current.shixuns)).pluck(:id) } }
when 'subject' then when 'subject' then
{ where: { id: Laboratory.current.subjects.pluck(:id) } } { where: { id: Laboratory.current.subjects.where(public: 2, status: 2)
.or( Laboratory.current.shixuns.where(status: 2, id: User.current.shixuns).pluck(:id)) } }
when 'course' then when 'course' then
{ where: { id: Laboratory.current.all_courses.pluck(:id) } } { where: { id: Laboratory.current.all_courses.pluck(:id) } }
else else

@ -17,9 +17,12 @@ class SubjectSearchService < ApplicationService
if type == "mine" if type == "mine"
@subjects = @subjects.where(id: User.current.subjects).visible.unhidden @subjects = @subjects.where(id: User.current.subjects).visible.unhidden
else else
@subjects = @subjects.visible.unhidden if User.current.admin? || User.current.business?
@subjects = @subjects.unhidden
else
@subjects = @subjects.publiced.unhidden.or(@subjects.where(id: User.current.subjects))
end
end end
Subject.search(keyword, search_options) Subject.search(keyword, search_options)
end end

@ -70,12 +70,21 @@ class Users::SubjectService
end end
def manage_subject_status_filter(relations) def manage_subject_status_filter(relations)
if params[:status] == "publiced"
relations = relations.where(public: 2)
elsif params[:status] == "applying"
relations = relations.where(public: 1)
else
status = case params[:status] status = case params[:status]
when 'editing' then 0 when 'editing' then
when 'applying' then 1 0
when 'published' then 2 when 'applying' then
1
when 'published' then
2
end end
relations = relations.where(status: status) if status relations = relations.where(status: status) if status
end
relations relations
end end

@ -0,0 +1,2 @@
json.status @status
json.message @status == 0 ? "已公开过申请,请等待管理员审核" : "公开申请已提交,请等待管理员的审核"

@ -1,2 +1,2 @@
json.status 1 json.status 0
json.subject_id @subject.id json.subject_id @subject.id

@ -1,2 +1,2 @@
json.status @status json.status 0
json.message @status == 0 ? "已发布过申请,请等待管理员审核" : "发布申请已提交,请等待管理员的审核" json.message "申请成功"

@ -6,7 +6,8 @@ json.subject_score @subject.all_score
json.member_count @subject.member_count json.member_count @subject.member_count
json.allow_delete (@subject.status != 2 && @is_creator) || @user.admin? json.allow_delete (@subject.status != 2 && @is_creator) || @user.admin?
json.publish_status publish_status(@subject, @is_manager, @user) json.publish_status publish_status(@subject, @is_manager)
json.public_status public_status(@subject, @is_manager, @user)
json.allow_statistics @is_manager json.allow_statistics @is_manager
json.allow_send @user.logged? json.allow_send @user.logged?
json.allow_visit @subject.status > 1 || @is_manager json.allow_visit @subject.status > 1 || @is_manager

@ -4,3 +4,7 @@
'0': 编辑中 '0': 编辑中
'1': 审核中 '1': 审核中
'2': 已发布 '2': 已发布
public:
'0': 编辑中
'1': 审核中
'2': 已发布

@ -406,9 +406,12 @@ Rails.application.routes.draw do
resources :subjects, path: :paths do resources :subjects, path: :paths do
member do member do
get 'choose_subject_shixun' get 'choose_subject_shixun'
get 'publish' post 'publish'
get 'cancel_publish' post :apply_public
get 'cancel_has_publish' post :cancel_public
post 'cancel_publish'
post 'cancel_has_publish'
post :cancel_has_public
get 'statistics' get 'statistics'
get 'statistics_info' get 'statistics_info'
get 'shixun_report' get 'shixun_report'

@ -0,0 +1,5 @@
class AddPublicForSubjects < ActiveRecord::Migration[5.2]
def change
add_column :subjects, :public, :integer, :default => 0
end
end

@ -0,0 +1,7 @@
class MigrateSubjectStatus < ActiveRecord::Migration[5.2]
def change
Subject.unhidden.visible.update_all(public: 2)
Subject.where(status: 1, id: ApplyAction.where(container_type: 'ApplySubject', status: 0)
.pluck(:container_id)).update_all(status: 2, public: 1)
end
end

File diff suppressed because it is too large Load Diff

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 it is too large Load Diff

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 384 KiB

After

Width:  |  Height:  |  Size: 393 KiB

@ -246,7 +246,7 @@ class CoursesBanner extends Component {
}) })
}else{ }else{
s = "邀请码停用后,用户不能主动加入该课堂了"; s = "课堂邀请码停用后,用户不能主动加入该课堂了";
ss = "您是否确认停用?"; ss = "您是否确认停用?";
this.showActionPoll(i,s,ss) this.showActionPoll(i,s,ss)
} }

@ -1032,7 +1032,7 @@ class Coursesleftnav extends Component{
item.type==="board"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-taolun mr10 fl":"iconfont icon-taolun mr10 fl"} ></i>: item.type==="board"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-taolun mr10 fl":"iconfont icon-taolun mr10 fl"} ></i>:
item.type==="course_group"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-fenban mr10 fl":"iconfont icon-fenban mr10 fl"} ></i>: item.type==="course_group"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-fenban mr10 fl":"iconfont icon-fenban mr10 fl"} ></i>:
item.type==="statistics"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-tongji mr10 fl":"iconfont icon-tongji mr10 fl"} ></i>: item.type==="statistics"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-tongji mr10 fl":"iconfont icon-tongji mr10 fl"} ></i>:
item.type==="video"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-bofang1 mr10 fl":"iconfont icon-bofang1 mr10 fl"} ></i>:"" item.type==="video"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-bofang2 mr10 fl":"iconfont icon-bofang2 mr10 fl"} ></i>:""
} }
{/*||this.props.location.pathname===this.state.url&&key===this.state.indexs*/} {/*||this.props.location.pathname===this.state.url&&key===this.state.indexs*/}
@ -1174,7 +1174,7 @@ class Coursesleftnav extends Component{
item.type==="board"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-taolun mr10 fl":"iconfont icon-taolun mr10 fl"} ></i>: item.type==="board"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-taolun mr10 fl":"iconfont icon-taolun mr10 fl"} ></i>:
item.type==="course_group"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-fenban mr10 fl":"iconfont icon-fenban mr10 fl"} ></i>: item.type==="course_group"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-fenban mr10 fl":"iconfont icon-fenban mr10 fl"} ></i>:
item.type==="video"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-bofang1 mr10 fl":"iconfont icon-bofang1 mr10 fl"} ></i>: item.type==="video"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-bofang2 mr10 fl":"iconfont icon-bofang2 mr10 fl"} ></i>:
item.type==="statistics"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-tongji mr10 fl":"iconfont icon-tongji mr10 fl"} ></i>:"" item.type==="statistics"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-tongji mr10 fl":"iconfont icon-tongji mr10 fl"} ></i>:""
} }

@ -133,7 +133,12 @@ function CourseGroupList(props) {
modalsType={DownloadType} modalsType={DownloadType}
/> />
<Titlesearchsection <Titlesearchsection
title={"分班列表"} title={
<ul className="course_publicNav">
<li className="active">分班列表</li>
<li onClick={() => {props.history.push(`/courses/${courseId}/course_groups/0`)}}>未分班</li>
</ul>
}
searchValue={ searchValue } searchValue={ searchValue }
onInputSearchChange={onInputSearchChange} onInputSearchChange={onInputSearchChange}
allowClearonChange={onInputSearchChange} allowClearonChange={onInputSearchChange}
@ -211,12 +216,12 @@ function CourseGroupList(props) {
onPressEnter={onPressEnter} onPressEnter={onPressEnter}
></Titlesearchsection> ></Titlesearchsection>
{!!none_group_member_count && <div className="mt20 E9F8FF padding20-30 pointer" onClick={() => {props.history.push(`/courses/${courseId}/course_groups/0`)}}> {/* {!!none_group_member_count && <div className="mt20 E9F8FF padding20-30 pointer" onClick={() => {props.history.push(`/courses/${courseId}/course_groups/0`)}}>
<span>未分班</span> <span>未分班</span>
<span style={{color: '#999999'}}>{none_group_member_count}个学生</span> <span style={{color: '#999999'}}>{none_group_member_count}个学生</span>
<WordsBtn style="blue" className="fr">查看</WordsBtn> <WordsBtn style="blue" className="fr">查看</WordsBtn>
</div>} </div>} */}
<Spin size="large" spinning={isSpin}> <Spin size="large" spinning={isSpin}>
{course_groups && !!course_groups.length ? {course_groups && !!course_groups.length ?

@ -1,11 +1,11 @@
import React, { useState, useEffect } from 'react' import React, { useState, useEffect } from 'react'
import { Input,Checkbox,Table, Pagination, Modal,Menu ,Spin, Tooltip , Badge, Popconfirm } from "antd"; import { Input,Checkbox,Table, Pagination, Modal,Menu ,Spin, Tooltip , Badge, Popconfirm, Result } from "antd";
import axios from 'axios' import axios from 'axios'
import { WordsBtn, trigger, on, off, getUrl, downloadFile , sortDirections } from 'educoder' import { WordsBtn, trigger, on, off, getUrl, downloadFile , sortDirections } from 'educoder'
import ClipboardJS from 'clipboard' import ClipboardJS from 'clipboard'
import './studentsList.css';
/** /**
角色数组, CREATOR: 创建者, PROFESSOR: 教师, ASSISTANT_PROFESSOR: 助教, STUDENT: 学生 角色数组, CREATOR: 创建者, PROFESSOR: 教师, ASSISTANT_PROFESSOR: 助教, STUDENT: 学生
course_members_count: 0 course_members_count: 0
@ -103,10 +103,30 @@ function CourseGroupListTable(props) {
dataIndex: 'invite_code', dataIndex: 'invite_code',
key: 'invite_code', key: 'invite_code',
align:'center', align:'center',
width:"10%", width:"21%",
className:"color-grey-6", className:"color-grey-6",
render: (invite_code, record, index) => { render: (invite_code, record, index) => {
return invite_code return <React.Fragment>
<span>{invite_code}</span>
{
record.edit_auth ?
<span onClick={()=>changeInviteCode(record.id,record.invite_code_halt)} className={record.invite_code_halt ?"codeBtnStyle codeBtn_green ml10":"codeBtnStyle codeBtn_blue ml10"}>
{record.invite_code_halt ?"启用":"停用"}
</span>
:""
}
{isAdmin && !record.invite_code_halt &&
<Tooltip title={
<div>
<div>成员可以通过邀请码主动加入分班</div>
<div>点击复制邀请码</div>
</div>
}>
<WordsBtn data-clipboard-text={record.invite_code}
className={`copyBtn_${record.id} codeBtnStyle codeBtn_yellow ml10`} style={''}>复制</WordsBtn>
</Tooltip>
}
</React.Fragment>
} }
} : { } : {
title: '你当前所在分班', title: '你当前所在分班',
@ -127,22 +147,12 @@ function CourseGroupListTable(props) {
dataIndex: 'setting', dataIndex: 'setting',
key: 'setting', key: 'setting',
align:'center', align:'center',
width:"25%", width:"14%",
className:"color-grey-6", className:"color-grey-6",
render: (none, record, index) => { render: (none, record, index) => {
return <React.Fragment> return <React.Fragment>
{!isCourseEnd && isAdmin && <WordsBtn style2={{ marginRight: '12px' }} onClick={() => onDelete(record)} style={'grey'}>删除分班</WordsBtn>} {!isCourseEnd && isAdmin && <WordsBtn style2={{ marginRight: '12px' }} onClick={() => onDelete(record)} style={'grey'}>删除分班</WordsBtn>}
{isAdmin &&
<Tooltip title={
<div>
<div>成员可以通过邀请码主动加入分班</div>
<div>点击复制邀请码</div>
</div>
}>
<WordsBtn style2={{ marginRight: '12px' }} data-clipboard-text={record.invite_code}
className={`copyBtn_${record.id}`} style={''}>复制邀请码</WordsBtn>
</Tooltip>
}
{isStudent && <WordsBtn style2={{ marginRight: '12px' }} onClick={() => addToDir(record)} style={''}>加入分班</WordsBtn>} {isStudent && <WordsBtn style2={{ marginRight: '12px' }} onClick={() => addToDir(record)} style={''}>加入分班</WordsBtn>}
<WordsBtn onClick={() => onGoDetail(record)} style={''}>查看</WordsBtn> <WordsBtn onClick={() => onGoDetail(record)} style={''}>查看</WordsBtn>
</React.Fragment> </React.Fragment>
@ -209,6 +219,32 @@ function CourseGroupListTable(props) {
function onGoDetail(record) { function onGoDetail(record) {
props.history.push(`/courses/${courseId}/course_groups/${record.id}`) props.history.push(`/courses/${courseId}/course_groups/${record.id}`)
} }
// 停用和启用邀请码
function changeInviteCode(id,flag){
if(flag){
changeInviteCodeFunc(id,flag);
}else{
props.confirm({
content:"分班邀请码停用后,用户不能主动加入该分班了",
subContent:'您是否确认停用?',
onOk:() => {
changeInviteCodeFunc(id,flag)
}
})
}
}
function changeInviteCodeFunc(id,flag){
const url= `/course_groups/${id}/set_invite_code_halt.json`;
axios.post(url).then(result=>{
if(result){
props.showNotification(`邀请码${flag?"启用":"停用"}成功!`);
props.onOperationSuccess && props.onOperationSuccess();
}
}).catch(error=>{
console.log(error);
})
}
const isAdmin = props.isAdmin(); const isAdmin = props.isAdmin();
const isSuperAdmin = props.isSuperAdmin(); const isSuperAdmin = props.isSuperAdmin();
const isStudent = props.isStudent() const isStudent = props.isStudent()

@ -6,3 +6,46 @@
.E9F8FF{ .E9F8FF{
background-color: #E9F8FF; background-color: #E9F8FF;
} }
.codeBtnStyle{
height: 18px;
line-height: 18px;
padding:0px 5px;
cursor: pointer;
font-size: 12px;
border-radius: 2px;
}
.codeBtn_yellow{
border:1px solid #FF6B06;
color: #FF6B06!important;
}
.codeBtn_green{
border:1px solid #00BA38;
color: #00BA38!important;
}
.codeBtn_blue{
border:1px solid #4CACFF;
color: #4CACFF!important;
}
.course_publicNav{
display: flex;
}
.course_publicNav li{
position: relative;
margin-right: 30px;
cursor: pointer;
}
.course_publicNav li.active{
color: #4CACFF
}
.course_publicNav li.active::after{
position: absolute;
width: 100%;
height: 2px;
content: '';
left: 0px;
bottom: -33px;
background: #4CACFF;
}

@ -741,12 +741,22 @@ class studentsList extends Component{
<Titlesearchsection <Titlesearchsection
title={isParent ? (pageType == TYPE_STUDENTS ? "全部学生" : "学生列表"): title={isParent ? (pageType == TYPE_STUDENTS ? "全部学生" : "学生列表"):
<React.Fragment> <React.Fragment>
{
course_group_name ?
<span> <span>
<Tooltip title="返回至分班列表"> <Tooltip title="返回至分班列表">
<i className="icon-zuojiantou iconfont font-14" onClick={() => { this.props.history.push(`/courses/${courseId}/course_groups`)}} <i className="icon-zuojiantou iconfont font-14" onClick={() => { this.props.history.push(`/courses/${courseId}/course_groups`)}}
style={{color: '#212121', verticalAlign: 'initial', marginRight: '14px' }} style={{color: '#212121', verticalAlign: 'initial', marginRight: '14px' }}
></i> ></i>
</Tooltip>{course_group_name || ''}</span> </Tooltip>{course_group_name}
</span>
:
<ul className="course_publicNav">
<li onClick={() => { this.props.history.push(`/courses/${courseId}/course_groups`)}}>分班列表</li>
<li className="active">未分班</li>
</ul>
}
{isAdmin && invite_code && <React.Fragment> {isAdmin && invite_code && <React.Fragment>
<span className="color-grey-9 font-16 ml10">邀请码</span> <span className="color-grey-9 font-16 ml10">邀请码</span>
<span className="color-orange font-16"> <span className="color-orange font-16">

@ -30,6 +30,9 @@ class DetailTop extends Component{
OpenCourseTypes:false, OpenCourseTypes:false,
putappointmenttype:false, putappointmenttype:false,
getappointmenttype:false, getappointmenttype:false,
openpathss:false,
cancel_publics:false,
cancel_has_publics:false
} }
} }
componentDidMount(){ componentDidMount(){
@ -104,55 +107,38 @@ class DetailTop extends Component{
}) })
} }
applyissuePath=()=>{
this.setState({
Modalstype:true,
Modalstopval:"发布申请已提交,请等待管理员的审核",
Modalsbottomval:"• 我们将在1-2个工作日内完成审核",
loadtype:true
})
}
cancelissuePath=()=>{
let pathId=this.props.match.params.pathId; applyissuePath=()=>{
let url ="/paths/"+pathId+"/cancel_publish.json"; let pathid=this.props.match.params.pathId;
axios.get(url).then((result)=>{ let url ="/paths/"+pathid+"/publish.json";
axios.post(url).then((result)=>{
if(result.status===200){ if(result.status===200){
if(result.data.status===0){ if(result.data.status===0){
this.props.showNotification(result.data.message)
this.props.getlistdatas();
}else if(result.data.status===1){ }else if(result.data.status===1){
window.location.href = "/paths/" + result.data.subject_id // window.location.reload();
} }
} }
}).catch((error)=>{ }).catch((error)=>{
console.log(error); console.log(error);
}) })
}
reovkissuePath=()=>{
this.setState({
Modalstype:true,
Modalstopval:"是否确认撤销发布",
Modalsbottomval:"确认后,回退到编辑状态",
cardsModalsavetype:true,
})
} }
reovkissuePaths=()=>{ postcancelissuePath=()=>{
let pathId=this.props.match.params.pathId; let pathId=this.props.match.params.pathId;
let url ="/paths/"+pathId+"/cancel_has_publish.json"; let url ="/paths/"+pathId+"/cancel_publish.json";
axios.get(url).then((result)=>{ axios.post(url).then((result)=>{
if(result.status===200){ if(result.status===200){
if(result.data.status===0){ if(result.data.status===0){
}else if(result.data.status===1){ }else if(result.data.status===1){
this.setState({ this.cardsModalcancel()
cardsModalsavetype:false, this.props.showNotification("撤销发布成功")
loadtype:false, this.props.getlistdatas()
deletepathtype:false // window.location.href = "/paths/" + result.data.subject_id
})
window.location.href = "/paths/" + result.data.subject_id
} }
} }
}).catch((error)=>{ }).catch((error)=>{
@ -160,13 +146,36 @@ class DetailTop extends Component{
}) })
} }
cancelissuePath=()=>{
this.setState({
Modalstype: true,
Modalstopval: "是否确认撤销发布?",
// modalsMidval:"撤销发布后,学员将无法进行练习,若您新增关",
// Modalsbottomval:"卡,学员需要重新体验实训",
cardsModalsavetype: true,
modalstyles:"848282"
})
}
cardsModalcancel=()=>{ cardsModalcancel=()=>{
this.setState({ this.setState({
Modalstype:false, Modalstype:false,
Modalsbottomval:'', Modalsbottomval:'',
loadtype:false, loadtype:false,
deletepathtype:false, deletepathtype:false,
putappointmenttype:false putappointmenttype:false,
modalsMidval:'',
modalstyles:'',
cardsModalsavetype:false,
applyissuePath:false,
openpathss:false,
cancel_publics:false,
cancel_has_publics:false
}) })
} }
@ -317,6 +326,7 @@ class DetailTop extends Component{
// this.props.getlistdatas() // this.props.getlistdatas()
this.props.showNotification(response.data.message) this.props.showNotification(response.data.message)
}else{ }else{
this.cardsModalcancel()
this.props.showNotification(response.data.message) this.props.showNotification(response.data.message)
} }
@ -327,10 +337,93 @@ class DetailTop extends Component{
}) })
} }
postopenpaths=()=>{
let pathid=this.props.match.params.pathId;
let url ="/paths/"+pathid+"/apply_public.json";
axios.post(url).then((result)=>{
if(result.status===200){
if(result.data.status===0){
this.props.showNotification(result.data.message)
this.props.getlistdatas();
this.cardsModalcancel()
}else if(result.data.status===1){
this.props.showNotification(result.data.message)
this.props.getlistdatas();
this.cardsModalcancel()
}
}
}).catch((error)=>{
console.log(error);
})
}
openpaths=()=>{
this.setState({
Modalstype: true,
openpathss:true,
Modalstopval: "公开申请已提交,请等待管理员的审核",
modalsMidval:"• 我们将在1-2个工作日内完成审核",
Loadtype:true,
modalstyles:"848282"
})
}
postcancel_public=()=>{
let pathid=this.props.match.params.pathId;
let url ="/paths/"+pathid+"/cancel_public.json";
axios.post(url).then((result)=>{
if(result.status===200){
if(result.data.status===0){
this.cardsModalcancel()
this.props.showNotification("撤销申请公开成功")
this.props.getlistdatas();
}
}
}).catch((error)=>{
console.log(error);
})
}
cancel_public=()=>{
this.setState({
cancel_publics:true,
Modalstype: true,
Modalstopval: "是否确认撤销申请公开?",
modalsMidval:" ",
ModalsBottomval:" ",
})
}
postcancel_has_public=()=>{
let pathid=this.props.match.params.pathId;
let url ="/paths/"+pathid+"/cancel_has_public.json";
axios.post(url).then((result)=>{
if(result.status===200){
if(result.data.status===0){
this.cardsModalcancel()
this.props.showNotification("撤消公开成功")
this.props.getlistdatas();
}
}
}).catch((error)=>{
console.log(error);
})
}
cancel_has_public=()=>{
this.setState({
cancel_has_publics:true,
Modalstype: true,
Modalstopval: "是否确认撤销公开?",
modalsMidval:" ",
ModalsBottomval:" ",
})
}
render(){ render(){
let{detailInfoList}=this.props; let{detailInfoList}=this.props;
let{Modalstype,Modalstopval,cardsModalcancel,putappointmenttype,Modalsbottomval,cardsModalsavetype,loadtype,getappointmenttype}=this.state; let{Modalstype,Modalstopval,cardsModalcancel,putappointmenttype,Modalsbottomval,cardsModalsavetype,loadtype,getappointmenttype,openpathss,cancel_publics,cancel_has_publics}=this.state;
const radioStyle = { const radioStyle = {
display: 'block', display: 'block',
height: '30px', height: '30px',
@ -367,8 +460,10 @@ class DetailTop extends Component{
modalsTopval={Modalstopval} modalsTopval={Modalstopval}
modalsBottomval={Modalsbottomval} modalsBottomval={Modalsbottomval}
modalCancel={cardsModalcancel} modalCancel={cardsModalcancel}
modalSave={cardsModalsavetype===true?()=>this.reovkissuePaths():putappointmenttype===true?()=>this.getappointment():()=>this.cardsModalsave()} modalSave={cardsModalsavetype===true?()=>this.postcancelissuePath():openpathss===true?()=>this.postopenpaths():cancel_publics===true?()=>this.postcancel_public():cancel_has_publics===true?()=>this.postcancel_has_public():putappointmenttype===true?()=>this.getappointment():()=>this.cardsModalsave()}
loadtype={loadtype} loadtype={loadtype}
modalsMidval={this.state.modalsMidval}
modalstyles={this.state.modalstyles}
> >
</Modals> </Modals>
{this.state.yslJointhe===true?<Jointheclass {...this.props} {...this.state} ysljoinmodalCancel={()=>this.ysljoinmodalCancel()} ysljoinmodalCanceltwo={()=>this.ysljoinmodalCanceltwo(this.state.MenuItemskey)}></Jointheclass>:""} {this.state.yslJointhe===true?<Jointheclass {...this.props} {...this.state} ysljoinmodalCancel={()=>this.ysljoinmodalCancel()} ysljoinmodalCanceltwo={()=>this.ysljoinmodalCanceltwo(this.state.MenuItemskey)}></Jointheclass>:""}
@ -436,7 +531,7 @@ class DetailTop extends Component{
border:1px solid rgba(255,255,255,1); border:1px solid rgba(255,255,255,1);
} }
.maxwinth600{ .maxwinth600{
width:740px; width:730px;
} }
` `
} }
@ -473,33 +568,48 @@ class DetailTop extends Component{
} }
{ detailInfoList.allow_send === true? { detailInfoList.allow_send === true?
<SendPanel {...this.props} {...this.state}></SendPanel>:"" <SendPanel {...this.props} {...this.state} widths={"80px"}></SendPanel>
:""
} }
{this.props.courses===undefined?"":detailInfoList.is_creator===true?<a className={"fr font-18 color-white kaike mr20 kkbths"} onClick={()=>this.OpenCoursefun()}>开课</a>:""} {this.props.courses===undefined?"":detailInfoList.is_creator===true?<a className={"fr font-18 color-white kaike mr20 kkbths"} style={{'width':'65px'}} onClick={()=>this.OpenCoursefun()}>开课</a>:""}
{ { detailInfoList.allow_statistics===true&& detailInfoList.public_status===2?
detailInfoList.publish_status===2 && detailInfoList.allow_statistics===true? <a className="fr font-18 color-white kaike mr20 kkbths" onClick={this.cancel_has_public}>撤销公开</a>:""
<a className="fr font-18 color-white kaike mr20 kkbths" onClick={this.reovkissuePath}>撤销发布</a>:"" }
{detailInfoList.allow_statistics===true&& detailInfoList.public_status===1?
<a className="fr font-18 color-white kaike mr20 kkbths" onClick={this.cancel_public} style={{width:'135px'}}>撤销申请公开</a>:""
}
{ detailInfoList.publish_status===2&& detailInfoList.allow_statistics===true&& detailInfoList.public_status===0?
<a className="fr font-18 color-white kaike mr20 kkbths" onClick={this.openpaths}>申请公开</a>:""
} }
{ {
detailInfoList.publish_status===1 && detailInfoList.allow_statistics===true? detailInfoList.publish_status===2 && detailInfoList.allow_statistics===true&&detailInfoList.public_status===0?
<a className="fr font-18 color-white kaike mr20 kkbths" onClick={this.cancelissuePath}>撤销申请</a>:"" <a className="fr font-18 color-white kaike mr20 kkbths" onClick={this.cancelissuePath}>撤销发布</a>:""
} }
{ {
detailInfoList.publish_status===0&&detailInfoList.allow_add_member===true? detailInfoList.publish_status===0&&detailInfoList.allow_add_member===true?
<a className="fr font-18 color-white kaike mr20 kkbths" onClick={this.applyissuePath}>申请发布</a>:"" <a className="fr font-18 color-white kaike mr20 kkbths"
style={{'width':'65px'}}
onClick={this.applyissuePath}>发布</a>:""
} }
{detailInfoList===undefined?"":detailInfoList.allow_delete===true?<a {detailInfoList===undefined?"":detailInfoList.allow_delete===true?<a
className={"fr font-18 color-white kaike mr20 kkbths"} className={"fr font-18 color-white kaike mr20 kkbths"}
onClick={this.allow_deletepath} onClick={this.allow_deletepath}
style={{'width':'65px'}}
>删除</a>:""} >删除</a>:""}
{detailInfoList===undefined?"":detailInfoList.allow_statistics===true? {detailInfoList===undefined?"":detailInfoList.allow_statistics===true?
<Link to={"/paths/"+this.props.match.params.pathId+"/edit"} className="fr font-18 color-white kaike mr20 kkbths" > <Link to={"/paths/"+this.props.match.params.pathId+"/edit"}
style={{'width':'65px'}}
className="fr font-18 color-white kaike mr20 kkbths" >
编辑 编辑
</Link> </Link>
:"" :""

@ -180,7 +180,9 @@ class sendPanel extends Component{
{ {
this.props.detailInfoList===undefined?"":this.props.detailInfoList.allow_send===true? this.props.detailInfoList===undefined?"":this.props.detailInfoList.allow_send===true?
<Tooltip placement="bottom" title="以实训作业的形式发送到我的课堂"> <Tooltip placement="bottom" title="以实训作业的形式发送到我的课堂">
<a onClick = {this.SentToLesson} className="fr font-18 color-white kaike mr20 kkbths"> <a onClick = {this.SentToLesson} className="fr font-18 color-white kaike mr20 kkbths"
style={{width:this.props&&this.props.widths}}
>
发送至 发送至
</a> </a>
</Tooltip>:'' </Tooltip>:''

@ -252,6 +252,8 @@ class InfosPath extends Component{
href="javascript:void(0)" onClick={() => this.changeStatus("applying")} className="w60">待审核</a></li> href="javascript:void(0)" onClick={() => this.changeStatus("applying")} className="w60">待审核</a></li>
<li className={status == "published" ? "active whitepanelysllisyt" : "whitepanelysllisyt"}><a <li className={status == "published" ? "active whitepanelysllisyt" : "whitepanelysllisyt"}><a
href="javascript:void(0)" onClick={() => this.changeStatus("published")} className="w60">已发布</a></li> href="javascript:void(0)" onClick={() => this.changeStatus("published")} className="w60">已发布</a></li>
<li className={status == "publiced" ? "active whitepanelysllisyt" : "whitepanelysllisyt"}><a
onClick={() => this.changeStatus("publiced")} className="w60" href="javascript:void(0)">已公开</a></li>
</div> </div>
} }
{ {

@ -265,10 +265,10 @@ class InfosShixun extends Component{
<a onClick={() => this.changeStatus()} className="w32" href="javascript:void(0)">全部</a></li> <a onClick={() => this.changeStatus()} className="w32" href="javascript:void(0)">全部</a></li>
<li className={status == "editing" ? "active whitepanelysllisyt" : "whitepanelysllisyt"}><a <li className={status == "editing" ? "active whitepanelysllisyt" : "whitepanelysllisyt"}><a
onClick={() => this.changeStatus("editing")} className="w60" href="javascript:void(0)">编辑中</a></li> onClick={() => this.changeStatus("editing")} className="w60" href="javascript:void(0)">编辑中</a></li>
<li className={status == "published" ? "active whitepanelysllisyt" : "whitepanelysllisyt"}><a
onClick={() => this.changeStatus("published")} className="w60" href="javascript:void(0)">已发布</a></li>
<li className={status == "applying" ? "active whitepanelysllisyt" : "whitepanelysllisyt"}><a <li className={status == "applying" ? "active whitepanelysllisyt" : "whitepanelysllisyt"}><a
onClick={() => this.changeStatus("applying")} className="w60" href="javascript:void(0)">待审核</a></li> onClick={() => this.changeStatus("applying")} className="w60" href="javascript:void(0)">待审核</a></li>
<li className={status == "published" ? "active whitepanelysllisyt" : "whitepanelysllisyt"}><a
onClick={() => this.changeStatus("published")} className="w60" href="javascript:void(0)">已发布</a></li>
<li className={status == "publiced" ? "active whitepanelysllisyt" : "whitepanelysllisyt"}><a <li className={status == "publiced" ? "active whitepanelysllisyt" : "whitepanelysllisyt"}><a
onClick={() => this.changeStatus("publiced")} className="w60" href="javascript:void(0)">已公开</a></li> onClick={() => this.changeStatus("publiced")} className="w60" href="javascript:void(0)">已公开</a></li>
<li className={status == "closed" ? "active whitepanelysllisyt" : "whitepanelysllisyt"}><a <li className={status == "closed" ? "active whitepanelysllisyt" : "whitepanelysllisyt"}><a

File diff suppressed because it is too large Load Diff

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 it is too large Load Diff

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 384 KiB

After

Width:  |  Height:  |  Size: 393 KiB

Loading…
Cancel
Save