diff --git a/app/services/schools/school_statistic_service.rb b/app/services/schools/school_statistic_service.rb index a5082108d..5d8a30141 100644 --- a/app/services/schools/school_statistic_service.rb +++ b/app/services/schools/school_statistic_service.rb @@ -2,7 +2,7 @@ class Schools::SchoolStatisticService < ApplicationService attr_reader :school def initialize(school) - @school = school.includes(:courses, user_extensions: :user) + @school = school @user_extensions = school.user_extensions end @@ -26,14 +26,14 @@ class Schools::SchoolStatisticService < ApplicationService @user_extensions.map{|ue| ue.user.last_login_on&.between?(1.weeks.ago, Time.now)}.size end - # 活跃用户(近3个月有登录) + # 活跃用户(近1个月有登录) def acitve_user_1_months_count - @user_extensions.map{|ue| ue.user.last_login_on&.between?(1.months.ago, Time.now)}.size + @user_extensions.joins(:user).map{|ue| ue.user.last_login_on&.between?(1.months.ago, Time.now)}.size end # 活跃用户(近3个月有登录) def acitve_user_3_months_count - @user_extensions.map{|ue| ue.user.last_login_on&.between?(3.months.ago, Time.now)}.size + @user_extensions.map{|ue| ue.user&.last_login_on&.between?(3.months.ago, Time.now)}.size end # 活跃用户(进半年有登录记录) @@ -52,10 +52,15 @@ class Schools::SchoolStatisticService < ApplicationService end # 实训作业数目 - def hom_shixuns_count + def homw_shixuns_count @school.courses.joins(:homework_commons).where(homework_commons: {homework_type: 'practice'}).size end + # 其他类型作业 + def homw_other_count + @school.courses.joins(:homework_commons).where.not(homework_commons: {homework_type: 'practice'}).size + end + # 资源数 def sources_count @school.courses.joins(:attachments).size @@ -67,7 +72,7 @@ class Schools::SchoolStatisticService < ApplicationService end # 制作实训数 - def shixun_count + def shixuns_count @user_extensions.joins(user: :shixuns).size end @@ -83,17 +88,17 @@ class Schools::SchoolStatisticService < ApplicationService # 挑战的关卡数 def games_count - @user_extensions.joins("join games on games.user_id = user_extensions.user_id").where(games: {status: 0..2}) + @user_extensions.joins("join games on games.user_id = user_extensions.user_id").where(games: {status: 0..2}).size end # 通关的关卡数 def pass_games_count - @user_extensions.joins("join games on games.user_id = user_extensions.user_id").where(games: {status: 2}) + @user_extensions.joins("join games on games.user_id = user_extensions.user_id").where(games: {status: 2}).size end # 评测总数 - def evalute_count - @user_extensions.joins("join games on games.user_id = user_extensions.user_id").sum(:evalute_count) + def evaluate_count + @user_extensions.joins("join games on games.user_id = user_extensions.user_id").sum(:evaluate_count).to_i end diff --git a/db/migrate/20200306072044_add_index_for_sta_all.rb b/db/migrate/20200306072044_add_index_for_sta_all.rb new file mode 100644 index 000000000..f4e62c8a9 --- /dev/null +++ b/db/migrate/20200306072044_add_index_for_sta_all.rb @@ -0,0 +1,5 @@ +class AddIndexForStaAll < ActiveRecord::Migration[5.2] + def change + add_index :sta_alls, :school_id, :unique => true + end +end diff --git a/lib/tasks/school_statistic.rake b/lib/tasks/school_statistic.rake deleted file mode 100644 index 3d017ad17..000000000 --- a/lib/tasks/school_statistic.rake +++ /dev/null @@ -1,8 +0,0 @@ -#coding=utf-8 - -desc "同步高校数据" -namespace :school_statistic do - task sync_records: :environment do - - end -end diff --git a/lib/tasks/static_all.rake b/lib/tasks/static_all.rake index 4c878841e..6deec5da1 100644 --- a/lib/tasks/static_all.rake +++ b/lib/tasks/static_all.rake @@ -2,15 +2,23 @@ desc "统计每个学校使用数据" namespace :static_all do task :repo => :environment do - School.find_each(batch_size: 100) do |school| - User.joins(:user_extension).where(school_id: school.id) - - - report = StaAll.find_or_initialize_by(school_id: school.id) - - report.shixun_evaluate_count = evaluate_count - - report.save + school_alls = School.includes(:courses, user_extensions: :user).all + school_alls.find_in_batches(batch_size: 50) do |schools| + Parallel.each(schools, in_processes: 5) do |school| + puts("school_id: #{school.id}") + data = Schools::SchoolStatisticService.new(school) + sta_all = StaAll.find_or_initialize_by(school_id: school.id) + attrs = {tea_count: data.teacher_count, stu_count: data.student_count, courses_count: data.courses_count, + active_users_count: data.acitve_user_3_months_count, curr_courses_count: data.curr_courses_count, + homw_shixuns_count: data.homw_shixuns_count, homw_other_count: data.homw_other_count, + sources_count: data.sources_count, videos_count: data.videos_count, shixuns_count: data.shixuns_count, + myshixuns_count: data.myshixuns_count, mys_passed_count: data.pass_myshixun_count, + games_count: data.games_count, games_passed_count: data.pass_games_count, build_count: data.evaluate_count} + puts "sta_all: #{attrs}" + sta_all.assign_attributes(attrs) + sta_all.save! + end end + end end \ No newline at end of file diff --git a/public/react/src/App.js b/public/react/src/App.js index 288afcb10..4c4908771 100644 --- a/public/react/src/App.js +++ b/public/react/src/App.js @@ -793,37 +793,37 @@ class App extends Component { render={ (props) => () }/> - {/* ()*/} - {/* }/>*/} + () + }/> - {/* ()*/} - {/* }/>*/} + () + }/> () } /> - {/* ()*/} - {/* } />*/} - - {/* ()*/} - {/* } />*/} - {/* ()*/} - {/* } />*/} - {/* ()*/} - {/* }/>*/} + () + } /> + + () + } /> + () + } /> + () + }/> () }/> - {/* ()*/} - {/* }/>*/} - - - + () + }/> {/*()*/} {/* }*/} {/*/>*/} - { // 退出时,清空内容 props.clearOjForUserReducer(); @@ -136,9 +147,9 @@ function StudentStudy (props) {
{/* to={`/problems/${_hack_id}/edit`} */} - handleClickEditor(hack.identifier)} + onClick={() => handleClickEditor(hack.identifier)} className={`quit-btn`} > 编辑 @@ -161,7 +172,7 @@ function StudentStudy (props) {
-
@@ -182,7 +193,7 @@ const mapStateToProps = (state) => { user_program_identifier, hack_identifier, searchParams - }; + }; }; const mapDispatchToProps = (dispatch) => ({ diff --git a/public/react/src/modules/question/NewMyShixunModel.js b/public/react/src/modules/question/NewMyShixunModel.js index d50f41484..cce7be87d 100644 --- a/public/react/src/modules/question/NewMyShixunModel.js +++ b/public/react/src/modules/question/NewMyShixunModel.js @@ -23,6 +23,7 @@ import Bottomsubmit from "../modals/Bottomsubmit"; import QuestionModalys from "./component/QuestionModalys"; //exam_id 试卷的id +var Undoclickable=true; class NewMyShixunModel extends Component { constructor(props) { super(props); @@ -162,11 +163,32 @@ class NewMyShixunModel extends Component { //初始化 componentDidMount() { - 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; + let isysladmins=false; + let 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; let {defaultActiveKey} = this.props; var defaultActiveKeys=defaultActiveKey; + try { + if(this.props){ + if(this.props.current_user){ + if(this.props.current_user.admin){ + isysladmins=true; + } + else if(this.props.current_user.business){ + isysladmins=true; + } + } + } + if(is_teacher===false){ + if(this.props.current_user.user_identity !=="学生"){ + //专业人士 + is_teacher=true + } + } + }catch (e) { + + } + if(isysladmins===true||(is_teacher===true&&professional_certification===true)){ defaultActiveKeys="0" }else{ @@ -206,12 +228,33 @@ class NewMyShixunModel 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; + let isysladmins=false; + let 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; let {defaultActiveKey} = this.props; var defaultActiveKeys=defaultActiveKey; + try { + if(this.props){ + if(this.props.current_user){ + if(this.props.current_user.admin){ + isysladmins=true; + } + else if(this.props.current_user.business){ + isysladmins=true; + } + } + } + if(is_teacher===false){ + if(this.props.current_user.user_identity !=="学生"){ + //专业人士 + is_teacher=true + } + } + }catch (e) { + + } + + if(isysladmins===true||(is_teacher===true&&professional_certification===true)){ defaultActiveKeys="0" }else{ @@ -219,6 +262,12 @@ class NewMyShixunModel extends Component { } this.callback(defaultActiveKeys); } + if(prevProps.Contentdata !== this.props.Contentdata){ + this.setState({ + Contentdata:this.props.Contentdata, + }) + + } } //公共和我的 @@ -719,57 +768,78 @@ class NewMyShixunModel extends Component { } // 撤销 getitem_basketss=(id)=>{ + let url=""; if(this.props.exam_id===undefined){ - url=`/item_baskets/${id}.json`; - axios.delete(url) - .then((result) => { - if (result.data.status == 0) { - // this.props.showNotification(`撤销成功`); - var data = { - discipline_id:this.state.discipline_id, - sub_discipline_id:this.state.sub_discipline_id, - tag_discipline_id:this.state.tag_discipline_id, - public: this.state.defaultActiveKey, - difficulty: this.state.difficulty, - item_type: this.state.item_type, - keyword: this.state.keywords, - page: this.state.page, - per_page:10, - exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id), - }; - this.getdatasy(data); - this.getbasket_listdata(); - } - }).catch((error) => { - ////console.log(error); - }) + if(Undoclickable===true) { + Undoclickable = false; + url = `/item_baskets/${id}.json`; + axios.delete(url) + .then((result) => { + if (result.data.status == 0) { + // this.props.showNotification(`撤销成功`); + var data = { + discipline_id: this.state.discipline_id, + sub_discipline_id: this.state.sub_discipline_id, + tag_discipline_id: this.state.tag_discipline_id, + public: this.state.defaultActiveKey, + difficulty: this.state.difficulty, + item_type: this.state.item_type, + keyword: this.state.keywords, + page: this.state.page, + per_page: 10, + exam_id: this.props.exam_id === undefined ? "" : parseInt(this.props.exam_id), + }; + this.getdatasy(data); + this.getbasket_listdata(); + } + setTimeout(()=>{ + Undoclickable=true; + },1000); + + }).catch((error) => { + setTimeout(()=>{ + Undoclickable=true; + },1000); + + }) + } }else{ - url=`/examination_banks/${this.props.exam_id}/revoke_item.json`; - axios.delete(url,{ data: { - item_id:id===undefined?"":parseInt(id), - }}) - .then((result) => { - if (result.data.status == 0) { - // this.props.showNotification(`撤销成功`); - var data = { - discipline_id:this.state.discipline_id, - sub_discipline_id:this.state.sub_discipline_id, - tag_discipline_id:this.state.tag_discipline_id, - public: this.state.defaultActiveKey, - difficulty: this.state.difficulty, - item_type: this.state.item_type, - keyword: this.state.keywords, - page: this.state.page, - per_page:10, - exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id), - }; - this.getdatasy(data); - this.getbasket_listdata(); - } - }).catch((error) => { - ////console.log(error); - }) + if(Undoclickable===true) { + Undoclickable = false; + url = `/examination_banks/${this.props.exam_id}/revoke_item.json`; + axios.delete(url, { + data: { + item_id: id === undefined ? "" : parseInt(id), + } + }) + .then((result) => { + if (result.data.status == 0) { + // this.props.showNotification(`撤销成功`); + var data = { + discipline_id: this.state.discipline_id, + sub_discipline_id: this.state.sub_discipline_id, + tag_discipline_id: this.state.tag_discipline_id, + public: this.state.defaultActiveKey, + difficulty: this.state.difficulty, + item_type: this.state.item_type, + keyword: this.state.keywords, + page: this.state.page, + per_page: 10, + exam_id: this.props.exam_id === undefined ? "" : parseInt(this.props.exam_id), + }; + this.getdatasy(data); + this.getbasket_listdata(); + } + setTimeout(()=>{ + Undoclickable=true; + },1000); + }).catch((error) => { + setTimeout(()=>{ + Undoclickable=true; + },1000); + }) + } } @@ -884,7 +954,7 @@ class NewMyShixunModel extends Component { page, per_page, items_count, Headertop, visible, placement, modalsType, modalsTypes,basket_list, completion_questions_count, judgement_questions_count, multiple_questions_count, practical_questions_count, program_questions_count, single_questions_count, subjective_questions_count,selectionbools, - modalsTypeInaudit + modalsTypeInaudit,Contentdata } = this.state; const Datacount = completion_questions_count + judgement_questions_count @@ -893,6 +963,8 @@ class NewMyShixunModel extends Component { + single_questions_count + subjective_questions_count; + // console.log("弹出框"); + // console.log(Contentdata) return (
@@ -962,6 +1034,7 @@ class NewMyShixunModel extends Component { /> {/*头部*/} { - const url=`/examination_intelligent_settings/${this.props.match.params.id}/exchange_one_item.json`; - let data={ - item_id:id, + if(Changes===true){ + Changes=false; + const url=`/examination_intelligent_settings/${this.props.match.params.id}/exchange_one_item.json`; + let data={ + item_id:id, + } + axios.post(url, data) + .then((result) => { + if (result.data.status == 0) { + //console.log(result); + var data = {} + this.getdata(data); + } + setTimeout(()=>{ + Changes=true; + },1000); + }).catch((error) => { + //console.log(error); + setTimeout(()=>{ + Changes=true; + },1000); + }) } - axios.post(url, data) - .then((result) => { - if (result.data.status == 0) { - //console.log(result); - var data = {} - this.getdata(data); - } - }).catch((error) => { - //console.log(error); - }) + } setIntelligentformation=(bool)=>{ @@ -384,7 +395,7 @@ class Paperreview extends Component { { newmyshixunmodelbool===true?
- this.setnewmyshixunmodelbool(e)}> + this.setnewmyshixunmodelbool(e)}>
: "" @@ -427,11 +438,12 @@ class Paperreview extends Component { { Cohetepaperbool===false? - this.Changingtopics(e)} Replacementtype={(e)=>this.Replacementtype(e)} getdata={(data)=>this.getdata(data)} setnewmyshixunmodelbool={(e)=>this.setnewmyshixunmodelbool(e)}> + this.Changingtopics(e)} Replacementtype={(e)=>this.Replacementtype(e)} getdata={(data)=>this.getdata(data)} setnewmyshixunmodelbool={(e)=>this.setnewmyshixunmodelbool(e)}> : this.getcontentMdRef(ref)} setitem_type={(item) => this.setitem_type(item)} diff --git a/public/react/src/modules/question/Paperreview_item.js b/public/react/src/modules/question/Paperreview_item.js index 0156b3211..8f3ca4f28 100644 --- a/public/react/src/modules/question/Paperreview_item.js +++ b/public/react/src/modules/question/Paperreview_item.js @@ -85,9 +85,17 @@ class Paperreview_item extends Component { const positions = this.props.single_questions.questions[result.destination.index].position; const url = `/item_baskets/${ids}/adjust_position.json` - var data = { - position: positions + if(this.props.match.params.type==="Intelligence") { + var data = { + position: positions, + exam_setting_id:this.props.match.params.id, + } + }else { + var data = { + position: positions + } } + axios.post(url, data) .then((result) => { if (result.data.status == 0) { @@ -104,8 +112,18 @@ class Paperreview_item extends Component { const ids = this.props.multiple_questions.questions[result.source.index].id; const positions = this.props.multiple_questions.questions[result.destination.index].position; const url = `/item_baskets/${ids}/adjust_position.json` - var data = { - position: positions + + if(this.props.match.params.type==="Intelligence") { + var data = { + position: positions, + exam_setting_id:this.props.match.params.id, + } + + }else { + var data = { + position: positions + } + } axios.post(url, data) .then((result) => { @@ -125,8 +143,18 @@ class Paperreview_item extends Component { const ids = this.props.judgement_questions.questions[result.source.index].id; const positions = this.props.judgement_questions.questions[result.destination.index].position; const url = `/item_baskets/${ids}/adjust_position.json` - var data = { - position: positions + + + if(this.props.match.params.type==="Intelligence") { + var data = { + position: positions, + exam_setting_id:this.props.match.params.id, + } + + }else { + var data = { + position: positions + } } axios.post(url, data) .then((result) => { @@ -145,8 +173,18 @@ class Paperreview_item extends Component { const ids = this.props.program_questions.questions[result.source.index].id; const positions = this.props.program_questions.questions[result.destination.index].position; const url = `/item_baskets/${ids}/adjust_position.json` - var data = { - position: positions + + + + if(this.props.match.params.type==="Intelligence") { + var data = { + position: positions, + exam_setting_id:this.props.match.params.id, + } + }else { + var data = { + position: positions + } } axios.post(url, data) .then((result) => { @@ -176,22 +214,43 @@ class Paperreview_item extends Component { } setDownloady = (fenshu) => { - const url = "/item_baskets/batch_set_score.json"; - var data = { - score: fenshu, - item_type: this.state.titilesm === "单选题" ? "SINGLE" : this.state.titilesm === "多选题" ? "MULTIPLE" : this.state.titilesm === "判断题" ? "JUDGMENT" : this.state.titilesm === "编程题" ? "PROGRAM" : '', - + if(this.props.match.params.type==="Intelligence") { + //智能选题 + const url = "/item_baskets/batch_set_score.json"; + var data = { + score: fenshu, + item_type: this.state.titilesm === "单选题" ? "SINGLE" : this.state.titilesm === "多选题" ? "MULTIPLE" : this.state.titilesm === "判断题" ? "JUDGMENT" : this.state.titilesm === "编程题" ? "PROGRAM" : '', + exam_setting_id:this.props.match.params.id, + } + axios.post(url, data) + .then((result) => { + if (result.data.status == 0) { + // this.props.showNotification(`调分成功`); + this.props.getdata({}); + this.Singlemagazine("", false); + } + }).catch((error) => { + //console.log(error); + }) + }else{ + const url = "/item_baskets/batch_set_score.json"; + var data = { + score: fenshu, + item_type: this.state.titilesm === "单选题" ? "SINGLE" : this.state.titilesm === "多选题" ? "MULTIPLE" : this.state.titilesm === "判断题" ? "JUDGMENT" : this.state.titilesm === "编程题" ? "PROGRAM" : '', + + } + axios.post(url, data) + .then((result) => { + if (result.data.status == 0) { + // this.props.showNotification(`调分成功`); + this.props.getdata({}); + this.Singlemagazine("", false); + } + }).catch((error) => { + //console.log(error); + }) } - axios.post(url, data) - .then((result) => { - if (result.data.status == 0) { - // this.props.showNotification(`调分成功`); - this.props.getdata({}); - this.Singlemagazine("", false); - } - }).catch((error) => { - //console.log(error); - }) + } setDownloadys=(value)=>{ @@ -239,24 +298,49 @@ class Paperreview_item extends Component { modalsTypedel: bool, titilesms: names }) - const url = `/item_baskets/delete_item_type.json`; - axios.delete((url), { - data: { - item_type: names - } - }) - .then((response) => { - if (response.data.status == 0) { - // this.props.showNotification('大题删除成功'); - this.props.getdata({}); - this.setState({ - titilesms: "" - }) - } - }) - .catch(function (error) { - ////console.log(error); - }); + if(this.props.match.params.type==="Intelligence") { + //智能组卷 + const url = `/item_baskets/delete_item_type.json`; + axios.delete((url), { + data: { + item_type: names, + exam_setting_id:this.props.match.params.id, + } + }) + .then((response) => { + if (response.data.status == 0) { + // this.props.showNotification('大题删除成功'); + this.props.getdata({}); + this.setState({ + titilesms: "" + }) + } + }) + .catch(function (error) { + ////console.log(error); + }); + + }else{ + const url = `/item_baskets/delete_item_type.json`; + axios.delete((url), { + data: { + item_type: names + } + }) + .then((response) => { + if (response.data.status == 0) { + // this.props.showNotification('大题删除成功'); + this.props.getdata({}); + this.setState({ + titilesms: "" + }) + } + }) + .catch(function (error) { + ////console.log(error); + }); + } + @@ -271,17 +355,35 @@ class Paperreview_item extends Component { }) }else { //确定 - const url = `/item_baskets/${this.state.item_bank_id}.json`; - axios.delete((url)) - .then((response) => { - if (response.data.status == 0) { - // this.props.showNotification('试题删除成功'); - this.props.getdata({}); - } - }) - .catch(function (error) { + if(this.props.match.params.type==="Intelligence"){ + //智能组卷 + const url = `/item_baskets/${this.state.item_bank_id}.json`; + axios.delete(url, { data: { + exam_setting_id: this.props.match.params.id, + }}) + .then((response) => { + if (response.data.status == 0) { + // this.props.showNotification('试题删除成功'); + this.props.getdata({}); + } + }) + .catch(function (error) { + + }); + }else{ + const url = `/item_baskets/${this.state.item_bank_id}.json`; + axios.delete(url) + .then((response) => { + if (response.data.status == 0) { + // this.props.showNotification('试题删除成功'); + this.props.getdata({}); + } + }) + .catch(function (error) { + + }); + } - }); this.setState({ modalsTypedels: bool, @@ -291,7 +393,8 @@ class Paperreview_item extends Component { } showsetmodalsTypedels=(id,bool,type)=>{ - debugger + console.log("Paperreview_item"); + this.setState({ item_bank_id:id, }) @@ -394,6 +497,8 @@ class Paperreview_item extends Component { modalsTypeys } = this.state; let {single_questions, multiple_questions, judgement_questions, program_questions, all_score} = this.props; + console.log("this.props"); + console.log(this.props); return (
{ diff --git a/public/react/src/modules/question/Paperreview_items.js b/public/react/src/modules/question/Paperreview_items.js index 75ed4a248..ba377f35f 100644 --- a/public/react/src/modules/question/Paperreview_items.js +++ b/public/react/src/modules/question/Paperreview_items.js @@ -61,6 +61,9 @@ class Paperreview_items extends Component { // //console.log(object); // //console.log("Paperreview_items"); // //console.log(object.item_id); + //这里换题修改过 + //这里删除修改过 + // /Integeneration/Intelligence/ 换题item_id 删除item_id return (
{ diff --git a/public/react/src/modules/question/Paperreview_single.js b/public/react/src/modules/question/Paperreview_single.js index 4066658b9..7193229d8 100644 --- a/public/react/src/modules/question/Paperreview_single.js +++ b/public/react/src/modules/question/Paperreview_single.js @@ -18,6 +18,7 @@ import NoneData from './component/NoneData'; import './questioncss/questioncom.css'; import '../tpm/newshixuns/css/Newshixuns.css'; import QuillForEditor from "../../common/quillForEditor"; +import QuestionModalPicture from "./component/QuestionModalPicture"; const tagArray = [ 'A.', 'B.', 'C.', 'D.', 'E.', 'F.', 'G.', 'H.', 'I.', @@ -35,6 +36,8 @@ class Paperreview_single extends Component { questions: 0, totalscore: 0, total: 0, + url: "" + } } @@ -67,9 +70,20 @@ class Paperreview_single extends Component { Singlemagaziness = () => { } - + handleShowUploadImage = (url) => { + // console.log('==============>>>>>>>>>>>>',url); + // setUrl(url); + this.setState({ + url:url + }) + } + handleClose=()=>{ + this.setState({ + url:'', + }) + } render() { - let {questions, totalscore, total, items} = this.state; + let {questions, totalscore, total, items,url} = this.state; let {objectsingle, indexx, paperreviewsingleindex, indexxy,name} = this.props; @@ -94,12 +108,30 @@ class Paperreview_single extends Component { const options = [ 'bold', // 加粗 ] + + try { + if(itemsnamesy.constructor === Object){ + // console.log("是对象"); + // console.log(itemsnamesy); + }else { + // console.log("不是对象"); + // console.log(itemsnamesy); + itemsnamesy=itemsnamesy+""; + } + }catch (e) { + + } return (
this.props.showparagraphs(indexxy,name)} style={{ minHeight: "114px", }}> + {url? + this.handleClose()}> + : + "" + } + + :"" + } { visible===true? - { - isysladmins===true? - this.showDrawer()} - Headertop={Headertop} - - /> - : - is_teacher===true&&professional_certification===true? + - : - - "" - } - {/*顶部*/} diff --git a/public/react/src/modules/question/Questionitem_banks.js b/public/react/src/modules/question/Questionitem_banks.js index 11605ec6d..0b8f0213e 100644 --- a/public/react/src/modules/question/Questionitem_banks.js +++ b/public/react/src/modules/question/Questionitem_banks.js @@ -1,5 +1,5 @@ import React, {Component} from "react"; -import {Link, NavLink} from 'react-router-dom'; +import {Link, NavLink,Prompt} from 'react-router-dom'; import {WordsBtn, ActionBtn, SnackbarHOC, getImageUrl,queryString} from 'educoder'; import axios from 'axios'; import { @@ -172,6 +172,20 @@ class Questionitem_banks extends Component { } + componentWillMount () { + // 拦截判断是否离开当前页面 + window.addEventListener('beforeunload', this.beforeunload); + } + componentWillUnmount () { + // 销毁拦截判断是否离开当前页面 + window.removeEventListener('beforeunload', this.beforeunload); + } + beforeunload (e) { + let confirmationMessage = '你确定离开此页面吗?'; + (e || window.event).returnValue = confirmationMessage; + return confirmationMessage; + } + getdata = (data) => { // const url=`/item_banks.json`; @@ -473,17 +487,22 @@ class Questionitem_banks extends Component { myrbkc.push(myda.id); } - this.props.setOjInitialValue({ - difficult: Getdatasdata[0].rbnd, - sub_discipline_id: Getdatasdata[3].rbkc[1], - tag_discipline_id: myrbkc, - }); + // this.props.setOjInitialValue({ + // difficult: Getdatasdata[0].rbnd, + // sub_discipline_id: Getdatasdata[3].rbkc[1], + // tag_discipline_id: myrbkc, + // }); + + 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}`); + // 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}`); + + this.props.history.replace( `/problems/new?difficult=${Getdatasdata[0].rbnd}&sub_discipline_id=${Getdatasdata[3].rbkc[1]}&tag_discipline_id=${arrays}&newoj=1&pages=${this.state.pages}`); + } @@ -505,6 +524,10 @@ class Questionitem_banks extends Component {
+ '你确定离开此页面吗?'} + />

@@ -408,7 +425,7 @@ class ChoquesEditor extends Component{ autoFocus={false} imgAttrs={{width: '146px', height: '136px'}} style={{ height: '166px'}} - placeholder="请您输入题干" + placeholder="请您输入选项" options={options} value={item} onContentChange={(value,quill) => this.onOptionContentChange(value,quill,index)} @@ -418,7 +435,7 @@ class ChoquesEditor extends Component{ autoFocus={false} imgAttrs={{width: '146px', height: '136px'}} style={{ height: '166px'}} - placeholder="请您输入题干" + placeholder="请您输入选项" options={options} value={JSON.parse(item)} onContentChange={(value,quill) => this.onOptionContentChange(value,quill,index)} diff --git a/public/react/src/modules/question/component/Contentpart.js b/public/react/src/modules/question/component/Contentpart.js index 6b6c57a43..955a9d9b8 100644 --- a/public/react/src/modules/question/component/Contentpart.js +++ b/public/react/src/modules/question/component/Contentpart.js @@ -17,6 +17,8 @@ import NoneDatas from '../component/NoneDatas'; import LoadingSpin from '../../../common/LoadingSpin'; import Contentquestionbank from "./Contentquestionbank"; import Listjihe from "./Listjihe"; +import Certifiedprofessional from "../../modals/Certifiedprofessional"; +import QuestionModalPicture from '../component/QuestionModalPicture.js' const { TabPane } = Tabs; const Search = Input.Search; class Contentpart extends Component { @@ -25,25 +27,114 @@ class Contentpart extends Component { this.state = { page:1, chakanjiexibool:false, + mydisplay:false, + occupation:2, + url: "", + isysladmins:false, } } //初始化 componentDidMount(){ + let isysladmins=false; + if(this.props){ + if(this.props.current_user){ + if(this.props.current_user.admin){ + isysladmins=true; + } + else if(this.props.current_user.business){ + isysladmins=true; + } + } + } + this.setState({ + isysladmins:isysladmins + }) } + handleShowUploadImage = (url) => { + // console.log('==============>>>>>>>>>>>>',url); + // setUrl(url); + this.setState({ + url:url + }) + } + handleClose=()=>{ + this.setState({ + url:'', + }) + } chakanjiexibool=(index)=>{ + if(this.props.current_user.professional_certification===false&&this.state.isysladmins===false){ + this.HideAddcoursestypess(2); + return + } this.props.chakanjiexibool(index); } + + showmodels=(e)=>{ + if(this.props.current_user.professional_certification===false&&this.state.isysladmins===false){ + this.HideAddcoursestypess(2); + return + } + this.props.showmodels(e) + } + + showmodelsInaudit=(e)=>{ + if(this.props.current_user.professional_certification===false&&this.state.isysladmins===false){ + this.HideAddcoursestypess(2); + return + } + this.props.showmodelsInaudit(e) + } + + showmodelysl=(e)=>{ + if(this.props.current_user.professional_certification===false&&this.state.isysladmins===false){ + this.HideAddcoursestypess(2); + return + } + this.props.showmodelysl(e) + } + + + + + + componentDidUpdate(prevProps) { if(prevProps.current_user !== this.props.current_user) { - 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; + let isysladmins=false; + let 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; let {defaultActiveKey} = this.props; var defaultActiveKeys=defaultActiveKey; + try { + if(this.props){ + if(this.props.current_user){ + if(this.props.current_user.admin){ + isysladmins=true; + } + else if(this.props.current_user.business){ + isysladmins=true; + } + } + } + + if(is_teacher===false){ + if(this.props.current_user.user_identity !=="学生"){ + //专业人士 + is_teacher=true + } + } + }catch (e) { + + } + this.setState({ + isysladmins:isysladmins + }) + if(isysladmins===true||(is_teacher===true&&professional_certification===true)){ defaultActiveKeys="0" }else{ @@ -52,7 +143,26 @@ class Contentpart extends Component { this.props.callback(defaultActiveKeys); } } + HideAddcoursestypess=(i)=>{ + console.log("调用了"); + this.setState({ + mydisplay:true, + occupation:i, + }) + } + + mydisplayHidedel=()=>{ + this.setState({ + mydisplay:false, + }) + } + xinzenw=(e)=>{ + //只限制了教师 + if(this.props.current_user.professional_certification===false&&this.state.isysladmins===false){ + this.HideAddcoursestypess(2); + return + } var urls=""; if(this.props.discipline_id){ // if(urls==="?"){ @@ -95,13 +205,32 @@ class Contentpart extends Component { } render() { - let {page}=this.state; + let {page,mydisplay,url}=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; + let isysladmins=false; + let 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; + try { + if(is_teacher===false){ + if(this.props.current_user.user_identity !=="学生"){ + //专业人士 + is_teacher=true + } + } + if(this.props){ + if(this.props.current_user){ + if(this.props.current_user.admin){ + isysladmins=true; + } + else if(this.props.current_user.business){ + isysladmins=true; + } + } + } + }catch (e) { + } const content = (

+ {url? + this.handleClose()}> + : + "" + } + { + mydisplay===true? + + + :"" + } + { + mydisplay===true? + + + :"" + }
@@ -166,7 +321,7 @@ class Contentpart extends Component { { - isysladmins===true||(is_teacher===true&&professional_certification===true)? + isysladmins===true||is_teacher===true? this.props.callback(e)}> @@ -192,7 +347,7 @@ class Contentpart extends Component { ` .xaxisreverseorder .ant-input-group-addon{ - width: 60px !important; + width: 48px !important; } @@ -214,7 +369,7 @@ class Contentpart extends Component {
{ defaultActiveKey===0||defaultActiveKey==="0"? - isysladmins===true||(is_teacher===true&&professional_certification===true)? + isysladmins===true||is_teacher===true? this.props.Isitapopup&&this.props.Isitapopup==="true"? "" : @@ -247,7 +402,7 @@ class Contentpart extends Component { defaultActiveKey===0||defaultActiveKey==="0"? this.props.Isitapopup&&this.props.Isitapopup==="true"? this.props.setdatafuns(value)} /> : this.props.getitem_basketss(id)} getitem_baskets={(e)=>this.props.getitem_baskets(e)} - showmodels={(e)=>this.props.showmodels(e)} - showmodelysl={(e)=>this.props.showmodelysl(e)} - showmodelsInaudit={(e)=>this.props.showmodelsInaudit(e)} + showmodels={(e)=>this.showmodels(e)} + showmodelysl={(e)=>this.showmodelysl(e)} + showmodelsInaudit={(e)=>this.showmodelsInaudit(e)} + handleShowUploadImage={(e)=>this.handleShowUploadImage(e)} + handleClose={()=>this.handleClose()} + > diff --git a/public/react/src/modules/question/component/Headplugselections.js b/public/react/src/modules/question/component/Headplugselections.js index 4da7a57e3..d683ad43e 100644 --- a/public/react/src/modules/question/component/Headplugselections.js +++ b/public/react/src/modules/question/component/Headplugselections.js @@ -260,7 +260,7 @@ 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={"bottomRight"}> + trigger.parentNode} overlay={ overlaymenu(item.sub_disciplines,item.id)} key={key} placement="bottomLeft">
  • this.shixunserdchAlls(item.sub_disciplines,item.id)}> {item.name}
  • diff --git a/public/react/src/modules/question/component/JudquestionEditor.js b/public/react/src/modules/question/component/JudquestionEditor.js index 09cf1094f..d7154259d 100644 --- a/public/react/src/modules/question/component/JudquestionEditor.js +++ b/public/react/src/modules/question/component/JudquestionEditor.js @@ -9,6 +9,7 @@ import TPMMDEditor from '../../../modules/tpm/challengesnew/TPMMDEditor'; import axios from 'axios' import update from 'immutability-helper' import './../questioncss/questioncom.css'; +import '../questioncss/font.css'; import {getUrl, ActionBtn, DMDEditor, ConditionToolTip} from 'educoder'; import QuillForEditor from '../../../common/quillForEditor'; @@ -368,10 +369,7 @@ class JudquestionEditor extends Component{ // ////////console.log(answerTagArray); // ////////console.log(!exerciseIsPublish); const params= this.props&&this.props.match&&this.props.match.params; - 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']} - ] + const options=['code-block', 'image', 'formula'] return(

    diff --git a/public/react/src/modules/question/component/Listjihe.js b/public/react/src/modules/question/component/Listjihe.js index d613227fe..34d8844e7 100644 --- a/public/react/src/modules/question/component/Listjihe.js +++ b/public/react/src/modules/question/component/Listjihe.js @@ -8,10 +8,12 @@ import { Table, Pagination, Radio, - Tooltip + Tooltip, + Icon } from "antd"; import './../questioncss/questioncom.css'; import QuillForEditor from "../../../common/quillForEditor"; +import Certifiedprofessional from "../../modals/Certifiedprofessional"; const tagArray = [ 'A.', 'B.', 'C.', 'D.', 'E.', 'F.', 'G.', 'H.', 'I.', @@ -31,15 +33,46 @@ class Listjihe extends Component { page: 1, name: "单选题", nd: "简单", + url: "", + mydisplay:false, + occupation:2, + isysladmins:false, } } //初始化 componentDidMount() { + let isysladmins=false; + if(this.props){ + if(this.props.current_user){ + if(this.props.current_user.admin){ + isysladmins=true; + } + else if(this.props.current_user.business){ + isysladmins=true; + } + } + } + this.setState({ + isysladmins:isysladmins + }) + } + handleShowUploadImage = (url) => { + try { + this.props.handleShowUploadImage(url); + }catch (e) { + + } } + handleClose=()=>{ + try { + this.props.handleClose(); + }catch (e) { + } + } //选用 Selectingpracticaltraining = (id) => { let data = {} @@ -53,8 +86,15 @@ class Listjihe extends Component { exam_id: this.props.exam_id === undefined ? "" : parseInt(this.props.exam_id), } } - + if(this.props.current_user.professional_certification===false&&this.state.isysladmins===false){ + this.HideAddcoursestypess(2); + return + } + this.getitem_baskets(data); + } + getitem_baskets=(data)=>{ this.props.getitem_baskets(data); + } //撤销 Selectingpracticaltrainings = (id) => { @@ -63,8 +103,29 @@ class Listjihe extends Component { } + seturls(url){ + if(this.props.current_user.professional_certification===false&&this.state.isysladmins===false){ + this.HideAddcoursestypess(2); + return + } + this.props.history.replace(url); + } + + HideAddcoursestypess=(i)=>{ + console.log("调用了"); + this.setState({ + mydisplay:true, + occupation:i, + }) + } + + mydisplayHidedel=()=>{ + this.setState({ + mydisplay:false, + }) + } render() { - let {page, name, nd} = this.state; + let {page, name, nd,url,mydisplay} = this.state; let {defaultActiveKey, items, listjihe, chakanjiexiboolindex, keindex} = this.props; // 编程答案 @@ -132,7 +193,7 @@ class Listjihe extends Component { }catch (e) { } if(itemssname===undefined){ - itemssname=items.name + itemssname=items.name+"" } @@ -141,7 +202,8 @@ class Listjihe extends Component { itemsnamesy= JSON.parse(items&&items.program_attr&&items.program_attr.description); }catch (e) { - itemsnamesy=items&&items.program_attr&&items.program_attr.description; + itemsnamesy=items&&items.program_attr&&items.program_attr.description+""; + } var analysisnames=""; @@ -149,7 +211,7 @@ class Listjihe extends Component { analysisnames= JSON.parse(items&&items.analysis); }catch (e) { - analysisnames=items&&items.analysis; + analysisnames=items&&items.analysis+""; } // console.log(items.name); // console.log(itemsnamesy); @@ -158,10 +220,61 @@ class Listjihe extends Component { const options = [ 'bold', // 加粗 ] + + try { + if(itemsnamesy.constructor === Object){ + // console.log("是对象"); + // console.log(itemsnamesy); + }else { + // console.log("不是对象"); + // console.log(itemsnamesy); + itemsnamesy=itemsnamesy+""; + } + }catch (e) { + + } + return (

    + className={chakanjiexiboolindex === keindex ? "w100s borderwds283 pd20 mb20 listjihecolors" : " borderwds pd20 mb20 listjihecolors"}> {/*顶部*/} + { + mydisplay===true? + + + :"" + } + { + mydisplay===true? + + + :"" + } + + + {/* 显示上传的图片信息 */} + {/*
    */} + {/* this.handleClose()}/>*/} + {/*
    */} + {/* */} + {/*
    */} + {/*
    */} +
    + {/**/} +
    + +
    +
    + + ) + } +} + +export default QuestionModalPicture; diff --git a/public/react/src/modules/question/component/SiderBars.js b/public/react/src/modules/question/component/SiderBars.js index 78674068c..e6cee7761 100644 --- a/public/react/src/modules/question/component/SiderBars.js +++ b/public/react/src/modules/question/component/SiderBars.js @@ -94,6 +94,22 @@ class SiderBars extends Component { var mypath= this.props&&this.props.match&&this.props.match.path; let{myvisible,Datacount,animateStyle}=this.props; + let swsilan=false; + if(this.props){ + if(this.props.current_user){ + if(this.props.current_user.admin){ + swsilan=true; + } + else if(this.props.current_user.business){ + swsilan=true; + } + else if(this.props.current_user.is_teacher){ + swsilan=true; + }else if(this.props.current_user.user_identity !=="学生") { + swsilan=true; + } + } + } return (
    0?"-task-sidebar mystask-sidebars":"-task-sidebar mystask-sidebarss"} > @@ -101,7 +117,7 @@ class SiderBars extends Component { {this.props.mygetHelmetapi&&this.props.mygetHelmetapi.main_site===true?
    { - mypath&&mypath==="/question"? + mypath&&mypath==="/question"&&swsilan===true?
    this.props.showDrawer()} > @@ -117,7 +133,7 @@ class SiderBars extends Component { -

    试题库

    +

    试题篮

    :"" diff --git a/public/react/src/modules/question/component/SingleEditor.js b/public/react/src/modules/question/component/SingleEditor.js index 39c2e447e..5bfda9f7a 100644 --- a/public/react/src/modules/question/component/SingleEditor.js +++ b/public/react/src/modules/question/component/SingleEditor.js @@ -10,6 +10,7 @@ import TPMMDEditor from '../../../modules/tpm/challengesnew/TPMMDEditor'; import axios from 'axios' import update from 'immutability-helper' import './../questioncss/questioncom.css'; +import '../questioncss/font.css'; import {getUrl, ActionBtn, DMDEditor, ConditionToolTip} from 'educoder'; const { TextArea } = Input; const confirm = Modal.confirm; @@ -258,8 +259,23 @@ class SingleEditor extends Component{ texts=""; } } else { - value = JSON.stringify(value); - texts=value; + if(_text.length>=500){ + var result = _text.substring(0,450); + texts={"ops":[{"insert":result}]}; + texts=JSON.stringify(texts); + }else { + // 提交到后台的内容需要处理一下; + value = JSON.stringify(value); + if(value.length>=500){ + let a=value.length-500; + let b=_text.length-a; + var result = _text.substring(0,b); + texts={"ops":[{"insert":result}]}; + texts=JSON.stringify(texts); + }else{ + texts=value; + } + } } let question_choices = this.state.question_choices.slice(0); question_choices[index] = texts; @@ -354,9 +370,7 @@ 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']} + const options=['code-block', 'image', 'formula' ] return(
    @@ -384,6 +398,10 @@ class SingleEditor extends Component{ } .signleEditor .quill_editor_for_react_area .ql-toolbar .ql-formats .ql-font { line-height: 20px; + min-width: 150px; + } + .signleEditor .quill_editor_for_react_area .ql-container .ql-editor p{ + font-family: MicrosoftYaHei; } `}

    @@ -428,7 +446,7 @@ class SingleEditor extends Component{ autoFocus={false} imgAttrs={{width: '146px', height: '136px'}} style={{ height: '166px'}} - placeholder="请您输入题干" + placeholder="请您输入选项" options={options} value={item} onContentChange={(value,quill) => this.onOptionContentChange(value,quill,index)} @@ -438,7 +456,7 @@ class SingleEditor extends Component{ autoFocus={false} imgAttrs={{width: '146px', height: '136px'}} style={{ height: '166px'}} - placeholder="请您输入题干" + placeholder="请您输入选项" options={options} value={JSON.parse(item)} onContentChange={(value,quill) => this.onOptionContentChange(value,quill,index)} diff --git a/public/react/src/modules/question/questioncss/font.css b/public/react/src/modules/question/questioncss/font.css new file mode 100644 index 000000000..1f2cd8386 --- /dev/null +++ b/public/react/src/modules/question/questioncss/font.css @@ -0,0 +1,67 @@ +@charset "utf-8"; +.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=SimSun]::before, +.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=SimSun]::before { + content: "宋体"; + font-family:SimSun !important; +} +.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=SimHei]::before, +.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=SimHei]::before { + content: "黑体"; + font-family:SimHei !important; +} +.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=Microsoft-YaHei]::before, +.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=Microsoft-YaHei]::before { + content: "微软雅黑"; + font-family:Microsoft YaHei !important; +} +.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=KaiTi]::before, +.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=KaiTi]::before { + content: "楷体"; + font-family:KaiTi !important; +} +.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=FangSong]::before, +.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=FangSong]::before { + content: "仿宋"; + font-family:FangSong !important; +} +.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=Arial]::before, +.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=Arial]::before { + content: "Arial"; + font-family:Arial !important; +} +.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=Times-New-Roman]::before, +.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=Times-New-Roman]::before { + content: "Times New Roman"; + font-family:Times New Roman !important; +} +.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=sans-serif]::before, +.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=sans-serif]::before { + content: "sans-serif"; + font-family:sans-serif !important; +} + + +.ql-font-SimSun { + font-family:SimSun !important; +} +.ql-font-SimHei { + font-family:SimHei !important; +} +.ql-font-Microsoft-YaHei { + font-family:Microsoft YaHei !important; +} +.ql-font-KaiTi { + font-family:KaiTi !important; +} +.ql-font-FangSong { + font-family:FangSong !important; +} +.ql-font-Arial { + font-family:Arial !important; +} +.ql-font-Times-New-Roman { + font-family:Times New Roman !important; +} +.ql-font-sans-serif { + font-family:sans-serif !important; +} diff --git a/public/react/src/modules/question/questioncss/quill.core.css b/public/react/src/modules/question/questioncss/quill.core.css new file mode 100644 index 000000000..516e388b6 --- /dev/null +++ b/public/react/src/modules/question/questioncss/quill.core.css @@ -0,0 +1,18 @@ +.ql-editor .ql-font-Microsoft-YaHei { + font-family: "Microsoft YaHei"; +} +.ql-editor .ql-font-SimSun { + font-family: "SimSun"; +} +.ql-editor .ql-font-SimHei { + font-family: "SimHei"; +} +.ql-editor .ql-font-KaiTi { + font-family: "KaiTi"; +} +.ql-editor .ql-font-Arial { + font-family: "Arial"; +} +.ql-editor .Times-New-Roman { + font-family: "Times New Roman"; +} diff --git a/public/react/src/modules/question/questioncss/quill.snow.css b/public/react/src/modules/question/questioncss/quill.snow.css new file mode 100644 index 000000000..962b40f99 --- /dev/null +++ b/public/react/src/modules/question/questioncss/quill.snow.css @@ -0,0 +1,28 @@ +.ql-snow .ql-picker.ql-font .ql-picker-label::before, +.ql-snow .ql-picker.ql-font .ql-picker-item::before { + content: '微软雅黑'; +} +.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=Microsoft-YaHei]::before, +.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=Microsoft-YaHei]::before { + content: "微软雅黑"; +} +.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=SimSun]::before, +.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=SimSun]::before { + content: "宋体"; +} +.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=SimHei]::before, +.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=SimHei]::before { + content: "黑体"; +} +.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=KaiTi]::before, +.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=KaiTi]::before { + content: "楷体"; +} +.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=Arial]::before, +.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=Arial]::before { + content: "Arial"; +} +.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=Times-New-Roman]::before, +.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=Times-New-Roman]::before { + content: "Times New Roman"; +} diff --git a/public/react/src/modules/testpaper/Paperlibraryeditid.js b/public/react/src/modules/testpaper/Paperlibraryeditid.js index 8700a216f..e5104804f 100644 --- a/public/react/src/modules/testpaper/Paperlibraryeditid.js +++ b/public/react/src/modules/testpaper/Paperlibraryeditid.js @@ -31,7 +31,7 @@ class Paperlibraryeditid extends Component { super(props); this.Judquestio = React.createRef(); this.state = { - paperlibrartdata: [], + Contentdata: [], disciplinesdata: [], knowledgepoints: [], disciplmy: [], @@ -139,7 +139,7 @@ class Paperlibraryeditid extends Component { axios.get(urls).then((response) => { if (response) { this.setState({ - paperlibrartdata: response.data, + Contentdata: response.data, item_banksedit: response.data.exam, }) } @@ -188,7 +188,7 @@ class Paperlibraryeditid extends Component { .then((result) => { if (result.data.status === 0) { // this.props.showNotification(`试卷更新成功`); - this.props.history.push('/paperlibrary'); + this.props.history.push('/paperlibrary/see/'+this.props.match.params.id); } }).catch((error) => { //console.log(error); @@ -227,7 +227,7 @@ class Paperlibraryeditid extends Component { } render() { - let {paperlibrartdata,newmyshixunmodelbool,defaultActiveKey} = this.state; + let {Contentdata,newmyshixunmodelbool,defaultActiveKey} = this.state; const params = this.props && this.props.match && this.props.match.params; let urlsysl=`/paperlibrary?defaultActiveKey=${defaultActiveKey}`; @@ -248,7 +248,7 @@ class Paperlibraryeditid extends Component { { newmyshixunmodelbool===true?

    - this.setnewmyshixunmodelbool(e)}> + this.setnewmyshixunmodelbool(e)}>
    : "" @@ -291,9 +291,9 @@ class Paperlibraryeditid extends Component {
    this.setnewmyshixunmodelbool(e)} - all_score={paperlibrartdata && paperlibrartdata.exam && paperlibrartdata.exam.all_questions_count} - all_questions_count={paperlibrartdata && paperlibrartdata.exam && paperlibrartdata.exam.all_score} - difficulty={paperlibrartdata && paperlibrartdata.exam && paperlibrartdata.exam.difficulty} + all_score={Contentdata && Contentdata.exam && Contentdata.exam.all_questions_count} + all_questions_count={Contentdata && Contentdata.exam && Contentdata.exam.all_score} + difficulty={Contentdata && Contentdata.exam && Contentdata.exam.difficulty} >
    @@ -301,15 +301,15 @@ class Paperlibraryeditid extends Component { {...this.state} {...this.props} getdata={() => this.getdata()} - single_questions={paperlibrartdata && paperlibrartdata.single_questions && paperlibrartdata.single_questions.questions.length > 0 ? paperlibrartdata.single_questions : null} - multiple_questions={paperlibrartdata && paperlibrartdata.multiple_questions - && paperlibrartdata.multiple_questions.questions.length > 0 ? paperlibrartdata.multiple_questions : null + single_questions={Contentdata && Contentdata.single_questions && Contentdata.single_questions.questions.length > 0 ? Contentdata.single_questions : null} + multiple_questions={Contentdata && Contentdata.multiple_questions + && Contentdata.multiple_questions.questions.length > 0 ? Contentdata.multiple_questions : null } - judgement_questions={paperlibrartdata && paperlibrartdata.judgement_questions - && paperlibrartdata.judgement_questions.questions.length > 0 ? paperlibrartdata.judgement_questions : null + judgement_questions={Contentdata && Contentdata.judgement_questions + && Contentdata.judgement_questions.questions.length > 0 ? Contentdata.judgement_questions : null } - program_questions={paperlibrartdata && paperlibrartdata.program_questions - && paperlibrartdata.program_questions.questions.length > 0 ? paperlibrartdata.program_questions : null + program_questions={Contentdata && Contentdata.program_questions + && Contentdata.program_questions.questions.length > 0 ? Contentdata.program_questions : null } > diff --git a/public/react/src/modules/testpaper/Testpaperlibrary.js b/public/react/src/modules/testpaper/Testpaperlibrary.js index 0fb34200e..f86fcee81 100644 --- a/public/react/src/modules/testpaper/Testpaperlibrary.js +++ b/public/react/src/modules/testpaper/Testpaperlibrary.js @@ -162,13 +162,11 @@ class Testpaperlibrary extends Component { booljupyterurls:true, }) } - + axios.get((url), {params: data}).then((response) => { - setTimeout(()=>{ this.setState({ booljupyterurls:false, }) - },1000); if (response === null || response === undefined) { return @@ -304,7 +302,7 @@ class Testpaperlibrary extends Component { tag_discipline_id:this.state.tag_discipline_id, public: this.state.defaultActiveKey, difficulty: this.state.difficulty, - keyword: this.state.keywords, + keyword: this.state.keyword, page: this.state.page, per_page:10, }; @@ -330,7 +328,7 @@ class Testpaperlibrary extends Component { tag_discipline_id:this.state.tag_discipline_id, public: this.state.defaultActiveKey, difficulty: this.state.difficulty, - keyword: this.state.keywords, + keyword: this.state.keyword, page: this.state.page, per_page:10, }; diff --git a/public/react/src/modules/testpaper/component/Contentpart.js b/public/react/src/modules/testpaper/component/Contentpart.js index 8a3d57414..5148e00ca 100644 --- a/public/react/src/modules/testpaper/component/Contentpart.js +++ b/public/react/src/modules/testpaper/component/Contentpart.js @@ -17,6 +17,7 @@ import NoneDatas from '../component/NoneDatas'; import Contentquestionbank from "./Contentquestionbank"; import LoadingSpin from '../../../common/LoadingSpin'; import Listjihe from "./Listjihe"; +import Certifiedprofessional from "../../modals/Certifiedprofessional"; const { TabPane } = Tabs; const Search = Input.Search; class Contentpart extends Component { @@ -25,6 +26,10 @@ class Contentpart extends Component { this.state = { page:1, defaultActiveKeyss:"0", + mydisplay:false, + occupation:2, + isysladmins:false, + } } @@ -50,6 +55,20 @@ class Contentpart extends Component { } } + let isysladmins=false; + if(this.props){ + if(this.props.current_user){ + if(this.props.current_user.admin){ + isysladmins=true; + } + else if(this.props.current_user.business){ + isysladmins=true; + } + } + } + this.setState({ + isysladmins:isysladmins + }) } //跳转人工组卷 @@ -60,11 +79,32 @@ class Contentpart extends Component { componentDidUpdate(prevProps) { if(prevProps.current_user !== this.props.current_user) { - 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; + let isysladmins=false; + let 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; let {defaultActiveKey} = this.props; let defaultActiveKeys=defaultActiveKey; + try { + if(this.props){ + if(this.props.current_user){ + if(this.props.current_user.admin){ + isysladmins=true; + } + else if(this.props.current_user.business){ + isysladmins=true; + } + } + } + + if(is_teacher===false){ + if(this.props.current_user.user_identity !=="学生"){ + //专业人士 + is_teacher=true + } + } + }catch (e) { + + } if(isysladmins===true||(is_teacher===true&&professional_certification===true)){ defaultActiveKeys="0" }else{ @@ -86,15 +126,120 @@ class Contentpart extends Component { this.props.callback(defaultActiveKeys,false); } } + HideAddcoursestypess=(i)=>{ + console.log("调用了"); + this.setState({ + mydisplay:true, + occupation:i, + }) + } + + mydisplayHidedel=()=>{ + this.setState({ + mydisplay:false, + }) + } + xinzenw=(url)=>{ + //只限制了教师 + if(this.props.current_user.professional_certification===false&&this.state.isysladmins===false){ + this.HideAddcoursestypess(2); + return + } + + this.props.history.push(url); + + } + HideAddcoursestypess=(i)=>{ + console.log("调用了"); + this.setState({ + mydisplay:true, + occupation:i, + }) + } + + mydisplayHidedel=()=>{ + this.setState({ + mydisplay:false, + }) + } + + Testpapereditor=(e)=>{ + + if(this.props.current_user.professional_certification===false&&this.state.isysladmins===false){ + this.HideAddcoursestypess(2); + return + } + this.props.Testpapereditor(e) + + } + + showmodels=(e)=>{ + + if(this.props.current_user.professional_certification===false&&this.state.isysladmins===false){ + this.HideAddcoursestypess(2); + return + } + this.props.showmodels(e) + + } + + + showmodelysl=(e)=>{ + + if(this.props.current_user.professional_certification===false&&this.state.isysladmins===false){ + this.HideAddcoursestypess(2); + return + } + this.props.showmodelysl(e) + + } + + + showmodelsInaudit=(e)=>{ + + if(this.props.current_user.professional_certification===false&&this.state.isysladmins===false){ + this.HideAddcoursestypess(2); + return + } + this.props.showmodelsInaudit(e) + + } + + + + + render() { - let {page,defaultActiveKeyss}=this.state; + let {page,defaultActiveKeyss,mydisplay}=this.state; let {defaultActiveKey,defaultActiveKeybool}=this.props; let 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; + let isysladmins=false; + let 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; + try { + if(this.props){ + if(this.props.current_user){ + if(this.props.current_user.admin){ + isysladmins=true; + } + else if(this.props.current_user.business){ + isysladmins=true; + } + } + } + + + if(is_teacher===false){ + if(this.props.current_user.user_identity !=="学生"){ + //专业人士 + is_teacher=true + } + } + }catch (e) { + + } const contents = (
    + { + mydisplay===true? + + + :"" + } + { + mydisplay===true? + + + :"" + }
    @@ -149,7 +315,7 @@ class Contentpart extends Component { { - isysladmins===true||(is_teacher===true&&professional_certification===true)? + isysladmins===true||is_teacher===true? this.props.callback(e,true)}> @@ -172,7 +338,7 @@ class Contentpart extends Component { { ` .sortinxdirection .ant-input-group-addon{ - width: 60px !important; + width: 48px !important; } @@ -186,7 +352,7 @@ class Contentpart extends Component { ` } -
    +
    this.props.setdatafunsval(e)} onSearch={ (value)=>this.props.setdatafuns(value)} - value={this.props.keywords} + value={this.props.keyword} /> { - isysladmins===true||(is_teacher===true&&professional_certification===true)? + isysladmins===true||is_teacher===true?
    - + this.xinzenw('/Integeneration')}>

    智能组卷

    - + this.xinzenw('/question')}>

    人工组卷

    @@ -260,9 +426,9 @@ class Contentpart extends Component { : this.props.Contentdata.exams.map((object, index) => { return ( this.props.Testpapereditor(e)} - showmodels={(e)=>this.props.showmodels(e)} - showmodelysl={(e)=>this.props.showmodelysl(e)} + Testpapereditor={(e)=>this.Testpapereditor(e)} + showmodels={(e)=>this.showmodels(e)} + showmodelysl={(e)=>this.showmodelysl(e)} Isitapopup={this.props.Isitapopup} showmodelsInaudit={(e)=>this.props.showmodelsInaudit(e)} > diff --git a/public/react/src/modules/testpaper/component/Listjihe.js b/public/react/src/modules/testpaper/component/Listjihe.js index b2f358b96..569ab3008 100644 --- a/public/react/src/modules/testpaper/component/Listjihe.js +++ b/public/react/src/modules/testpaper/component/Listjihe.js @@ -10,6 +10,7 @@ import { Radio } from "antd"; import './../testioncss/testioncss.css'; +import Certifiedprofessional from "../../modals/Certifiedprofessional"; const tagArray = [ 'A.', 'B.', 'C.', 'D.', 'E.', 'F.', 'G.', 'H.', 'I.', 'J.', 'K.', 'L.', 'M.', 'N.', 'O.', 'P.', 'Q.', 'R.', @@ -23,12 +24,27 @@ class Listjihe extends Component { name:"单选题", nd:"简单", chakanjiexibool:false, + mydisplay:false, + occupation:2, + isysladmins:false, } } //初始化 componentDidMount(){ - - + let isysladmins=false; + if(this.props){ + if(this.props.current_user){ + if(this.props.current_user.admin){ + isysladmins=true; + } + else if(this.props.current_user.business){ + isysladmins=true; + } + } + } + this.setState({ + isysladmins:isysladmins + }) } chakanjiexibool=()=>{ @@ -55,15 +71,31 @@ class Listjihe extends Component { this.props.getitem_basketss(id); } + HideAddcoursestypess=(i)=>{ + console.log("调用了"); + this.setState({ + mydisplay:true, + occupation:i, + }) + } + mydisplayHidedel=()=>{ + this.setState({ + mydisplay:false, + }) + } gotoseesj=(id)=>{ + if(this.props.current_user.professional_certification===false&&this.state.isysladmins===false){ + this.HideAddcoursestypess(2); + return + } this.props.history.push(`/paperlibrary/see/${id}?defaultActiveKey=${this.props.defaultActiveKey}`); } render() { - let {page,name,nd,chakanjiexibool}=this.state; + let {page,name,nd,chakanjiexibool,mydisplay}=this.state; let {defaultActiveKey,items}=this.props; const names= items&&items.name&&items.name; @@ -77,12 +109,33 @@ class Listjihe extends Component { return (
    + { + mydisplay===true? + + + :"" + } + { + mydisplay===true? + + + :"" + }
    - +

    试题数:{question_counts}

    总分:{total_scores}

    @@ -135,21 +188,22 @@ class Listjihe extends Component { } { - items.apply===false? -

    this.props.showmodels(items.id)}> - - 公开 -

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

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

    + + 已公开

    - ) + : + items.apply===false? +

    this.props.showmodels(items.id)}> + + 公开 +

    + : +

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

    }
    :""} @@ -159,7 +213,9 @@ class Listjihe extends Component {
    -
    +

    发起考试

    diff --git a/public/react/src/modules/testpaper/component/Paperlibraryseeid_items.js b/public/react/src/modules/testpaper/component/Paperlibraryseeid_items.js index 9fffcca76..76b715519 100644 --- a/public/react/src/modules/testpaper/component/Paperlibraryseeid_items.js +++ b/public/react/src/modules/testpaper/component/Paperlibraryseeid_items.js @@ -16,6 +16,7 @@ import { import '../testioncss/testioncss.css'; import '../../tpm/newshixuns/css/Newshixuns.css'; import QuillForEditor from "../../../common/quillForEditor"; +import QuestionModalPicture from "../../question/component/QuestionModalPicture"; const tagArray = [ 'A.', 'B.', 'C.', 'D.', 'E.', 'F.', 'G.', 'H.', 'I.', @@ -33,6 +34,7 @@ class Paperlibraryseeid_items extends Component { questions: 0, totalscore: 0, total: 0, + url: "" } } @@ -65,9 +67,20 @@ class Paperlibraryseeid_items extends Component { Singlemagaziness = () => { } - + handleShowUploadImage = (url) => { + // console.log('==============>>>>>>>>>>>>',url); + // setUrl(url); + this.setState({ + url:url + }) + } + handleClose=()=>{ + this.setState({ + url:'', + }) + } render() { - let {questions, totalscore, total, items} = this.state; + let {questions, totalscore, total, items,url} = this.state; let {objectsingle, indexx, paperreviewsingleindex, indexxy,name} = this.props; @@ -90,12 +103,30 @@ class Paperlibraryseeid_items extends Component { const options = [ 'bold', // 加粗 ] + try { + if(itemsnamesy.constructor === Object){ + // console.log("是对象"); + // console.log(itemsnamesy); + }else { + // console.log("不是对象"); + // console.log(itemsnamesy); + itemsnamesy=itemsnamesy+""; + } + }catch (e) { + + } + return (
    + {url? + this.handleClose()}> + : + "" + } - {/*
  • */} - {/* */} - {/*
    */} - {/*
    */} - {/* 题库*/} - {/*
    */} - {/*
    */} - {/*
    */} - {/*
  • */} + { + Periofters===true? +
  • + +
    +
    + 题库 +
    +
    +
    +
  • + :"" + } +