diff --git a/public/react/src/modules/question/component/Listjihe.js b/public/react/src/modules/question/component/Listjihe.js index 36a83fbbf..91e29eb3a 100644 --- a/public/react/src/modules/question/component/Listjihe.js +++ b/public/react/src/modules/question/component/Listjihe.js @@ -1,9 +1,9 @@ + import React, { Component } from "react"; import { markdownToHTML } from 'educoder'; import { Radio, - Tooltip, - Icon + Tooltip } from "antd"; import './../questioncss/questioncom.css'; import QuillForEditor from "../../../common/quillForEditor"; @@ -21,24 +21,24 @@ const tagArrays = [ ] const questionType = [ { - type:'SINGLE', - color:'typeGreen', - name:'单选题' + type: 'SINGLE', + color: 'typeGreen', + name: '单选题' }, { - type:'MULTIPLE', - color:'typeBlue', - name:'多选题' + type: 'MULTIPLE', + color: 'typeBlue', + name: '多选题' }, { - type:'JUDGMENT', - color:'typeRed', - name:'判断题' + type: 'JUDGMENT', + color: 'typeRed', + name: '判断题' }, { - type:'PROGRAM', - color:'typeYellow', - name:'编程题' + type: 'PROGRAM', + color: 'typeYellow', + name: '编程题' } ] //Paperreview_single.js Paperlibraryseeid_items.js @@ -50,57 +50,57 @@ class Listjihe extends Component { name: "单选题", nd: "简单", url: "", - mydisplay:false, - occupation:2, - isysladmins: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; + 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; + else if (this.props.current_user.business) { + isysladmins = true; } } } this.setState({ - isysladmins:isysladmins + isysladmins: isysladmins }) } handleShowUploadImage = (url) => { try { this.props.handleShowUploadImage(url); - }catch (e) { + } catch (e) { } } - handleClose=()=>{ + handleClose = () => { try { this.props.handleClose(); - }catch (e) { + } catch (e) { } } //选用 Selectingpracticaltraining = (id) => { - try { - if(this.props.Datacountbool){ - if(this.props.Datacount===100){ - this.props.showNotification(`已选100个试题(不能在选用更多试题)`); - return; - } - } - }catch (e) { + try { + if (this.props.Datacountbool) { + if (this.props.Datacount === 100) { + this.props.showNotification(`已选100个试题(不能在选用更多试题)`); + return; + } + } + } catch (e) { - } + } @@ -115,13 +115,13 @@ 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){ + if (this.props.current_user.professional_certification === false && this.state.isysladmins === false) { this.HideAddcoursestypess(2); return } - this.getitem_baskets(data); + this.getitem_baskets(data); } - getitem_baskets=(data)=>{ + getitem_baskets = (data) => { this.props.getitem_baskets(data); } @@ -132,30 +132,30 @@ class Listjihe extends Component { } - seturls(url){ - if(this.props.current_user.professional_certification===false&&this.state.isysladmins===false){ + 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)=>{ + HideAddcoursestypess = (i) => { console.log("调用了"); this.setState({ - mydisplay:true, - occupation:i, + mydisplay: true, + occupation: i, }) } - mydisplayHidedel=()=>{ + mydisplayHidedel = () => { this.setState({ - mydisplay:false, + mydisplay: false, }) } render() { - let {page, name, nd,url,mydisplay} = this.state; - let {defaultActiveKey, items, listjihe, chakanjiexiboolindex, keindex} = this.props; + let { page, name, nd, url, mydisplay } = this.state; + let { defaultActiveKey, items, listjihe, chakanjiexiboolindex, keindex } = this.props; // 编程答案 var rightkey = null @@ -193,72 +193,54 @@ class Listjihe extends Component { MULTIPLEkey = MULTIPLEkey + tagArrays[i]; } - // 编程答案 - var rightkey = null - - if (items) { - if (items.item_type) { - if (items.item_type === "PROGRAM") { - - } else { - if (items.item_type === "JUDGMENT") { - - - if (items.choices) { - if (items.choices.length > 0) { - var arr = items.choices; - for (let data of arr) { - if (data.is_answer === true) { - rightkey = data.choice_text; - break; - } - } - } - } - } else { - if (items.choices) { - if (items.choices.length > 0) { - var arr = items.choices; - for (var i = 0; i < arr.length; i++) { - if (arr[i].is_answer === true) { - rightkey = i; - break; - } - } - } - } - - - } - } - } + } + } + } + } + + } else { + if (items.choices) { + if (items.choices.length > 0) { + var arr = items.choices; + for (var i = 0; i < arr.length; i++) { + if (arr[i].is_answer === true) { + rightkey = i; + break; + } + } + } + } + } + } + } + } } - var itemssname=""; + var itemssname = ""; try { - itemssname= JSON.parse(items.name); - }catch (e) { + itemssname = JSON.parse(items.name); + } catch (e) { } - if(itemssname===undefined){ - itemssname=items.name+"" + if (itemssname === undefined) { + itemssname = items.name + "" } - var itemsnamesy = ""; - try { - itemsnamesy = JSON.parse(items && items.program_attr && items.program_attr.description); + var itemsnamesy = ""; + try { + itemsnamesy = JSON.parse(items && items.program_attr && items.program_attr.description); - }catch (e) { - itemsnamesy=items&&items.program_attr&&items.program_attr.description+""; + } catch (e) { + itemsnamesy = items && items.program_attr && items.program_attr.description + ""; } - var analysisnames = ""; - try { - analysisnames = JSON.parse(items && items.analysis); + var analysisnames = ""; + try { + analysisnames = JSON.parse(items && items.analysis); - }catch (e) { - analysisnames=items&&items.analysis+""; + } catch (e) { + analysisnames = items && items.analysis + ""; } // console.log(items.name); // console.log(itemsnamesy); @@ -269,30 +251,30 @@ class Listjihe extends Component { ] try { - if(itemsnamesy.constructor === Object){ + if (itemsnamesy.constructor === Object) { // console.log("是对象"); // console.log(itemsnamesy); - }else { + } else { // console.log("不是对象"); // console.log(itemsnamesy); - itemsnamesy=itemsnamesy+""; + itemsnamesy = itemsnamesy + ""; } - }catch (e) { + } catch (e) { } - const types = questionType.filter(item=>item.type === items.item_type); + const types = questionType.filter(item => item.type === items.item_type); return (