diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 4396f5936..317383d5a 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -23,23 +23,23 @@ class ApplicationController < ActionController::Base # 所有请求必须合法签名 def check_sign - unless Rails.env.development? - Rails.logger.info("66666 #{params}") - suffix = request.url.split(".").last.split("?").first - suffix_arr = ["xls", "xlsx", "pdf", "zip"] # excel文件先注释 - unless suffix_arr.include?(suffix) - if params[:client_key].present? - randomcode = params[:randomcode] - # tip_exception(501, "请求不合理") unless (Time.now.to_i - randomcode.to_i).between?(0,5) - - sign = Digest::MD5.hexdigest("#{OPENKEY}#{randomcode}") - Rails.logger.info("2222 #{sign}") - tip_exception(501, "请求不合理") if sign != params[:client_key] - else - tip_exception(501, "请求不合理") - end - end - end + # unless Rails.env.development? + # Rails.logger.info("66666 #{params}") + # suffix = request.url.split(".").last.split("?").first + # suffix_arr = ["xls", "xlsx", "pdf"] # excel文件先注释 + # unless suffix_arr.include?(suffix) + # if params[:client_key].present? + # randomcode = params[:randomcode] + # # tip_exception(501, "请求不合理") unless (Time.now.to_i - randomcode.to_i).between?(0,5) + # + # sign = Digest::MD5.hexdigest("#{OPENKEY}#{randomcode}") + # Rails.logger.info("2222 #{sign}") + # tip_exception(501, "请求不合理") if sign != params[:client_key] + # else + # tip_exception(501, "请求不合理") + # end + # end + # end end # 全局配置参数 diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index 87ab58f63..a18e395dd 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -40,7 +40,7 @@ if (isDev) { // 超管 // debugType="admin"; // 老师 -//ebugType="teacher"; +//debugType="teacher"; // 学生 //debugType="student"; @@ -126,7 +126,7 @@ export function initAxiosInterceptors(props) { let timestamp = Date.parse(new Date())/1000; if (window.location.port === "3007") { // let timestamp=railsgettimes(proxy); - console.log(timestamp) + // console.log(timestamp) railsgettimes(`${proxy}/api/main/first_stamp.json`); let newopens=md5(opens+timestamp) config.url = `${proxy}${url}`; diff --git a/public/react/src/modules/courses/busyWork/reply/CommonWorkAppraiseReply.js b/public/react/src/modules/courses/busyWork/reply/CommonWorkAppraiseReply.js index b67266d77..3d3f83bc6 100644 --- a/public/react/src/modules/courses/busyWork/reply/CommonWorkAppraiseReply.js +++ b/public/react/src/modules/courses/busyWork/reply/CommonWorkAppraiseReply.js @@ -297,7 +297,7 @@ class CommonWorkAppraiseReply extends Component{ - + { excellent===true&&this.props.isAdminOrStudent()===false?"": trigger.parentNode} visible={coursedata.teacher_applies_count===undefined?false:coursedata.teacher_applies_count>0?true:false} @@ -766,7 +766,7 @@ background:rgba(204,204,204,0.2) !important; 学分 {coursedata.credit} } - + } {/*
  • */} {/**/} diff --git a/public/react/src/modules/forums/MemoDetail.js b/public/react/src/modules/forums/MemoDetail.js index 7578eea6e..db00bdf6f 100644 --- a/public/react/src/modules/forums/MemoDetail.js +++ b/public/react/src/modules/forums/MemoDetail.js @@ -55,7 +55,7 @@ class MemoDetail extends Component { } } componentDidMount() { - window.$("html,body").animate({"scrollTop":0}) + // window.$("html,body").animate({"scrollTop":0}) const { match } = this.props diff --git a/public/react/src/modules/home/shixunsHome.js b/public/react/src/modules/home/shixunsHome.js index 3e295344c..8ae97450d 100644 --- a/public/react/src/modules/home/shixunsHome.js +++ b/public/react/src/modules/home/shixunsHome.js @@ -200,13 +200,13 @@ class ShixunsHome extends Component { item.sub_repertoires.map((i,k)=>{ return(
    -

    {i.name} -

    +
    { i.tags.map((t,e)=>{ return( diff --git a/public/react/src/modules/page/main/ChooseEvaluateView.js b/public/react/src/modules/page/main/ChooseEvaluateView.js index e9a2b6eed..64efa08f6 100644 --- a/public/react/src/modules/page/main/ChooseEvaluateView.js +++ b/public/react/src/modules/page/main/ChooseEvaluateView.js @@ -1,10 +1,10 @@ import React, { Component } from 'react'; -import IconButton from 'material-ui/IconButton'; import Tooltip from 'material-ui/Tooltip'; import { CircularProgress } from 'material-ui/Progress'; +import './ChooseEvaluateViewnew.css'; class ChooseEvaluateView extends Component { @@ -128,7 +128,7 @@ class ChooseEvaluateView extends Component {
    -
    +
    {/* diff --git a/public/react/src/modules/page/main/ChooseEvaluateViewnew.css b/public/react/src/modules/page/main/ChooseEvaluateViewnew.css new file mode 100644 index 000000000..4b9d988ae --- /dev/null +++ b/public/react/src/modules/page/main/ChooseEvaluateViewnew.css @@ -0,0 +1,3 @@ +.paddingbottom60tpm{ + padding-bottom: 60px; +} \ No newline at end of file diff --git a/public/react/src/modules/page/main/CodeEvaluateView.css b/public/react/src/modules/page/main/CodeEvaluateView.css index 9c07c4541..3b391ff16 100644 --- a/public/react/src/modules/page/main/CodeEvaluateView.css +++ b/public/react/src/modules/page/main/CodeEvaluateView.css @@ -134,4 +134,8 @@ } .-task-ces-info .inputTitle .input{ white-space: pre-wrap; +} + +.paddingbottom60tpm{ + padding-bottom: 60px; } \ No newline at end of file diff --git a/public/react/src/modules/page/main/CodeEvaluateView.js b/public/react/src/modules/page/main/CodeEvaluateView.js index 346b8797e..fef5bd83e 100644 --- a/public/react/src/modules/page/main/CodeEvaluateView.js +++ b/public/react/src/modules/page/main/CodeEvaluateView.js @@ -1,11 +1,10 @@ import '../VNC.css'; import React, { Component } from 'react'; -import IconButton from 'material-ui/IconButton'; import Tooltip from 'material-ui/Tooltip'; -import Button from 'material-ui/Button'; + import { connect } from 'react-redux'; -import './CodeEvaluateView.css' +import './CodeEvaluateView.css'; import { CircularProgress } from 'material-ui/Progress'; import { on, off } from 'educoder' import actions from '../../../redux/actions'; @@ -386,7 +385,7 @@ class CodeEvaluateView extends Component {
    -
    +
    {/* diff --git a/public/react/src/modules/question/component/SingleEditor.js b/public/react/src/modules/question/component/SingleEditor.js index 142999632..e226b9b68 100644 --- a/public/react/src/modules/question/component/SingleEditor.js +++ b/public/react/src/modules/question/component/SingleEditor.js @@ -5,6 +5,7 @@ import { Slider, Button, Upload, Icon, Rate, Checkbox, message, Row, Col, Select, Modal, Tooltip } from 'antd'; +import QuillForEditor from '../../../common/quillForEditor'; import TPMMDEditor from '../../../modules/tpm/challengesnew/TPMMDEditor'; import axios from 'axios' import update from 'immutability-helper' @@ -302,11 +303,18 @@ class SingleEditor extends Component{ 题干:

    - this.setState({ question_title: val})} - ref="titleEditor" + {/* this.setState({ question_title: val})}*/} + {/* ref="titleEditor"*/} - > + {/*>*/} + +
    {/* {!question_id ? '新建' : '编辑'} */} diff --git a/public/react/src/modules/tpm/TPMIndexHOC.js b/public/react/src/modules/tpm/TPMIndexHOC.js index 4116aef3a..f46835959 100644 --- a/public/react/src/modules/tpm/TPMIndexHOC.js +++ b/public/react/src/modules/tpm/TPMIndexHOC.js @@ -375,9 +375,7 @@ export function TPMIndexHOC(WrappedComponent) { }); } - /** - 课堂权限相关方法,暂时写这里了 ----------------------------------------END - */ + fetchUser = () => { let url = `/users/get_user_info.json` let courseId; diff --git a/public/react/src/modules/tpm/jupyter/index.js b/public/react/src/modules/tpm/jupyter/index.js index dab3a1f5e..6883aa72f 100644 --- a/public/react/src/modules/tpm/jupyter/index.js +++ b/public/react/src/modules/tpm/jupyter/index.js @@ -69,6 +69,7 @@ function JupyterTPI (props) { drawervisible, reset_with_tpi, jupytertime, + endjupytertime, active_with_tpi, spinning, updataspinning, @@ -303,7 +304,7 @@ function JupyterTPI (props) { >
    - {item.title} + {item.title} { jsCopy("file_path"+i) @@ -326,6 +327,7 @@ function JupyterTPI (props) { }, [props]); const onFinish= () =>{ + Modal.destroyAll(); Modal.confirm({ title: '倒计时截止', content: ( @@ -337,11 +339,24 @@ function JupyterTPI (props) { cancelText: '取消', onOk () { reset_with_tpi(myIdentifier, '重置成功'); - // active_with_tpi(myIdentifier, '重置成功'); } }) } - + const endonFinish= () =>{ + Modal.confirm({ + title: '服务中断提醒', + content: ( +

    + jupyter将于时间后服务中断,是否需要延长使用时间? +

    + ), + okText: '立即延长', + cancelText: '不需要', + onOk () { + active_with_tpi(myIdentifier, '延长成功'); + } + }) + } return (
    @@ -351,6 +366,9 @@ function JupyterTPI (props) { {jupyterInfo.name} + + {endjupytertime===false?"":} +

    @@ -457,7 +475,7 @@ const mapStateToProps = (state) => { jupyter_pagination, jupyter_identifier } = state.jupyterReducer; - const { loading ,drawervisible,jupytertime,spinning} = state.commonReducer; + const { loading ,drawervisible,jupytertime,spinning,endjupytertime} = state.commonReducer; return { loading, jupyter_info, @@ -470,6 +488,7 @@ const mapStateToProps = (state) => { jupyter_identifier, drawervisible, jupytertime, + endjupytertime, spinning }; } diff --git a/public/react/src/modules/tpm/jupyter/index.scss b/public/react/src/modules/tpm/jupyter/index.scss index 2428b93fd..b2c900652 100644 --- a/public/react/src/modules/tpm/jupyter/index.scss +++ b/public/react/src/modules/tpm/jupyter/index.scss @@ -26,7 +26,7 @@ .filestyles{ color: #28b887 !important; font-size: 25px !important; - margin-left:20px; + margin-left:48px; } .Resizer.horizontal:hover { border-top: 5px solid rgba(0, 0, 0, 0.5); @@ -230,16 +230,32 @@ line-height: 50px !important; width: 186px; } -.maxnamewidth181{ - max-width:181px; +.maxnamewidth152{ + max-width:152px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: default; - width: 181px; + width: 152px; } .height45lineheight45{ height: 45px; line-height: 45px !important; +} + +.Countdowntypes{ + width:1px; + height:1px; + overflow: hidden; + display: block; +} + +.Countdownfonttpi{ + width: 60px; + display: inline-block; +} + +.Countdownfonttpi .ant-statistic-content-value{ + font-size: 14px; } \ No newline at end of file diff --git a/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js b/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js index 0e30f21ea..c1a5f8dea 100644 --- a/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js +++ b/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js @@ -30,7 +30,8 @@ class Challengesjupyter extends Component { fileList:[], shuaxin:false, showtime:false, - jupytertime:Date.now() +3600 * 1000 + jupytertime:Date.now() +3600 * 1000, + endtimes:false } } @@ -119,10 +120,12 @@ class Challengesjupyter extends Component { let remainingSeconds=response.data.remainingSeconds; // let summain=3600 * 1000; let sums= remainingSeconds * 1000; + let endsms=(remainingSeconds-300<=0?0:remainingSeconds-300)*1000 // let sum=summain-sums; setTimeout(()=>{ this.setState({ - jupytertime:Date.now() +sums + jupytertime:Date.now() +sums, + endtimes:endsms===0?Date.now()+1000:Date.now() +endsms }) },500); } @@ -420,6 +423,7 @@ class Challengesjupyter extends Component { } onFinish=()=>{ + Modal.destroyAll(); let id=this.props.match.params.shixunId; let that=this; Modal.confirm({ @@ -436,8 +440,45 @@ class Challengesjupyter extends Component { } }) } + + onendFinish=()=>{ + let id=this.props.match.params.shixunId; + let that=this; + Modal.confirm({ + title:"服务中断提醒", + content: ( +

    + jupyter将于时间后服务中断,是否需要延长使用时间? +

    + ), + okText: '立即延长', + cancelText: '不需要', + onOk () { + that.onendhandleClickResetTpi(id) + } + }) + } + + + onendhandleClickResetTpi=(id)=>{ + + const url = `/jupyters/active_with_tpm.json`; + axios.get(url,{params:{ + identifier:id + }}).then((response) => { + if(response.data.status===0){ + this.props.showNotification('延长成功!'); + setTimeout(()=>{ + this.setState({ + jupytertime:Date.now() + 900 * 1000, + endtimes:Date.now() + 300 * 1000 + }) + },500); + } + }); + } render() { - let{ChallengesDataList,booljupyterurls,enlarge,fileList}=this.state; + let{ChallengesDataList,booljupyterurls,enlarge,fileList,endtimes}=this.state; let id = this.props.match.params.shixunId; //老师 const is_teacher = this.props&&this.props.current_user&&this.props.current_user.is_teacher?this.props.current_user.is_teacher:false; @@ -509,6 +550,7 @@ class Challengesjupyter extends Component { {/*this.state.jupytertime*/} + {endtimes===false?"":}

    diff --git a/public/react/src/modules/tpm/shixunchild/shixunchildCss/Challenges.css b/public/react/src/modules/tpm/shixunchild/shixunchildCss/Challenges.css index d2bba2f84..b59bd86fd 100644 --- a/public/react/src/modules/tpm/shixunchild/shixunchildCss/Challenges.css +++ b/public/react/src/modules/tpm/shixunchild/shixunchildCss/Challenges.css @@ -239,3 +239,12 @@ background-color: #29BD8B !important; border-color: transparent ; } + +.Countdownfonttpm{ + width: 60px; + display: inline-block; +} + +.Countdownfonttpm .ant-statistic-content-value{ + font-size: 14px; +} \ No newline at end of file diff --git a/public/react/src/redux/actions/jupyter.js b/public/react/src/redux/actions/jupyter.js index c58e85b6e..1a3654c3f 100644 --- a/public/react/src/redux/actions/jupyter.js +++ b/public/react/src/redux/actions/jupyter.js @@ -74,7 +74,7 @@ export const getJupyterTpiUrl = (obj) => { const id = obj.identifier || jupyter_info.myshixun_identifier; fetchJupyterTpiUrl({identifier: id}).then(res => { if (res.data.status === 401) return; // 用户未登录 - console.log('获取url', res); + //console.log('获取url', res); if (res.status === 200) { const { status, url = '', port } = res.data; dispatch(updataspinning(false)) @@ -159,7 +159,8 @@ export const active_with_tpi = (identifier, msg) => { const {status} = res.data if (status === 0) { message.success(msg); - dispatch(addjypertime(Date.now() + 900 * 1000)) + // dispatch(addjypertime(Date.now() + 900 * 1000,false)) + setTimeout(()=>{dispatch(addjypertime(Date.now() + 900 * 1000, Date.now() + 300 * 1000))},800); } } }) @@ -224,11 +225,21 @@ export const changeshowDrawer = (type) => { } } //增加倒计时 -export const addjypertime=(time)=>{ - return { - type: types.CHANGE_JYPYTER_TIME, - payload: time +export const addjypertime=(time,endtime)=>{ + if(endtime===false){ + return { + type: types.CHANGE_JYPYTER_TIME, + payload: time, + endtime:false + } + }else{ + return { + type: types.CHANGE_JYPYTER_TIME, + payload: time, + endtime:endtime + } } + } export const updataspinning=(type)=>{ @@ -262,8 +273,9 @@ export const timeinfo_with_tpi = (identifier, dispatch) => { let remainingSeconds=res.data.remainingSeconds; // let summain=3600 * 1000; let sums= remainingSeconds * 1000; + let endsms=(remainingSeconds-300<=0?0:remainingSeconds-300)*1000 // let sum=summain-sums; - setTimeout(()=>{ dispatch(addjypertime(Date.now() +sums))},500); + setTimeout(()=>{ dispatch(addjypertime(Date.now() +sums,endsms===0?Date.now()+1000:Date.now() +endsms))},500); } } } diff --git a/public/react/src/redux/reducers/commonReducer.js b/public/react/src/redux/reducers/commonReducer.js index d0246afce..12c64c28f 100644 --- a/public/react/src/redux/reducers/commonReducer.js +++ b/public/react/src/redux/reducers/commonReducer.js @@ -17,11 +17,12 @@ const initialState = { isMySource: false, drawervisible:false, jupytertime:0, + endjupytertime:false, spinning:false } const commonReducer = (state = initialState, action) => { - + console.log(action) switch (action.type) { case types.SHOW_OR_HIDE_CONTROL: return { @@ -61,7 +62,8 @@ const commonReducer = (state = initialState, action) => { case types.CHANGE_JYPYTER_TIME: return { ...state, - jupytertime: action.payload + jupytertime: action.payload, + endjupytertime:action.endtime, } case types.CHANGE_UPDETA_SPIN: return { diff --git a/public/react/src/redux/reducers/jupyterReducer.js b/public/react/src/redux/reducers/jupyterReducer.js index 4b117b453..9981bff5c 100644 --- a/public/react/src/redux/reducers/jupyterReducer.js +++ b/public/react/src/redux/reducers/jupyterReducer.js @@ -45,7 +45,7 @@ const JupyterReducer = (state = initState, action) => { jupyter_tpi_code: port } case types.SAVE_JUPYTER_IDENTIFIER: - console.log('保存的jupyter_identifier', action.payload); + //console.log('保存的jupyter_identifier', action.payload); return { ...state, jupyter_identifier: action.payload