From f8735c56fd274e466447f02f25be7a39c4f0e42d Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Mon, 23 Dec 2019 21:27:12 +0800 Subject: [PATCH 01/30] add get pod timeinfo --- app/controllers/jupyters_controller.rb | 13 +++++++++++++ app/services/jupyter_service.rb | 23 +++++++++++++++++++++++ bin/bundle | 0 bin/rails | 0 bin/rake | 0 bin/setup | 0 bin/update | 0 bin/yarn | 0 config/routes.rb | 2 ++ 9 files changed, 38 insertions(+) mode change 100644 => 100755 bin/bundle mode change 100644 => 100755 bin/rails mode change 100644 => 100755 bin/rake mode change 100644 => 100755 bin/setup mode change 100644 => 100755 bin/update mode change 100644 => 100755 bin/yarn diff --git a/app/controllers/jupyters_controller.rb b/app/controllers/jupyters_controller.rb index 988cef01a..6cc78536a 100644 --- a/app/controllers/jupyters_controller.rb +++ b/app/controllers/jupyters_controller.rb @@ -80,4 +80,17 @@ class JupytersController < ApplicationController render json: {status: 0} end + def timeinfo_with_tpm + shixun = Shixun.find_by(identifier: params[:identifier]) + info = jupyter_timeinfo_tpm(shixun) + render json: {status: 0}.merge(info) + end + + def timeinfo_with_tpi + myshixun = Myshixun.find_by(identifier: params[:identifier]) + info = jupyter_timeinfo_tpi(shixun) + render json: {status: 0}.merge(info) + end + + end diff --git a/app/services/jupyter_service.rb b/app/services/jupyter_service.rb index bff9b5dc6..29f54cb02 100644 --- a/app/services/jupyter_service.rb +++ b/app/services/jupyter_service.rb @@ -213,4 +213,27 @@ module JupyterService _jupyter_active(tpiID) end + def _jupyter_timeinfo(tpiID) + shixun_tomcat = edu_setting('cloud_bridge') + uri = "#{shixun_tomcat}/bridge/jupyter/getTimeInfo" + params = {:tpiID => tpiID} + res = uri_post uri, params + if res && res['code'].to_i != 0 + raise("实训云平台繁忙(繁忙等级:130)") + end + + res['data'] + end + + # 获取时间参数 + def jupyter_timeinfo_tpm(shixun) + tpiID = "tpm#{shixun.id}" + _jupyter_timeinfo(tpiID) + end + + # 获取时间参数 + def jupyter_timeinfo_tpi(myshixun) + tpiID = myshixun.id + _jupyter_timeinfo(tpiID) + end end diff --git a/bin/bundle b/bin/bundle old mode 100644 new mode 100755 diff --git a/bin/rails b/bin/rails old mode 100644 new mode 100755 diff --git a/bin/rake b/bin/rake old mode 100644 new mode 100755 diff --git a/bin/setup b/bin/setup old mode 100644 new mode 100755 diff --git a/bin/update b/bin/update old mode 100644 new mode 100755 diff --git a/bin/yarn b/bin/yarn old mode 100644 new mode 100755 diff --git a/config/routes.rb b/config/routes.rb index 73756ece3..fc281f0d3 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -35,6 +35,8 @@ Rails.application.routes.draw do get :reset_with_tpm get :active_with_tpm get :active_with_tpi + get :timeinfo_with_tpm + get :timeinfo_with_tpi post :import_with_tpm end From 28a7698475c2be38ad06f026db067e0cefcc5bb9 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Tue, 24 Dec 2019 15:58:49 +0800 Subject: [PATCH 02/30] =?UTF-8?q?=E5=B0=86jupyter=E7=9A=84=E9=87=8D?= =?UTF-8?q?=E7=BD=AE=E6=8E=A5=E5=8F=A3=E6=94=B9=E4=B8=BAresetJupyterTpm?= =?UTF-8?q?=E3=80=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/myshixuns_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/myshixuns_controller.rb b/app/controllers/myshixuns_controller.rb index 0e9ba477a..255c0f42e 100644 --- a/app/controllers/myshixuns_controller.rb +++ b/app/controllers/myshixuns_controller.rb @@ -376,7 +376,7 @@ class MyshixunsController < ApplicationController # todo: identifier 是以前的密码,用来验证的,新版如果不需要,和中间层协调更改. params = {tpiID: "#{@myshixun.try(:id)}", tpiGitURL: "#{git_myshixun_url}", tpmGitURL: "#{git_shixun_url}", identifier: "xinhu1ji2qu3"} - uri = "#{shixun_tomcat}/bridge/game/resetTpmRepository" + uri = "#{shixun_tomcat}/bridge/game/resetJupyterTpm" res = uri_post uri, params if (res && res['code'] != 0) tip_exception("实训云平台繁忙(繁忙等级:95)") From 3b6daa3d7bd803ed5dc0f529f6045d6421ddcc75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Wed, 25 Dec 2019 09:28:03 +0800 Subject: [PATCH 03/30] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/tpm/TPMBanner.js | 8 ++++---- .../modules/tpm/TPMsettings/Configuration.js | 8 +++++--- .../tpm/TPMsettings/Shixuninformation.js | 6 +++++- .../modules/tpm/component/TPMRightSection.js | 14 ++++++------- .../src/modules/tpm/component/TPMright.css | 7 ++++--- public/react/src/modules/tpm/jupyter/index.js | 12 +++++------ .../Collaborators/Collaborators.css | 14 ++++++++----- .../Collaborators/Collaborators.js | 20 +++++++++---------- .../shixunchild/Ranking_list/Ranking_list.js | 2 +- 9 files changed, 51 insertions(+), 40 deletions(-) diff --git a/public/react/src/modules/tpm/TPMBanner.js b/public/react/src/modules/tpm/TPMBanner.js index 73a09bb45..fa8a4b222 100644 --- a/public/react/src/modules/tpm/TPMBanner.js +++ b/public/react/src/modules/tpm/TPMBanner.js @@ -857,7 +857,7 @@ class TPMBanner extends Component { ` .shixunDetail_top{ height: 180px !important; - padding-top:35px !important; + padding-top:50px !important; } .ant-popover{ z-index:1000 !important; @@ -900,9 +900,9 @@ class TPMBanner extends Component { }

