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_account, except: [:index, :show, :right_banner]
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,
:search_members, :add_subject_members, :statistics, :shixun_report, :school_report,
:up_member_position, :down_member_position, :update_team_title, :statistics_info]
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,
: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 :shixun_marker, only: [:add_shixun_to_stage]
@ -33,16 +34,16 @@ class SubjectsController < ApplicationController
laboratory_join = " AND subjects.id in #{subject_ids} "
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
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")
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
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")
end
else
@ -59,7 +60,7 @@ class SubjectsController < ApplicationController
elsif reorder == "publish_time"
@subjects = @subjects.unhidden
else
@subjects = @subjects.visible.unhidden
@subjects = @subjects.publiced.unhidden
end
# 类型
@ -72,7 +73,7 @@ class SubjectsController < ApplicationController
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)
end
@ -273,14 +274,44 @@ class SubjectsController < ApplicationController
end
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
if apply && apply.status == 0
@status = 0
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)
begin
status = Educoder::Sms.send(mobile: '18711011226', send_type:'publish_subject' , name: '管理员')
Educoder::Sms.send(mobile: '18711011226', send_type:'publish_subject' , name: '管理员')
rescue => e
uid_logger_error("发送验证码出错: #{e}")
end
@ -288,28 +319,28 @@ class SubjectsController < ApplicationController
end
end
def cancel_publish
def cancel_public
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)
@subject.update_attributes(public: 0)
render_ok
rescue => e
uid_logger_error(e.message)
tip_exception("撤销申请失败")
raise ActiveRecord::Rollback
end
end
def cancel_has_publish
def cancel_has_public
begin
@subject.update_attributes(:status => 0)
@subject.update_attributes(:public => 0)
render_ok
rescue => e
uid_logger_error(e.message)
tip_exception("撤销发布失败")
raise ActiveRecord::Rollback
tip_exception("撤销公开失败")
end
end

@ -6,6 +6,6 @@ module Admins::SubjectsHelper
when 1 then 'text-warning'
when 2 then 'text-success'
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

@ -1,12 +1,23 @@
module SubjectsHelper
# 实训路径的发布状态
def publish_status subject, is_manager, user
def publish_status subject, is_manager
status = -1
if is_manager
status = 0 if subject.status == 0
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
status
end

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

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

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

@ -10,7 +10,7 @@ class Admins::SubjectAuths::AgreeApplyService < ApplicationService
def call
ActiveRecord::Base.transaction do
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!
end

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

@ -41,7 +41,8 @@ class SearchService < ApplicationService
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) } }
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
{ where: { id: Laboratory.current.all_courses.pluck(:id) } }
else

@ -17,9 +17,12 @@ class SubjectSearchService < ApplicationService
if type == "mine"
@subjects = @subjects.where(id: User.current.subjects).visible.unhidden
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
Subject.search(keyword, search_options)
end

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

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

@ -6,7 +6,8 @@ json.subject_score @subject.all_score
json.member_count @subject.member_count
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_send @user.logged?
json.allow_visit @subject.status > 1 || @is_manager

@ -1,6 +1,10 @@
'zh-CN':
subject:
status:
'0': 编辑中
'1': 审核中
'2': 已发布
public:
'0': 编辑中
'1': 审核中
'2': 已发布

@ -406,9 +406,12 @@ Rails.application.routes.draw do
resources :subjects, path: :paths do
member do
get 'choose_subject_shixun'
get 'publish'
get 'cancel_publish'
get 'cancel_has_publish'
post 'publish'
post :apply_public
post :cancel_public
post 'cancel_publish'
post 'cancel_has_publish'
post :cancel_has_public
get 'statistics'
get 'statistics_info'
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{
s = "邀请码停用后,用户不能主动加入该课堂了";
s = "课堂邀请码停用后,用户不能主动加入该课堂了";
ss = "您是否确认停用?";
this.showActionPoll(i,s,ss)
}

