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

dev_aliyun_beta
cxt 5 years ago
commit e2fb524f23

@ -1085,12 +1085,16 @@ class CoursesController < ApplicationController
# 导出课堂信息 # 导出课堂信息
def export_couser_info def export_couser_info
if params[:export].present? && params[:export]
normal_status(0,"正在下载中")
else
set_export_cookies set_export_cookies
course_info_to_xlsx @course course_info_to_xlsx @course
filename_ = "#{current_user.real_name}_#{@course.name}_课堂信息_#{Time.now.strftime('%Y%m%d_%H%M%S')}" filename_ = "#{current_user.real_name}_#{@course.name}_课堂信息_#{Time.now.strftime('%Y%m%d_%H%M%S')}"
render xlsx: "#{format_sheet_name filename_.strip}",template: "courses/export_course_info.xlsx.axlsx", render xlsx: "#{format_sheet_name filename_.strip}",template: "courses/export_course_info.xlsx.axlsx",
locals: {course_info: @course_info} locals: {course_info: @course_info}
end end
end
# 导出活跃度 # 导出活跃度
def export_member_act_score def export_member_act_score

@ -280,11 +280,12 @@ class ExerciseQuestionsController < ApplicationController
if null_choice_text_count >= ex_answer_pre_count if null_choice_text_count >= ex_answer_pre_count
new_add_choice = null_choice_text_count_array - ex_answer_pre_count_array new_add_choice = null_choice_text_count_array - ex_answer_pre_count_array
ex_answer_pre_count_array.each do |n| ex_answer_pre_count_array.each do |n|
standard_option = { @hash_symbol_null_ = {
:exercise_question_id => @exercise_question.id, :exercise_question_id => @exercise_question.id,
:exercise_choice_id => null_choice_id, :exercise_choice_id => null_choice_id,
:answer_text => null_choice_text[n-1] :answer_text => null_choice_text[n - 1]
} }
standard_option = @hash_symbol_null_
ex_answer_pre[n-1].update(standard_option) ex_answer_pre[n-1].update(standard_option)
end end
if new_add_choice.count > 0 #表示有新增的 if new_add_choice.count > 0 #表示有新增的

@ -493,7 +493,8 @@ class Fileslists extends Component{
let selectpagetype=selectpage===page?true:false let selectpagetype=selectpage===page?true:false
this.setState({ this.setState({
page:page, page:page,
checkAllValue:selectpagetype checkAllValue:selectpagetype,
checkBoxValues:[]
}) })
let{pagesize,tagname,searchValue,sort,sorttype,coursesecondcategoryid}=this.state; let{pagesize,tagname,searchValue,sort,sorttype,coursesecondcategoryid}=this.state;
@ -801,7 +802,7 @@ class Fileslists extends Component{
{this.props.isAdmin()? files===undefined?'' :files.length===0? "":<div className="mt20 edu-back-white padding20-30" style={{display:this.props.isAdmin()||this.props.isStudent()?"":"none"}}> {this.props.isAdmin()? files===undefined?'' :files.length===0? "":<div className="mt20 edu-back-white padding20-30" style={{display:this.props.isAdmin()||this.props.isStudent()?"":"none"}}>
<div className="clearfix"> <div className="clearfix">
{this.props.isAdmin()? <Checkbox className="fl" onChange={this.onCheckAll} checked={checkAllValue}>已选 {checkBoxValues.length} </Checkbox>:""} {this.props.isAdmin()? <Checkbox className="fl" onChange={this.onCheckAll} checked={checkAllValue}>已选 {checkBoxValues.length} 不支持跨页勾选</Checkbox>:""}
<div className="studentList_operation_ul"> <div className="studentList_operation_ul">
{this.props.isAdmin()?<li className="li_line"><a href="javascript:void(0)" className="color-grey-9" onClick={this.onDelete}>删除</a></li>:""} {this.props.isAdmin()?<li className="li_line"><a href="javascript:void(0)" className="color-grey-9" onClick={this.onDelete}>删除</a></li>:""}
{this.props.isAdmin()?<li className="li_line"><a href="javascript:void(0)" className="color-grey-9" onClick={this.onSend}>发送</a></li>:""} {this.props.isAdmin()?<li className="li_line"><a href="javascript:void(0)" className="color-grey-9" onClick={this.onSend}>发送</a></li>:""}
@ -837,7 +838,7 @@ class Fileslists extends Component{
{course_modules&&course_modules.course_modules.map((item,key)=>{ {course_modules&&course_modules.course_modules.map((item,key)=>{
return( return(
filesId&&filesId===item.id?"":<li key={key} id={item.id} onClick={() => this.moveTos(0)}>{item.module_name}</li> filesId&&filesId===item.id?"":<li key={key} id={item.id} onClick={() => this.moveTos(0)} title={item.module_name}>{item.module_name}</li>
) )
})} })}
@ -847,7 +848,7 @@ class Fileslists extends Component{
return (!this.state.dirSearchValue || item.name.indexOf(this.state.dirSearchValue) != -1) return (!this.state.dirSearchValue || item.name.indexOf(this.state.dirSearchValue) != -1)
}).map((itm,k)=>{ }).map((itm,k)=>{
return( return(
filesId&&filesId===itm.id?"":<li key={k} id={itm.id} onClick={() => this.moveTos(itm.id )}>{itm.name}</li> filesId&&filesId===itm.id?"":<li key={k} id={itm.id} onClick={() => this.moveTos(itm.id )} title={itm.name}>{itm.name}</li>
) )
}) })
})} })}

