diff --git a/public/react/src/App.js b/public/react/src/App.js index 90de0389d..d2987da20 100644 --- a/public/react/src/App.js +++ b/public/react/src/App.js @@ -301,19 +301,23 @@ const Developer = Loadable({ loader: () => import('./modules/developer'), loading: Loading }) -// 题库 +// 试题库 const Headplugselection = Loadable({ loader: () => import('./modules/question/Question'), loading: Loading }) -//题库新建 //题库编辑 +//试题库新建 //题库编辑 const Questionitem_banks = Loadable({ loader: () => import('./modules/question/Questionitem_banks'), loading: Loading }) - +//试卷库 +const Testpaperlibrary= Loadable({ + loader: () => import('./modules/testpaper/Testpaperlibrary'), + loading: Loading +}) @@ -768,6 +772,11 @@ class App extends Component { render={ (props) => () }/> + + () + }/> () diff --git a/public/react/src/modules/testpaper/Testpaperlibrary.js b/public/react/src/modules/testpaper/Testpaperlibrary.js new file mode 100644 index 000000000..7907835b1 --- /dev/null +++ b/public/react/src/modules/testpaper/Testpaperlibrary.js @@ -0,0 +1,239 @@ +import React, {Component} from "react"; +import {Link, NavLink} from 'react-router-dom'; +import {WordsBtn, ActionBtn, SnackbarHOC, getImageUrl} from 'educoder'; +import axios from 'axios'; +import { + notification, + Spin, + Table, + Pagination, + Drawer, + Input +} from "antd"; +import {TPMIndexHOC} from "../tpm/TPMIndexHOC"; +import NoneData from './component/NoneData'; +import './testioncss/testioncss.css'; +import Contentpart from "./component/Contentpart"; +import SiderBar from "../tpm/SiderBar"; +import Headplugselection from "../question/component/Headplugselection"; + +class Testpaperlibrary extends Component { + constructor(props) { + super(props); + this.state = { + Headertop: "", + disciplinesdata:null, + discipline_id:null, + sub_discipline_id:null, + tag_discipline_id:null, + public:null, + difficulty:null, + item_type:null, + keywords:null, + page:1, + per_page:10, + booljupyterurls:false, + Contentdata:[], + items_count:0, + + } + } + getContainer = () => { + return this.container; + }; + saveContainer = container => { + this.container = container; + }; + + //初始化 + componentDidMount() { + let url = `/users/get_navigation_info.json`; + axios.get(url, {}).then((response) => { + // ////console.log("开始请求/get_navigation_info.json"); + // ////console.log(response); + if (response != undefined) { + if (response.status === 200) { + this.setState({ + Headertop: response.data.top, + Footerdown: response.data.down + }) + } + } + }); + + //获取题库筛选资料 + let urls = `/disciplines.json`; + axios.get(urls, {params: { + source:"question" + }}).then((response) => { + if (response) { + this.setState({ + disciplinesdata: response.data.disciplines, + }) + } + }); + + } + + paginationonChange=()=>{ + var data={ + + } + this.getdata(data); + } + +// 选择难度 + setdifficulty=()=>{ + + + } + + callback=()=>{ + + } + + //搜索框的内容 + setdatafunsval=()=>{ + + } + +//搜索按钮 + setdatafuns=()=>{ + + } + + //获取数据 + getdata=(data)=>{ + const url = `/item_banks.json`; + this.setState({ + booljupyterurls:true, + }) + axios.get((url), {params: data}).then((response) => { + setTimeout(()=>{ + this.setState({ + booljupyterurls:false, + }) + },1000); + if (response === null || response === undefined) { + + return + } + if (response.data.status === 403 || response.data.status === 401 || response.data.status === 500) { + + } else { + + } + ////console.log("item_banks"); + ////console.log(response); + this.setState({ + Contentdata: response.data, + items_count: response.data.items_count, + }) + }).catch((error) => { + ////console.log(error) + this.setState({ + booljupyterurls:false, + }) + }); + + } + setdiscipline_id=(discipline_id)=>{ + this.setState({ + discipline_id:discipline_id, + sub_discipline_id:null, + tag_discipline_id:null + }) + var data = { + discipline_id:discipline_id, + sub_discipline_id:null, + tag_discipline_id:null, + public: this.state.defaultActiveKey, + difficulty: this.state.difficulty, + item_type: this.state.item_type, + keywords: this.state.keywords, + page: this.state.page, + per_page:10, + }; + this.getdata(data); + + } + setsub_discipline_id=(sub_discipline_id)=>{ + this.setState({ + sub_discipline_id:sub_discipline_id, + tag_discipline_id:null + }) + var data = { + discipline_id:this.state.discipline_id, + sub_discipline_id:sub_discipline_id, + tag_discipline_id:null, + public: this.state.defaultActiveKey, + difficulty: this.state.difficulty, + item_type: this.state.item_type, + keywords: this.state.keywords, + page: this.state.page, + per_page:10, + }; + this.getdata(data); + } + + settag_discipline_id=(tag_discipline_id)=>{ + this.setState({ + tag_discipline_id:tag_discipline_id + }) + var data = { + discipline_id:this.state.discipline_id, + sub_discipline_id:this.state.sub_discipline_id, + tag_discipline_id:tag_discipline_id, + public: this.state.defaultActiveKey, + difficulty: this.state.difficulty, + item_type: this.state.item_type, + keywords: this.state.keywords, + page: this.state.page, + per_page:10, + }; + this.getdata(data); + } + + render() { + let{Headertop,items_count,page,per_page}=this.state; + return ( +
+ {/*试卷库*/} + this.showDrawer()} + Headertop={Headertop}/> + {/*顶部*/} + this.setdiscipline_id(e)} + setsub_discipline_id={(e)=>this.setsub_discipline_id(e)} + settag_discipline_id={(e)=>this.settag_discipline_id(e)} + > + {/*头部*/} + + + + { + items_count&&items_count>10? +
+ +
+ : +
+
+ } + + + +
+ ) + + } + + +} + +export default SnackbarHOC()(TPMIndexHOC(Testpaperlibrary)); diff --git a/public/react/src/modules/testpaper/component/Contentpart.js b/public/react/src/modules/testpaper/component/Contentpart.js new file mode 100644 index 000000000..96728110d --- /dev/null +++ b/public/react/src/modules/testpaper/component/Contentpart.js @@ -0,0 +1,175 @@ +import React, {Component} from "react"; +import {Link, NavLink} from 'react-router-dom'; +import {WordsBtn, ActionBtn,SnackbarHOC,getImageUrl} from 'educoder'; +import axios from 'axios'; +import { + notification, + Spin, + Table, + Pagination, + Tabs, + Input, + Popover +} from "antd"; +import './../testioncss/testioncss.css'; +import NoneDatas from '../component/NoneDatas'; +import LoadingSpin from '../../../common/LoadingSpin'; +import Contentquestionbank from "./Contentquestionbank"; +const { TabPane } = Tabs; +const Search = Input.Search; +class Contentpart extends Component { + constructor(props) { + super(props); + this.state = { + page:1, + + } + } + //初始化 + componentDidMount(){ + + + } + + render() { + let {page}=this.state; + let {defaultActiveKey}=this.props; + const content = ( +
+

this.props.setitem_types("SINGLE")}>单选题

