diff --git a/app/controllers/concerns/controller_rescue_handler.rb b/app/controllers/concerns/controller_rescue_handler.rb index 6ff15cfbc..4ab5d3276 100644 --- a/app/controllers/concerns/controller_rescue_handler.rb +++ b/app/controllers/concerns/controller_rescue_handler.rb @@ -6,10 +6,12 @@ module ControllerRescueHandler Util.logger_error e render json: {status: -1, message: e.message} end + rescue_from ActiveRecord::StatementInvalid do |e| Util.logger_error e render json: {status: -1, message: "接口数据异常"} end + rescue_from NoMethodError do |e| Util.logger_error e render json: {status: -1, message: "接口方法异常"} @@ -18,6 +20,7 @@ module ControllerRescueHandler rescue_from ActionController::UnknownFormat do |e| render json: {status: -1, message: "接口调用非JSON格式"} end + # rescue_from ActionView::MissingTemplate, with: :object_not_found # rescue_from ActiveRecord::RecordNotFound, with: :object_not_found rescue_from Educoder::TipException, with: :tip_show @@ -32,6 +35,7 @@ module ControllerRescueHandler rescue_from ActiveRecord::RecordInvalid do |ex| render_error(ex.record.errors.full_messages.join(',')) end + # rescue_from RuntimeError do |ex| # Util.logger_error "#######ex:#{ex}" # render_error(ex.message) diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index c7cdc84ab..24caf0c67 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -44,9 +44,9 @@ if (isDev) { // 超管 debugType="admin"; // 老师 -//debugType="teacher"; +// debugType="teacher"; // 学生 -//debugType="student"; +// debugType="student"; diff --git a/public/react/src/common/quillForEditor/index.js b/public/react/src/common/quillForEditor/index.js index 012743141..89a4f6224 100644 --- a/public/react/src/common/quillForEditor/index.js +++ b/public/react/src/common/quillForEditor/index.js @@ -22,8 +22,8 @@ import FillBlot from './FillBlot'; const Size = Quill.import('attributors/style/size'); const Font = Quill.import('formats/font'); // const Color = Quill.import('attributes/style/color'); -Size.whitelist = ['12px', '14px', '16px', '18px', '20px', false]; -Font.whitelist = ['SimSun', 'SimHei','Microsoft-YaHei','KaiTi','FangSong','Arial','Times-New-Roman','sans-serif']; +Size.whitelist = ['14px', '16px', '18px', '20px', false]; +Font.whitelist = ['Microsoft-YaHei','SimSun', 'SimHei','KaiTi','FangSong','Arial','Times-New-Roman','sans-serif']; window.Quill = Quill; window.katex = katex; @@ -55,10 +55,11 @@ function QuillForEditor ({ // toolbar 默认值 const defaultConfig = [ 'bold', 'italic', 'underline', - {size: ['12px', '14px', '16px', '18px', '20px']}, + {size: ['14px', '16px', '18px', '20px']}, {align: []}, {list: 'ordered'}, {list: 'bullet'}, // 列表 {script: 'sub'}, {script: 'super'}, { 'color': [] }, { 'background': [] }, + { 'font': ['Microsoft-YaHei','SimSun', 'SimHei','KaiTi','FangSong','Arial','Times-New-Roman','sans-serif']}, {header: [1,2,3,4,5,false]}, 'blockquote', 'code-block', 'link', 'image', 'video', @@ -99,7 +100,7 @@ function QuillForEditor ({ */ handler: function (range, context) { /** - * index: 删除元素的位置 + * index: 删除元素的位置 * length: 删除元素的个数 */ const {index, length} = range; @@ -123,7 +124,7 @@ function QuillForEditor ({ let delIndexs = []; // 获取删除元素的下标 delArrs.forEach((item, i) => { - leaveLen === 0 ? delIndexs.push(i) : delIndexs.push(leaveLen + i); + leaveLen === 0 ? delIndexs.push(i) : delIndexs.push(leaveLen + i); }); deleteFill && deleteFill(delIndexs); // 调用删除回调, 返回删除的元素下标[] return true diff --git a/public/react/src/modules/courses/Video/LiveItem.js b/public/react/src/modules/courses/Video/LiveItem.js index 913235ef0..b71e5b02b 100644 --- a/public/react/src/modules/courses/Video/LiveItem.js +++ b/public/react/src/modules/courses/Video/LiveItem.js @@ -174,4 +174,4 @@ class LiveItem extends Component{ ) } } -export default LiveItem; \ No newline at end of file +export default LiveItem; diff --git a/public/react/src/modules/courses/Video/VideoIndex.js b/public/react/src/modules/courses/Video/VideoIndex.js index d490887bf..d58a2f187 100644 --- a/public/react/src/modules/courses/Video/VideoIndex.js +++ b/public/react/src/modules/courses/Video/VideoIndex.js @@ -294,4 +294,4 @@ class VideoIndex extends Component{ ) } } -export default VideoIndex; \ No newline at end of file +export default VideoIndex; diff --git a/public/react/src/modules/developer/components/knowledge/index.js b/public/react/src/modules/developer/components/knowledge/index.js index 9598037ab..0a1e00125 100644 --- a/public/react/src/modules/developer/components/knowledge/index.js +++ b/public/react/src/modules/developer/components/knowledge/index.js @@ -4,7 +4,7 @@ * @Github: * @Date: 2019-12-30 13:51:19 * @LastEditors : tangjiang - * @LastEditTime : 2020-01-07 15:46:24 + * @LastEditTime : 2020-02-11 16:34:18 */ import './index.scss'; import React, { useState, useEffect } from 'react'; @@ -22,7 +22,6 @@ function KnowLedge (props) { showAdd, // 显示新增图标 addKnowledge // 调用新增知识点接口 } = props; - useEffect(() => { const _options = []; const _selects = []; diff --git a/public/react/src/modules/developer/newOrEditTask/index.js b/public/react/src/modules/developer/newOrEditTask/index.js index 9be899b9c..565d6af30 100644 --- a/public/react/src/modules/developer/newOrEditTask/index.js +++ b/public/react/src/modules/developer/newOrEditTask/index.js @@ -35,7 +35,10 @@ const NewOrEditTask = (props) => { getUserInfoForNew, handleCancelPublish, validateOjForm, - getQuestion + getQuestion, + saveSearchParams, + setOjInitialValue, + courseQuestions // updateTestAndValidate, } = props; @@ -54,14 +57,35 @@ const NewOrEditTask = (props) => { useEffect(() => { // 获取用户信息 getUserInfoForNew(); + // console.log('获取路由参数: ====', props.match.params); + const id = props.match.params.id; + // 保存OJForm的id号,指明是编辑还是新增 + props.saveOJFormId(id); + // 获取地址栏查询参数 + const $searchs = window.location.search && window.location.search.substring(1); + if ($searchs) { + const $params = $searchs.split('&') || []; + let obj = Object.create(null); + $params.forEach(item => { + const keys = item.split('='); + obj[keys[0]] = keys[1]; + }); + // 保存初始值 + if (obj['newoj']) { + const tags = obj['tag_discipline_id']; + const tag_arrs = (tags && tags.split(',').map(tag => +tag)) || []; + setOjInitialValue({ + difficult: obj['difficult'], + sub_discipline_id: obj['sub_discipline_id'], + tag_discipline_id: tag_arrs + }); + } + saveSearchParams({searchParams: $searchs, curPage: obj['pages']}); + } // 获取课程列表 getQuestion({ source: 'question' }); - // console.log('获取路由参数: ====', props.match.params); - const id = props.match.params.id; - // 保存OJForm的id号,指明是编辑还是新增 - props.saveOJFormId(id); if (id) { // id号即 identifier // TODO id 存在时, 编辑, 获取 store 中的记录数 props.getOJFormById(id); @@ -96,7 +120,8 @@ const NewOrEditTask = (props) => { props.clearOJFormStore(); // 清空描述信息 toStore('oj_description', ''); - props.history.push('/problems'); + // props.history.push('/problems'); + props.history.push(`/question?${props.searchParams}`); } // 发布 @@ -236,7 +261,7 @@ const NewOrEditTask = (props) => { } const mapStateToProps = (state) => { - const { ojForm, identifier, testCases, isPublish } = state.ojFormReducer; + const { ojForm, identifier, testCases, isPublish, searchParams, courseQuestions } = state.ojFormReducer; const { publishLoading, submitLoading } = state.commonReducer; const { userInfo } = state.userReducer; return { @@ -246,7 +271,9 @@ const mapStateToProps = (state) => { isPublish, // 是否已发布 publishLoading, submitLoading, - userInfo + userInfo, + searchParams, + courseQuestions } }; @@ -278,7 +305,9 @@ const mapDispatchToProps = (dispatch) => ({ // 新建时获取信息 getUserInfoForNew: () => dispatch(actions.getUserInfoForNew()), validateOjForm: (props, type, cb) => dispatch(actions.validateOjForm(props, type, cb)), - getQuestion: (params) => dispatch(actions.getQuestion(params)) + getQuestion: (params) => dispatch(actions.getQuestion(params)), + saveSearchParams: (params) => dispatch(actions.saveSearchParams(params)), + setOjInitialValue: (params) => dispatch(actions.setOjInitialValue(params)) }); export default withRouter(connect( diff --git a/public/react/src/modules/developer/newOrEditTask/leftpane/editorTab/index.js b/public/react/src/modules/developer/newOrEditTask/leftpane/editorTab/index.js index cdbf14a30..afa68fb23 100644 --- a/public/react/src/modules/developer/newOrEditTask/leftpane/editorTab/index.js +++ b/public/react/src/modules/developer/newOrEditTask/leftpane/editorTab/index.js @@ -4,7 +4,7 @@ * @Github: * @Date: 2019-11-20 10:35:40 * @LastEditors : tangjiang - * @LastEditTime : 2020-02-05 13:26:58 + * @LastEditTime : 2020-02-11 16:44:57 */ import './index.scss'; // import 'katex/dist/katex.css'; @@ -61,7 +61,7 @@ class EditTab extends React.Component { top: 500, bottom: 20, offsetTop: 0, - showAdd: false + showAdd: props.tag_discipline_id || false // knowledges: [], // coursers: [] // 选中的课程 } diff --git a/public/react/src/modules/developer/studentStudy/index.js b/public/react/src/modules/developer/studentStudy/index.js index 0c8c7012f..184ce0af5 100644 --- a/public/react/src/modules/developer/studentStudy/index.js +++ b/public/react/src/modules/developer/studentStudy/index.js @@ -4,7 +4,7 @@ * @Github: * @Date: 2019-11-23 10:53:19 * @LastEditors : tangjiang - * @LastEditTime : 2020-01-06 15:27:34 + * @LastEditTime : 2020-02-10 18:24:01 */ import './index.scss'; import React, { useEffect, useState } from 'react'; @@ -31,7 +31,9 @@ function StudentStudy (props) { // user_program_identifier, restoreInitialCode, changeUserCodeTab, - changeShowOrHideControl + changeShowOrHideControl, + searchParams, + saveSearchParams } = props; const { @@ -47,7 +49,16 @@ function StudentStudy (props) { saveUserProgramIdentifier(id); // startProgramQuestion(id); getUserProgramDetail(id); - + const $searchs = window.location.search && window.location.search.substring(1); + if ($searchs) { + const $params = $searchs.split('&') || []; + let obj = Object.create(null); + $params.forEach(item => { + const keys = item.split('='); + obj[keys[0]] = keys[1]; + }); + saveSearchParams({searchParams: $searchs, curPage: obj['pages']}); + } if (tab) { changeUserCodeTab(tab); } @@ -97,7 +108,7 @@ function StudentStudy (props) { changeShowOrHideControl(false); props.saveEditorCodeForDetail(''); props.clearOjForUserReducer(); - props.history.push(`/problems/${identifier}/edit`); + props.history.push(`/problems/${identifier}/edit?{searchParams}`); } // 处理退出 const handleClickQuit = () => { @@ -106,7 +117,8 @@ function StudentStudy (props) { // 将控制台关闭 changeShowOrHideControl(false); props.saveEditorCodeForDetail(''); - props.history.push('/problems'); + // props.history.push('/problems'); + props.history.push(`/question?${searchParams}`); } return ( @@ -163,11 +175,13 @@ function StudentStudy (props) { const mapStateToProps = (state) => { const { userInfo } = state.userReducer; const { hack_identifier, user_program_identifier, hack } = state.ojForUserReducer; + const { searchParams } = state.ojFormReducer; return { hack, userInfo, user_program_identifier, - hack_identifier + hack_identifier, + searchParams }; }; @@ -182,7 +196,8 @@ const mapDispatchToProps = (dispatch) => ({ restoreInitialCode: (identifier, msg) => dispatch(actions.restoreInitialCode(identifier, msg)), changeShowOrHideControl: (flag) => dispatch(actions.changeShowOrHideControl(flag)), clearOjForUserReducer: () => dispatch(actions.clearOjForUserReducer()), - changeUserCodeTab: (tab) => dispatch(actions.changeUserCodeTab(tab)) + changeUserCodeTab: (tab) => dispatch(actions.changeUserCodeTab(tab)), + saveSearchParams: (params) => dispatch(actions.saveSearchParams(params)) }); export default withRouter(connect( diff --git a/public/react/src/modules/question/Paperreview.js b/public/react/src/modules/question/Paperreview.js index 2adc77c03..33f137cd1 100644 --- a/public/react/src/modules/question/Paperreview.js +++ b/public/react/src/modules/question/Paperreview.js @@ -406,14 +406,14 @@ class Paperreview extends Component { Cohetepaperbool===false? artificialtype==="artificial"? - 试题库 - 人工组卷 + 试题库 + 人工组卷 试卷预览 : - 试卷库 - 智能组卷 + 试卷库 + 智能组卷 试卷预览 : @@ -449,7 +449,7 @@ class Paperreview extends Component { this.setCohetepaperbool(bool)} - onSubmits={() => this.preservation()} url={'/question'}> + onSubmits={() => this.preservation()} url={ artificialtype==="artificial"?'/question':'/paperlibrary'}> ) diff --git a/public/react/src/modules/question/Paperreview_single.js b/public/react/src/modules/question/Paperreview_single.js index 3eacc9c16..4066658b9 100644 --- a/public/react/src/modules/question/Paperreview_single.js +++ b/public/react/src/modules/question/Paperreview_single.js @@ -90,7 +90,10 @@ class Paperreview_single extends Component { }catch (e) { itemsnamesy=objectsingle&&objectsingle.program_attr&&objectsingle.program_attr.description; } - + var fenshul=(objectsingle.score+"分"); + const options = [ + 'bold', // 加粗 + ] return (
-

