Merge branch 'dev_aliyun' into dev_cxt

dev_hjm_a
cxt 5 years ago
commit 0c6507624b

@ -3,7 +3,8 @@ class Ecs::CourseManagersController < Ecs::CourseBaseController
before_action :check_major_manager_permission!, only: [:create, :destroy]
def create
@user = Ecs::CreateCourseManagerService.call(current_course, params[:user_id])
Ecs::CreateCourseManagerService.call(current_course, params[:user_ids])
render_ok
rescue Ecs::CreateCourseManagerService::Error => ex
render_error(ex.message)
end

@ -692,7 +692,7 @@ class PollsController < ApplicationController
else
unified_setting = @poll.unified_setting
end
show_result = params[:show_result].to_i
show_result = params[:show_result]
un_anonymous = params[:un_anonymous] ? true : false
# 统一设置或者分班为0则更新问卷并删除问卷分组
if unified_setting || (course_group_ids.size == 0)

@ -0,0 +1,5 @@
class TemplatesController < ApplicationController
def show
@template = EcTemplate.find_by_name!(params[:name])
end
end

@ -0,0 +1,11 @@
class Wechat::App
class << self
attr_accessor :appid, :secret
delegate :access_token, :jscode2session, to: :client
def client
@_client ||= Wechat::Client.new(appid, secret)
end
end
end

@ -34,6 +34,10 @@ class Wechat::Client
jsapi_ticket
end
def jscode2session(code)
request(:get, '/sns/jscode2session', appid: appid, secret: secret, js_code: code, grant_type: 'authorization_code')
end
def access_token_cache_key
"#{base_cache_key}/access_token"
end
@ -49,7 +53,7 @@ class Wechat::Client
private
def request(method, url, **params)
Rails.logger.error("[wechat] request: #{method} #{url} #{params.inspect}")
Rails.logger.error("[wechat] request: #{method} #{url} #{params.except(:secret).inspect}")
client = Faraday.new(url: BASE_SITE)
response = client.public_send(method, url, params)

@ -2,20 +2,14 @@ class Wechat::OfficialAccount
class << self
attr_accessor :appid, :secret
delegate :access_token, :jsapi_ticket, to: :client
def js_sdk_signature(url, noncestr, timestamp)
data = { jsapi_ticket: jsapi_ticket, noncestr: noncestr, timestamp: timestamp, url: url }
str = data.map { |k, v| "#{k}=#{v}" }.join('&')
Digest::SHA1.hexdigest(str)
end
def access_token
client.access_token
end
def jsapi_ticket
client.jsapi_ticket
end
def client
@_client ||= Wechat::Client.new(appid, secret)
end

@ -5,7 +5,7 @@ class MirrorRepository < ApplicationRecord
scope :published_mirror, -> { where(status: 1) }
scope :published_mirror, -> { where(status: [1,2,3,5]) }
scope :published_main_mirror, -> { published_mirror.where(main_type: 1) }
scope :published_small_mirror, -> { published_mirror.where(main_type: 0) }

@ -3,27 +3,29 @@ class Ecs::CreateCourseManagerService < ApplicationService
COURSE_MANAGER_COUNT_LIMIT = 2 # 课程管理员数量限制
attr_reader :ec_course, :user_id
attr_reader :ec_course, :user_ids
def initialize(ec_course, user_id)
def initialize(ec_course, user_ids)
@ec_course = ec_course
@user_id = user_id
@user_ids = user_ids
end
def call
user = User.find_by(id: params[:user_id])
raise Error, '该用户不存在' if user.blank?
users_count = User.where(id: user_ids).count
raise Error, '用户不存在' if users_count != user_ids.size
if ec_course.ec_course_users.exists?(user_id: user.id)
raise Error, '用户已经是该课程的管理员'
if ec_course.ec_course_users.exists?(user_id: user_ids)
raise Error, '用户已经是该课程的管理员'
end
if ec_course.ec_course_users.count >= COURSE_MANAGER_COUNT_LIMIT
raise Error, '该课程管理员数量已达上限'
if ec_course.ec_course_users.count + user_ids.size > COURSE_MANAGER_COUNT_LIMIT
raise Error, "课程管理员数量过多(最多#{COURSE_MANAGER_COUNT_LIMIT}"
end
ec_course.ec_course_users.create!(user: user)
user
ActiveRecord::Base.transaction do
user_ids.each do |user_id|
ec_course.ec_course_users.create!(user_id: user_id)
end
end
end
end

@ -1 +0,0 @@
json.partial! 'ecs/shared/user', user: @user

