From 6b3ca627c4334a761c149dda2cdd3ba4261a321b Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 29 Nov 2019 11:41:56 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E8=B0=83=E8=AF=95=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/users/shixun_service.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/services/users/shixun_service.rb b/app/services/users/shixun_service.rb index 9460d3a88..da64abd5f 100644 --- a/app/services/users/shixun_service.rb +++ b/app/services/users/shixun_service.rb @@ -43,6 +43,7 @@ class Users::ShixunService # 只有自己或者管理员才有过滤筛选及查看全部状态下实训功能 Rails.logger.info("self_or_admin?: #{self_or_admin?}") Rails.logger.info("user: #{user.id}") + Rails.logger.info("User.current.id : #{User.current.id }") if self_or_admin? relations = relations.where.not(status: -1) status_filter(relations) From c3b5126d8a27def4df8e22ea88920b03e7bdde17 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 29 Nov 2019 11:45:32 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=E6=89=93=E5=8D=B0=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/users/shixun_service.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/services/users/shixun_service.rb b/app/services/users/shixun_service.rb index da64abd5f..ffe51ff92 100644 --- a/app/services/users/shixun_service.rb +++ b/app/services/users/shixun_service.rb @@ -44,6 +44,7 @@ class Users::ShixunService Rails.logger.info("self_or_admin?: #{self_or_admin?}") Rails.logger.info("user: #{user.id}") Rails.logger.info("User.current.id : #{User.current.id }") + Rails.logger.info("relations : #{relations.map(&:id) }") if self_or_admin? relations = relations.where.not(status: -1) status_filter(relations) @@ -72,6 +73,8 @@ class Users::ShixunService when 'published' then 2 when 'closed' then 3 end + Rails.logger.info("######status: #{status}") + Rails.logger.info("######relations: #{relations.map(&:id}") relations = relations.where(status: status) if status relations end From 6c7d88248b9b76ca6cac7c528058222d576f6d4d Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 29 Nov 2019 11:45:52 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E6=89=93=E5=8D=B0=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/users/shixun_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/users/shixun_service.rb b/app/services/users/shixun_service.rb index ffe51ff92..999cc435a 100644 --- a/app/services/users/shixun_service.rb +++ b/app/services/users/shixun_service.rb @@ -74,7 +74,7 @@ class Users::ShixunService when 'closed' then 3 end Rails.logger.info("######status: #{status}") - Rails.logger.info("######relations: #{relations.map(&:id}") + Rails.logger.info("######relations: #{relations.map(&:id)}") relations = relations.where(status: status) if status relations end From 43e70b8063e002acb4618908d067ee59a1ec3558 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 29 Nov 2019 11:52:23 +0800 Subject: [PATCH 4/9] 1 --- app/services/users/shixun_service.rb | 6 ------ 1 file changed, 6 deletions(-) diff --git a/app/services/users/shixun_service.rb b/app/services/users/shixun_service.rb index 999cc435a..aeaac6a2c 100644 --- a/app/services/users/shixun_service.rb +++ b/app/services/users/shixun_service.rb @@ -41,10 +41,6 @@ class Users::ShixunService def user_policy_filter(relations) # 只有自己或者管理员才有过滤筛选及查看全部状态下实训功能 - Rails.logger.info("self_or_admin?: #{self_or_admin?}") - Rails.logger.info("user: #{user.id}") - Rails.logger.info("User.current.id : #{User.current.id }") - Rails.logger.info("relations : #{relations.map(&:id) }") if self_or_admin? relations = relations.where.not(status: -1) status_filter(relations) @@ -73,8 +69,6 @@ class Users::ShixunService when 'published' then 2 when 'closed' then 3 end - Rails.logger.info("######status: #{status}") - Rails.logger.info("######relations: #{relations.map(&:id)}") relations = relations.where(status: status) if status relations end From e802b89aa45eccd9a5fa34e8833131e586bbd22d Mon Sep 17 00:00:00 2001 From: tangjiang <465264938@qq.com> Date: Fri, 29 Nov 2019 18:03:34 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20quill=20=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E5=99=A8=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/developer/quillEditor/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/developer/quillEditor/index.js b/public/react/src/modules/developer/quillEditor/index.js index da8fda7d1..57fd9f2a4 100644 --- a/public/react/src/modules/developer/quillEditor/index.js +++ b/public/react/src/modules/developer/quillEditor/index.js @@ -4,7 +4,7 @@ * @Github: * @Date: 2019-11-25 09:46:03 * @LastEditors: tangjiang - * @LastEditTime: 2019-11-29 14:45:27 + * @LastEditTime: 2019-11-29 15:04:12 */ import 'quill/dist/quill.core.css'; import 'quill/dist/quill.bubble.css'; From 62ba1af749500f8075db7a724d3b563d91ef6c5d Mon Sep 17 00:00:00 2001 From: tangjiang <465264938@qq.com> Date: Fri, 29 Nov 2019 18:04:28 +0800 Subject: [PATCH 6/9] update editor config --- .../modules/page/component/TPICodeMirror.js | 16 ++++++++--- .../modules/page/component/TPICodeSetting.js | 25 +++++++++++++++-- .../page/component/monaco/TPIMonaco.css | 4 +-- .../page/component/monaco/TPIMonaco.js | 27 +++++++++++++------ 4 files changed, 57 insertions(+), 15 deletions(-) diff --git a/public/react/src/modules/page/component/TPICodeMirror.js b/public/react/src/modules/page/component/TPICodeMirror.js index 86f705478..9bfb714d4 100644 --- a/public/react/src/modules/page/component/TPICodeMirror.js +++ b/public/react/src/modules/page/component/TPICodeMirror.js @@ -33,13 +33,15 @@ function getModeByMirrorName(mirror_name) { return mode; } const _extraKeys = {"Alt-/": "autocomplete"}; -function createCMOptions(mirror_name) { +function createCMOptions(mirror_name, theme) { let mode = getModeByMirrorName(mirror_name) let cmOptions = { lineNumbers: true, mode: mode, - theme: "railscasts", + // theme: "railscasts", + // theme: "vs-dark", + theme: theme, indentUnit:4, matchBrackets: true, autoRefresh: true, @@ -97,6 +99,7 @@ class TPICodeMirror extends Component { super(props) this.state = { cmFontSize: fromStore('cmFontSize', 16), + cmCodeMode: fromStore('cmCodeMode', 'vs-dark'), autoCompleteSwitch: fromStore('autoCompleteSwitch', true), } } @@ -114,7 +117,7 @@ class TPICodeMirror extends Component { } } componentDidMount() { - let cmOptions = createCMOptions(this.props.mirror_name) + let cmOptions = createCMOptions(this.props.mirror_name, this.state.cmCodeMode) extend_editor = window.CodeMirror.fromTextArea(window.$('#extend-challenge-file-edit')[0] , cmOptions); @@ -241,6 +244,12 @@ class TPICodeMirror extends Component { this.setState({ cmFontSize: value }); } + onCodeModeChange = (value) => { + toStore('cmCodeMode', value); + this.setState({ cmCodeMode: value }); + window.monaco.editor.setTheme(value); + } + render() { const { repositoryCode, showSettingDrawer, settingDrawerOpen } = this.props; const { cmFontSize } = this.state; @@ -259,6 +268,7 @@ class TPICodeMirror extends Component { > diff --git a/public/react/src/modules/page/component/TPICodeSetting.js b/public/react/src/modules/page/component/TPICodeSetting.js index 51a9f390c..7f7e66698 100644 --- a/public/react/src/modules/page/component/TPICodeSetting.js +++ b/public/react/src/modules/page/component/TPICodeSetting.js @@ -18,12 +18,13 @@ class TPICodeSetting extends Component { render() { const { autoCompleteSwitch, onAutoCompleteSwitchChange, onFontSizeChange - , cmFontSize, + , cmFontSize, cmCodeMode, + onCodeModeChange, shixun } = this.props; const task_pass = shixun.task_pass const forbid_copy = shixun.forbid_copy const test_set_permission = shixun.test_set_permission - + console.log('==========', cmCodeMode); return (