-
+
-
}> -
+
学员评分
diff --git a/public/react/src/modules/tpm/TPMsettings/Configuration.js b/public/react/src/modules/tpm/TPMsettings/Configuration.js index b65d20f5d..b5aafc909 100644 --- a/public/react/src/modules/tpm/TPMsettings/Configuration.js +++ b/public/react/src/modules/tpm/TPMsettings/Configuration.js @@ -295,6 +295,8 @@ export default class Shixuninformation extends Component { const dateFormat = 'YYYY-MM-DD HH:mm'; + // console.log() + console.log(this.props&&this.props.identity<8) return (
@@ -308,8 +310,8 @@ export default class Shixuninformation extends Component {
} -
-
+
+ {this.props&&this.props.status>1&&this.state.use_scope===0&&this.props&&this.props.identity>7||this.props&&this.props.public===2&&this.state.use_scope===0&&this.props&&this.props.identity>7?"":
公开程度: @@ -387,7 +389,7 @@ export default class Shixuninformation extends Component { -
+
}
开启时间: diff --git a/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js b/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js index 66e1da8dd..04e729596 100644 --- a/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js +++ b/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js @@ -1185,7 +1185,11 @@ class Shixuninformation extends Component { closable={false} footer={null} > -

评测脚本生成成功!

+
+ {/*

已根据您的选择,生成新的评测脚本!

*/} + {/*

您之前使用的脚本已复制到剪贴板,可通过Ctrl+C贴贴

*/} +

评测脚本生成成功!

+
diff --git a/public/react/src/modules/tpm/component/TPMRightSection.js b/public/react/src/modules/tpm/component/TPMRightSection.js index 88894794b..545032e56 100644 --- a/public/react/src/modules/tpm/component/TPMRightSection.js +++ b/public/react/src/modules/tpm/component/TPMRightSection.js @@ -82,18 +82,18 @@ class TPMRightSection extends Component {
-
+
{TPMRightSectionData === undefined ? "" : TPMRightSectionData.creator === undefined ? "" : TPMRightSectionData.creator.name}
- {TPMRightSectionData.user_shixuns_count} + 共发布实训 {TPMRightSectionData.user_shixuns_count}
-
- 发布实训项目 - {/*粉丝 {TPMRightSectionData.fans_count}*/} - {/* 取消关注 */} -
+ {/*
*/} + {/* 发布实训项目*/} + {/* /!*粉丝 {TPMRightSectionData.fans_count}*!/*/} + {/* /!* 取消关注 *!/*/} + {/*
*/}
diff --git a/public/react/src/modules/tpm/component/TPMright.css b/public/react/src/modules/tpm/component/TPMright.css index 0d6b306fd..bef960742 100644 --- a/public/react/src/modules/tpm/component/TPMright.css +++ b/public/react/src/modules/tpm/component/TPMright.css @@ -98,14 +98,15 @@ } .creatornamelist { - -o-text-overflow: ellipsis; + cursor: default; + overflow: hidden; text-overflow: ellipsis; white-space: nowrap; - cursor: default; + width: 139px; } .width80center { - width: 80px; + font-size:12px; text-align: center; } diff --git a/public/react/src/modules/tpm/jupyter/index.js b/public/react/src/modules/tpm/jupyter/index.js index 56b9a4dc3..4485cc1fe 100644 --- a/public/react/src/modules/tpm/jupyter/index.js +++ b/public/react/src/modules/tpm/jupyter/index.js @@ -326,12 +326,12 @@ function JupyterTPI (props) {

{/*sync | poweroff */} - {/*重置实训*/} + +

diff --git a/public/react/src/modules/tpm/shixunchild/shixunchildCss/Challenges.css b/public/react/src/modules/tpm/shixunchild/shixunchildCss/Challenges.css index 83d8fb15d..6b055be56 100644 --- a/public/react/src/modules/tpm/shixunchild/shixunchildCss/Challenges.css +++ b/public/react/src/modules/tpm/shixunchild/shixunchildCss/Challenges.css @@ -217,3 +217,21 @@ .jupyterswidth{ width: 1140px; } + +.chongzhistyles{ + color: #fff; + width: 85px !important; + height: 32px !important; + margin-right: 20px; +} + +.chongzhistyles:hover, .chongzhistyles:focus{ + color: #fff !important; + background-color: #29BD8B !important; + border-color: transparent; +} +.chongzhistyles:active, .chongzhistyles:active{ + color: #fff !important; + background-color: #29BD8B !important; + border-color: transparent ; +} diff --git a/public/react/src/redux/actions/jupyter.js b/public/react/src/redux/actions/jupyter.js index 6afdea7b7..1cd6c2f11 100644 --- a/public/react/src/redux/actions/jupyter.js +++ b/public/react/src/redux/actions/jupyter.js @@ -52,12 +52,13 @@ export const getJupyterTpiDataSet = (identifier, params) => { fetchJupyterTpiDataSet(identifier, params).then(res => { if (res.data.status === 401) return; // 用户未登录 if (res.status === 200) { - const {data_sets, data_sets_count} = res.data; + const {data_sets, data_sets_count,folder_name} = res.data; dispatch({ type: types.GET_JUPYTER_DATA_SETS, payload: { data_sets, - data_sets_count + data_sets_count, + folder_name, } }); } diff --git a/public/react/src/redux/reducers/jupyterReducer.js b/public/react/src/redux/reducers/jupyterReducer.js index f8825fb36..75c9d374f 100644 --- a/public/react/src/redux/reducers/jupyterReducer.js +++ b/public/react/src/redux/reducers/jupyterReducer.js @@ -25,11 +25,12 @@ const initState = { const JupyterReducer = (state = initState, action) => { switch (action.type) { case types.GET_JUPYTER_DATA_SETS: - const { data_sets, data_sets_count } = action.payload; + const { data_sets, data_sets_count,folder_name} = action.payload; return { ...state, jupyter_data_set: data_sets, - jupyter_data_set_count: data_sets_count + jupyter_data_set_count: data_sets_count, + jupyter_folder_name:folder_name, } case types.GET_JUPYTER_TPI_URL: const {url, status, port} = action.payload; From 4e1edf4a742f7731237806338d5993f4854dea53 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 25 Dec 2019 11:41:00 +0800 Subject: [PATCH 10/30] Fork --- app/controllers/shixuns_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 940955e93..bda0df5dd 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -216,7 +216,7 @@ class ShixunsController < ApplicationController ShixunInfo.create!(shixun_id: @new_shixun.id, description: @shixun.description, evaluate_script: @shixun.evaluate_script, - shixun_reason: params[:reason].to_s.strip) + fork_reason: params[:reason].to_s.strip) end # 同步私密版本库 From 82d8c2f4b1d8105813527bf2fc46b2cf5aa95a9b Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 25 Dec 2019 11:52:29 +0800 Subject: [PATCH 11/30] =?UTF-8?q?=E5=85=AC=E5=BC=80=E6=88=96=E7=A7=81?= =?UTF-8?q?=E6=9C=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/migrate/20191225035117_modify_open_or_not_for_hacks.rb | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 db/migrate/20191225035117_modify_open_or_not_for_hacks.rb diff --git a/db/migrate/20191225035117_modify_open_or_not_for_hacks.rb b/db/migrate/20191225035117_modify_open_or_not_for_hacks.rb new file mode 100644 index 000000000..6b67d2dfd --- /dev/null +++ b/db/migrate/20191225035117_modify_open_or_not_for_hacks.rb @@ -0,0 +1,5 @@ +class ModifyOpenOrNotForHacks < ActiveRecord::Migration[5.2] + def change + change_column :hacks, :open_or_not, :boolean, :default => false + end +end From 38ff27c4aa0d28acec3b5ac69481a0c501fbc970 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 25 Dec 2019 11:55:11 +0800 Subject: [PATCH 12/30] 1 --- app/models/hack.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/hack.rb b/app/models/hack.rb index 915ff6f9e..e1b2b225e 100644 --- a/app/models/hack.rb +++ b/app/models/hack.rb @@ -56,7 +56,7 @@ class Hack < ApplicationRecord private def send_delete_tiding base_attrs = { - user_id: user_id, viewed: 0, tiding_type: 'System', trigger_user_id: current_user.id, + user_id: user_id, viewed: 0, tiding_type: 'System', trigger_user_id: User.current.id, parent_container_type: "HackDelete" } tidings.create!(base_attrs) From 91b3706d42c16430f1a54f85f58f53187ff69a7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Wed, 25 Dec 2019 12:41:06 +0800 Subject: [PATCH 13/30] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/tpm/TPMIndex.js | 18 +++++----- .../Challenges/Challengesjupyter.js | 36 ++++++++++++------- .../Collaborators/Collaborators.js | 4 +-- 3 files changed, 36 insertions(+), 22 deletions(-) diff --git a/public/react/src/modules/tpm/TPMIndex.js b/public/react/src/modules/tpm/TPMIndex.js index a8e869a3c..cf674a220 100644 --- a/public/react/src/modules/tpm/TPMIndex.js +++ b/public/react/src/modules/tpm/TPMIndex.js @@ -423,22 +423,24 @@ class TPMIndex extends Component { { this.state.is_jupyter===false? 排行榜 :""} - - {this.state.identity >4||this.state.identity===undefined ? "": - - + -
更多设置在这里,点击“配置”看一看~
-
- +
更多设置在这里,点击“配置”看一看~
+
+ } trigger="click" placement="top" visible={this.state.openknows} > +
+ + + {this.state.identity >4||this.state.identity===undefined ? "": + 配置 -
} diff --git a/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js b/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js index 6eb9c128b..573f30d4d 100644 --- a/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js +++ b/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js @@ -1,23 +1,13 @@ import React, { Component } from 'react'; import { Link } from "react-router-dom"; import { markdownToHTML, configShareForCustom,getImageUrl,getUploadActionUrlthree,appendFileSizeToUploadFileAll} from 'educoder' -import { Divider, Tooltip,Upload,Modal} from 'antd'; +import { Divider, Tooltip,Upload,Modal,Spin} from 'antd'; import LoadingSpin from '../../../../common/LoadingSpin'; import 'antd/lib/pagination/style/index.css'; import '../shixunchildCss/Challenges.css'; import axios from 'axios'; const $ = window.$; - function handleClickResetTpisync_code(id){ - const url = `/jupyters/reset_with_tpm.json`; - axios.post(url,{ - identifier:id - }).then((response) => { - if(response.data.status===0){ - return response - } - }) -} class Challengesjupyter extends Component { constructor(props) { super(props) @@ -326,9 +316,31 @@ class Challengesjupyter extends Component { } } + handleClickResetTpisync_code=(id)=>{ + this.setState({ + jupyter_url : null, + booljupyterurls:false, + }) + const url = `/jupyters/reset_with_tpm.json`; + axios.get(url,{params:{ + identifier:id + }}).then((response) => { + if(response.data.status===0){ + + setTimeout(()=>{ + this.setState({ + jupyter_url :response.data.url, + booljupyterurls:true, + }) + },1000); + this.props.showNotification('重置实训成功!'); + } + }); + } // 重置实训 handleClickResetTpi = () => { let id=this.props.match.params.shixunId; + let that=this; Modal.confirm({ title: '重置实训', content: ( @@ -340,7 +352,7 @@ class Challengesjupyter extends Component { okText: '确定', cancelText: '取消', onOk () { - console.log(handleClickResetTpisync_code(id)) + that.handleClickResetTpisync_code(id) }, onCancel() { diff --git a/public/react/src/modules/tpm/shixunchild/Collaborators/Collaborators.js b/public/react/src/modules/tpm/shixunchild/Collaborators/Collaborators.js index 0404bc0fe..1d88bf32a 100644 --- a/public/react/src/modules/tpm/shixunchild/Collaborators/Collaborators.js +++ b/public/react/src/modules/tpm/shixunchild/Collaborators/Collaborators.js @@ -525,9 +525,9 @@ class Collaborators extends Component {
  • - + {Collaboratorslist&&Collaboratorslist.length===0? 请先将新的管理员通过 this.showCollaboratorsvisible("cooperation")}>"添加合作者" 加入合作者列表 - + :""} { Collaboratorslist.length === 0 ? "" : Collaboratorslist.map((item, key) => { From bd34b956669f8c94a0454dbf209c566a91bf1a5d Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 25 Dec 2019 13:36:22 +0800 Subject: [PATCH 14/30] =?UTF-8?q?OJ=E5=88=A0=E9=99=A4=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/hacks_controller.rb | 5 +++++ app/models/hack.rb | 11 ----------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/app/controllers/hacks_controller.rb b/app/controllers/hacks_controller.rb index cb2e67922..d2dcbe145 100644 --- a/app/controllers/hacks_controller.rb +++ b/app/controllers/hacks_controller.rb @@ -132,6 +132,11 @@ class HacksController < ApplicationController def destroy @hack.destroy + base_attrs = { + user_id: user_id, viewed: 0, tiding_type: 'System', trigger_user_id: current_user.id, + parent_container_type: "HackDelete" + } + @hack.tidings.create!(base_attrs) render_ok end diff --git a/app/models/hack.rb b/app/models/hack.rb index e1b2b225e..b94eddbd2 100644 --- a/app/models/hack.rb +++ b/app/models/hack.rb @@ -23,8 +23,6 @@ class Hack < ApplicationRecord scope :opening, -> {where(open_or_not: 1)} scope :mine, -> (author_id){ where(user_id: author_id) } - after_destroy :send_delete_tiding - def language if hack_codes.count == 1 hack_codes.first.language @@ -53,13 +51,4 @@ class Hack < ApplicationRecord user_id == user.id || user.admin_or_business? end - private - def send_delete_tiding - base_attrs = { - user_id: user_id, viewed: 0, tiding_type: 'System', trigger_user_id: User.current.id, - parent_container_type: "HackDelete" - } - tidings.create!(base_attrs) - end - end From 66d0bbbda72044354496c379fdfe203249796f22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Wed, 25 Dec 2019 13:44:49 +0800 Subject: [PATCH 15/30] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/tpm/TPMsettings/Configuration.js | 2 +- public/react/src/modules/tpm/jupyter/index.js | 12 ++++++------ .../tpm/shixunchild/Challenges/Challengesjupyter.js | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/public/react/src/modules/tpm/TPMsettings/Configuration.js b/public/react/src/modules/tpm/TPMsettings/Configuration.js index b5aafc909..c7c359b35 100644 --- a/public/react/src/modules/tpm/TPMsettings/Configuration.js +++ b/public/react/src/modules/tpm/TPMsettings/Configuration.js @@ -311,7 +311,7 @@ export default class Shixuninformation extends Component {
}
- {this.props&&this.props.status>1&&this.state.use_scope===0&&this.props&&this.props.identity>7||this.props&&this.props.public===2&&this.state.use_scope===0&&this.props&&this.props.identity>7?"":
+ {this.props&&this.props.status>1&&this.state.use_scope===0&&this.props&&this.props.identity>2||this.props&&this.props.public===2&&this.state.use_scope===0&&this.props&&this.props.identity>2?"":
公开程度: diff --git a/public/react/src/modules/tpm/jupyter/index.js b/public/react/src/modules/tpm/jupyter/index.js index 6a61715a7..96f2fd6d2 100644 --- a/public/react/src/modules/tpm/jupyter/index.js +++ b/public/react/src/modules/tpm/jupyter/index.js @@ -332,12 +332,12 @@ function JupyterTPI (props) {

{/*sync | poweroff */} - + {/*重置实训*/}

- + {/**/}
From 3528f3764eb36cb3a256447e0a00258ae2f148d3 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 25 Dec 2019 13:48:06 +0800 Subject: [PATCH 16/30] 1 --- app/controllers/hacks_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/hacks_controller.rb b/app/controllers/hacks_controller.rb index d2dcbe145..9faa28ea3 100644 --- a/app/controllers/hacks_controller.rb +++ b/app/controllers/hacks_controller.rb @@ -131,12 +131,12 @@ class HacksController < ApplicationController def new;end def destroy - @hack.destroy base_attrs = { - user_id: user_id, viewed: 0, tiding_type: 'System', trigger_user_id: current_user.id, + user_id: @hack.user_id, viewed: 0, tiding_type: 'System', trigger_user_id: current_user.id, parent_container_type: "HackDelete" } @hack.tidings.create!(base_attrs) + @hack.destroy render_ok end From d7efe742a7c2d3db5e9396b399f32cf82b3b3b32 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 25 Dec 2019 13:57:18 +0800 Subject: [PATCH 17/30] =?UTF-8?q?=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/hacks_controller.rb | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/app/controllers/hacks_controller.rb b/app/controllers/hacks_controller.rb index 9faa28ea3..df9bab36a 100644 --- a/app/controllers/hacks_controller.rb +++ b/app/controllers/hacks_controller.rb @@ -131,13 +131,19 @@ class HacksController < ApplicationController def new;end def destroy - base_attrs = { - user_id: @hack.user_id, viewed: 0, tiding_type: 'System', trigger_user_id: current_user.id, - parent_container_type: "HackDelete" - } - @hack.tidings.create!(base_attrs) - @hack.destroy - render_ok + begin + base_attrs = { + user_id: @hack.user_id, viewed: 0, tiding_type: 'System', trigger_user_id: current_user.id, + parent_container_type: "HackDelete" + } + @hack.tidings.create!(base_attrs) + @hack.destroy + render_ok + rescue => e + logger.error("####hack_delete_error: #{e.message}") + render_error("删除失败") + end + end private From ed2445b6acb3266be315655dbf5c3ccab310186e Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 25 Dec 2019 14:05:19 +0800 Subject: [PATCH 18/30] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E5=88=86=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hack_user_lastest_codes_controller.rb | 5 ++++- .../submit_records.json.jbuilder | 12 ++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/app/controllers/hack_user_lastest_codes_controller.rb b/app/controllers/hack_user_lastest_codes_controller.rb index 814d16d51..afa58290c 100644 --- a/app/controllers/hack_user_lastest_codes_controller.rb +++ b/app/controllers/hack_user_lastest_codes_controller.rb @@ -61,7 +61,10 @@ class HackUserLastestCodesController < ApplicationController # 提交记录 def submit_records - @records = @my_hack.hack_user_codes.created_order + records = @my_hack.hack_user_code + @records_count = records.count + @records = paginate records.created_order + end diff --git a/app/views/hack_user_lastest_codes/submit_records.json.jbuilder b/app/views/hack_user_lastest_codes/submit_records.json.jbuilder index 797bda742..a73d58c4e 100644 --- a/app/views/hack_user_lastest_codes/submit_records.json.jbuilder +++ b/app/views/hack_user_lastest_codes/submit_records.json.jbuilder @@ -1,4 +1,8 @@ -json.array! @records do |hack_user| - json.(hack_user, :id, :created_at, :status, :execute_time, :execute_memory) - json.language hack_user.hack.language -end \ No newline at end of file +json.records do + json.array! @records do |hack_user| + json.(hack_user, :id, :created_at, :status, :execute_time, :execute_memory) + json.language hack_user.hack.language + end +end + +json.records_count @records_count \ No newline at end of file From 726a981b33b6289deb5f473c4b8350f8024ce63e Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 25 Dec 2019 14:13:12 +0800 Subject: [PATCH 19/30] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=8F=91=E9=80=81?= =?UTF-8?q?=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/hack_user_lastest_codes_controller.rb | 2 +- app/controllers/hacks_controller.rb | 2 +- app/decorators/tiding_decorator.rb | 2 +- app/models/hack.rb | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/hack_user_lastest_codes_controller.rb b/app/controllers/hack_user_lastest_codes_controller.rb index afa58290c..08ca3ff77 100644 --- a/app/controllers/hack_user_lastest_codes_controller.rb +++ b/app/controllers/hack_user_lastest_codes_controller.rb @@ -61,7 +61,7 @@ class HackUserLastestCodesController < ApplicationController # 提交记录 def submit_records - records = @my_hack.hack_user_code + records = @my_hack.hack_user_codes @records_count = records.count @records = paginate records.created_order diff --git a/app/controllers/hacks_controller.rb b/app/controllers/hacks_controller.rb index df9bab36a..f93b2dab5 100644 --- a/app/controllers/hacks_controller.rb +++ b/app/controllers/hacks_controller.rb @@ -134,7 +134,7 @@ class HacksController < ApplicationController begin base_attrs = { user_id: @hack.user_id, viewed: 0, tiding_type: 'System', trigger_user_id: current_user.id, - parent_container_type: "HackDelete" + parent_container_type: "HackDelete", extra: "#{@hack.name}" } @hack.tidings.create!(base_attrs) @hack.destroy diff --git a/app/decorators/tiding_decorator.rb b/app/decorators/tiding_decorator.rb index a9f60b890..8e0c402dd 100644 --- a/app/decorators/tiding_decorator.rb +++ b/app/decorators/tiding_decorator.rb @@ -412,6 +412,6 @@ module TidingDecorator end def hack_content - I18n.t(locale_format(parent_container_type)) % container&.name + I18n.t(locale_format(parent_container_type)) % (container&.name || extra) end end diff --git a/app/models/hack.rb b/app/models/hack.rb index b94eddbd2..37e1f239d 100644 --- a/app/models/hack.rb +++ b/app/models/hack.rb @@ -14,7 +14,7 @@ class Hack < ApplicationRecord # 点赞 has_many :praise_treads, as: :praise_tread_object, dependent: :destroy # 消息 - has_many :tidings, as: :container, dependent: :destroy + has_many :tidings, as: :container belongs_to :user From 97cb40d2ee4f853a3e5fe7af1754987b06f565d9 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 25 Dec 2019 14:25:17 +0800 Subject: [PATCH 20/30] =?UTF-8?q?Fork=E5=8E=9F=E5=9B=A0=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/shixun_info.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/models/shixun_info.rb b/app/models/shixun_info.rb index 321b4c44a..7f7aa364e 100644 --- a/app/models/shixun_info.rb +++ b/app/models/shixun_info.rb @@ -1,6 +1,7 @@ class ShixunInfo < ApplicationRecord belongs_to :shixun validates_uniqueness_of :shixun_id + validates_length_of :fork_reason, maximum: 60 after_commit :create_diff_record private From ac4f8dad02482c66c644d6a48d2f4195c1ddf91d Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 25 Dec 2019 14:52:47 +0800 Subject: [PATCH 21/30] =?UTF-8?q?=E4=BC=A0=E5=8F=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/shixuns_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index bda0df5dd..859dce6f6 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -363,7 +363,7 @@ class ShixunsController < ApplicationController page = params[:page] || 1 limit = params[:limit] || 10 @member_count = @shixun.shixun_members.count - @members = @shixun.shixun_members.includes(:user).page(page).per(limit) + @members = @shixun.shixun_members.order("role = 1 desc, created_at asc").includes(:user).page(page).per(limit) end def fork_list From cf657d44ee1b7b15b676005fc5684f69f9b2b9b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Wed, 25 Dec 2019 15:00:02 +0800 Subject: [PATCH 22/30] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/coursesPublic/NewShixunModel.js | 37 +++++++++---------- .../paths/PathDetail/DetailCardsEditAndAdd.js | 1 + .../PathDetail/DetailCardsEditAndEdit.js | 1 + public/react/src/modules/tpm/TPMBanner.js | 9 +++-- .../modules/tpm/TPMsettings/Configuration.js | 9 +++-- .../src/modules/tpm/shixuns/ShixunCard.js | 4 +- 6 files changed, 34 insertions(+), 27 deletions(-) diff --git a/public/react/src/modules/courses/coursesPublic/NewShixunModel.js b/public/react/src/modules/courses/coursesPublic/NewShixunModel.js index 1f7518a9d..f9318eb9d 100644 --- a/public/react/src/modules/courses/coursesPublic/NewShixunModel.js +++ b/public/react/src/modules/courses/coursesPublic/NewShixunModel.js @@ -25,23 +25,22 @@ class NewShixunModel extends Component{ } componentDidMount() { let{page,type,keyword,order,diff,limit,status,sort}=this.state; - let newsort=sort - if(this.props&&this.props.user.course_name===undefined){ - newsort="created_at"; - }else{ - newsort="publish_time"; - } - if(this.props.type==='shixuns'){ - this.getdatalist(page,type,status,keyword,order,diff,limit,undefined,newsort); + this.getdatalist(page,type,status,keyword,order,diff,limit,undefined,sort); }else{ this.getdatalist(page,type,undefined,keyword,order,undefined,limit,undefined,sort); } - } - getdatalist=(page,type,newstatus,keyword,order,diff,limit,pagetype,sort)=>{ - + getdatalist=(page,type,newstatus,keyword,order,diff,limit,pagetype,sorts)=>{ + let newsort=sorts; + if(this.props.type==="shixuns"&&type==="mine"){ + if(this.props&&this.props.user.course_name===undefined){ + newsort="created_at"; + }else{ + newsort="publish_time"; + } + } this.setState({ isspinning:true }) @@ -53,14 +52,14 @@ class NewShixunModel extends Component{ url="/subject_lists.json"; } axios.get(url,{params:{ - page, - type, - status, - keyword, - order, - diff, - limit, - sort + page:page, + type:type, + status:status, + keyword:keyword, + order:order, + diff:diff, + limit:limit, + sort:newsort }}).then((response) => { if(response.data){ if(pagetype===undefined){ diff --git a/public/react/src/modules/paths/PathDetail/DetailCardsEditAndAdd.js b/public/react/src/modules/paths/PathDetail/DetailCardsEditAndAdd.js index 9a4b82fb3..c296899f2 100644 --- a/public/react/src/modules/paths/PathDetail/DetailCardsEditAndAdd.js +++ b/public/react/src/modules/paths/PathDetail/DetailCardsEditAndAdd.js @@ -502,6 +502,7 @@ class DetailCardsEditAndAdd extends Component{ diff --git a/public/react/src/modules/paths/PathDetail/DetailCardsEditAndEdit.js b/public/react/src/modules/paths/PathDetail/DetailCardsEditAndEdit.js index 350c2eb8d..1a3fd3362 100644 --- a/public/react/src/modules/paths/PathDetail/DetailCardsEditAndEdit.js +++ b/public/react/src/modules/paths/PathDetail/DetailCardsEditAndEdit.js @@ -504,6 +504,7 @@ class DetailCardsEditAndEdit extends Component{ diff --git a/public/react/src/modules/tpm/TPMBanner.js b/public/react/src/modules/tpm/TPMBanner.js index fa8a4b222..ee8bfd740 100644 --- a/public/react/src/modules/tpm/TPMBanner.js +++ b/public/react/src/modules/tpm/TPMBanner.js @@ -1307,7 +1307,7 @@ class TPMBanner extends Component { } :"" } - {this.state.Radiovalue === 4 ?