{indexx}

、 +

{indexx}

@@ -146,25 +155,26 @@ class Paperreview_single extends Component { objectsingle.item_type==="PROGRAM"?
({objectsingle.score}分)
-
+ +
: -
-
+
({objectsingle.score}分)
-
{ itemssname===null|| itemssname===undefined? @@ -207,7 +217,7 @@ class Paperreview_single extends Component {

{ objectsingle&&objectsingle.program_attr&&objectsingle.program_attr.description? -

{ itemsnamesy===null || itemsnamesy===undefined? diff --git a/public/react/src/modules/question/Question.js b/public/react/src/modules/question/Question.js index ba0b10b68..e4a618f19 100644 --- a/public/react/src/modules/question/Question.js +++ b/public/react/src/modules/question/Question.js @@ -118,6 +118,7 @@ class Question extends Component { setsub_discipline_id=(discipline_id,sub_discipline_id)=>{ this.setState({ sub_discipline_id:sub_discipline_id, + discipline_id:discipline_id, tag_discipline_id:null, keyword:"", page:1, @@ -937,6 +938,7 @@ class Question extends Component { /> {/*头部*/} this.chakanjiexibool(e)} diff --git a/public/react/src/modules/question/Questionitem_banks.js b/public/react/src/modules/question/Questionitem_banks.js index d62b4f1df..11605ec6d 100644 --- a/public/react/src/modules/question/Questionitem_banks.js +++ b/public/react/src/modules/question/Questionitem_banks.js @@ -1,6 +1,6 @@ import React, {Component} from "react"; import {Link, NavLink} from 'react-router-dom'; -import {WordsBtn, ActionBtn, SnackbarHOC, getImageUrl} from 'educoder'; +import {WordsBtn, ActionBtn, SnackbarHOC, getImageUrl,queryString} from 'educoder'; import axios from 'axios'; import { notification, @@ -35,13 +35,25 @@ class Questionitem_banks extends Component { myquestion_choicesco: [], disciplinesdata: [], knowledgepoints: [], - disciplmy:[] + disciplmy:[], + pages:1, } } //初始化 componentDidMount() { + const query = this.props.location.search; + const parsed = queryString.parse(query); + console.log(parsed); + try { + this.setState({ + pages:parsed.pages + }) + }catch (e) { + + } + // let {defaultActiveKey}= this.state; // var data={ // public:defaultActiveKey @@ -454,6 +466,7 @@ class Questionitem_banks extends Component { } if (this.state.item_type === "PROGRAM") { //编程题 跳转到 oj 中创建 + // debugger var myrbkc=[]; var Getdatasdatas=Getdatasdata[2].rbzsd; for(let myda of Getdatasdatas) { @@ -465,7 +478,12 @@ class Questionitem_banks extends Component { sub_discipline_id: Getdatasdata[3].rbkc[1], tag_discipline_id: myrbkc, }); - window.open("/problems/new"); + + let arrays=myrbkc.join(','); + // console.log("开始打印了"); + // console.log(arrays); + + window.open( `/problems/new?difficult=${Getdatasdata[0].rbnd}&sub_discipline_id=${Getdatasdata[3].rbkc[1]}&tag_discipline_id=${arrays}&newoj=1&pages=${this.state.pages}`); } @@ -491,7 +509,10 @@ class Questionitem_banks extends Component {

{/* {!question_id ? '新建' : '编辑'} */} @@ -369,7 +375,7 @@ class ChoquesEditor extends Component{ imgAttrs={{width: '146px', height: '136px'}} style={{ height: '155px'}} placeholder="请您输入题干" - options={['code-block', 'image', 'formula']} + options={options} value={question_title} onContentChange={this.onContentChange} @@ -403,7 +409,7 @@ class ChoquesEditor extends Component{ imgAttrs={{width: '146px', height: '136px'}} style={{ height: '166px'}} placeholder="请您输入题干" - options={['code-block', 'image', 'formula']} + options={options} value={item} onContentChange={(value,quill) => this.onOptionContentChange(value,quill,index)} /> @@ -413,7 +419,7 @@ class ChoquesEditor extends Component{ imgAttrs={{width: '146px', height: '136px'}} style={{ height: '166px'}} placeholder="请您输入题干" - options={['code-block', 'image', 'formula']} + options={options} value={JSON.parse(item)} onContentChange={(value,quill) => this.onOptionContentChange(value,quill,index)} /> @@ -452,7 +458,7 @@ class ChoquesEditor extends Component{ imgAttrs={{width: '146px', height: '136px'}} style={{height: '166px' }} placeholder="请您输入题目解析" - options={['code-block', 'image', 'formula']} + options={options} value={question_titles} onContentChange={this.onContentChanges} /> diff --git a/public/react/src/modules/question/component/Contentpart.js b/public/react/src/modules/question/component/Contentpart.js index 61a0fb8ea..6b6c57a43 100644 --- a/public/react/src/modules/question/component/Contentpart.js +++ b/public/react/src/modules/question/component/Contentpart.js @@ -38,7 +38,7 @@ class Contentpart extends Component { } componentDidUpdate(prevProps) { if(prevProps.current_user !== this.props.current_user) { - debugger + const isysladmins=this.props&&this.props.current_user&&this.props.current_user.admin?this.props.current_user.admin:false; const is_teacher=this.props&&this.props.current_user&&this.props.current_user.is_teacher?this.props.current_user.is_teacher:false; const professional_certification=this.props&&this.props.current_user&&this.props.current_user.professional_certification?this.props.current_user.professional_certification:false; @@ -53,50 +53,51 @@ class Contentpart extends Component { } } xinzenw=(e)=>{ - var urls="?"; + var urls=""; if(this.props.discipline_id){ - if(urls==="?"){ - urls=urls+`discipline_id=${this.props.discipline_id}` - }else { + // if(urls==="?"){ + // urls=urls+`discipline_id=${this.props.discipline_id}` + // }else { urls=urls+`&discipline_id=${this.props.discipline_id}` - } + // } } if(this.props.sub_discipline_id){ - if(urls==="?"){ - urls=urls+`sub_discipline_id=${this.props.sub_discipline_id}` - }else { + // if(urls==="?"){ + // urls=urls+`sub_discipline_id=${this.props.sub_discipline_id}` + // }else { urls=urls+`&sub_discipline_id=${this.props.sub_discipline_id}` - } + // } } if(this.props.tag_discipline_id){ - if(urls==="?"){ - urls=urls+`sub_discipline_id=${this.props.tag_discipline_id}` - }else { + // if(urls==="?"){ + // urls=urls+`sub_discipline_id=${this.props.tag_discipline_id}` + // }else { urls=urls+`&sub_discipline_id=${this.props.tag_discipline_id}` - } + // } } if(this.props.difficulty){ - if(urls==="?"){ - urls=urls+`difficulty=${this.props.difficulty}&` - }else { + // if(urls==="?"){ + // urls=urls+`difficulty=${this.props.difficulty}&` + // }else { urls=urls+`&difficulty=${this.props.difficulty}` - } + // } } if(this.props.item_type){ - if(urls==="?"){ - urls=urls+`item_type=${this.props.item_type}` - }else { + // if(urls==="?"){ + // urls=urls+`item_type=${this.props.item_type}` + // }else { urls=urls+`&item_type=${this.props.item_type}` - } + // } } + this.props.history.push("/question/newitem?pages="+this.props.pages+urls); - this.props.history.push("/question/newitem"+urls); } render() { let {page}=this.state; let {defaultActiveKey,item_type,booljupyterurls}=this.props; + const defaultActiveKeys=defaultActiveKey+''; const isysladmins=this.props&&this.props.current_user&&this.props.current_user.admin?this.props.current_user.admin:false; const is_teacher=this.props&&this.props.current_user&&this.props.current_user.is_teacher?this.props.current_user.is_teacher:false; const professional_certification=this.props&&this.props.current_user&&this.props.current_user.professional_certification?this.props.current_user.professional_certification:false; @@ -166,14 +167,14 @@ class Contentpart extends Component { { isysladmins===true||(is_teacher===true&&professional_certification===true)? - this.props.callback(e)}> + this.props.callback(e)}> : - this.props.callback(e)}> + this.props.callback(e)}> @@ -316,6 +317,7 @@ class Contentpart extends Component { keindex={index} items={object} key={index} + pages={this.props.pages} getitem_basketss={(id)=>this.props.getitem_basketss(id)} getitem_baskets={(e)=>this.props.getitem_baskets(e)} showmodels={(e)=>this.props.showmodels(e)} diff --git a/public/react/src/modules/question/component/Headplugselections.js b/public/react/src/modules/question/component/Headplugselections.js index b3da84054..4da7a57e3 100644 --- a/public/react/src/modules/question/component/Headplugselections.js +++ b/public/react/src/modules/question/component/Headplugselections.js @@ -80,10 +80,36 @@ class Headplugselections extends Component { }catch (e) { } + + + } + + shixunserdchAlls=(itme,id)=>{ + if(id!=undefined){ + this.setState({ + shixunsearchAllvalue:id, + }) + try { + this.props.setdiscipline_id(id); + }catch (e) { + + } + + } + // console.log(itme); + // console.log(itme[0]); + if(itme!=undefined){ + try { + this.props.setsub_discipline_id(id,itme[0].id); + }catch (e) { + + } + } } //获取方向 shixunsearchAll = (id) => { + //大写A //console.log("获取方向"); //console.log(id); if(id!=undefined){ @@ -128,7 +154,8 @@ class Headplugselections extends Component { getshixunchildValue = (id,ids) => { // //console.log("getshixunchildValue"); - // //console.log(id); + // console.log(id); + // console.log(ids); // debugger if(id!=undefined ||ids!=undefined){ this.setState({ @@ -141,6 +168,7 @@ class Headplugselections extends Component { } } + } render() { let {shixunhoverData, shixunchildValues, shixunsearchAllvalue, InputValue,openStatus,openLevel} = this.state; @@ -232,8 +260,8 @@ class Headplugselections extends Component { disciplinesdata&&disciplinesdata.map((item,key)=>{ return( item.sub_disciplines.length>0? - trigger.parentNode} overlay={ overlaymenu(item.sub_disciplines,item.id)} key={key} placement={item.id<4?"bottomRight":item.id>=8?"bottomLeft":"bottomCenter"}> -

  • this.shixunsearchAll(item.id)}> + trigger.parentNode} overlay={ overlaymenu(item.sub_disciplines,item.id)} key={key} placement={"bottomRight"}> +
  • this.shixunserdchAlls(item.sub_disciplines,item.id)}> {item.name}
  • diff --git a/public/react/src/modules/question/component/Itembankstop.js b/public/react/src/modules/question/component/Itembankstop.js index e1fa235e8..126dc6bc8 100644 --- a/public/react/src/modules/question/component/Itembankstop.js +++ b/public/react/src/modules/question/component/Itembankstop.js @@ -681,6 +681,9 @@ class Itembankstop extends Component {

    {/* {!question_id ? '新建' : '编辑'} */} @@ -384,7 +410,7 @@ class JudquestionEditor extends Component{ imgAttrs={{width: '146px', height: '136px'}} style={{ height: '155px'}} placeholder="请您输入题干" - options={['code-block', 'image', 'formula']} + options={options} value={question_title} onContentChange={this.onContentChange} @@ -434,7 +460,7 @@ class JudquestionEditor extends Component{ imgAttrs={{width: '146px', height: '136px'}} style={{height: '166px' }} placeholder="请您输入题目解析" - options={['code-block', 'image', 'formula']} + options={options} value={question_titles} onContentChange={this.onContentChanges} /> diff --git a/public/react/src/modules/question/component/Listjihe.js b/public/react/src/modules/question/component/Listjihe.js index cdca0367e..d613227fe 100644 --- a/public/react/src/modules/question/component/Listjihe.js +++ b/public/react/src/modules/question/component/Listjihe.js @@ -151,10 +151,13 @@ class Listjihe extends Component { }catch (e) { analysisnames=items&&items.analysis; } - console.log(items.name); - console.log(itemsnamesy); - - console.log(analysisnames); + // console.log(items.name); + // console.log(itemsnamesy); + // + // console.log(analysisnames); + const options = [ + 'bold', // 加粗 + ] return (

    @@ -165,18 +168,29 @@ class Listjihe extends Component { padding-left: 0px !important; padding-top: 0px !important; } - + .markdown-body .ql-editor p span{ + font-weight: bold; + } + .markdown-body .ql-editor p { + font-weight: bold; + } .programquill .ql-editor{ padding-left: 0px !important; padding-top: 0px !important; } + .ql-editor{ + display: inline-block; + text-align: justify; + } ` }
    -
    +
    { this.props.listjihe }. @@ -184,10 +198,11 @@ class Listjihe extends Component { { items.item_type==="PROGRAM"? -
    +
    : -
    +
    + { items===undefined||items===null||items===""?"": items.name === undefined || items.name === null || items.name === "" ? "" @@ -319,8 +334,8 @@ class Listjihe extends Component { { items.choosed === true ?

    this.Selectingpracticaltrainings(items.id)}> - - 撤销

    + {/**/} + 撤销

    : items.item_type === "PROGRAM" ? items.program_attr.status === 0 ? @@ -354,7 +369,7 @@ class Listjihe extends Component { this.props.Isitapopup&&this.props.Isitapopup==="true"? "" : - +

    编辑 @@ -364,7 +379,7 @@ class Listjihe extends Component { this.props.Isitapopup&&this.props.Isitapopup==="true"? "" : - +

    编辑 @@ -400,7 +415,15 @@ class Listjihe extends Component { 公开

    : - "" + ( + items.public==true? + "" + : +

    this.props.showmodelsInaudit(e)}> + + 公开审核中 +

    + ) : "" } @@ -451,13 +474,18 @@ class Listjihe extends Component {
    -

    + 解析: +

    +

    {items ? items.analysis=== undefined || items.analysis=== null || items.analysis === "" ? - "" + "暂无解析" : items.analysis.length>0? analysisnames===null || analysisnames===undefined?"": @@ -467,7 +495,7 @@ class Listjihe extends Component { value={analysisnames} /> : - "" + "暂无解析" : "" } diff --git a/public/react/src/modules/question/component/Newknledpots.js b/public/react/src/modules/question/component/Newknledpots.js index b299654af..7e0a79228 100644 --- a/public/react/src/modules/question/component/Newknledpots.js +++ b/public/react/src/modules/question/component/Newknledpots.js @@ -9,7 +9,10 @@ class PaperDeletModel extends Component { constructor(props) { super(props); this.state={ - newkntypeinput:"" + newkntypeinput:"", + errores:false, + errorestit:'', + addonAfteronelens3:0, } } isNull=( str )=>{ @@ -28,12 +31,13 @@ class PaperDeletModel extends Component { // }) // //console.log(e.target.value); // //console.log(e.target.value.length); - if(this.isNull(e.target.value)===true){ - this.props.showNotification('不能输入空格'); - return - } + this.setState({ - newkntypeinput: e.target.value + newkntypeinput: e.target.value, + addonAfteronelens3:e.target.value.length, + errorestit:'', + errores:false, + boolred:false, }) this.props.setboolred(false); // @@ -48,7 +52,8 @@ class PaperDeletModel extends Component { // }) // } // } - } + }; + mysinputOnBlur=(e)=>{ //console.log("失去焦点了"); } @@ -57,8 +62,28 @@ class PaperDeletModel extends Component { //console.log("获取焦点"); } + NewknTypedeltyoedels=()=>{ + debugger + if(this.state.newkntypeinput.length===0){ + this.setState({ + errorestit:'请输入知识点', + errores:true, + boolred:true, + }) + return + } + if(this.isNull(this.state.newkntypeinput)===true){ + this.setState({ + errorestit:'不能输入空格', + errores:true, + boolred:true, + }) + return + } + this.props.NewknTypedeltyoedel(this.state.newkntypeinput) + } render() { - + let{errores,errorestit,addonAfteronelens3}=this.state; return(

    -
    - + +
    +
    -
    diff --git a/public/react/src/modules/question/component/Paperreview_itemModel.js b/public/react/src/modules/question/component/Paperreview_itemModel.js index b4ceacc02..72c9dd469 100644 --- a/public/react/src/modules/question/component/Paperreview_itemModel.js +++ b/public/react/src/modules/question/component/Paperreview_itemModel.js @@ -20,6 +20,25 @@ class Paperreview_itemModel extends Component { }) } + setDownloadysl=()=>{ + var re = /^[0-9]+.?[0-9]*$/; //判断字符串是否为数字 //判断正整数 /^[1-9]+[0-9]*]*$/ + var nubmer = this.state.value; + + if (!re.test(nubmer)) { + this.props.showNotification(`必须为数值`); + return; + } + + try { + if(nubmer<1){ + this.props.showNotification(`不能小于0`); + return; + } + }catch (e) { + + } + this.props.setDownloady(this.state.value) + } render() { return( @@ -56,7 +75,7 @@ width: 124px !important;
    diff --git a/public/react/src/modules/question/component/Paperreview_itemModels.js b/public/react/src/modules/question/component/Paperreview_itemModels.js index ba7978aff..c6d7ce029 100644 --- a/public/react/src/modules/question/component/Paperreview_itemModels.js +++ b/public/react/src/modules/question/component/Paperreview_itemModels.js @@ -21,6 +21,28 @@ class Paperreview_itemModels extends Component { }) } + setDownloadysl=()=>{ + var re = /^[0-9]+.?[0-9]*$/; //判断字符串是否为数字 //判断正整数 /^[1-9]+[0-9]*]*$/ + var nubmer = this.state.value; + + if (!re.test(nubmer)) { + this.props.showNotification(`必须为数值`); + return; + } + + try { + if(nubmer<1){ + this.props.showNotification(`不能小于0`); + return; + } + }catch (e) { + + } + console.log("必须为数值s"); + + this.props.setDownloadys(this.state.value); + } + render() { return( @@ -57,7 +79,7 @@ width: 124px !important;
    diff --git a/public/react/src/modules/question/component/SingleEditor.js b/public/react/src/modules/question/component/SingleEditor.js index dffbf620c..39c2e447e 100644 --- a/public/react/src/modules/question/component/SingleEditor.js +++ b/public/react/src/modules/question/component/SingleEditor.js @@ -21,7 +21,6 @@ const tagArray = [ 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' ] - //题库的试卷 单选题 组件 class SingleEditor extends Component{ constructor(props){ @@ -253,17 +252,14 @@ class SingleEditor extends Component{ const reg = /^[\s\S]*.*[^\s][\s\S]*$/; if (!reg.test(_text)) { // 处理编辑器内容为空 - texts=""; - } else { - if(_text.length>=301){ - var result = _text.substring(0,300); - texts={"ops":[{"insert":result}]}; - texts=JSON.stringify(texts); - }else { - // 提交到后台的内容需要处理一下; - value = JSON.stringify(value) - texts=value; + try { + texts= JSON.stringify(value) + }catch (e) { + texts=""; } + } else { + value = JSON.stringify(value); + texts=value; } let question_choices = this.state.question_choices.slice(0); question_choices[index] = texts; @@ -291,30 +287,21 @@ class SingleEditor extends Component{ const reg = /^[\s\S]*.*[^\s][\s\S]*$/; if (!reg.test(_text)) { // 处理编辑器内容为空 - this.setState({ - question_titleysl:"" - }) + try { + this.setState({ + question_titleysl: JSON.stringify(value) + }) + }catch (e) { + this.setState({ + question_titleysl:"" + }) + } } else { - // 提交到后台的内容需要处理一下; - - var texts=""; - if(_text.length>=1001){ - var result = _text.substring(0,1000); - texts={"ops":[{"insert":result}]}; - texts=JSON.stringify(texts); - }else { - value = JSON.stringify(value) - texts=value; - } + let texts = JSON.stringify(value); this.setState({ question_titleysl:texts }) - try { - //console.log("onContentChange"); - //console.log(quill.getText().length); - }catch (e) { - } } } onContentChanges=(value,quill)=>{ @@ -322,19 +309,18 @@ class SingleEditor extends Component{ const reg = /^[\s\S]*.*[^\s][\s\S]*$/; if (!reg.test(_text)) { // 处理编辑器内容为空 - this.setState({ - question_titlesysl:"" - }) - } else { - var texts=""; - if(_text.length>=1001){ - var result = _text.substring(0,1000); - texts={"ops":[{"insert":result}]}; - texts=JSON.stringify(texts); - }else { - value = JSON.stringify(value) - texts=value; + try { + this.setState({ + question_titlesysl:JSON.stringify(value) + }) + }catch (e) { + this.setState({ + question_titlesysl:"" + }) } + } else { + + let texts = JSON.stringify(value); this.setState({ question_titlesysl:texts }) @@ -368,6 +354,10 @@ class SingleEditor extends Component{ // //////console.log("xuanzheshijuan"); // //////console.log(answerTagArray); // //////console.log(!exerciseIsPublish); + const options=['code-block', 'image', 'formula',{size: ['14px', '16px', '18px', '20px']}, + { 'color': ['#333333','#e60000','#ff9900','#ffff00','#ffffff']}, + { 'font': ['Microsoft-YaHei','SimSun', 'SimHei','KaiTi','FangSong','Arial','Times-New-Roman','sans-serif']} + ] return(
    @@ -389,6 +379,12 @@ class SingleEditor extends Component{ #e_tips_mdEditor_question_undefined4{ display: none; } + .signleEditor .quill_editor_for_react_area .ql-toolbar .ql-formats .ql-size { + line-height: 20px; + } + .signleEditor .quill_editor_for_react_area .ql-toolbar .ql-formats .ql-font { + line-height: 20px; + } `}

    {/* {!question_id ? '新建' : '编辑'} */} @@ -401,7 +397,7 @@ class SingleEditor extends Component{ imgAttrs={{width: '146px', height: '136px'}} style={{ height: '155px'}} placeholder="请您输入题干" - options={['code-block', 'image', 'formula']} + options={options} value={question_title} onContentChange={this.onContentChange} /> @@ -433,7 +429,7 @@ class SingleEditor extends Component{ imgAttrs={{width: '146px', height: '136px'}} style={{ height: '166px'}} placeholder="请您输入题干" - options={['code-block', 'image', 'formula']} + options={options} value={item} onContentChange={(value,quill) => this.onOptionContentChange(value,quill,index)} /> @@ -443,7 +439,7 @@ class SingleEditor extends Component{ imgAttrs={{width: '146px', height: '136px'}} style={{ height: '166px'}} placeholder="请您输入题干" - options={['code-block', 'image', 'formula']} + options={options} value={JSON.parse(item)} onContentChange={(value,quill) => this.onOptionContentChange(value,quill,index)} /> @@ -484,7 +480,7 @@ class SingleEditor extends Component{ imgAttrs={{width: '146px', height: '136px'}} style={{height: '166px' }} placeholder="请您输入题目解析" - options={['code-block', 'image', 'formula']} + options={options} value={question_titles} onContentChange={this.onContentChanges} /> diff --git a/public/react/src/modules/question/comthetestpaper/Comthetestpaperst.js b/public/react/src/modules/question/comthetestpaper/Comthetestpaperst.js index 662a5a9d5..a426e7ea7 100644 --- a/public/react/src/modules/question/comthetestpaper/Comthetestpaperst.js +++ b/public/react/src/modules/question/comthetestpaper/Comthetestpaperst.js @@ -621,6 +621,9 @@ class Comthetestpaperst extends Component { @@ -142,12 +153,12 @@ class Paperlibraryseeid_items extends Component { objectsingle.item_type==="PROGRAM"?

    ({objectsingle.score}分)
    -
    @@ -155,11 +166,11 @@ class Paperlibraryseeid_items extends Component { :
    ({objectsingle.score}分)
    -
    { itemssname===null || itemssname===undefined? diff --git a/public/react/src/modules/testpaper/component/QuestionModalys.js b/public/react/src/modules/testpaper/component/QuestionModalys.js new file mode 100644 index 000000000..7bd704884 --- /dev/null +++ b/public/react/src/modules/testpaper/component/QuestionModalys.js @@ -0,0 +1,42 @@ +import React, { Component } from 'react'; +import {getImageUrl} from 'educoder'; +import { Modal} from 'antd'; +import axios from 'axios'; +import './../../question/questioncss/questioncom.css' +//立即申请试用 +class QuestionModalys extends Component { + + constructor(props) { + super(props); + this.state={ + + } + } + + + render() { + + return( + +
    +

    {this.props.titilesm}

    +

    {this.props.titiless}

    + +
    +
    + ) + } +} + +export default QuestionModalys; diff --git a/public/react/src/redux/actions/actionTypes.js b/public/react/src/redux/actions/actionTypes.js index 22dfa5b77..4d422fc91 100644 --- a/public/react/src/redux/actions/actionTypes.js +++ b/public/react/src/redux/actions/actionTypes.js @@ -37,6 +37,7 @@ const types = { GET_COURSE_QUESTION: 'GET_COURSE_QUESTION', // 获取编辑题 CHANGE_KNOWLEDGES: 'CHANGE_KNOWLEDGES', // 保存所选择的知识点 SET_OJ_INITIAL_VALUE: 'SET_OJ_INITIAL_VALUE', // 设置初始值 + SET_SEARCH_PARAMS: 'SET_SEARCH_PARAMS', // 只在地址栏参数 // 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 663e94028..9a7eb7a28 100644 --- a/public/react/src/redux/actions/index.js +++ b/public/react/src/redux/actions/index.js @@ -38,7 +38,8 @@ import { getQuestion, saveKnowledge, setOjInitialValue, - tagDisciplines + tagDisciplines, + saveSearchParams } from './ojForm'; import { @@ -145,6 +146,7 @@ export default { saveKnowledge, setOjInitialValue, tagDisciplines, + saveSearchParams, // addTestCase, deleteTestCase, diff --git a/public/react/src/redux/actions/ojForUser.js b/public/react/src/redux/actions/ojForUser.js index e7520c533..87c877fa5 100644 --- a/public/react/src/redux/actions/ojForUser.js +++ b/public/react/src/redux/actions/ojForUser.js @@ -4,7 +4,7 @@ * @Github: * @Date: 2019-11-27 13:42:11 * @LastEditors : tangjiang - * @LastEditTime : 2020-01-09 14:14:47 + * @LastEditTime : 2020-02-10 18:17:00 */ import types from "./actionTypes"; import { Base64 } from 'js-base64'; @@ -24,7 +24,9 @@ import { notification } from "antd"; // 进入编程页面时,首先调用开启编程题接口 export const startProgramQuestion = (id, props) => { - return (dispatch) => { + return (dispatch, getState) => { + const {searchParams} = getState().ojFormReducer; + console.log(searchParams); fetchStartProgram(id).then(res => { const { status, data } = res; if (status === 200) { @@ -48,7 +50,7 @@ export const startProgramQuestion = (id, props) => { // console.log(path); // props.history.push(`/myproblems/${identifier}`); props.history.push({ - pathname: `/myproblems/${identifier}`, + pathname: `/myproblems/${identifier}?${searchParams}`, }); } } diff --git a/public/react/src/redux/actions/ojForm.js b/public/react/src/redux/actions/ojForm.js index aa8a7f50d..e6fe1309e 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-07 16:45:34 + * @LastEditTime : 2020-02-11 16:29:32 */ import types from './actionTypes'; import CONST from '../../constants'; @@ -206,7 +206,7 @@ export const validateOjForm = (props, type, cb) => { if (hasSuccess) { // console.log('表单保存的数据为: ', getState()); const {ojFormReducer} = getState(); - const {code, score, ojForm, testCases = [], tag_discipline_id = []} = ojFormReducer; + const {code, score, ojForm, testCases = [], tag_discipline_id = [], curPage = 1} = ojFormReducer; const {category, description, difficult, language, name, openOrNot, timeLimit, sub_discipline_id} = ojForm; let paramsObj = {}; const hack = { // 编程题干 @@ -312,14 +312,19 @@ export const validateOjForm = (props, type, cb) => { payload: identifier }); - console.log(identifier , props.identifier); + // console.log(identifier , props.identifier); if (identifier || props.identifier) { dispatch(getOJFormById(identifier || props.identifier)); } // 保存成功后,调用编辑接口并改变路 if (paramsObj['submitType'] === 'add' && identifier) { - - props.history.push(`/problems/${identifier}/edit`); + //更改查询参数 + dispatch({ + type: types.SET_SEARCH_PARAMS, + searchParams: `editoj=1&pages=${curPage}`, + curPage: curPage + }); + props.history.push(`/problems/${identifier}/edit?editoj=1&pages=${curPage}`); }; } // 保存或更新后,调用start接口 @@ -691,7 +696,7 @@ export const getQuestion = (params) => { disciplines.forEach(c => { if (sub_discipline_id && c.sub_disciplines) { c.sub_disciplines.forEach(sub => { - if (+sub.id === sub_discipline_id) { + if (+sub.id === +sub_discipline_id) { temp_knowledges = sub.tag_disciplines || []; } }); @@ -763,3 +768,11 @@ export const tagDisciplines = (params) => { }); } } + +// 保存地址栏参数 +export const saveSearchParams = (params) => { + return { + type: types.SET_SEARCH_PARAMS, + payload: params + } +} diff --git a/public/react/src/redux/reducers/ojFormReducer.js b/public/react/src/redux/reducers/ojFormReducer.js index 0da4d415b..adbbcfa92 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-03 17:38:50 + * @LastEditTime : 2020-02-10 17:59:55 */ import { Base64 } from 'js-base64'; import types from '../actions/actionTypes'; @@ -75,6 +75,8 @@ const init = { isPublish: 0, // 是否是发布状态: 0 未发布 1 已发布 courseQuestions: [], // 课程题库 knowledges: [], // 知识点下拉值 + searchParams: '', // 地址栏参数 + curPage: 1, // 当前页数 } const tcValidateObj = { @@ -350,11 +352,18 @@ const ojFormReducer = (state = initialState, action) => { } case types.SET_OJ_INITIAL_VALUE: const _p = action.payload; + console.log(_p.tag_discipline_id); return { ...state, ojForm: Object.assign({}, state.ojForm, {difficult: _p.difficult, sub_discipline_id: _p.sub_discipline_id}), tag_discipline_id: _p.tag_discipline_id || [] } + case types.SET_SEARCH_PARAMS: + return { + ...state, + searchParams: action.payload.searchParams, + curPage: action.payload.curPage + } default: return state; }