From 1b25daba450b7d1048ab637e54b933ae2622c29d Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Fri, 3 Jan 2020 16:16:36 +0800 Subject: [PATCH 1/7] =?UTF-8?q?git=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=88=96=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/git_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/git_service.rb b/app/services/git_service.rb index f5a74f244..7867d063e 100644 --- a/app/services/git_service.rb +++ b/app/services/git_service.rb @@ -6,7 +6,7 @@ class GitService class << self - ['add_repository', 'fork_repository', 'delete_repository', 'file_tree', 'update_file', 'file_content', 'commits', 'add_tree'].each do |method| + ['add_repository', 'fork_repository', 'delete_repository', 'file_tree', 'update_file', 'file_content', 'commits', 'add_tree', 'delete_file'].each do |method| define_method method do |params| post(method, params) end From a16ad63e191e414aa0e88da8339eaefb6a25eab9 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 3 Jan 2020 16:29:00 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/concerns/git_helper.rb | 7 ++++++- app/controllers/shixuns_controller.rb | 6 ++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/controllers/concerns/git_helper.rb b/app/controllers/concerns/git_helper.rb index 7f2024830..0d8604aac 100644 --- a/app/controllers/concerns/git_helper.rb +++ b/app/controllers/concerns/git_helper.rb @@ -46,10 +46,15 @@ module GitHelper end # 添加目录 - def add_git_folder(folder_path, author_name, author_email, message) + def git_add_folder(folder_path, author_name, author_email, message) GitService.add_tree(file_path: folder_path, message: message, author_name: author_name, author_email: author_email) end + # 删除文件 + def git_delete_file(file_path, author_name, author_email, message) + GitService.delete_file(file_path: file_path, message: message, author_name: author_name, author_email: author_email) + end + # 版本库Fork功能 def project_fork(container, original_rep_path, username) raise Educoder::TipException.new("fork源路径为空,fork失败!") if original_rep_path.blank? diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 37c72db97..7b3cb7588 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -901,12 +901,14 @@ class ShixunsController < ApplicationController def upload_git_folder author_name = current_user.real_name author_email = current_user.git_mail - add_git_folder(@path, author_name, author_email, "upload folder by browser") + git_add_folder(@path, author_name, author_email, "upload folder by browser") render_ok end def delete_git_file - + author_name = current_user.real_name + author_email = current_user.git_mail + git_delete_file(@path, author_name, author_email, "delete filer by browser") render_ok end From 1b013733bee8ec738d71b246540d1e392d5648d9 Mon Sep 17 00:00:00 2001 From: tangjiang <465264938@qq.com> Date: Fri, 3 Jan 2020 16:45:13 +0800 Subject: [PATCH 3/7] add init oj --- public/react/src/redux/actions/actionTypes.js | 1 + public/react/src/redux/actions/index.js | 4 +++- public/react/src/redux/actions/ojForm.js | 18 +++++++++++++++++- .../react/src/redux/reducers/ojFormReducer.js | 9 ++++++++- 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/public/react/src/redux/actions/actionTypes.js b/public/react/src/redux/actions/actionTypes.js index 9ba1d58cf..53d62003b 100644 --- a/public/react/src/redux/actions/actionTypes.js +++ b/public/react/src/redux/actions/actionTypes.js @@ -36,6 +36,7 @@ const types = { DEBUGGER_CODE: 'DEBUGGER_CODE', // 调试代码 GET_COURSE_QUESTION: 'GET_COURSE_QUESTION', // 获取编辑题 CHANGE_KNOWLEDGES: 'CHANGE_KNOWLEDGES', // 保存所选择的知识点 + SET_OJ_INITIAL_VALUE: 'SET_OJ_INITIAL_VALUE', // 设置初始值 // study SAVE_USER_PROGRAM_ID: 'SAVE_USER_PROGRAM_ID',// 保存用户编程题id值 USER_PROGRAM_DETAIL: 'USER_PROGRAM_DETAIL', // 用户编程题详情 diff --git a/public/react/src/redux/actions/index.js b/public/react/src/redux/actions/index.js index 897923f94..efce336c9 100644 --- a/public/react/src/redux/actions/index.js +++ b/public/react/src/redux/actions/index.js @@ -35,7 +35,8 @@ import { updateOpenTestCaseIndex, handleClickCancelPublish, getQuestion, - saveKnowledge + saveKnowledge, + setOjInitialValue } from './ojForm'; import { @@ -123,6 +124,7 @@ export default { handleClickCancelPublish, getQuestion, saveKnowledge, + setOjInitialValue, // addTestCase, deleteTestCase, diff --git a/public/react/src/redux/actions/ojForm.js b/public/react/src/redux/actions/ojForm.js index 539798ff4..6d2da50a3 100644 --- a/public/react/src/redux/actions/ojForm.js +++ b/public/react/src/redux/actions/ojForm.js @@ -4,7 +4,7 @@ * @Github: * @Date: 2019-11-20 16:35:46 * @LastEditors : tangjiang - * @LastEditTime : 2020-01-02 17:38:12 + * @LastEditTime : 2020-01-03 16:40:54 */ import types from './actionTypes'; import CONST from '../../constants'; @@ -694,3 +694,19 @@ export const saveKnowledge = (values) => { payload: values } } + +/** + * 新增时跳转到OJ时带的默认参数: + * @param {}} params + * { + * difficult: '', // 难易度 + * sub_discipline_id: '' // 课程方向 + * tag_discipline_id: [] 知识点 + * } + */ +export const setOjInitialValue = (params) => { + return { + type: types.SET_OJ_INITIAL_VALUE, + payload: params + } +} diff --git a/public/react/src/redux/reducers/ojFormReducer.js b/public/react/src/redux/reducers/ojFormReducer.js index d604a6156..95236b821 100644 --- a/public/react/src/redux/reducers/ojFormReducer.js +++ b/public/react/src/redux/reducers/ojFormReducer.js @@ -4,7 +4,7 @@ * @Github: * @Date: 2019-11-20 16:40:32 * @LastEditors : tangjiang - * @LastEditTime : 2020-01-02 17:36:40 + * @LastEditTime : 2020-01-03 16:39:09 */ import { Base64 } from 'js-base64'; import types from '../actions/actionTypes'; @@ -348,6 +348,13 @@ const ojFormReducer = (state = initialState, action) => { knowledges: action.payload } } + case types.SET_OJ_INITIAL_VALUE: + const _p = action.payload; + return { + ...state, + ojForm: Object.assign({}, state.ojForm, {difficult: _p.difficult, sub_discipline_id: _p.sub_discipline_id}), + tag_discipline_id: _p.tag_discipline_id || [] + } default: return state; } From bb6d7948c3eca07a048b10b24665c95ecb779210 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 3 Jan 2020 16:49:50 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/question/Questionitem_banks.js | 36 ++++-------- .../question/component/Itembankstop.js | 56 +++++++++++++++++-- .../question/component/Newknledpots.js | 4 +- 3 files changed, 65 insertions(+), 31 deletions(-) diff --git a/public/react/src/modules/question/Questionitem_banks.js b/public/react/src/modules/question/Questionitem_banks.js index f5c3307e2..3608b7ad0 100644 --- a/public/react/src/modules/question/Questionitem_banks.js +++ b/public/react/src/modules/question/Questionitem_banks.js @@ -14,18 +14,13 @@ import { } from "antd"; import {TPMIndexHOC} from "../tpm/TPMIndexHOC"; import Itembankstop from "./component/Itembankstop"; -import NoneData from './component/NoneData'; import './questioncss/questioncom.css'; import '../tpm/newshixuns/css/Newshixuns.css'; -import Choicequestion from './component/Choicequestion'; import SingleEditor from "./component/SingleEditor"; import ChoquesEditor from "./component/ChoquesEditor" import JudquestionEditor from "./component/JudquestionEditor"; import Bottomsubmit from "../../modules/modals/Bottomsubmit"; -// var itembankstop=null; -// var singleEditor=null; -// var Judquestio=null; -// var Choques=null; + class Questionitem_banks extends Component { constructor(props) { super(props); @@ -212,13 +207,6 @@ class Questionitem_banks extends Component { } preservation = () => { - //////console.log("preservation"); - // //////console.log(this.contentMdRef); - // //////console.log(this.answerMdRef); - //////console.log("preservation222"); - //////console.log(this.contentMdRef.Getdatas()); - //////console.log("preservation3333"); - //////console.log(this.answerMdRef.onSave()); const params = this.props && this.props.match && this.props.match.params; var url = ""; var boolnew = true; @@ -232,20 +220,19 @@ class Questionitem_banks extends Component { // "编辑" } - if (this.contentMdRef.Getdatas().length === 0) { - this.scrollToAnchor("Itembankstopid"); - return; - } - + if(this.state.item_type !== "PROGRAM"){ + if (this.contentMdRef.Getdatas().length === 0) { + this.scrollToAnchor("Itembankstopid"); + return; + } - console.log("preservation"); - console.log(this.contentMdRef.Getdatas()); - var Getdatasdata=this.contentMdRef.Getdatas(); - if (this.state.item_type === null) { + var Getdatasdata=this.contentMdRef.Getdatas(); + if (this.state.item_type === null) { + return + } + } - return - } if (this.state.item_type === "SINGLE") { if (this.answerMdRef != null) { //单选题 @@ -578,6 +565,7 @@ class Questionitem_banks extends Component { } + export default SnackbarHOC()(TPMIndexHOC(Questionitem_banks)); diff --git a/public/react/src/modules/question/component/Itembankstop.js b/public/react/src/modules/question/component/Itembankstop.js index 2c149c86e..0806493b5 100644 --- a/public/react/src/modules/question/component/Itembankstop.js +++ b/public/react/src/modules/question/component/Itembankstop.js @@ -16,7 +16,7 @@ import { Col, Row, InputNumber, DatePicker, AutoComplete, Button, Tag } from "antd"; import './../questioncss/questioncom.css'; - +import Newknledpots from './Newknledpots' const InputGroup = Input.Group; const {Option} = Select; const options = [ @@ -53,6 +53,7 @@ class Itembankstop extends Component { rbkc: undefined, knowledgepoints: [], options: [], + NewknTypedel:false } } @@ -86,6 +87,7 @@ class Itembankstop extends Component { } componentDidUpdate(prevProps) { + //编辑的时候 if (prevProps.item_banksedit !== this.props.item_banksedit) { if (this.props.item_banksedit.item_type) { @@ -377,9 +379,44 @@ class Itembankstop extends Component { } + NewknTypedeldel=(bool)=>{ + this.setState({ + NewknTypedel:bool + }) + + } + + NewknTypedeltyoedel=(value)=>{ + if(value===null||value===""){ + this.props.showNotification(`请输入知识点`); + return + } + + if(value.length===0){ + this.props.showNotification(`请输入知识点`); + return + } + var data={ + name:"", + sub_discipline_id:"" + } + const url="/tag_disciplines.json"; + axios.post(url,data) + .then((result) => { + if (result.data.status == 0) { + this.props.showNotification(`新增知识点成功!`); + } + }).catch((error) => { + //console.log(error); + }) + + this.setState({ + NewknTypedel:false + }) + } render() { - let {page, options} = this.state; + let {page, options,NewknTypedel} = this.state; const {getFieldDecorator} = this.props.form; //console.log("renderrenderrender"); //console.log(this.props.item_banksedit); @@ -418,6 +455,15 @@ class Itembankstop extends Component { }
+ { + NewknTypedel? +