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

dev_hjm_a
daiao 5 years ago
commit 489e32b350

@ -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

@ -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

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

@ -818,6 +818,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={

@ -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"),

@ -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>:
""
}
to={`/courses/${courseId}/${moduleEngName}/${workId}/setting`}>{this.props.isAdmin()?"设置":"得分规则"}</Link>
{/* { this.props.tabRightComponents } */}

@ -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>:
""
}
to={`/courses/${courseId}/${moduleEngName}/${workId}/setting`}>{this.props.isAdmin()?"设置":"得分规则"}</Link>
{ this.props.tabRightComponents }

@ -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>

@ -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){

@ -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>:""}

@ -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>

@ -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){
@ -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>

@ -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,7 +1588,7 @@ 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) {
@ -1597,6 +1598,7 @@ class Listofworksstudentone extends Component {
}
}
}
}
}catch (e) {
}
@ -3242,9 +3244,13 @@ 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?*/}
@ -3269,10 +3275,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 "}
@ -3567,7 +3569,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 +3802,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?*/}

@ -250,10 +250,10 @@ class ShixunHomeworkPage extends Component {
`
}</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`}*/}

@ -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,
});
@ -2077,6 +2079,9 @@ class Trainingjobsetting extends Component {
// console.log(this.state.code_review===false)
// console.log("引入的分值");
// console.log(this.state.work_efficiencys);
return (
<div className=" clearfix " ref='targetElementTrainingjobsetting' style={{margin: "auto", minWidth:"1200px"}}>
{this.state.showmodel===true?<ShixunWorkModal

@ -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,6 +641,10 @@ class MessagSub extends Component {
})}
</Spin>
</div>
</div>
{/*页数*/}
{data === undefined ? ""
:
@ -656,9 +660,6 @@ class MessagSub extends Component {
}
</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) {
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 {

@ -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