+

+

this.props.setitem_types("MULTIPLE")}>多选题

+

+

this.props.setitem_types("JUDGMENT")}>判断题

+

+

this.props.setitem_types("PROGRAM")}>编程题

+

+ +
+ ); + const contents = ( +
+

this.props.setdifficulty(1)}>简单

+

+

this.props.setdifficulty(2)}>适中

+

+

this.props.setdifficulty(3)}>困难

+

+
+ ); + return ( +
+
+
+ + + this.props.callback(e)}> + + + + + +
+ +
+ { + defaultActiveKey===0||defaultActiveKey==="0"? + +
+

新增

+
+
+ :"" + } + this.props.handleVisibleChange(true)}> +
+ +
+ 难度 +
+ +
+
+ + + + this.props.handleVisibleChanges(true)}> +
+
+ 题型 +
+ +
+
+ this.props.setdatafunsval(e)} + onSearch={ (value)=>this.props.setdatafuns(value)} /> +
+ +
+
+ + + + +
+
+ ) + + } + + + +} +export default Contentpart diff --git a/public/react/src/modules/testpaper/component/Contentquestionbank.js b/public/react/src/modules/testpaper/component/Contentquestionbank.js new file mode 100644 index 000000000..ceef1fd87 --- /dev/null +++ b/public/react/src/modules/testpaper/component/Contentquestionbank.js @@ -0,0 +1,68 @@ +import React, {Component} from "react"; +import {Link, NavLink} from 'react-router-dom'; +import {WordsBtn, ActionBtn,SnackbarHOC,getImageUrl} from 'educoder'; +import axios from 'axios'; +import { + notification, + Spin, + Table, + Pagination, + Radio, + Checkbox +} from "antd"; +import './../testioncss/testioncss.css'; +class Contentquestionbank extends Component { + constructor(props) { + super(props); + this.state = { + page:1, + } + } + //初始化 + componentDidMount(){ + ////console.log("componentDidMount"); + ////console.log(this.state); + ////console.log(this.props); + // let homeworkid = this.props.match.params.homeworkid; + // let url = "/homework_commons/" + homeworkid + "/end_groups.json"; + // axios.get(url).then((response) => { + // if (response.status === 200) { + // this.setState({}) + // } + // }).catch((error) => { + // ////console.log(error) + // }); + + } + onChange=(e)=> { + ////console.log(`checked = ${e.target.checked}`); + } + + render() { + + return ( + +
+
+
+
+ +
+
+ 共{this.props.items_count?this.props.items_count:0}个试题 +
+
+ + + + +
+
+ ) + + } + + + +} +export default Contentquestionbank ; diff --git a/public/react/src/modules/testpaper/component/NoneData.js b/public/react/src/modules/testpaper/component/NoneData.js new file mode 100644 index 000000000..123b7524e --- /dev/null +++ b/public/react/src/modules/testpaper/component/NoneData.js @@ -0,0 +1,37 @@ +import React, { Component } from 'react'; +import { getImageUrl , getUrl } from 'educoder'; + +class NoneData extends Component{ + constructor(props) { + super(props) + } + render(){ + const { style } = this.props; + return( +
+ + +

暂无相关数据

+

请选择试题进行组卷

+
+ ) + } +} +export default NoneData; diff --git a/public/react/src/modules/testpaper/component/NoneDatas.js b/public/react/src/modules/testpaper/component/NoneDatas.js new file mode 100644 index 000000000..c36cc29d1 --- /dev/null +++ b/public/react/src/modules/testpaper/component/NoneDatas.js @@ -0,0 +1,36 @@ +import React, { Component } from 'react'; +import { getImageUrl , getUrl } from 'educoder'; + +class NoneDatas extends Component{ + constructor(props) { + super(props) + } + render(){ + const { style } = this.props; + return( +
+ + +

暂无相关数据

+
+ ) + } +} +export default NoneDatas; diff --git a/public/react/src/modules/testpaper/testioncss/testioncss.css b/public/react/src/modules/testpaper/testioncss/testioncss.css new file mode 100644 index 000000000..e69de29bb diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index 8c4b06eb2..01cf7334d 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -915,7 +915,7 @@ submittojoinclass=(value)=>{ }}>

试题库

-

试卷库

+

试卷库

); @@ -992,35 +992,32 @@ submittojoinclass=(value)=>{ ) }) } - {/**/} - {/*
  • */} - {/* */} - {/*
    */} - {/*
    */} - {/* 题库*/} - {/*
    */} - {/*
    */} - {/*
    */} - {/*
  • */} + +
  • + +
    +
    + 题库 +
    +
    +
    +
  • -
  • - 题库 -
  • diff --git a/public/react/src/modules/tpm/TPMIndex.js b/public/react/src/modules/tpm/TPMIndex.js index 5cf50c39a..86d0e9637 100644 --- a/public/react/src/modules/tpm/TPMIndex.js +++ b/public/react/src/modules/tpm/TPMIndex.js @@ -388,6 +388,7 @@ class TPMIndex extends Component { let url = window.location.href; let flag = url.indexOf("add_file")>-1; + return (
    {/*头部*/}