@ -1019,7 +1019,7 @@ class Coursesleftnav extends Component{
<a>
<li title={item.name.length<7?"":item.name} onClick={(e)=>this.showsandians(e,key,item.category_url,1,item.id,item.type)} className={this.props.mainurl===item.category_url&&this.props.location.pathname===item.category_url?"liactive":"clearfix active"} onMouseLeave={(e)=>this.hidesandian(e,key)} onMouseEnter={(e)=>this.showsandian(e,key)}>
<a onClick={(e)=>this.showsandians(e,key,item.category_url,1,item.id,item.type)} className={ item.second_category===undefined?"fl ml20 pd0":item.second_category.length===0?"fl ml20 pd0":this.state.sandiantypes===key?"fl ml20 pd0 ebebeb":"fl ml20 pd0"}>
{
{
item.type==="announcement"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-xiaoxi1 mr10 fl":"iconfont icon-xiaoxi1 mr10 fl"}></i>:
item.type==="online_learning"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-kecheng mr10 fl font-16":"iconfont icon-kecheng mr10 fl font-16"}></i>:
item.type==="shixun_homework"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-daima mr10 fl":"iconfont icon-daima mr10 fl"}></i>:
@ -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==="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==="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*/}
@ -1173,8 +1173,8 @@ class Coursesleftnav extends Component{
item.type==="attachment"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-ziyuan mr10 fl":"iconfont icon-ziyuan 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==="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>:""
}

@ -133,7 +133,12 @@ function CourseGroupList(props) {
modalsType={DownloadType}
/>
<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 }
onInputSearchChange={onInputSearchChange}
allowClearonChange={onInputSearchChange}
@ -211,12 +216,12 @@ function CourseGroupList(props) {
onPressEnter={onPressEnter}
></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 style={{color: '#999999'}}>{none_group_member_count}个学生</span>
<WordsBtn style="blue" className="fr">查看</WordsBtn>
</div>}
</div>} */}
<Spin size="large" spinning={isSpin}>
{course_groups && !!course_groups.length ?

@ -1,11 +1,11 @@
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 { WordsBtn, trigger, on, off, getUrl, downloadFile , sortDirections } from 'educoder'
import ClipboardJS from 'clipboard'
import './studentsList.css';
/**
角色数组, CREATOR: 创建者, PROFESSOR: 教师, ASSISTANT_PROFESSOR: 助教, STUDENT: 学生
course_members_count: 0
@ -103,10 +103,30 @@ function CourseGroupListTable(props) {
dataIndex: 'invite_code',
key: 'invite_code',
align:'center',
width:"10%",
width:"21%",
className:"color-grey-6",
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: '你当前所在分班',
@ -127,22 +147,12 @@ function CourseGroupListTable(props) {
dataIndex: 'setting',
key: 'setting',
align:'center',
width:"25%",
width:"14%",
className:"color-grey-6",
render: (none, record, index) => {
return <React.Fragment>
{!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>}
<WordsBtn onClick={() => onGoDetail(record)} style={''}>查看</WordsBtn>
</React.Fragment>
@ -209,6 +219,32 @@ function CourseGroupListTable(props) {
function onGoDetail(record) {
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 isSuperAdmin = props.isSuperAdmin();
const isStudent = props.isStudent()

@ -5,4 +5,47 @@
.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
title={isParent ? (pageType == TYPE_STUDENTS ? "全部学生" : "学生列表"):
<React.Fragment>
<span>
<Tooltip title="返回至分班列表">
<i className="icon-zuojiantou iconfont font-14" onClick={() => { this.props.history.push(`/courses/${courseId}/course_groups`)}}
style={{color: '#212121', verticalAlign: 'initial', marginRight: '14px' }}
></i>
</Tooltip>{course_group_name || ''}</span>
{
course_group_name ?
<span>
<Tooltip title="返回至分班列表">
<i className="icon-zuojiantou iconfont font-14" onClick={() => { this.props.history.push(`/courses/${courseId}/course_groups`)}}
style={{color: '#212121', verticalAlign: 'initial', marginRight: '14px' }}
></i>
</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>
<span className="color-grey-9 font-16 ml10">邀请码</span>
<span className="color-orange font-16">

@ -30,6 +30,9 @@ class DetailTop extends Component{
OpenCourseTypes:false,
putappointmenttype:false,
getappointmenttype:false,
openpathss:false,
cancel_publics:false,
cancel_has_publics:false
}
}
componentDidMount(){
@ -104,61 +107,60 @@ class DetailTop extends Component{
})
}
applyissuePath=()=>{
this.setState({
Modalstype:true,
Modalstopval:"发布申请已提交,请等待管理员的审核",
Modalsbottomval:"• 我们将在1-2个工作日内完成审核",
loadtype:true
})
let pathid=this.props.match.params.pathId;
let url ="/paths/"+pathid+"/publish.json";
axios.post(url).then((result)=>{
if(result.status===200){
if(result.data.status===0){
this.props.showNotification(result.data.message)
this.props.getlistdatas();
}else if(result.data.status===1){
// window.location.reload();
}
}
}).catch((error)=>{
console.log(error);
})
}
postcancelissuePath=()=>{
let pathId=this.props.match.params.pathId;
let url ="/paths/"+pathId+"/cancel_publish.json";
axios.post(url).then((result)=>{
if(result.status===200){
if(result.data.status===0){
}else if(result.data.status===1){
this.cardsModalcancel()
this.props.showNotification("撤销发布成功")
this.props.getlistdatas()
// window.location.href = "/paths/" + result.data.subject_id
}
}
}).catch((error)=>{
console.log(error);
})
}
cancelissuePath=()=>{
let pathId=this.props.match.params.pathId;
let url ="/paths/"+pathId+"/cancel_publish.json";
axios.get(url).then((result)=>{
if(result.status===200){
if(result.data.status===0){
}else if(result.data.status===1){
window.location.href = "/paths/" + result.data.subject_id
}
}
}).catch((error)=>{
console.log(error);
})
}
reovkissuePath=()=>{
this.setState({
Modalstype: true,
Modalstopval: "是否确认撤销发布?",
// modalsMidval:"撤销发布后,学员将无法进行练习,若您新增关",
// Modalsbottomval:"卡,学员需要重新体验实训",
cardsModalsavetype: true,
modalstyles:"848282"
})
this.setState({
Modalstype:true,
Modalstopval:"是否确认撤销发布",
Modalsbottomval:"确认后,回退到编辑状态",
cardsModalsavetype:true,
})
}
reovkissuePaths=()=>{
let pathId=this.props.match.params.pathId;
let url ="/paths/"+pathId+"/cancel_has_publish.json";
axios.get(url).then((result)=>{
if(result.status===200){
if(result.data.status===0){
}else if(result.data.status===1){
this.setState({
cardsModalsavetype:false,
loadtype:false,
deletepathtype:false
})
window.location.href = "/paths/" + result.data.subject_id
}
}
}).catch((error)=>{
console.log(error);
})
}
cardsModalcancel=()=>{
this.setState({
@ -166,7 +168,14 @@ class DetailTop extends Component{
Modalsbottomval:'',
loadtype: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.showNotification(response.data.message)
}else{
this.cardsModalcancel()
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(){
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 = {
display: 'block',
height: '30px',
@ -367,8 +460,10 @@ class DetailTop extends Component{
modalsTopval={Modalstopval}
modalsBottomval={Modalsbottomval}
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}
modalsMidval={this.state.modalsMidval}
modalstyles={this.state.modalstyles}
>
</Modals>
{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);
}
.maxwinth600{
width:740px;
width:730px;
}
`
}
@ -473,33 +568,48 @@ class DetailTop extends Component{
}
{ 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.publish_status===2 && detailInfoList.allow_statistics===true?
<a className="fr font-18 color-white kaike mr20 kkbths" onClick={this.reovkissuePath}>撤销发布</a>:""
{ detailInfoList.allow_statistics===true&& detailInfoList.public_status===2?
<a className="fr font-18 color-white kaike mr20 kkbths" onClick={this.cancel_has_public}>撤销公开</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?
<a className="fr font-18 color-white kaike mr20 kkbths" onClick={this.cancelissuePath}>撤销申请</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.cancelissuePath}>撤销发布</a>:""
}
{
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
className={"fr font-18 color-white kaike mr20 kkbths"}
onClick={this.allow_deletepath}
style={{'width':'65px'}}
>删除</a>:""}
{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>
:""

@ -69,7 +69,7 @@ class sendPanel extends Component{
openSearch:false
})
}
// 选择课堂获取选中的Id
selectCloseList=(e)=>{
this.setState({
@ -85,7 +85,7 @@ class sendPanel extends Component{
// shixunNum:list.length
})
}
//确认提交
submitInfo=()=>{
let {sendToCourseId,sendToShixunArray}=this.state;
@ -180,7 +180,9 @@ class sendPanel extends Component{
{
this.props.detailInfoList===undefined?"":this.props.detailInfoList.allow_send===true?
<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>
</Tooltip>:''
@ -199,8 +201,8 @@ class sendPanel extends Component{
// onMouseLeave={this.closeList}
>
<Select
placeholder="请选择您要发送的课堂"
style={{"width":"100%"}}
placeholder="请选择您要发送的课堂"
style={{"width":"100%"}}
onSelect={this.selectCloseList}
// onMouseEnter={this.openList}
defaultOpen={false}
@ -217,7 +219,7 @@ class sendPanel extends Component{
{moment( item.created_at ).format('YYYY-MM-DD HH:mm')}
</Col>
</Row>
</Option>
</Option>
)
})
}
@ -262,6 +264,6 @@ class sendPanel extends Component{
</div>
)
}
}
export default SnackbarHOC()(sendPanel);

@ -252,6 +252,8 @@ class InfosPath extends Component{
href="javascript:void(0)" onClick={() => this.changeStatus("applying")} className="w60">待审核</a></li>
<li className={status == "published" ? "active whitepanelysllisyt" : "whitepanelysllisyt"}><a
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>
}
{

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