From 054e6a946dc416654208bf3d629f162d48dc0555 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Sun, 5 Jan 2020 17:44:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=80=89=E6=8B=A9=E9=A2=98?= =?UTF-8?q?=E9=81=97=E7=95=99=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/config/webpack.config.dev.js | 2 +- public/react/config/webpack.config.prod.js | 4 ++-- public/react/src/modules/page/MainContent.js | 10 +++++++++- .../react/src/modules/page/MainContentContainer.js | 12 ++++++++---- .../src/modules/page/main/ChooseRepositoryView.js | 3 +++ .../src/modules/paths/PathDetail/DetailCards.js | 8 +++++--- 6 files changed, 28 insertions(+), 11 deletions(-) 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/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" >开始实战} +
  • :"" }