From d316a52a0f195ee0589fe8a2a73cf72417ab11c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Wed, 4 Sep 2019 15:09:04 +0800 Subject: [PATCH] bd --- .../questionbank/Generaljobbankdetails.js | 229 +++++------------- .../src/modules/user/usersInfo/InfosTopics.js | 4 +- .../modules/user/usersInfo/banks/banksMenu.js | 28 ++- 3 files changed, 93 insertions(+), 168 deletions(-) diff --git a/public/react/src/modules/courses/questionbank/Generaljobbankdetails.js b/public/react/src/modules/courses/questionbank/Generaljobbankdetails.js index 0817f5122..ee5956d7d 100644 --- a/public/react/src/modules/courses/questionbank/Generaljobbankdetails.js +++ b/public/react/src/modules/courses/questionbank/Generaljobbankdetails.js @@ -1,23 +1,27 @@ import React, {Component} from "react"; -import {Link, NavLink} from 'react-router-dom'; +import {BrowserRouter as Router,Route,Switch,Link, NavLin} from 'react-router-dom'; import {WordsBtn, ActionBtn,getImageUrl} from 'educoder'; import { Input,Checkbox,Table, Pagination, Modal,Menu, Tooltip,Spin,Button,Form } from "antd"; import axios from 'axios'; -import { - notification -} from "antd"; -import CoursesListType from '../coursesPublic/CoursesListType'; -import Generaljobdetails from './Generaljobdetails'; -import Generaljobanswer from './Generaljobanswer'; -import SendTopics from '../../modals/SendTopics'; -import Modals from '../../modals/Modals'; +import BanksMenu from '../../user/usersInfo/banks/banksMenu' +import Loadable from 'react-loadable'; +import Loading from '../../../Loading'; import '../css/members.css'; import "../common/formCommon.css"; import '../css/Courses.css'; import '../css/busyWork.css'; import '../poll/pollStyle.css'; - +// 问卷内容 +const Generaljobdetails = Loadable({ + loader: () => import('./Generaljobdetails'), + loading: Loading, +}) +// 试卷详情 +const Generaljobanswer = Loadable({ + loader: () => import('./Generaljobanswer'), + loading: Loading, +}); class Generaljobbankdetails extends Component { //普通作业内容详情 constructor(props) { @@ -28,42 +32,12 @@ class Generaljobbankdetails extends Component { workid:1, isSpin:false, datas:[], - visible:false - } - - } - - //切换tab - ChangeTab = (e) => { - // console.log(e); - this.setState({ - tab: e - }) - try { - var currenturl = window.location.href; - var newUrl = (currenturl.split("?"))[0]; - window.history.pushState('','',newUrl+'?tab='+e); - }catch (e) { - console.log(e); - console.log("44"); + visible:false, + banksMenu:undefined } - this.getonedata(); } - componentDidMount() { - // console.log("父组件加载框"); - const query = this.props.location.search; - const type = query.split('?tab='); - // let sum = [] - // sum.push(type[1]) - // console.log("componentDidMountcomponentDidMount"); - // console.log(type); - this.setState({ - tab: type[1], - }); - console.log("Generaljobbankdetails"); - console.log(this.props); this.getonedata(); } @@ -102,7 +76,20 @@ class Generaljobbankdetails extends Component { crumbArray:[ {content:'详情'} ] + }; + const menuData={ + tab:'0',//tab选中的index + menuArray:[//tab以及tab路由 + {to:`/banks/normal/${workids}/${this.props.match.params.type}/details`,content:'内容详情'}, + {to:`/banks/normal/${workids}/${this.props.match.params.type}/answer`,content:'参考答案'} + ], + category:'normal',//毕设选题 + tos:`/banks/normal/${workids}/edit/${this.props.match.params.type}`, + id:workids, } + this.setState({ + banksMenu:menuData + }) this.props.initPublic(crumbData); }catch (e) { @@ -130,132 +117,50 @@ class Generaljobbankdetails extends Component { isSpin:false, }) }); - } - -//发送至相关 - sendTopics=()=>{ - this.setState({ - visible:true - }) - } - - topicscancelmodel=()=>{ - this.setState({ - Modalstype:false, - Loadtype:false, - visible:false, - Modalstopval:"", - ModalCancel:"", - ModalSave:"", - checkBoxValues:[], - checkedtype:false - }) - } - - //删除相关 - - deletecheckBoxValues=()=>{ - - this.setState({ - Modalstype:true, - Modalstopval:"是否确认删除?", - ModalCancel:this.topicscancelmodel, - ModalSave:this.topicssavedelete, - }) - - } - - topicssavedelete=()=>{ - - const url = `/question_banks/multi_delete.json`; - axios.delete(url, { data: { - object_id: [this.props.match.params.workid], - object_type:"normal" - }}) - .then((response) => { - if(response.data.status===0){ - this.props.showNotification(response.data.message) - window.location.href=`/users/${this.props.current_user.login}/topics/personal`; - }else{ - this.props.showNotification(response.data.message) - } - }) - .catch(function (error) { - console.log(error); - }); - this.topicscancelmodel() - } + }; + // initPublic = (crumbData,menuData) =>{ + // this.setState({ + // banksMenu:menuData + // }) + // this.props.initPublic(crumbData); + // } render() { let {tab,datas,visible} = this.state; - - let user_id=this.props.current_user&&this.props.current_user.user_id; - let user_type=this.props.current_user&&this.props.current_user.user_identity; - let targetuserid=this.props.data&&this.props.data.id; - - + let{ + banksMenu + }=this.state + // + // const common={ + // initPublic:this.initPublic, + // } return ( -
*/} - {/* {datas&&datas.name}*/} - {/*
*/} - {/*