@ -283,6 +283,9 @@ class Boards extends Component{
console.log('checked = ', checkedValues); console.log('checked = ', checkedValues);
} }
onPageChange = (pageNumber) => { onPageChange = (pageNumber) => {
this.setState({
checkBoxValues:[]
})
this.fetchAll(null, pageNumber) this.fetchAll(null, pageNumber)
} }
@ -365,7 +368,7 @@ class Boards extends Component{
{messages&&messages.length == 0?"": isAdmin && <div className="mt20 edu-back-white padding20-30"> {messages&&messages.length == 0?"": isAdmin && <div className="mt20 edu-back-white padding20-30">
<div className="clearfix"> <div className="clearfix">
{isAdmin&&<Checkbox className="fl" onChange={this.onCheckAll} checked={checkAllValue}>已选 {checkBoxValues.length} </Checkbox>} {isAdmin&&<Checkbox className="fl" onChange={this.onCheckAll} checked={checkAllValue}>已选 {checkBoxValues.length} 不支持跨页勾选</Checkbox>}
<div className="studentList_operation_ul"> <div className="studentList_operation_ul">
{ !!isAdmin && { !!isAdmin &&
<React.Fragment> <React.Fragment>
@ -384,7 +387,7 @@ class Boards extends Component{
boards && boards.filter((item)=> { boards && boards.filter((item)=> {
return item.id != bid && (!this.state.dirSearchValue || item.name.indexOf(this.state.dirSearchValue) != -1) return item.id != bid && (!this.state.dirSearchValue || item.name.indexOf(this.state.dirSearchValue) != -1)
}).map( (item) => { }).map( (item) => {
return <li onClick={() => this.moveTo(item)}>{item.name}</li> return <li onClick={() => this.moveTo(item)} title={item.name}>{item.name}</li>
}) })
} }
{ isAdmin && { isAdmin &&

@ -153,7 +153,8 @@ class commonWork extends Component{
onPageChange=(pageNumber)=>{ onPageChange=(pageNumber)=>{
this.setState({ this.setState({
page:pageNumber page:pageNumber,
checkBoxValues:[]
}) })
let {search,order}=this.state; let {search,order}=this.state;
this.getList(pageNumber,search,order); this.getList(pageNumber,search,order);
@ -430,7 +431,7 @@ class commonWork extends Component{
mainList && mainList.course_identity < 5 && mainList.homeworks.length>0 && mainList && mainList.course_identity < 5 && mainList.homeworks.length>0 &&
<div className="mt20 edu-back-white padding20-30"> <div className="mt20 edu-back-white padding20-30">
<div className="clearfix" > <div className="clearfix" >
<Checkbox className="fl" onChange={this.changeAll} checked={checkAll}>已选 {checkBoxValues.length} </Checkbox> <Checkbox className="fl" onChange={this.changeAll} checked={checkAll}>已选 {checkBoxValues.length} 不支持跨页勾选</Checkbox>
<div className="studentList_operation_ul"> <div className="studentList_operation_ul">
<li className="li_line"> <li className="li_line">
<a href="javascript:void(0)" className="color-grey-9" <a href="javascript:void(0)" className="color-grey-9"

@ -56,7 +56,8 @@ class Coursesleftnav extends Component{
positiontype:undefined, positiontype:undefined,
toopvisible:false, toopvisible:false,
toopvisibleindex:undefined, toopvisibleindex:undefined,
sandiantypes:undefined sandiantypes:undefined,
antIcon:false
} }
} }
@ -582,7 +583,9 @@ class Coursesleftnav extends Component{
} }
deletenavchilds=(url,mainurl)=>{ deletenavchilds=(url,mainurl)=>{
this.setState({
antIcon:true
})
axios.delete(url).then((result)=>{ axios.delete(url).then((result)=>{
if(result.data.status===0){ if(result.data.status===0){
@ -809,6 +812,7 @@ class Coursesleftnav extends Component{
modalSave={ModalSave} modalSave={ModalSave}
modalCancel={this.cannerNavmoda} modalCancel={this.cannerNavmoda}
loadtype={loadtype} loadtype={loadtype}
antIcon={this.state.antIcon}
> >
</Modals> </Modals>

@ -150,8 +150,7 @@ class Startshixuntask extends Component{
keyboard={false} keyboard={false}
> >
<div className="task-popup-content"> <div className="task-popup-content">
<p className="task-popup-text-center font-16 pb20">本实训的开启时间{shixunsmessage} <br/>开启时间之前不能挑战 <p className="task-popup-text-center font-16 pb20">目前该实训项目尚在内测中将于{shixunsmessage}之后开放谢谢</p>
</p>
</div> </div>
<div className="task-popup-submit clearfix"> <div className="task-popup-submit clearfix">
{/*<a onClick={this.hidestartshixunCombattype} className="task-btn fl">取消</a>*/} {/*<a onClick={this.hidestartshixunCombattype} className="task-btn fl">取消</a>*/}

@ -132,7 +132,7 @@ class Sendresource extends Component{
onAttachmentRemove = (file) => { onAttachmentRemove = (file) => {
debugger
const url = `/attachments/${file.response ? file.response.id : file.uid}.json` const url = `/attachments/${file.response ? file.response.id : file.uid}.json`
axios.delete(url, { axios.delete(url, {
}) })

@ -293,7 +293,7 @@ class Elearning extends Component{
footer={null} footer={null}
> >
<div className="task-popup-content"> <div className="task-popup-content">
<p className="task-popup-text-center font-16 pb20">本实训的开启时间{this.state.shixunsmessages} <br/>开启时间之前不能挑战 </p> <p className="task-popup-text-center font-16 pb20">目前该实训项目尚在内测中将于{this.state.shixunsmessages}之后开放谢谢</p>
</div> </div>
<div className="task-popup-submit clearfix"> <div className="task-popup-submit clearfix">
{/*<a onClick={this.hidestartshixunCombattype} className="task-btn fl">取消</a>*/} {/*<a onClick={this.hidestartshixunCombattype} className="task-btn fl">取消</a>*/}

@ -141,7 +141,7 @@ class YslDetailCards extends Component{
footer={null} footer={null}
> >
<div className="task-popup-content"> <div className="task-popup-content">
<p className="task-popup-text-center font-16 pb20">本实训的开启时间{this.state.shixunsmessage} <br/>开启时间之前不能挑战 </p> <p className="task-popup-text-center font-16 pb20">目前该实训项目尚在内测中将于{this.state.shixunsmessage}之后开放谢谢</p>
</div> </div>
<div className="task-popup-submit clearfix"> <div className="task-popup-submit clearfix">
{/*<a onClick={this.hidestartshixunCombattype} className="task-btn fl">取消</a>*/} {/*<a onClick={this.hidestartshixunCombattype} className="task-btn fl">取消</a>*/}

@ -130,7 +130,8 @@ class Exercise extends Component{
//切换分页 //切换分页
changePage=(pageNumber)=>{ changePage=(pageNumber)=>{
this.setState({ this.setState({
page:pageNumber page:pageNumber,
checkBoxValues:[]
}) })
let{type,StudentList_value,limit}=this.state let{type,StudentList_value,limit}=this.state
this.InitList(type,StudentList_value,pageNumber,limit); this.InitList(type,StudentList_value,pageNumber,limit);
@ -522,7 +523,7 @@ class Exercise extends Component{
<Spin size="large" spinning={this.state.isSpin}> <Spin size="large" spinning={this.state.isSpin}>
{this.props.isAdmin()?exercises && exercises.length ===0?"":<div className="mt20 mb20 edu-back-white padding20-30"> {this.props.isAdmin()?exercises && exercises.length ===0?"":<div className="mt20 mb20 edu-back-white padding20-30">
<div className="clearfix"> <div className="clearfix">
<Checkbox className="fl" onChange={this.onCheckAll} checked={checkAllValue}>已选 {checkBoxValues.length} </Checkbox> <Checkbox className="fl" onChange={this.onCheckAll} checked={checkAllValue}>已选 {checkBoxValues.length} 不支持跨页勾选</Checkbox>
<div className="studentList_operation_ul"> <div className="studentList_operation_ul">
<li className="li_line"><a className="color-grey-9" onClick={()=>this.ActionPoll("delete")}>删除</a></li> <li className="li_line"><a className="color-grey-9" onClick={()=>this.ActionPoll("delete")}>删除</a></li>
<li className="li_line"> <li className="li_line">

@ -4,14 +4,14 @@ import {Form,Checkbox,DatePicker,Button,Input,Select,Tooltip} from "antd";
import { handleDateString } from 'educoder'; import { handleDateString } from 'educoder';
import PollDetailTabForthRules from '../poll/PollDetailTabForthRules'; import PollDetailTabForthRules from '../poll/PollDetailTabForthRules';
import '../css/members.css' import '../css/members.css';
import '../css/busyWork.css' import '../css/busyWork.css';
import '../poll/pollStyle.css' import '../poll/pollStyle.css';
import moment from 'moment' import moment from 'moment';
import locale from 'antd/lib/date-picker/locale/zh_CN'; import locale from 'antd/lib/date-picker/locale/zh_CN';
import axios from 'axios' import axios from 'axios';
import Modals from '../../modals/Modals' import Modals from '../../modals/Modals';
const Search=Input.Search; const Search=Input.Search;
const Option=Select.Option; const Option=Select.Option;
@ -549,6 +549,7 @@ class Exercisesetting extends Component{
} }
//取消编辑 //取消编辑
cancelEdit=()=>{ cancelEdit=()=>{
this.getSettingInfo();
this.setState({ this.setState({
flagPageEdit:false flagPageEdit:false
}) })

@ -778,6 +778,7 @@ class GraduationTaskssettingapp extends Component{
} }
isgoback=()=>{ isgoback=()=>{
this.getsettings();
this.setState({ this.setState({
flagPageEdit: false, flagPageEdit: false,
}) })

@ -360,7 +360,8 @@ class GraduationTasks extends Component{
let selectpagetype=selectpage===page?true:false let selectpagetype=selectpage===page?true:false
this.setState({ this.setState({
page:page, page:page,
checkAllValue:selectpagetype checkAllValue:selectpagetype,
checkBoxValues:[]
}) })
this.fetchAll(search,page,order); this.fetchAll(search,page,order);
@ -700,7 +701,7 @@ class GraduationTasks extends Component{
{this.props.isAdmin()?all_count===undefined?'' :all_count===0?"": <div className="mt20 edu-back-white padding20-30"> {this.props.isAdmin()?all_count===undefined?'' :all_count===0?"": <div className="mt20 edu-back-white padding20-30">
<div className="clearfix"> <div className="clearfix">
<Checkbox className="fl" onChange={this.onCheckAll} checked={checkAllValue}>已选 {checkBoxValues.length} </Checkbox> <Checkbox className="fl" onChange={this.onCheckAll} checked={checkAllValue}>已选 {checkBoxValues.length} 不支持跨页勾选</Checkbox>
<div className="studentList_operation_ul"> <div className="studentList_operation_ul">
<li className="li_line"><a className="color-grey-9" onClick={this.onDelete}>删除</a></li> <li className="li_line"><a className="color-grey-9" onClick={this.onDelete}>删除</a></li>

@ -153,7 +153,8 @@ class Boards extends Component{
// 分页 // 分页
onChangePage=(pageNum)=>{ onChangePage=(pageNum)=>{
this.setState({ this.setState({
page:pageNum page:pageNum,
checkBoxValues:[]
}) })
let {status,searchValue}=this.state; let {status,searchValue}=this.state;
this.fetchAll(searchValue,pageNum,status); this.fetchAll(searchValue,pageNum,status);
@ -430,7 +431,7 @@ onBoardsNew=()=>{
// 超级管理员、教师、助教 // 超级管理员、教师、助教
isAdmin ? isAdmin ?
<div className="clearfix mt20 edu-back-white padding20-30"> <div className="clearfix mt20 edu-back-white padding20-30">
<Checkbox className="fl" onChange={this.onCheckAll} checked={checkAllValue}>已选 {checkBoxValues.length} </Checkbox> <Checkbox className="fl" onChange={this.onCheckAll} checked={checkAllValue}>已选 {checkBoxValues.length} 不支持跨页勾选</Checkbox>
<div className="studentList_operation_ul"> <div className="studentList_operation_ul">
<li className="li_line"><a href="javascript:void(0)" className="color-grey-9" onClick={()=>this.onDelete(1)}>删除</a></li> <li className="li_line"><a href="javascript:void(0)" className="color-grey-9" onClick={()=>this.onDelete(1)}>删除</a></li>
{ {

@ -128,7 +128,8 @@ class studentsList extends Component{
} }
/// 确认是否下载 /// 确认是否下载
confirmysl(url){ confirmysl(url){
axios.get(url).then((response) => { // this.props.showGlobalLoading('正在生成文件,请稍后...')
axios.get(url + 'export=true').then((response) => {
if(response === undefined){ if(response === undefined){
return return
} }
@ -659,7 +660,7 @@ class studentsList extends Component{
return item.id != course_group_id && (!this.state.groupSearchValue || item.name.indexOf(this.state.groupSearchValue) != -1) return item.id != course_group_id && (!this.state.groupSearchValue || item.name.indexOf(this.state.groupSearchValue) != -1)
}).map( item => { }).map( item => {
return ( return (
<li key={item.id} onClick={() => this.moveToGroup(item)}>{item.name}</li> <li key={item.id} onClick={() => this.moveToGroup(item)} title={item.name}>{item.name}</li>
) )
}) } }) }
{ isAdmin && { isAdmin &&

@ -151,7 +151,8 @@ class Poll extends Component{
changePage=(pageNumber)=>{ changePage=(pageNumber)=>{
this.setState({ this.setState({
page:pageNumber page:pageNumber,
checkBoxValues:[]
}) })
let{type,StudentList_value}=this.state let{type,StudentList_value}=this.state
this.InitList(type,StudentList_value,pageNumber); this.InitList(type,StudentList_value,pageNumber);
@ -543,7 +544,7 @@ class Poll extends Component{
pollsList && pollsList.length > 0 && isAdmin && pollsList && pollsList.length > 0 && isAdmin &&
<div className="mt20 edu-back-white padding20-30"> <div className="mt20 edu-back-white padding20-30">
<div className="clearfix"> <div className="clearfix">
<Checkbox className="fl" onChange={this.onCheckAll} checked={checkAllValue}>已选 {checkBoxValues.length} </Checkbox> <Checkbox className="fl" onChange={this.onCheckAll} checked={checkAllValue}>已选 {checkBoxValues.length} 不支持跨页勾选</Checkbox>
<div className="studentList_operation_ul"> <div className="studentList_operation_ul">
<li className="li_line"><a className="color-grey-9" onClick={()=>this.ActionPoll("delete")}>删除</a></li> <li className="li_line"><a className="color-grey-9" onClick={()=>this.ActionPoll("delete")}>删除</a></li>
<li className="li_line"> <li className="li_line">

@ -218,8 +218,7 @@ class ShixunhomeWorkItem extends Component{
footer={null} footer={null}
> >
<div className="task-popup-content"> <div className="task-popup-content">
<p className="task-popup-text-center font-16 pb20">本实训的开启时间{shixunsmessage} <br/>开启时间之前不能挑战 <p className="task-popup-text-center font-16 pb20">目前该实训项目尚在内测中将于{shixunsmessage}之后开放谢谢</p>
</p>
</div> </div>
<div className="task-popup-submit clearfix"> <div className="task-popup-submit clearfix">
{/*<a onClick={this.hidestartshixunCombattype} className="task-btn fl">取消</a>*/} {/*<a onClick={this.hidestartshixunCombattype} className="task-btn fl">取消</a>*/}

@ -54,7 +54,8 @@ class ShixunHomework extends Component{
course_groupslist:[], course_groupslist:[],
checkedtype:false, checkedtype:false,
checkBoxValues:[], checkBoxValues:[],
isSpin:false isSpin:false,
antIcon:false
} }
} }
updateNavSuccess=()=>{ updateNavSuccess=()=>{
@ -559,7 +560,8 @@ class ShixunHomework extends Component{
let {Coursename,order}=this.state; let {Coursename,order}=this.state;
this.setState({ this.setState({
page:pageNumber page:pageNumber,
checkBoxValues:[]
}) })
this.homeworkupdatalist(Coursename,pageNumber,order); this.homeworkupdatalist(Coursename,pageNumber,order);
@ -659,10 +661,11 @@ class ShixunHomework extends Component{
savedelete=()=>{ savedelete=()=>{
this.setState({
antIcon:true
})
let {Coursename,page,order,checkBoxValues,datas}=this.state; let {Coursename,page,order,checkBoxValues,datas}=this.state;
let category_id=this.props.match.params.category_id; let category_id=this.props.match.params.category_id;
const cid = this.props.match.params.coursesId const cid = this.props.match.params.coursesId
const url = `/courses/`+cid+`/homework_commons/multi_destroy.json`; const url = `/courses/`+cid+`/homework_commons/multi_destroy.json`;
axios.post(url, { axios.post(url, {
@ -690,10 +693,16 @@ class ShixunHomework extends Component{
Loadtype:false, Loadtype:false,
checkBoxValues:[], checkBoxValues:[],
checkedtype:false, checkedtype:false,
antIcon:false
}) })
this.props.showNotification(response.data.message) this.props.showNotification(response.data.message)
this.homeworkupdatalist(Coursename,page,order); this.homeworkupdatalist(Coursename,page,order);
this.props.updataleftNavfun() this.props.updataleftNavfun()
}else{
this.setState({
antIcon:false
})
this.props.showNotification(response.data.message)
} }
}) })
.catch(function (error) { .catch(function (error) {
@ -922,6 +931,7 @@ class ShixunHomework extends Component{
course_modules, course_modules,
shixunpath, shixunpath,
order, order,
antIcon,
}=this.state; }=this.state;
let main_id=this.props.match.params.main_id; let main_id=this.props.match.params.main_id;
@ -937,6 +947,7 @@ class ShixunHomework extends Component{
modalSave={this.state.ModalSave} modalSave={this.state.ModalSave}
modalsBottomval={this.state.ModalsBottomval} modalsBottomval={this.state.ModalsBottomval}
loadtype={this.state.Loadtype} loadtype={this.state.Loadtype}
antIcon={this.state.antIcon}
/>:""} />:""}
{/*立即发布*/} {/*立即发布*/}
{visible===true?<HomeworkModal {visible===true?<HomeworkModal
@ -1070,7 +1081,7 @@ class ShixunHomework extends Component{
<div className="mt20 edu-back-white padding20-30"> <div className="mt20 edu-back-white padding20-30">
<div className="clearfix"> <div className="clearfix">
<Checkbox className="fl" style={{marginTop:'0px'}}checked={checkedtype} onClick={this.funselect}>已选 {checkBoxValues&&checkBoxValues.length} </Checkbox> <Checkbox className="fl" style={{marginTop:'0px'}}checked={checkedtype} onClick={this.funselect}>已选 {checkBoxValues&&checkBoxValues.length} 不支持跨页勾选</Checkbox>
<div className="studentList_operation_ul"> <div className="studentList_operation_ul">
<li className="li_line"><a className="color-grey-9" onClick={this.onDelete}>删除</a></li> <li className="li_line"><a className="color-grey-9" onClick={this.onDelete}>删除</a></li>
<li className="li_line"><a className="color-grey-9" onClick={this.homeworkstart}>立即发布</a></li> <li className="li_line"><a className="color-grey-9" onClick={this.homeworkstart}>立即发布</a></li>
@ -1089,7 +1100,7 @@ class ShixunHomework extends Component{
{course_modules&&course_modules.main_category.map((item,key)=>{ {course_modules&&course_modules.main_category.map((item,key)=>{
return( return(
datas&&datas.category_id===null?"":<li key={key} id={item.main_category_id} onClick={() => this.moveTos(item.main_category_id)}>{item.main_category_name}</li> datas&&datas.category_id===null?"":<li key={key} id={item.main_category_id} onClick={() => this.moveTos(item.main_category_id)} title={item.main_category_name}>{item.main_category_name}</li>
) )
})} })}
@ -1098,10 +1109,10 @@ class ShixunHomework extends Component{
return (!this.state.dirSearchValue || item.category_name.indexOf(this.state.dirSearchValue) != -1) return (!this.state.dirSearchValue || item.category_name.indexOf(this.state.dirSearchValue) != -1)
}).map( (item,key) => { }).map( (item,key) => {
if(datas&&datas.category_id!=null&&datas&&datas.category_id===item.category_id===false){ if(datas&&datas.category_id!=null&&datas&&datas.category_id===item.category_id===false){
return <li key={key} id={item.category_id} onClick={() => this.moveTos(item.category_id )}>{item.category_name}</li> return <li key={key} id={item.category_id} onClick={() => this.moveTos(item.category_id )} title={item.category_name}>{item.category_name}</li>
} }
if(datas&&datas.category_id===null){ if(datas&&datas.category_id===null){
return <li key={key} id={item.category_id} onClick={() => this.moveTos(item.category_id )}>{item.category_name}</li> return <li key={key} id={item.category_id} onClick={() => this.moveTos(item.category_id )} title={item.category_name}>{item.category_name}</li>
} }
})} })}

@ -361,7 +361,7 @@ class DetailCards extends Component{
footer={null} footer={null}
> >
<div className="task-popup-content"> <div className="task-popup-content">
<p className="task-popup-text-center font-16 pb20">本实训的开启时间{this.state.shixunsmessage} <br/>开启时间之前不能挑战 </p> <p className="task-popup-text-center font-16 pb20">目前该实训项目尚在内测中将于{this.state.shixunsmessage}之后开放谢谢</p>
</div> </div>
<div className="task-popup-submit clearfix"> <div className="task-popup-submit clearfix">
{/*<a onClick={this.hidestartshixunCombattype} className="task-btn fl">取消</a>*/} {/*<a onClick={this.hidestartshixunCombattype} className="task-btn fl">取消</a>*/}

@ -731,8 +731,7 @@ class TPMBanner extends Component {
footer={null} footer={null}
> >
<div className="task-popup-content"> <div className="task-popup-content">
<p className="task-popup-text-center font-16 pb20">本实训的开启时间{shixunsmessage} <br/>开启时间之前不能挑战 <p className="task-popup-text-center font-16 pb20">目前该实训项目尚在内测中将于{shixunsmessage}之后开放谢谢</p>
</p>
</div> </div>
<div className="task-popup-submit clearfix"> <div className="task-popup-submit clearfix">
{/*<a onClick={this.hidestartshixunCombattype} className="task-btn fl">取消</a>*/} {/*<a onClick={this.hidestartshixunCombattype} className="task-btn fl">取消</a>*/}

@ -4,139 +4,43 @@ import {Input, Select, Radio, Checkbox, Popconfirm, message, Modal} from 'antd';
import {BrowserRouter as Router, Route, Link, Switch} from "react-router-dom"; import {BrowserRouter as Router, Route, Link, Switch} from "react-router-dom";
// import "antd/dist/antd.css";
import axios from 'axios'; import axios from 'axios';
import {getUrl} from 'educoder'; import TPMMDEditor from '../../tpm/challengesnew/TPMMDEditor';
let origin = getUrl();
let path = getUrl("/editormd/lib/")
const $ = window.$;
let timeout;
let currentValue;
const Option = Select.Option;
const RadioGroup = Radio.Group;
function create_editorMD(id, width, high, placeholder, imageUrl, callback) {
var editorName = window.editormd(id, {
width: width,
height: high,
path: path, // "/editormd/lib/"
syncScrolling: "single",
tex: true,
tocm: true,
emoji: true,
taskList: true,
codeFold: true,
searchReplace: true,
htmlDecode: "style,script,iframe",
sequenceDiagram: true,
autoFocus: false,
toolbarIcons: function () {
// Or return editormd.toolbarModes[name]; // full, simple, mini
// Using "||" set icons align right.
return ["bold", "italic", "|", "list-ul", "list-ol", "|", "code", "code-block", "|", "testIcon", "testIcon1", '|', "image", "table", '|', "watch", "clear"]
},
toolbarCustomIcons: {
testIcon: "<a type=\"inline\" class=\"latex\" ><div class='zbg'></div></a>",
testIcon1: "<a type=\"latex\" class=\"latex\" ><div class='zbg_latex'></div></a>"
},
//这个配置在simple.html中并没有但是为了能够提交表单使用这个配置可以让构造出来的HTML代码直接在第二个隐藏的textarea域中方便post提交表单。
saveHTMLToTextarea: true,
// 用于增加自定义工具栏的功能可以直接插入HTML标签不使用默认的元素创建图标
dialogMaskOpacity: 0.6,
placeholder: placeholder,
imageUpload: true,
imageFormats: ["jpg", "jpeg", "gif", "png", "bmp", "webp", "JPG", "JPEG", "GIF", "PNG", "BMP", "WEBP"],
imageUploadURL: imageUrl,//url
onload: function () {
// this.previewing();
$("#" + id + " [type=\"latex\"]").bind("click", function () {
editorName.cm.replaceSelection("```latex");
editorName.cm.replaceSelection("\n");
editorName.cm.replaceSelection("\n");
editorName.cm.replaceSelection("```");
var __Cursor = editorName.cm.getDoc().getCursor();
editorName.cm.setCursor(__Cursor.line - 1, 0);
});
$("#" + id + " [type=\"inline\"]").bind("click", function () { import {getUrl} from 'educoder';
editorName.cm.replaceSelection("$$$$");
var __Cursor = editorName.cm.getDoc().getCursor();
editorName.cm.setCursor(__Cursor.line, __Cursor.ch - 2);
editorName.cm.focus();
});
$("[type=\"inline\"]").attr("title", "行内公式");
$("[type=\"latex\"]").attr("title", "多行公式");
window.md_elocalStorage(editorName, `UpdatepropaedeMDs_${id}`, "UpdatepropaedeMDs");
callback && callback()
}
});
return editorName;
}
export default class TPMUpdatepropaede extends Component { export default class TPMUpdatepropaede extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
this.neweditanswerRef=React.createRef();
this.state = { this.state = {
shixunId:undefined shixunId:undefined,
}
}
updatepropaedeMD(initValue, id) {
this.contentChanged = false;
const placeholder = "";
// amp;
// 编辑时要传memoId
const imageUrl = `/api/attachments.json`;
// 创建editorMd
const Updatepropaede_editormd = create_editorMD(id, '100%', 400, placeholder, imageUrl, () => {
setTimeout(() => {
Updatepropaede_editormd.resize()
Updatepropaede_editormd.cm && Updatepropaede_editormd.cm.refresh()
}, 500)
if (initValue != undefined) {
Updatepropaede_editormd.setValue(initValue)
} }
Updatepropaede_editormd.cm.on("change", (_cm, changeObj) => {
console.log('....contentChanged')
this.contentChanged = true;
})
});
this.Updatepropaede_editormd = Updatepropaede_editormd;
window.Updatepropaede_editormd = Updatepropaede_editormd;
} }
componentDidMount() { componentDidMount() {
let id = this.props.match.params.shixunId; let id = this.props.match.params.shixunId;
let url="/shixuns/"+id+"/propaedeutics.json"; let url="/shixuns/"+id+"/propaedeutics.json";
axios.get(url).then((response) => { axios.get(url).then((response) => {
console.log(response)
if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { if (response.data.status === 403||response.data.status === 401||response.data.status === 500) {
}else{ }else{
this.setState({ this.setState({
shixunId:id shixunId:id,
}) })
if(response.data.content[0]!=null){ if(response.data.content[0]!=null){
this.updatepropaedeMD(response.data.content, "UpdatepropaedeMD"); this.setState({
editanswersRefval:response.data.content,
})
this.neweditanswerRef.current.setValue(response.data.content)
}else{ }else{
this.updatepropaedeMD("", "UpdatepropaedeMD"); this.setState({
editanswersRefval:"",
})
this.neweditanswerRef.current.setValue('')
} }
} }
}).catch((error) => { }).catch((error) => {
@ -148,7 +52,7 @@ export default class TPMUpdatepropaede extends Component {
updatepropaedeuticsvalue=()=>{ updatepropaedeuticsvalue=()=>{
let id = this.props.match.params.shixunId; let id = this.props.match.params.shixunId;
let url="/shixuns/"+id+"/update_propaedeutics.json"; let url="/shixuns/"+id+"/update_propaedeutics.json";
const update_propaedeuticsvalue = this.Updatepropaede_editormd.getValue(); const update_propaedeuticsvalue = this.editanswersRef.current.getValue().trim();
axios.post(url,{ axios.post(url,{
content:update_propaedeuticsvalue content:update_propaedeuticsvalue
} }
@ -163,10 +67,7 @@ export default class TPMUpdatepropaede extends Component {
}); });
} }
render() { render() {
let {shixunId} = this.state; let {shixunId} = this.state;
return ( return (
<React.Fragment> <React.Fragment>
<div className="educontent"> <div className="educontent">
@ -178,11 +79,8 @@ export default class TPMUpdatepropaede extends Component {
</div> </div>
<div className="padding40-20"> <div className="padding40-20">
<div className="padding10-20 edu-back-greyf5 radius4" id="UpdatepropaedeMD"> <TPMMDEditor ref={this.neweditanswerRef} placeholder="请输入选择题的题干内容" mdID={'editquestioMDid'} refreshTimeout={1500}
<textarea style={{display: 'none'}} id="Updatepropaedes" name="content"> </textarea> needRecreate={true} watch={true} className="courseMessageMD" initValue={this.neweditanswerRefval}></TPMMDEditor>
<div className="CodeMirror cm-s-defualt">
</div>
</div>
</div> </div>
</div> </div>

@ -44,7 +44,7 @@
position:relative; position:relative;
} }
.newedboxheight{ .newedboxheight{
max-height:204px; max-height: 177px;
overflow-y: hidden; overflow-y: hidden;
} }
.newminheight{ .newminheight{

@ -587,7 +587,7 @@ class Challenges extends Component {
footer={null} footer={null}
> >
<div className="task-popup-content"> <div className="task-popup-content">
<p className="task-popup-text-center font-16 pb20">本实训的开启时间{shixunsmessage} <br/>开启时间之前不能挑战 </p> <p className="task-popup-text-center font-16 pb20">目前该实训项目尚在内测中将于{shixunsmessage}之后开放谢谢 </p>
</div> </div>
<div className="task-popup-submit clearfix"> <div className="task-popup-submit clearfix">
{/*<a onClick={this.hidestartshixunCombattype} className="task-btn fl">取消</a>*/} {/*<a onClick={this.hidestartshixunCombattype} className="task-btn fl">取消</a>*/}

Loading…
Cancel
Save