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

courseware
cxt 5 years ago
commit 9bbcb3471d

@ -18,19 +18,17 @@ class QuestionBanksController < ApplicationController
# 已认证才能获取题库
if @certification_teacher
sql = %Q{
#{@objects.table_name}.is_public = 1 and concat(#{@objects.table_name}.name, course_lists.name) like
'%#{params[:search]}%'
}
@objects.joins(:course_list).where(sql)
#{@objects.table_name}.is_public = 1 and concat(#{@objects.table_name}.name, course_lists.name) like :keyword
}
@objects.joins(:course_list).where(sql, keyword: "%#{params[:search]}%")
else
@objects.none
end
else
sql = %Q{
#{@objects.table_name}.user_id = #{current_user.id} and concat(#{@objects.table_name}.name, course_lists.name) like
'%#{params[:search]}%'
}
@objects.joins(:course_list).where(sql)
#{@objects.table_name}.user_id = #{current_user.id} and concat(#{@objects.table_name}.name, course_lists.name) like :keyword
}
@objects.joins(:course_list).where(sql, keyword: "%#{params[:search]}%")
end
else
if params[:filter] == 'public'

@ -769,7 +769,7 @@ function showcity(province, cityField) {
var cityOptions = new Array("福州","厦门","泉州","漳州","龙岩","南平","宁德","莆田","三明");
break;
case "甘肃":
var cityOptions = new Array("兰州","白银","定西","敦煌","甘南","金昌","酒泉","临夏","平凉","天水","武都","武威","西峰","张掖");
var cityOptions = new Array("兰州","白银","定西","敦煌","甘南","金昌","酒泉","临夏","平凉","天水","陇南","武威","西峰","张掖");
break;
case "广西":
var cityOptions = new Array("南宁","百色","北海","桂林","防城港","贵港","河池","贺州","柳州","钦州","梧州","玉林");
@ -1267,7 +1267,7 @@ function opClickString(item) {
operationItem = item
// setTimeout(function(){ $(item).css('background', '#4CACFF');$(item).html(value); }, 4000)
}
//
//
// var isOperationSending = false;
$(document).bind('ajaxStop', function(event, xhr, settings) {
if (settings && settings.url && (settings.url.match(/operation\?/))) {

@ -91,6 +91,7 @@
"react-router-dom": "^4.2.2",
"react-split-pane": "^0.1.89",
"react-url-query": "^1.4.0",
"react-zmage": "^0.8.5-beta.31",
"redux": "^4.0.0",
"redux-thunk": "2.3.0",
"rsuite": "^4.0.1",

@ -46,7 +46,7 @@ debugType = "admin";
// 老师
// debugType="teacher";
// 学生
debugType="student";
// debugType="student";

@ -524,8 +524,8 @@ const options = [{
value: '天水',
label: '天水'
},{
value: '武都',
label: '武都'
value: '陇南',
label: '陇南'
},{
value: '武威',
label: '武威'

@ -18,8 +18,8 @@ function ImageLayer2(props) {
const fileName = event.target.innerHTML.trim()
if (isImageExtension((imageSrc && imageSrc.trim())) || isImageExtension(fileName) || event.target.tagName == 'IMG' || (imageSrc && imageSrc.indexOf('base64,')) != -1) {
// 非回复里的头像图片; 非emoticons
if (imageSrc.indexOf('/images/avatars/User') === -1 &&
imageSrc.indexOf('kindeditor/plugins/emoticons') === -1 ) {
if (imageSrc.indexOf('/images/avatars/User') === -1 &&
imageSrc.indexOf('kindeditor/plugins/emoticons') === -1 ) {
setShowImage(true)
setImageSrc(imageSrc)
}
@ -41,7 +41,7 @@ function ImageLayer2(props) {
})
return (
<ImageLayer showImage={showImage} imageSrc={imageSrc} onImageLayerClose={onImageLayerClose}></ImageLayer>
showImage?<ImageLayer showImage={showImage} imageSrc={imageSrc} onImageLayerClose={onImageLayerClose}></ImageLayer>:""
)
}

@ -137,6 +137,9 @@ class TPIContextProvider extends Component {
this.costTimeInterval && window.clearInterval(this.costTimeInterval)
}
componentDidMount() {
window.$(window).unload( ()=>{
console.log(12321)
});
// TODO 登录状态的判断?
// request
@ -158,12 +161,24 @@ class TPIContextProvider extends Component {
}
}, 1000)
// 页面离开时存下用户的任务耗时
// 页面离开时存下用户的任务耗时
window.$(window).bind('beforeunload', function (e) {
console.log(111111)
this._updateCostTime();
})
// // 页面离开时存下用户的任务耗时
// window.$(window).unload( ()=>{
// this._updateCostTime();
// });
window.$(window).unload( ()=>{
this._updateCostTime();
});
}
// force 评测通过后异步执行该方法强制同步costTime到服务端
_updateCostTime(async = false, force) {
const { game, loading } = this.state;

@ -107,6 +107,15 @@ class CommonWorkAppraise extends Component{
}
gotoget_next_work=(id)=>{
if(this.props.match.path===`/classrooms/:coursesId/common_homework/:workId/:studentWorkId/appraise`){
this.props.history.replace(`/classrooms/${this.props.match.params.coursesId}/common_homeworks/${this.props.match.params.workId}/${id}/appraise`);
}
if(this.props.match.path===`/classrooms/:coursesId/group_homework/:workId/:studentWorkId/appraise`){
this.props.history.replace(`/classrooms/${this.props.match.params.coursesId}/common_homeworks/${this.props.match.params.workId}/${id}/appraise`);
}
if(this.props.match.path===`/classrooms/:coursesId/common_homeworks/:workId/:studentWorkId/appraise`){
this.props.history.replace(`/classrooms/${this.props.match.params.coursesId}/common_homeworks/${this.props.match.params.workId}/${id}/appraise`);
}
@ -114,6 +123,7 @@ class CommonWorkAppraise extends Component{
if(this.props.match.path===`/classrooms/:coursesId/group_homeworks/:workId/:studentWorkId/appraise`){
this.props.history.replace(`/classrooms/${this.props.match.params.coursesId}/common_homeworks/${this.props.match.params.workId}/${id}/appraise`);
}
this.setState({
get_next_worktype:false
})

@ -94,12 +94,12 @@ class CoursesHomeCard extends Component{
</Tooltip>
</p>
<div className="mb15 task-hide mt10" style={{height:20}}>
<div className="task-hide" style={{height:25,marginBottom:10}}>
{item.teacher_users.length===0?'':
<span className="color-grey-98" >协作老师
{item.teacher_users.map((iem,idx)=>{
return(
<span className="mb15 task-hide mt10" style={{width:50,marginLeft:5}}>{idx<3?iem:''} </span>
<span className="task-hide" style={{width:50,marginLeft:5}}>{idx<3?iem:''} </span>
)
})
}

@ -547,8 +547,9 @@ class Trainingjobsetting extends Component {
}
} else {
//不是统一设置
//分班设置
// console.log("分班设置");
console.log("分班设置");
// console.log(this.$pollDetailTabForthRules);
const result=this.$pollDetailTabForthRules.notUnifiedSettingCheck(this.state.rules);
@ -561,11 +562,79 @@ class Trainingjobsetting extends Component {
return false;
}
let rulesdata = this.state.rulesdata;
if (rulesdata.length === 0) {
this.props.showNotification(`分班发布设置不能为空`);
return;
}
}
}else{
// console.log("分班设置");
var mylate_times=false;
if (this.state.unifiedsetting === false) {
///非统一设置
let rulesdata = this.state.rulesdata;
//开启了补交
if(this.state.allowreplenishment===true){
//补交结束时间不为空
if(this.state.late_time){
// 分班设置数组不为空
if(rulesdata){
for(var i=0;i<rulesdata.length-1;i++){
let item=rulesdata[i];
if(item.end_time!=="Invalid date"){
let emdtimes=null;
try {
emdtimes= moment(item.end_time, "YYYY-MM-DD HH:mm")
}catch (e) {
}
if(emdtimes){
if(moment(this.state.late_time, "YYYY-MM-DD HH:mm") <= emdtimes){
mylate_times=true;
let kus=i+1;
this.setState({
hand__e_tip: "补交时间必须晚于发布规则" +kus+ "的截止时间",
hand_flags: true,
handclass: "bor-reds",
});
this.props.showNotification(`补交结束时间必须晚于截止时间`);
break;
}else{
mylate_times=false;
this.setState({
hand__e_tip: "",
hand_flags: false,
handclass: undefined,
})
}
}
}
}
}
}
}
if(mylate_times){
this.scrollToAnchor("late_timeids");
return
}
}else{
///统一设置
}
}
@ -787,22 +856,27 @@ class Trainingjobsetting extends Component {
// console.log(JSON.stringify(data));
axios.post(url, data)
.then((result) => {
if (result.data.status == 0) {
// console.log(JSON.stringify(result));
this.getTrainingjobsetting(true);
this.props.showNotification(`更新成功`);
this.setState({
flagPageEditsbox: false,
flagPageEdit: false,
flagPageEditstwo: false,
flagPageEditsthrees: false,
flagPageEditsfor: false,
whethertopay: false,
completionefficiencyscore: false,
})
this.refs.targetElementTrainingjobsetting.scrollIntoView()
if(result){
if(result.data){
if (result.data.status == 0) {
// console.log(JSON.stringify(result));
this.getTrainingjobsetting(true);
this.props.showNotification(`更新成功`);
this.setState({
flagPageEditsbox: false,
flagPageEdit: false,
flagPageEditstwo: false,
flagPageEditsthrees: false,
flagPageEditsfor: false,
whethertopay: false,
completionefficiencyscore: false,
})
this.refs.targetElementTrainingjobsetting.scrollIntoView()
}
}
}
}).catch((error) => {
console.log(error);
})
@ -2577,7 +2651,7 @@ class Trainingjobsetting extends Component {
</div>
{/*补交设置*/}
<div className="stud-class-set bor-bottom-greyE edu-back-white">
<div className="stud-class-set bor-bottom-greyE edu-back-white" id={"late_timeids"}>
<div className=" clearfix edu-back-white poll_list mt10">
<div className={"font-16 color-dark fl pl20 mt10 "} style={{color: "#05101A"}}>补交设置</div>
</div>
@ -2660,7 +2734,7 @@ class Trainingjobsetting extends Component {
<p className="color-red lineh-25 clearfix ml70" style={{height: "25px"}}>
{
this.state.hand__e_tip && this.state.hand__e_tip != "" ?
<span className="fl">{this.state.hand__e_tip}</span> : ""
<span className="fl ml10">{this.state.hand__e_tip}</span> : ""
}
</p>
</div>
@ -2929,75 +3003,3 @@ class Trainingjobsetting extends Component {
}
export default Trainingjobsetting;
// <div className="stud-class-set bor-bottom-greyE ">
// <div className=" clearfix edu-back-white poll_list">
// <a onClick={(e)=>this.ChangeTab(0)}>作品列表</a>
// <a onClick={(e)=>this.ChangeTab(1)}>作业问答</a>
// {this.props.isAdmin()?this.state.code_review===true||jobsettingsdata === undefined ? [""] : jobsettingsdata.data.homework_status[0]==="未发布"?"": <a onClick={(e)=>this.ChangeTab(2)}>代码查重</a> : ""}
// <style>{
// `
// .poll_list a.active:after {
// content: '';
// width: 57px;
// left: 10px;
// bottom: 0px;
// height: 2px;
// background-color: #4CACFF;
// position: absolute;
// }
// `
// }</style>
// <a className="active"
// onClick={(e)=>this.ChangeTab(3)}
// >设置</a>
// <style>{`
// .drop_down_menu li a {
// padding: 0px;
// font-size: 14px;
// }
// .drop_down_menu {
// width: 93px;
// }
// .drop_down_menu li {
// overflow: visible;
// width: 93px;
// }
// .drop_down_menu, .drop_down_normal {
// padding-top: 10px;
// padding-bottom: 8px;
// }
// a:hover {
// color:#1A0B00 !important;
// }
// `}</style>
// {this.props.isAdmin() ? <li className="li_line drop_down fr color-blue font-16 mr8 mt20" style={{"padding": "0 20px"}}>
// 导出<i className="iconfont icon-xiajiantou font-12 ml2"></i>
// <ul className="drop_down_menu" style={{"right": "-0px", "left": "unset", "height": "auto"}}>
// <li><a onClick={()=>this.confirmysl(`/zip/shixun_report?homework_common_id=${this.props.match.params.homeworkid}`)}>实训报告</a>
// </li>
// <li><a onClick={()=>this.confirmysl(`/homework_commons/${this.props.match.params.homeworkid}/works_list.xlsx`)}>学生成绩</a>
// </li>
// </ul>
// </li>: ""}
// {this.props.isAdmin() ?jobsettingsdata&&jobsettingsdata.data.end_immediately===true?
// <a className="fr color-blue font-16" onClick={this.homeworkends}>立即截止</a>
// : "": ""}
// {this.props.isAdmin() ?jobsettingsdata&&jobsettingsdata.data.publish_immediately===true?
// <a className="fr color-blue font-16" onClick={this.homeworkstart}>立即发布</a>: "" : ""}
// {this.props.isAdmin()?
// jobsettingsdata&&jobsettingsdata.data.code_review===true?
// <a className="fr color-blue font-16" onClick={this.workshowmodel}>代码查重</a>: "":""}
// {
// jobsettingsdata&& jobsettingsdata&&jobsettingsdata.data === undefined ? ""
// : jobsettingsdata&& jobsettingsdata.data.commit_des === null || jobsettingsdata&& jobsettingsdata.data.commit_des === undefined ? "" :
// <a className="fr color-blue font-16"
// href={`/courses/${this.state.props.match.params.coursesId}/${this.state.shixuntypes}/${ jobsettingsdata&& jobsettingsdata.data === undefined ? "" : jobsettingsdata&& jobsettingsdata.data.id}/commitsummary/${this.state.props.match.params.homeworkid}`}>{ jobsettingsdata&& jobsettingsdata.data.commit_des}</a>
// }
// { jobsettingsdata&&jobsettingsdata.data === undefined ? "" : <Startshixuntask
// {...this.props}
// data={ jobsettingsdata&& jobsettingsdata.data}
// />}
{/* </div>*/
}
{/*</div>*/
}

@ -59,7 +59,7 @@ class LeftNav extends Component {
<div className="leftnav" style={{position: 'fixed', bottom:0}}>
<a href="/shixuns/uznmbg54?exit=true" className="leftnav-box-inner" id="exit_task_tab">
<i className="fa fa-arrow-left font-20"></i><br/><span className="font-12">退出实训</span>
<i className="fa fa-arrow-left font-20"></i><br/><span className="font-12">退出实训1</span>
</a>
</div>

@ -1,26 +1,63 @@
import React, { Component } from 'react';
import ReactDOM from 'react-dom'
import { Redirect } from 'react-router';
import PropTypes from 'prop-types';
import Rate from 'rc-rate';
import { Button,Icon} from 'antd';
import './TaskResultLayer.css'
class ImageLayer extends Component {
constructor(props) {
super(props);
this.state = {
visible: false,
previewImage: '',
current: 90,
transStyle: ''
}
}
translate = () => {
this.setState({
current:(this.state.current+90)%360,
transStyle:'rotate('+this.state.current+'deg)'
});
}
render() {
let { showImage, imageSrc, onImageLayerClose } = this.props;
// 语法介绍 https://reactjs.org/docs/portals.html
// 将html渲染都指定的element下
return ReactDOM.createPortal(
<div>
{showImage ?
<div className="taskResultLayer" onClick={onImageLayerClose} style={{overflow: 'auto'}}>
<div className="passContent">
<img src={ imageSrc } className="passImg" unselectable="on" alt=""/>
</div>
{showImage ?
<div className="taskResultLayer">
<div className={"ImageLayerbutton mt20"}>
<Button
className={"fr"}
onClick={()=>this.props.onImageLayerClose()}
>
关闭<Icon type="close" />
</Button>
<Button
href={imageSrc}
className={"fr mr10"}
>
下载<Icon type="vertical-align-bottom" />
</Button>
<Button
onClick = {()=>this.translate()}
className={"fr mr10"}
>
旋转<Icon type="reload" theme="outlined" />
</Button>
</div>
<div className="passContent" style={{ transform:this.state.transStyle}}>
<img src={imageSrc} className="passImg" unselectable="on" alt=""/>
</div>
</div>
:
<div></div>

@ -7,7 +7,7 @@
background:rgba(0,0,0,0.8);
top: 0px;
overflow: hidden;
}
}
.taskResultLayer .closeIcon{
position: absolute;
right: 100px;
@ -40,7 +40,7 @@
justify-content: center;
align-items: center;
display: -webkit-flex;
height: 100%;
height: 90%;
text-align: center;
}
.passImg{
@ -137,4 +137,11 @@
.vertical4{
vertical-align: -4px;
}
.ImageLayerbutton{
position: absolute;
top: 0px;
right: 10px;
z-index: 10;
}

@ -346,7 +346,7 @@ class InfosCourse extends Component{
<span><img alt="用户" className="radius mt15" height="50" src={getImageUrl('images/'+`${item.teacher && item.teacher.avatar_url}`)} width="50"/></span>
<p className="font-14 mt10 task-hide"><span>{item.teacher && item.teacher.real_name}</span></p>
<p className="font-16 mb15 task-hide mt10"><span className="color-grey-98">{item&&item.school}</span></p>
<div className="task-hide" style={{height:20,marginBottom:10}}>
<div className="task-hide" style={{height:30 }}>
{item.teacher_users.length===0?'':
<span className="color-grey-98">协作老师
{item.teacher_users.map((iem,idx)=>{

Loading…
Cancel
Save