@ -2,4 +2,5 @@ json.partial! "graduation_topics/show_navigation", locals: {course: course, grad
json.task_status task_curr_status(graduation, course)[:status]
json.task_name graduation.name
json.task_id graduation.id
json.status graduation.status
json.status graduation.status
json.end_time graduation.end_time

@ -0,0 +1,3 @@
json.template do
json.partial! 'attachments/attachment_simple', attachment: @template.attachments.last
end

@ -821,6 +821,7 @@ Rails.application.routes.draw do
post :feedback
end
end
resource :template, only: [:show]
end
namespace :admins do

@ -661,6 +661,11 @@ class CoursesIndex extends Component{
(props) => (<ListPageIndex {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
<Route path="/courses/:coursesId/course_groups"
render={
(props) => (<ListPageIndex {...this.props} {...props} {...this.state} {...common}/>)
}
></Route>
{/* 普通作业 */}
<Route path="/courses/:coursesId/common_homeworks/:category_id" exact

@ -232,6 +232,11 @@ class ListPageIndex extends Component{
(props) => (<StudentsList {...this.props} {...props} {...this.state} />)
}
></Route>
<Route path="/courses/:coursesId/course_groups"
render={
(props) => (<StudentsList {...this.props} {...props} {...this.state} />)
}
></Route>
<Route path="/courses/:coursesId/exercises/:Id"
render={

@ -242,7 +242,7 @@ class Fileslistitem extends Component{
{
discussMessage.is_lock === true ?
<Tooltip title={ this.props.isNotMember===true?"私有属性,非课堂成员不能访问":"私有属性"} placement="bottom">
<Tooltip title={"私有属性,非课堂成员不能访问"} placement="bottom">
<i className="iconfont icon-guansuo color-grey-c ml10 font-16 fl mt4"></i>
</Tooltip>
:""

@ -593,7 +593,7 @@ class Fileslists extends Component{
modalname:"立即发布",
visible:true,
typs:"start",
Topval:"学生将能立即查看和下载发布资源",
Topval:"学生将能立即收到资源",
// Botvalleft:"暂不发布",
// Botval:`本操作只对"未发布"的分班有效`,
// starttime:"发布时间:"+moment(moment(new Date())).format("YYYY-MM-DD HH:mm"),

@ -70,7 +70,7 @@ class BoardsListItem extends Component{
{ !!discussMessage.sticky && <span className="btn-cir btn-cir-red fl mt5 ml5">置顶</span> }
{
discussMessage.is_public == false ? (<Tooltip title={`${isAdminOrStudent ? '私有属性' : '私有属性,非课堂成员不能访问'}`} placement="bottom">
discussMessage.is_public == false ? (<Tooltip title={'私有属性,非课堂成员不能访问'} placement="bottom">
<i className="iconfont icon-guansuo color-grey-c ml10 font-16 fl mt4"></i>
</Tooltip>) : ""
}

@ -308,15 +308,11 @@ class CommonWorkDetailIndex extends Component{
onClick={() => this.setState({moduleName: '参考答案'})}
className={`${childModuleName == '参考答案' ? 'active' : '' } `}
to={`/courses/${courseId}/${moduleEngName}/${workId}/answer`}>参考答案</Link>}
{this.props.isAdmin() ?
<Link
onClick={() => this.setState({moduleName: '设置'})}
className={`${childModuleName == '设置' ? 'active' : '' } `}
style={{paddingLeft:'38px'}}
to={`/courses/${courseId}/${moduleEngName}/${workId}/setting`}>设置</Link>:
""
}
style={{paddingLeft:this.props.isAdmin()?'38px':'20px'}}
to={`/courses/${courseId}/${moduleEngName}/${workId}/setting`}>{this.props.isAdmin()?"设置":"得分规则"}</Link>
{/* { this.props.tabRightComponents } */}

@ -175,7 +175,7 @@ class CommonWorkItem extends Component{
{/* 只有非课堂成员且作业是私有的情况下才会为true */}
{
item.private_icon===true ?
(<Tooltip title={ isAdminOrStudent ? "私有属性" : "私有属性,非课堂成员不能访问"} placement="bottom" >
(<Tooltip title={"私有属性,非课堂成员不能访问"} placement="bottom" >
<i className="iconfont icon-guansuo color-grey-c ml10 font-16 fl"></i>
</Tooltip>) : ""
}

@ -1055,7 +1055,7 @@ class CommonWorkSetting extends Component{
{/* <Tooltip placement="bottom" title={this.props.isSuperAdmin()?"":publish_time_type===true?"":""}>
</Tooltip> */}
<ConditionToolTip condition={moment(this.state.init_publish_time) < this.fetchMoment} title={"时间已过,不能再修改"}>
<ConditionToolTip condition={moment(this.state.init_publish_time) < this.fetchMoment} title={this.props.isAdmin()?"时间已过,不能再修改":""}>
<span>
<DatePicker
@ -1087,7 +1087,7 @@ class CommonWorkSetting extends Component{
<span>截止时间</span>
{/* <Tooltip placement="bottom" title={this.props.isSuperAdmin()?"":end_time_type===true?"":""}>
</Tooltip> */}
<ConditionToolTip condition={moment(this.state.init_end_time) < this.fetchMoment} title={"时间已过,不能再修改"}>
<ConditionToolTip condition={moment(this.state.init_end_time) < this.fetchMoment} title={this.props.isAdmin()?"时间已过,不能再修改":""}>
<span>
<DatePicker
dropdownClassName="hideDisable"
@ -1210,8 +1210,8 @@ class CommonWorkSetting extends Component{
{/* 开启时间 */}
<div className={"h20 mb30 ml60"}>
<span>开启时间</span>
<Tooltip placement="bottom" title={this.props.isSuperAdmin()?"":starttimetype===true?"发布时间已过,则不能修改":""}>
<ConditionToolTip condition={moment(init_evaluation_start) < this.fetchMoment} title={"时间已过,不能再修改"}>
<Tooltip placement="bottom" title={this.props.isSuperAdmin()?"":starttimetype===true?this.props.isAdmin()?"发布时间已过,则不能修改":"":""}>
<ConditionToolTip condition={moment(init_evaluation_start) < this.fetchMoment} title={this.props.isAdmin()?"时间已过,不能再修改":""}>
<span>
<DatePicker
dropdownClassName="hideDisable"
@ -1244,7 +1244,7 @@ class CommonWorkSetting extends Component{
{/* <Tooltip placement="bottom" title={this.props.isSuperAdmin()?"":starttimetype===true?"":""}>
</Tooltip> */}
<ConditionToolTip condition={moment(init_evaluation_end) < this.fetchMoment} title={"时间已过,不能再修改"}>
<ConditionToolTip condition={moment(init_evaluation_end) < this.fetchMoment} title={this.props.isAdmin()?"时间已过,不能再修改":""}>
<span>
<DatePicker
dropdownClassName="hideDisable"
@ -1283,7 +1283,7 @@ class CommonWorkSetting extends Component{
{/* 匿评数量 */}
<div className={"h20 mb30 ml60"}>
<span>匿评数量</span>
<Tooltip placement="bottom" title={this.props.isSuperAdmin()?"":starttimetype===true?"发布时间已过,则不能修改":""}>
<Tooltip placement="bottom" title={this.props.isSuperAdmin()?"":starttimetype===true?this.props.isAdmin()?"发布时间已过,则不能修改":"":""}>
<span>
<Input type="number" className="mr10" style={{width:"100px" }} value={evaluation_num} onInput={this.evaluation_num_change}
disabled={anonymous_comment && !noAuth? false : true} min={0} max={100}
@ -1296,7 +1296,7 @@ class CommonWorkSetting extends Component{
<div className={"h20 mb30 ml60"}>
<span>缺评扣分</span>
<Tooltip placement="bottom" title={this.props.isSuperAdmin()?"":starttimetype===true?"发布时间已过,则不能修改":""}>
<Tooltip placement="bottom" title={this.props.isSuperAdmin()?"":starttimetype===true?this.props.isAdmin()?"发布时间已过,则不能修改":"":""}>
<span>
<Input type="number" className="mr10" style={{width:"100px" }} value={absence_penalty} onInput={this.absence_penalty_change}
disabled={ anonymous_comment && !noAuth ? false : true} min={0} max={100}
@ -1343,7 +1343,7 @@ class CommonWorkSetting extends Component{
<span>结束时间</span>
{/* <Tooltip placement="bottom" title={this.props.isSuperAdmin()?"":starttimetype===true?"":""}>
</Tooltip> */}
<ConditionToolTip condition={moment(init_appeal_time) < this.fetchMoment} title={"时间已过,不能再修改"}>
<ConditionToolTip condition={moment(init_appeal_time) < this.fetchMoment} title={this.props.isAdmin()?"时间已过,不能再修改":""}>
<span>
<DatePicker
dropdownClassName="hideDisable"
@ -1371,7 +1371,7 @@ class CommonWorkSetting extends Component{
{/* 违规匿评扣分: */}
<div className={"h20 mb30 ml60"}>
<span>违规匿评扣分</span>
<Tooltip placement="bottom" title={this.props.isSuperAdmin()?"":starttimetype===true?"发布时间已过,则不能修改":""}>
<Tooltip placement="bottom" title={this.props.isSuperAdmin()?"":starttimetype===true?this.props.isAdmin()?"发布时间已过,则不能修改":"":""}>
<span>
<Input type="number" className="mr10" style={{width:"100px" }} value={appeal_penalty} onInput={this.appeal_penalty_change}
disabled={ anonymous_appeal && !noAuth ? false : true} min={0} max={100}
@ -1393,7 +1393,7 @@ class CommonWorkSetting extends Component{
</div>
<div className={"mb30 ml60"}>
<Tooltip placement="bottom" title={this.props.isSuperAdmin()?"":starttimetype===true?"发布时间已过,则不能修改":""}>
<Tooltip placement="bottom" title={this.props.isSuperAdmin()?"":starttimetype===true?this.props.isAdmin()?"发布时间已过,则不能修改":"":""}>
<RadioGroup onChange={this.ta_mode_change} value={ta_mode}>
<Radio style={radioStyle} value={1} disabled={noAuth}>
普通模式<span className={"font-14 color-grey-9 ml10"}>选中则取各助教最终评分的平均分</span>

@ -144,13 +144,11 @@ class WorkDetailPageHeader extends Component{
{view_answer == true && <Link
className={`${childModuleName == '参考答案' ? 'active' : '' } `}
to={`/courses/${courseId}/${moduleEngName}/${workId}/answer`}>参考答案</Link>}
{this.props.isAdmin()?
<Link
className={`${childModuleName == '设置' ? 'active' : '' } `}
style={{paddingLeft:'38px'}}
to={`/courses/${courseId}/${moduleEngName}/${workId}/setting`}>设置</Link>:
""
}
style={{paddingLeft:this.props.isAdmin()?'38px':'20px'}}
to={`/courses/${courseId}/${moduleEngName}/${workId}/setting`}>{this.props.isAdmin()?"设置":"得分规则"}</Link>
{ this.props.tabRightComponents }

@ -1055,7 +1055,7 @@ class Coursesleftnav extends Component{
iem.category_id===0?"":
iem.category_type==="graduation_topics"||iem.category_type==="graduation_tasks"?
(
iem.category_name.length<13?
iem.category_name&&iem.category_name.length<13?
<span className={"fr mr20 color999 Draggablelichild font-14"} >{iem.category_count===0?"":iem.category_count}</span>
:
<Tooltip placement="right" key={index} title={iem.category_name} visible={toopvisibleindexs===undefined?false:toopvisibleindexs===index?true:false}>
@ -1064,7 +1064,7 @@ class Coursesleftnav extends Component{
)
:
(
iem.category_name.length<13?
iem.category_name&&iem.category_name.length<13?
<Popover placement="right" content={this.content(item,iem,index)} trigger="hover" key={index} onMouseEnter={(e)=>this.twosandianshowyss(e)}>
<i className={"iconfont icon-sandian fr color999 mr15 Draggablelichild"}></i>
</Popover>
@ -1147,15 +1147,26 @@ class Coursesleftnav extends Component{
{/*title={iem.category_name.length<10?"":iem.category_name}*/}
<li className="clearfix Draggableli" key={index} style={{ width: '244px'}} >
<Tooltip placement="right" key={index} title={iem.category_name}>
<a className="fl pl46 pd0 Draggablelichild" onClick={(e)=>this.selectnavids(e,key,iem.category_id,item.type+"child",iem.second_category_url,key)} >
{/*<span className="fl ml38 maxwidth170 task-hide">{iem.category_name}</span>*/}
{/*{iem.category_name.length<10?"":*/}
{/* iem.category_name}*/}
<span className={this.props.location.pathname===iem.second_category_url?"color-blue fl ml38 maxwidth170 task-hide Draggablelichild":"fl ml38 maxwidth170 task-hide Draggablelichild"}>{iem.category_name}</span>
<span className={twosandiantype===undefined?this.props.location.pathname===iem.second_category_url?"fr mr20 color-blue font-14":"fr mr20 color999 font-14":twosandiantype===index&&item.type!="graduation"?"none":this.props.location.pathname===iem.second_category_url?"fr mr20 color-blue font-14":"fr mr20 color999 font-14"}>{iem.category_count===0?"":iem.category_count}</span>
</a>
</Tooltip>
{
iem.category_name&&iem.category_name.length<13?
<a className="fl pl46 pd0 Draggablelichild" onClick={(e)=>this.selectnavids(e,key,iem.category_id,item.type+"child",iem.second_category_url,key)} >
{/*<span className="fl ml38 maxwidth170 task-hide">{iem.category_name}</span>*/}
{/*{iem.category_name.length<10?"":*/}
{/* iem.category_name}*/}
<span className={this.props.location.pathname===iem.second_category_url?"color-blue fl ml38 maxwidth170 task-hide Draggablelichild":"fl ml38 maxwidth170 task-hide Draggablelichild"}>{iem.category_name}</span>
<span className={twosandiantype===undefined?this.props.location.pathname===iem.second_category_url?"fr mr20 color-blue font-14":"fr mr20 color999 font-14":twosandiantype===index&&item.type!="graduation"?"none":this.props.location.pathname===iem.second_category_url?"fr mr20 color-blue font-14":"fr mr20 color999 font-14"}>{iem.category_count===0?"":iem.category_count}</span>
</a>
:
<Tooltip placement="right" key={index} title={iem.category_name}>
<a className="fl pl46 pd0 Draggablelichild" onClick={(e)=>this.selectnavids(e,key,iem.category_id,item.type+"child",iem.second_category_url,key)} >
{/*<span className="fl ml38 maxwidth170 task-hide">{iem.category_name}</span>*/}
{/*{iem.category_name.length<10?"":*/}
{/* iem.category_name}*/}
<span className={this.props.location.pathname===iem.second_category_url?"color-blue fl ml38 maxwidth170 task-hide Draggablelichild":"fl ml38 maxwidth170 task-hide Draggablelichild"}>{iem.category_name}</span>
<span className={twosandiantype===undefined?this.props.location.pathname===iem.second_category_url?"fr mr20 color-blue font-14":"fr mr20 color999 font-14":twosandiantype===index&&item.type!="graduation"?"none":this.props.location.pathname===iem.second_category_url?"fr mr20 color-blue font-14":"fr mr20 color999 font-14"}>{iem.category_count===0?"":iem.category_count}</span>
</a>
</Tooltip>
}
</li>
</a>

@ -153,7 +153,7 @@ class AppraiseModal extends Component{
</style>
<div className="clearfix">
<p className={"font mt10 mb10 ml10"}>
可见:(学生可查看老师的评阅内容
可见(学生可查看老师的评阅内容
</p>
{/*<Radio.Group onChange={this.onChanges} value={this.state.valuetype}>*/}
{/*<Radio value={0} style={radioStyle} className={"newfont"}>可见 (学生查看老师的评阅内容)</Radio>*/}
@ -167,7 +167,7 @@ class AppraiseModal extends Component{
/>
<p className={"font mt10 mb10 ml10"}>
不可见:(仅对课堂老师可见
不可见(仅对课堂老师可见
</p>
<WordNumberTextarea
placeholder={"请填写评阅内容"}

@ -371,7 +371,7 @@ class Elearning extends Component{
<Progress percent={learned} showInfo={false} />
</div>
<div style={{marginTop:"7px",textAlign: "left"}}>
<span className="font-16">上次学</span><span style={{color:"#4CADFF",marginLeft:"25px"}}>{last_shixun}</span>
<span className="font-16">上次学习内容</span><span style={{color:"#4CADFF",marginLeft:"25px"}}>{last_shixun}</span>
</div>

@ -134,7 +134,7 @@ class ExerciseListItem extends Component{
{
item.lock_status === 0 ?
<Tooltip title={ this.props.isNotMember()===true?"私有属性,非课堂成员不能访问":"私有属性"} placement="bottom">
<Tooltip title={"私有属性,非课堂成员不能访问"} placement="bottom">
<i className="iconfont icon-guansuo color-grey-c ml10 font-16 fl"></i>
</Tooltip>
:""

@ -104,6 +104,10 @@ class Exercisesetting extends Component{
if(this.props.Commonheadofthetestpaper!=undefined){
this.editSetting()
}
if(this.props.isAdmin() === false){
this.cancelEdit()
}
}
componentDidUpdate = (prevProps) => {
if(prevProps.Commonheadofthetestpaper!= this.props.Commonheadofthetestpaper){

@ -256,7 +256,7 @@ class GraduateTaskItem extends Component{
{
this.props.discussMessage.private_icon===true?
<Tooltip title={ this.props.isNotMember===true?"私有属性,非课堂成员不能访问":"私有属性"} placement="bottom">
<Tooltip title={"私有属性,非课堂成员不能访问"} placement="bottom">
<i className="iconfont icon-guansuo color-grey-c ml10 font-16 fl mt4"></i>
</Tooltip>
:

@ -189,7 +189,8 @@ class GraduationAcross extends Component{
cross_teachers: item.cross_teachers,
student_id:item.student_id,
user_name:item.user_name,
work_id:item.work_id
work_id:item.work_id,
cross_groups:item.cross_groups
}
return list;
}),
@ -395,7 +396,7 @@ class GraduationAcross extends Component{
`
}
</style>:""}
<div id="closeIcon" onClick={()=>this.props.modalCloss()}>
<div id="closeIcon" onClick={this.props.modalCloss}>
<i className="iconfont icon-shanchudiao"></i>
</div>
<style>

@ -93,6 +93,7 @@ class GraduationTaskDetail extends Component{
this.setState({
acrossVisible:false
})
this.getdatas()
}

@ -720,7 +720,7 @@ class GraduationTasks extends Component{
<li className="li_line"><a className="color-grey-9" onClick={() => { this.publish() }}>立即发布</a></li>
<li className="li_line"><a className="color-grey-9" onClick={() => { this.end() }}>立即截止</a></li>
{course_public===true?<li className="li_line"><a className="color-grey-9" onClick={this.onOpen}>设为公开</a></li>:""}
<li className="li_line"><a className="color-grey-9" onClick={()=>this.ActionPoll()}>加入题库</a></li>
{/*<li className="li_line"><a className="color-grey-9" onClick={()=>this.ActionPoll()}>加入题库</a></li>*/}
</div>
</div>
</div>:""}

@ -103,7 +103,7 @@ class GraduateTopicItem extends Component{
}
{
discussMessage.private_icon===true?
<Tooltip title={ this.props.isNotMember()===true?"私有属性,非课堂成员不能访问":"私有属性"} placement="bottom">
<Tooltip title={"私有属性,非课堂成员不能访问"} placement="bottom">
<i className="iconfont icon-guansuo color-grey-c ml10 font-16 fl mt4"></i>
</Tooltip>
:""

@ -447,7 +447,7 @@ onBoardsNew=()=>{
{
course_public && course_public==1 ? <li className="li_line"><a href="javascript:void(0)" className="color-grey-9" onClick={()=>this.onDelete(2)}>设为公开</a></li>:""
}
<li className="li_line"><a className="color-grey-9" onClick={()=>this.onDelete(3)}>加入题库</a></li>
{/*<li className="li_line"><a className="color-grey-9" onClick={()=>this.onDelete(3)}>加入题库</a></li>*/}
{/* <li className="li_line"><a href="javascript:void(0)" className="color-grey-9">加入题库</a></li> */}
</div>
</div>

@ -96,6 +96,9 @@ class AddAdminModal extends Component{
}).then((result)=>{
if(result.data.status==0){
this.props.showNotification('操作成功。')
if (this.props.isCourseAdmin()) {
window.location.reload()
}
// this.fetchAll()
this.setVisible(false)
this.props.changeAdminSuccess && this.props.changeAdminSuccess()

@ -16,7 +16,9 @@ import DownloadMessageysl from "../../modals/DownloadMessageysl";
import CreateGroupByImportModal from './modal/CreateGroupByImportModal'
const Search =Input.Search;
const TYPE_STUDENTS = 1
const TYPE_COURSE_GOURP_PARENT = 2
const TYPE_COURSE_GOURP_CHILD = 3
const buildColumns = (that,isParent) => {
const { course_groups , sortedInfo } = that.state
let showSorter = isParent==true
@ -581,6 +583,16 @@ class studentsList extends Component{
// console.log(paramsString);
// console.log(checkBoxValues);
// console.log(searchValue);
let pageType = TYPE_STUDENTS
if (this.props.match.path.endsWith('students')) {
} else if (course_group_id) {
pageType = TYPE_COURSE_GOURP_PARENT
} else {
pageType = TYPE_COURSE_GOURP_CHILD
}
return(
<React.Fragment >
<DownloadMessageysl
@ -590,7 +602,7 @@ class studentsList extends Component{
modalsType={this.state.DownloadType}
/>
<Titlesearchsection
title={isParent ? "学生列表" :
title={isParent ? (pageType == TYPE_STUDENTS ? "全部学生" : "学生列表"):
<React.Fragment>
<span>{course_group_name || '未分班'}</span>
{isAdmin && invite_code && <React.Fragment>
@ -617,15 +629,21 @@ class studentsList extends Component{
searchPlaceholder={ '请输入姓名、学号进行搜索' }
firstRowRight={
<React.Fragment>
{ isSuperAdmin && <React.Fragment>
{
// pageType !== TYPE_STUDENTS &&
isSuperAdmin && <React.Fragment>
<CreateGroupByImportModal ref="createGroupByImportModal" {...this.props}
createGroupImportSuccess={this.createGroupImportSuccess}
></CreateGroupByImportModal>
<WordsBtn style="blue" className="mr30" onClick={()=> this.refs['createGroupByImportModal'].setVisible(true)}>导入创建分班</WordsBtn>
</React.Fragment> }
{ !isCourseEnd && isAdmin && isParent && <WordsBtn style="blue" className="mr30" onClick={()=>this.addDir()}>添加分班</WordsBtn> }
{ isAdmin && !isParent && course_group_id != 0 && <WordsBtn style="blue" className="mr30" onClick={()=>this.deleteDir()}>删除分班</WordsBtn> }
{ isAdmin && !isParent && course_group_id != 0 && <WordsBtn style="blue" className="mr30" onClick={()=>this.renameDir()}>分班重命名</WordsBtn> }
{
// pageType !== TYPE_STUDENTS &&
!isCourseEnd && isAdmin && isParent && <WordsBtn style="blue" className="mr30" onClick={()=>this.addDir()}>添加分班</WordsBtn> }
{
isAdmin && !isParent && course_group_id != 0 && <WordsBtn style="blue" className="mr30" onClick={()=>this.deleteDir()}>删除分班</WordsBtn> }
{
isAdmin && !isParent && course_group_id != 0 && <WordsBtn style="blue" className="mr30" onClick={()=>this.renameDir()}>分班重命名</WordsBtn> }
<style>{`
.drop_down_menu li a {
padding: 0px;

@ -98,7 +98,7 @@ function buildColumns(that) {
return (
<ConditionToolTip title={`暂未有分班信息,不能操作`} condition={noGroups}>
<span className="drop_down" style={{color: '#29BD8B', display: 'inline-block'}}>
{ arg_course_groups.length == 0 ? '不限' : arg_course_groups.map(item => item.name).join(', ') }
{ arg_course_groups.length == 0 ? '全部分班' : arg_course_groups.map(item => item.name).join(', ') }
{ isAdmin &&
<React.Fragment>
<i className="iconfont icon-xiajiantou font-12 ml2"></i>
@ -645,6 +645,9 @@ class studentsList extends Component{
<React.Fragment>
{/* { isAdmin && <WordsBtn style="blue" className="mr30" onClick={()=>this.addTeacher()}></WordsBtn> }
{ isAdmin && <WordsBtn style="blue" className="mr30" onClick={()=>this.addStudent()}>添加学生</WordsBtn> } */}
{ isAdmin && <WordsBtn style="blue" className="fr" onClick={()=>this.showChangeAdminModal()}>更换管理员</WordsBtn>}
</React.Fragment>
}
secondRowLeft={

@ -86,6 +86,10 @@ class PollDetailTabForth extends Component{
if(this.props.pollDetail!=undefined){
this.editSetting();
}
if(this.props.isAdmin() === false){
this.cancelEdit()
}
}
componentDidUpdate = (prevProps) => {
if(prevProps.pollDetail!= this.props.pollDetail){
@ -546,7 +550,7 @@ class PollDetailTabForth extends Component{
<div className="clearfix mb5">
<span className="font-16 mr15 fl mt6">发布时间</span>
<div className="fl">
<Tooltip placement="bottom" title={un_change_unified ? "发布时间已过,不能再修改":""}>
<Tooltip placement="bottom" title={un_change_unified ?this.props.isAdmin()? "发布时间已过,不能再修改":"":""}>
<span>
<DatePicker
showToday={false}
@ -575,7 +579,7 @@ class PollDetailTabForth extends Component{
<div className="clearfix">
<span className="mr15 fl mt10 font-16">截止时间</span>
<div className="fl">
<Tooltip placement="bottom" title={un_change_end ? "截止时间已过,不能再修改":""}>
<Tooltip placement="bottom" title={un_change_end ? this.props.isAdmin()?"截止时间已过,不能再修改":"":""}>
<span>
<DatePicker
showToday={false}
@ -640,7 +644,7 @@ class PollDetailTabForth extends Component{
</div>
</div>
{
flagPageEdit ?
flagPageEdit&& this.props.isAdmin() === true ?
<div className="clearfix mt30 mb30">
<Button type="primary" htmlType="submit" className="defalutSubmitbtn fl mr20">提交</Button>
<a className="defalutCancelbtn fl" onClick={this.cancelEdit}>取消</ a>

@ -413,7 +413,7 @@ class PollDetailTabForthRules extends Component{
</div>
</div>
<div className="fl pr20 with25 yskspickersy">
<Tooltip placement="bottom" title={rule.e_timeflag ? "发布时间已过,不能再修改":""}>
<Tooltip placement="bottom" title={rule.e_timeflag ? this.props.isAdmin()?"发布时间已过,不能再修改":"":""}>
<span>
<DatePicker
showToday={false}
@ -439,7 +439,7 @@ class PollDetailTabForthRules extends Component{
</p>
</div>
<div className="fl mr20 yskspickersy">
<Tooltip placement="bottom" title={rule.e_timeflag ? "截止时间已过,不能再修改":""}>
<Tooltip placement="bottom" title={rule.e_timeflag ? this.props.isAdmin()?"截止时间已过,不能再修改":"":""}>
<span>
<DatePicker
showToday={false}

@ -63,7 +63,7 @@ class PollListItem extends Component{
}
{
item.lock_status === 0 ?
<Tooltip title={`${courseType.user_permission == 0 ? "私有属性,非课堂成员不能访问" : "私有属性"}`} placement="bottom">
<Tooltip title={"私有属性,非课堂成员不能访问"} placement="bottom">
<i className="iconfont icon-guansuo color-grey-c ml10 font-16 fl"></i>
</Tooltip>
:""

@ -1535,6 +1535,7 @@ class Listofworksstudentone extends Component {
// console.log("获取作品列表");
// console.log("935");
// debugger
let searchtype=this.props.history.location.search;
let urll = `/homework_commons/${homeworkid}/works_list.json`;
var datasysl = {
search: this.state.searchtext,
@ -1587,13 +1588,14 @@ class Listofworksstudentone extends Component {
if(this.props.isAdmin() === true){
if(result.data.update_score===true){
if(bool===true){
if(searchtype==="?tab=0"){
try {
this.props.yslslowCheckresults();
}catch (e) {
}
this.setComputeTimet();
this.setComputeTimet();
}
}
}
}
@ -2625,9 +2627,11 @@ class Listofworksstudentone extends Component {
// return
// }
this.setState({
loadingstate: true
loadingstate: true,
page:1,
limit:20,
})
this.Startsortingt(this.state.orders, this.state.course_groupyslstwo, this.state.checkedValuesineinfo, value, this.state.page, this.state.limit);
this.Startsortingt(this.state.orders, this.state.course_groupyslstwo, this.state.checkedValuesineinfo, value, 1,20);
// console.log(value)
@ -2639,9 +2643,11 @@ class Listofworksstudentone extends Component {
// this.onSearch();
// console.log("使用了回车键");
this.setState({
loadingstate: true
loadingstate: true,
page:1,
limit:20,
})
this.Startsortingt(this.state.orders, this.state.course_groupyslstwo, this.state.checkedValuesineinfo, this.state.searchtext, this.state.page, this.state.limit);
this.Startsortingt(this.state.orders, this.state.course_groupyslstwo, this.state.checkedValuesineinfo, this.state.searchtext, 1,20);
}
}
//排序
@ -3242,21 +3248,25 @@ class Listofworksstudentone extends Component {
{/*作品状态GraduationTaskssettinglist*/}
<ul className="clearfix" style={{padding: '20px 15px 10px 20px'}}>
<li className="clearfix " >
<span className="fl mr10 color-grey-6 ">计算成绩时间{teacherdata&&teacherdata.calculation_time==null?"--": moment(teacherdata&&teacherdata.calculation_time).format('YYYY-MM-DD HH:mm')}</span>
{/*<span className="fl mr10 color-grey-6 ">计算成绩时间:{teacherdata&&teacherdata.calculation_time==null?"--": moment(teacherdata&&teacherdata.calculation_time).format('YYYY-MM-DD HH:mm')}</span>*/}
</li>
<li className="clearfix mt10">
<div className="fr mr5 search-newysl" style={{marginBottom: '1px'}}>
{/*{course_is_end===true?"":<span>*/}
{/*{teacherdata&&teacherdata.update_score===true&&computeTimetype===true?*/}
{/* (this.props.isNotMember()===false?<div className={"computeTime font-16"} onClick={this.setComputeTimet}>*/}
{/* 查看最新成绩*/}
{/* </div>:""):*/}
{/* teacherdata&&teacherdata.homework_status!==undefined&&teacherdata.homework_status[0]=== "未发布"? "":*/}
{/* (this.props.isNotMember()===false?<div className={"computeTimes font-16"}>*/}
{/* 查看最新成绩*/}
{/* </div>:"")*/}
{/*}*/}
{/*</span>}*/}
{/*{teacherdata&&teacherdata.update_score===true&&computeTimetype===true?*/}
{/* (this.props.isNotMember()===false?<div className={"computeTime font-16"} onClick={this.setComputeTimet}>*/}
{/* 查看最新成绩*/}
{/* </div>:""):*/}
{/* teacherdata&&teacherdata.homework_status!==undefined&&teacherdata.homework_status[0]=== "未发布"? "":*/}
{/* (this.props.isNotMember()===false?<div className={"computeTimes font-16"}>*/}
{/* 查看最新成绩*/}
{/* </div>:"")*/}
{/*}*/}
{/*</span>}*/}
<span className="search-newyslw fr ml20">
<Search
placeholder="请输入姓名或学号搜索"
@ -3269,10 +3279,6 @@ class Listofworksstudentone extends Component {
></Search>
</span>
</div>
</li>
<li className="clearfix mt10">
<span className="fl mr10 color-grey-8 ">作品状态</span>
<span className="fl "><a id="graduation_comment_no_limit"
className={unlimited === 0 ? "pl10 pr10 mr20 check_on" : "pl10 pr10 mr20 "}
@ -3342,6 +3348,7 @@ class Listofworksstudentone extends Component {
`
.edu-position-hide li a:hover {
background: #F0F0F0;
color: #05101A;
}
`
}
@ -3567,7 +3574,7 @@ class Listofworksstudentone extends Component {
<div className="fr">
<span className="fl mr10 color-grey-6 ">计算成绩时间{teacherdata&&teacherdata.calculation_time==null?"--": moment(teacherdata&&teacherdata.calculation_time).format('YYYY-MM-DD HH:mm')}</span>
{/*<span className="fl mr10 color-grey-6 ">计算成绩时间:{teacherdata&&teacherdata.calculation_time==null?"--": moment(teacherdata&&teacherdata.calculation_time).format('YYYY-MM-DD HH:mm')}</span>*/}
{/* { course_is_end===true?"":teacherdata&&teacherdata.task_operation[0]==="开启挑战"?"":<span>*/}
{/* {computeTimetype===true?*/}
{/* (this.props.isNotMember()===false?*/}
@ -3800,7 +3807,7 @@ class Listofworksstudentone extends Component {
</style>
<div className="fr">
<span className="fl mr10 color-grey-6 ">计算成绩时间{teacherdata&&teacherdata.calculation_time==null?"--": moment(teacherdata&&teacherdata.calculation_time).format('YYYY-MM-DD HH:mm')}</span>
{/*<span className="fl mr10 color-grey-6 ">计算成绩时间:{teacherdata&&teacherdata.calculation_time==null?"--": moment(teacherdata&&teacherdata.calculation_time).format('YYYY-MM-DD HH:mm')}</span>*/}
{/* { course_is_end===true?"":teacherdata&&teacherdata.task_operation&&teacherdata.task_operation[0]==="开启挑战"?"":<span>*/}
{/* {computeTimetype===true?*/}

@ -236,7 +236,7 @@ class ShixunHomeworkPage extends Component {
onClick={(e) => this.ChangeTab(2)}>
代码查重</a> : ""}
{parseInt(tab) === 3?
<style>{
<style>{this.props.isAdmin()?
`
.poll_list a.active:after {
content: '';
@ -247,13 +247,13 @@ class ShixunHomeworkPage extends Component {
background-color: #4CACFF;
position: absolute;
}
`
`:""
}</style>
:""}
{this.props.isAdmin() ?
<a className={parseInt(tab) === 3 ? "active" : ""}
onClick={(e) => this.ChangeTab(3)}
>设置</a>:""}
>{this.props.isAdmin()?"设置":"得分规则"}</a>
{/*{this.props.isAdmin() ? <a*/}
{/* className="fr color-blue font-16"*/}
{/* href={`/api/homework_commons/${this.props.match.params.coursesId}/works_list.xlsx`}*/}

@ -337,7 +337,7 @@ class ShixunhomeWorkItem extends Component{
{
this.props.discussMessage.private_icon===true?
<Tooltip title={ this.props.isNotMember===true?"私有属性,非课堂成员不能访问":"私有属性"} placement="bottom">
<Tooltip title={"私有属性,非课堂成员不能访问"} placement="bottom">
<i className="iconfont icon-guansuo color-grey-c ml10 font-16 fl mt4"></i>
</Tooltip>
:

@ -147,7 +147,9 @@ class Trainingjobsetting extends Component {
if(this.props.isAdmin() === false){
this.cancelEdit()
}
}
// componentWillReceiveProps(nextProps) {
// // console.log("+++++++++916");
@ -1721,7 +1723,7 @@ class Trainingjobsetting extends Component {
flagPageEditsthrees:deadline,
flagPageEditsfor:endtime,
completionefficiencyscore:true,
work_efficiencys:true,
work_efficiencys:this.state.work_efficiencys,
unifiedsetting:this.state.unifiedsetting,
latedeductiontwo:20,
});
@ -1837,7 +1839,7 @@ class Trainingjobsetting extends Component {
flagPageEditsthrees:deadline,
flagPageEditsfor:endtime,
completionefficiencyscore:true,
work_efficiencys:true,
work_efficiencys:datas.data.work_efficiency,
unifiedsetting:datas.data.unified_setting,
latedeductiontwo:20,
});
@ -2076,7 +2078,10 @@ class Trainingjobsetting extends Component {
// console.log(this.props.isAdmin())
// console.log(this.state.code_review===false)
// console.log("引入的分值");
// console.log(this.state.work_efficiencys);
console.log(this.state.work_efficiencys);
return (
<div className=" clearfix " ref='targetElementTrainingjobsetting' style={{margin: "auto", minWidth:"1200px"}}>
{this.state.showmodel===true?<ShixunWorkModal
@ -2181,7 +2186,7 @@ class Trainingjobsetting extends Component {
<div>
<div className="clearfix mb5 ml15">
<span className="font-16 fl mt3" style={{color:"#999999"}}>发布时间</span>
<Tooltip placement="bottom" title={this.props.isSuperAdmin() ? "" : !flagPageEditstwo === true && publish_timebool === true?"发布时间已过,则不能修改": ""}>
<Tooltip placement="bottom" title={this.props.isSuperAdmin() ? "" : !flagPageEditstwo === true && publish_timebool === true?this.props.isAdmin()?"发布时间已过,则不能修改":"": ""}>
<div className="fl yskspickers">
<DatePicker
showToday={false}
@ -2214,7 +2219,7 @@ class Trainingjobsetting extends Component {
</p>
<div className="clearfix ml15 mb5">
<span className=" fl mt3 font-16" style={{color:"#999999"}}>截止时间</span>
<Tooltip placement="bottom" title={this.props.isSuperAdmin() ? "" : !flagPageEditsthrees === true&&end_timebool===true?"截止时间已过,则不能修改": ""}>
<Tooltip placement="bottom" title={this.props.isSuperAdmin() ? "" : !flagPageEditsthrees === true&&end_timebool===true?this.props.isAdmin()?"截止时间已过,则不能修改":"": ""}>
<div className="fl yskspickers">
<DatePicker
showToday={false}

@ -545,7 +545,7 @@ class MessagSub extends Component {
{/*下面内容页面*/}
<div className="bor-top-greyE mycenter">
{/*这里可以进行数据处理*/}
<div className="myw100baifenbi">
<div className="myw100baifenbi edu-back-white">
<Spin size="large" className="myw100baifenbi mt10" spinning={isSpin}>
{
@ -641,23 +641,24 @@ class MessagSub extends Component {
})}
</Spin>
{/*页数*/}
{data === undefined ? ""
:
(count > 10 ?
<div style={{textAlign: "center"}} className="new_expand mt10">
<div className="edu-txt-center mt30">
<Pagination showQuickJumper current={page}
onChange={this.paginationonChanges} pageSize={limit}
total={count}></Pagination>
</div>
</div> : ""
)
}
</div>
</div>
{/*页数*/}
{data === undefined ? ""
:
(count > 10 ?
<div style={{textAlign: "center"}} className="new_expand mt10">
<div className="edu-txt-center mt30">
<Pagination showQuickJumper current={page}
onChange={this.paginationonChanges} pageSize={limit}
total={count}></Pagination>
</div>
</div> : ""
)
}
</div>
)
}

@ -8,6 +8,7 @@ import moment from 'moment';
import {getImageUrl,markdownToHTML} from 'educoder';
import "../css/messagemy.css"
import WriteaprivateletterModal from '../messagemodal/WriteaprivateletterModal';
import NoneData from '../../../modules/courses/coursesPublic/NoneData'
//私信页面
class MessagePrivate extends Component{
constructor(props) {
@ -160,11 +161,8 @@ class MessagePrivate extends Component{
<Spin size="large" className="myw100baifenbi" spinning={isSpin}>
{
data===undefined?"":data.length===0?
<div className="edu-tab-con-box clearfix edu-txt-center">
<img className="edu-nodata-img mb20" src={getImageUrl("images/educoder/nodata.png")}/>
<p className="edu-nodata-p mb20">暂无数据哦~</p>
</div>
data===undefined?<NoneData></NoneData> :data.length===0?
<NoneData></NoneData>
:data.map((item,key)=>{
return(
<div className="private-item clearfix df" key={key} onClick={()=>this.smyJump(3,item.target.id)}>

@ -21,8 +21,11 @@ function getNewTreeData(treeData, curKey, child, level) {
data.forEach((item) => {
// 这里不能用indexOf 同一级可能出现test目录和test.py文件
if (item.key == curKey) {
child = addPrePath(child, curKey);
item.children = child;
if (child && child.length) { // 可能没有子节点
child = addPrePath(child, curKey);
item.children = child;
}
item.isLeaf = false;
} else {
if (item.children) {
loop(item.children);
@ -153,6 +156,10 @@ class CodeRepositoryViewContainer extends Component {
});
}
map2OldData = (treeData) => {
if (!treeData || treeData.length == 0) {
return []
}
if (!treeData || treeData.length === 0) return treeData;
treeData = treeData.map(item => {
return {

@ -222,7 +222,7 @@ export function TPMIndexHOC(WrappedComponent) {
# 课程权限判断
ADMIN = 0 # 超级管理员
BUSINESS = 1 # 运营人员
CREATOR = 2 # 课程创建者
CREATOR = 2 # 课程创建者 课堂管理员
PROFESSOR = 3 # 课程老师
ASSISTANT_PROFESSOR = 4 # 课程助教
STUDENT = 5 # 学生
@ -233,6 +233,9 @@ export function TPMIndexHOC(WrappedComponent) {
isSuperAdmin = () => {
// return false
return this.state.coursedata&&this.state.coursedata.course_identity === 0
}
isCourseAdmin = () => {
return this.state.coursedata&&this.state.coursedata.course_identity === 2
}
//超管、运维0-1
isClassManagement = () => {
@ -537,6 +540,8 @@ export function TPMIndexHOC(WrappedComponent) {
isSuperAdmin:this.isSuperAdmin,
isAdminOrCreator:this.isAdminOrCreator,
isClassManagement:this.isClassManagement,
isCourseAdmin:this.isCourseAdmin,
isAdmin: this.isAdmin,
isAdminOrTeacher: this.isAdminOrTeacher,
isStudent: this.isStudent,

@ -284,7 +284,7 @@ class AccountSecure extends Component {
<div className="description">
{
basicInfo && basicInfo.phone ?
<span>{ regPhoneAndEmail(basicInfo.phone) }</span>
<span>{ basicInfo.phone }</span>
:
<span style={{color: '#EA320E'}}>未绑定</span>
}
@ -348,7 +348,7 @@ class AccountSecure extends Component {
<div className="description">
{
basicInfo && basicInfo.mail ?
<span>{ regPhoneAndEmail(basicInfo.mail) }</span>
<span>{ basicInfo.mail }</span>
:
<span style={{color: '#EA320E'}}>未绑定</span>
}

@ -297,8 +297,8 @@ class InfosTopics extends Component{
let categorylist=[
{val:"普通作业",type:"normal"},
{val:"分组作业",type:"group"},
{val:"毕设选题",type:"gtopic"},
{val:"毕设任务",type:"gtask"},
// {val:"毕设选题",type:"gtopic"},
// {val:"毕设任务",type:"gtask"},
{val:"试卷",type:"exercise"},
{val:"问卷",type:"poll"},
]

@ -288,12 +288,22 @@ function InfoVideo (props) {
个视频
</span>
{categoryObj.category == 'all' && <CRoundSelect {...props}
width={'90px'}
items={_items}
onSortChange={onSortChange}
sortKey={sortKey }
></CRoundSelect>}
{/*{categoryObj.category == 'all' && <CRoundSelect {...props}*/}
{/*width={'90px'}*/}
{/*items={_items}*/}
{/*onSortChange={onSortChange}*/}
{/*sortKey={sortKey }*/}
{/*></CRoundSelect>}*/}
{categoryObj.category == 'all' &&<div className="fr">
<li className="drop_down">
<span className="color-grey-9 font-12">{sortKey=="published_at-desc"?"最新上传":"最早上传"}</span><i className="iconfont icon-xiajiantou font-12 ml2 color-grey-6"></i>
<ul className="drop_down_normal">
<li onClick={()=>onSortChange("published_at-desc",0)}>最新上传</li>
<li onClick={()=>onSortChange("published_at-asc",1)}>最早上传</li>
</ul>
</li>
</div>}
</div>

Loading…
Cancel
Save