diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 89d53e73c..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"] # 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/config/webpack.config.dev.js b/public/react/config/webpack.config.dev.js index 4e28af31f..d1092894a 100644 --- a/public/react/config/webpack.config.dev.js +++ b/public/react/config/webpack.config.dev.js @@ -30,7 +30,7 @@ const env = getClientEnvironment(publicUrl); module.exports = { // You may want 'eval' instead if you prefer to see the compiled output in DevTools. // See the discussion in https://github.com/facebookincubator/create-react-app/issues/343.s - devtool: "cheap-module-eval-source-map", + //devtool: "cheap-module-eval-source-map", // 开启调试 //devtool: "source-map", // 开启调试 // These are the "entry points" to our application. diff --git a/public/react/config/webpack.config.prod.js b/public/react/config/webpack.config.prod.js index 596843f5f..1fe7a6c93 100644 --- a/public/react/config/webpack.config.prod.js +++ b/public/react/config/webpack.config.prod.js @@ -326,8 +326,8 @@ module.exports = { comments: false }, compress: { - drop_debugger: false, - drop_console: false + drop_debugger: true, + drop_console: true } } }), diff --git a/public/react/src/modules/page/MainContent.js b/public/react/src/modules/page/MainContent.js index 282f65e78..aa14fa6cb 100644 --- a/public/react/src/modules/page/MainContent.js +++ b/public/react/src/modules/page/MainContent.js @@ -21,8 +21,16 @@ import './tpiPageForMobile.css'; import actions from '../../redux/actions'; const $ = window.$; class MainContent extends Component { + constructor(props) { + super(props) + this.chooseQ = React.createRef(); + } + chooseQfun = (Ref) => { + this.chooseQ = Ref; + } componentDidMount() { // ios下图标位置有问题 + this.props.mainContentfun(this) setTimeout(()=>{ if (window.$('.b-label>.resize-helper').position().top < 100) { window.$('.b-label>.resize-helper').css('top', '200px') @@ -162,7 +170,7 @@ class MainContent extends Component { - : + : this.chooseQfun(ref)}{ ...this.props }> } {/* */} diff --git a/public/react/src/modules/page/MainContentContainer.js b/public/react/src/modules/page/MainContentContainer.js index b2a52e55c..d74f6f7d1 100644 --- a/public/react/src/modules/page/MainContentContainer.js +++ b/public/react/src/modules/page/MainContentContainer.js @@ -158,7 +158,7 @@ class MainContentContainer extends Component { this.showResetCodeDialog = this.showResetCodeDialog.bind(this) this.showResetPassedCodeDialog = this.showResetPassedCodeDialog.bind(this) - + this.mainContent = React.createRef(); this.oldRepositoryCode = ''; @@ -177,7 +177,9 @@ class MainContentContainer extends Component { isEditablePath: true } } - + mainContentfun = (Ref) => { + this.mainContent = Ref; + } // ------------------------------------------------ // static childContextTypes = { // muiTheme: PropTypes.object @@ -589,7 +591,9 @@ class MainContentContainer extends Component { onRunChooseTest() { const { st, game, onRunChooseTestFinish, showSnackbar } = this.props; // 获取form表单值 - var value = this.refs.mainContent.refs.chooseQ.getForm().getFieldsValue(); + // console.log(this.mainContent.chooseQ.props.form.getFieldsValue()) + var value = this.mainContent.chooseQ.props.form.getFieldsValue(); + // this.refs.mainContent.refs.chooseQ.getForm().getFieldsValue(); var valueArray = []; // map转array var unSelectOptionIndexArray = [] // 自己做未选提示 @@ -984,7 +988,7 @@ class MainContentContainer extends Component { - this.mainContentfun(ref)} {...this.props} output_sets={output_sets} {...this.state} onRepositoryCodeUpdate={this.onRepositoryCodeUpdate} onRunCodeTest={this.onRunCodeTest} codemirrorDidMount={this.codemirrorDidMount} fetchRepositoryCode={this.fetchRepositoryCode} showResetCodeDialog={this.showResetCodeDialog} showResetPassedCodeDialog={this.showResetPassedCodeDialog} diff --git a/public/react/src/modules/page/main/ChooseRepositoryView.js b/public/react/src/modules/page/main/ChooseRepositoryView.js index 21818ba5e..ce91f3764 100644 --- a/public/react/src/modules/page/main/ChooseRepositoryView.js +++ b/public/react/src/modules/page/main/ChooseRepositoryView.js @@ -70,6 +70,9 @@ subject:"计算机中的应用软件是指:" option_name:"所有计算机上都应使用的软件" positon:0 */ + componentDidMount() { + this.props.chooseQfun(this) + } renderChooseQuestions() { const { getFieldDecorator } = this.props.form; const { choose, choose_test_cases } = this.props; diff --git a/public/react/src/modules/page/main/CodeEvaluateView.js b/public/react/src/modules/page/main/CodeEvaluateView.js index e70d02008..346b8797e 100644 --- a/public/react/src/modules/page/main/CodeEvaluateView.js +++ b/public/react/src/modules/page/main/CodeEvaluateView.js @@ -318,6 +318,7 @@ class CodeEvaluateView extends Component { */ const _arrowClasses = isCollapse ? 'iconfont icon-xiajiantou btn-arrow' : 'iconfont icon-shangjiantou btn-arrow'; + return ( @@ -330,11 +331,11 @@ class CodeEvaluateView extends Component { this.tabIndexChange(1)}> 测试结果 - + {this.props&&this.props.vnc_url? this.handleShowTestCase()}> - + :""} {this.props.inDrawer ? {/*TODO 按钮大小改造,css*/} diff --git a/public/react/src/modules/paths/PathDetail/DetailCards.js b/public/react/src/modules/paths/PathDetail/DetailCards.js index 604d8fefe..658d0fdfb 100644 --- a/public/react/src/modules/paths/PathDetail/DetailCards.js +++ b/public/react/src/modules/paths/PathDetail/DetailCards.js @@ -510,9 +510,10 @@ class DetailCards extends Component{ {this.props.current_user&&this.props.current_user.admin===true||this.props.current_user&&this.props.current_user.business===true? item.shixuns_list && item.shixuns_list.map((line,index)=>{ return( - + this.showparagraph(key,index)} onMouseLeave={this.hideparagraph}> - + + { @@ -531,7 +532,8 @@ class DetailCards extends Component{ { showparagraphkey===key&&showparagraphindex===index? 查看详情 - :"" + {line.shixun_status==="暂未公开"?"":this.startgameid(line.identifier)} className="btn_auto user_bluebg_btn fl" id="shixun_operation" >开始实战} + :"" }