diff --git a/public/react/src/modules/courses/poll/PollDetailTabThird.js b/public/react/src/modules/courses/poll/PollDetailTabThird.js index e51563a46..ee3befe1b 100644 --- a/public/react/src/modules/courses/poll/PollDetailTabThird.js +++ b/public/react/src/modules/courses/poll/PollDetailTabThird.js @@ -1,14 +1,13 @@ import React,{ Component } from "react"; -import {Checkbox,Radio} from "antd"; - import '../css/members.css' import '../css/busyWork.css' import './pollStyle.css' +import PollDetailTabThirdInfo from './PollDetailTabThirdInfo' + import axios from 'axios'; -const map={1:"单选题",2:"多选题",3:"主观题",4:"主观题"} class PollDetailTabThird extends Component{ constructor(props){ super(props); @@ -36,105 +35,7 @@ class PollDetailTabThird extends Component{ let {pollDetail}=this.state; return(
- { - pollDetail && pollDetail.poll.polls_description && -

{ pollDetail.poll.polls_description }

- } -
-

- { pollDetail && pollDetail.question_types.q_counts===0 ? "" : - - { - pollDetail && pollDetail.question_types.q_counts > 0 && - 合计{pollDetail.question_types.q_counts}题: - } - { - pollDetail && pollDetail.question_types.q_singles > 0 && - 单选题{pollDetail.question_types.q_singles}题 - } - { - pollDetail && pollDetail.question_types.q_doubles > 0 && - 多选题{pollDetail.question_types.q_doubles}题 - } - { - pollDetail && pollDetail.question_types.q_mains > 0 && - 主观题{pollDetail.question_types.q_mains}题 - } - - } -

- - { - pollDetail && pollDetail.questions.map((item,key)=>{ - console.log("ddd"); - console.log(item.question.min_choices); - return( -
-

- {item.question.question_number}、{map[item.question.question_type]} - { item.question.is_necessary==1 ? 必答:选答 } - { item.question.question_type == 2 && item.question.min_choices != undefined && item.question.min_choices != null && item.question.max_choices != undefined && item.question.max_choices != null ? - - { - item.question.min_choices == item.question.max_choices ? "可选"+item.question.max_choices+"项" : - "可选"+item.question.min_choices+"-"+item.question.max_choices+"项" - } - :"" - } -

-
  • {item.question.question_title}
  • - { - // 单选题 - item.question.question_type==1 && - - { - item.question.answers.map((index,k)=>{ - return( -
  • - - {index.answer_text} - { - index.answer_text=="其他" ?

    :"" - } - -
  • - ) - }) - } -
    - } - { - // 多选题 - item.question.question_type==2 && - - { - item.question.answers.map((index,k)=>{ - return( -
  • - - {index.answer_text} - { - index.answer_text=="其他" ?

    :"" - } -
  • - ) - }) - } -
    - } - { - // 主观题 - item.question.question_type == 3 && -
    - -
    - } - -
    - ) - }) - } -
    +
    ) } diff --git a/public/react/src/modules/courses/poll/PollDetailTabThirdInfo.js b/public/react/src/modules/courses/poll/PollDetailTabThirdInfo.js new file mode 100644 index 000000000..792c1b64f --- /dev/null +++ b/public/react/src/modules/courses/poll/PollDetailTabThirdInfo.js @@ -0,0 +1,117 @@ +import React,{ Component } from "react"; +import {Checkbox,Radio} from "antd"; + + +import '../css/members.css' +import '../css/busyWork.css' +import './pollStyle.css' + + +const map={1:"单选题",2:"多选题",3:"主观题",4:"主观题"} +class PollDetailTabThirdInfo extends Component{ + constructor(props){ + super(props); + } + render(){ + let { pollDetail }=this.props; + return( +
    + { + pollDetail && pollDetail.poll.polls_description && +

    { pollDetail.poll.polls_description }

    + } +

    + { pollDetail && pollDetail.question_types.q_counts===0 ? "" : + + { + pollDetail && pollDetail.question_types.q_counts > 0 && + 合计{pollDetail.question_types.q_counts}题: + } + { + pollDetail && pollDetail.question_types.q_singles > 0 && + 单选题{pollDetail.question_types.q_singles}题 + } + { + pollDetail && pollDetail.question_types.q_doubles > 0 && + 多选题{pollDetail.question_types.q_doubles}题 + } + { + pollDetail && pollDetail.question_types.q_mains > 0 && + 主观题{pollDetail.question_types.q_mains}题 + } + + } +

    + + { + pollDetail && pollDetail.questions.map((item,key)=>{ + return( +
    +

    + {item.question.question_number}、{map[item.question.question_type]} + { item.question.is_necessary==1 ? 必答:选答 } + { item.question.question_type == 2 && item.question.min_choices != undefined && item.question.min_choices != null && item.question.max_choices != undefined && item.question.max_choices != null ? + + { + item.question.min_choices == item.question.max_choices ? "可选"+item.question.max_choices+"项" : + "可选"+item.question.min_choices+"-"+item.question.max_choices+"项" + } + :"" + } +

    +
  • {item.question.question_title}
  • + { + // 单选题 + item.question.question_type==1 && + + { + item.question.answers.map((index,k)=>{ + return( +
  • + + {index.answer_text} + { + index.answer_text=="其他" ?

    :"" + } + +
  • + ) + }) + } +
    + } + { + // 多选题 + item.question.question_type==2 && + + { + item.question.answers.map((index,k)=>{ + return( +
  • + + {index.answer_text} + { + index.answer_text=="其他" ?

    :"" + } +
  • + ) + }) + } +
    + } + { + // 主观题 + item.question.question_type == 3 && +
    + +
    + } +
    + ) + }) + } +
    + ) + } +} +export default PollDetailTabThirdInfo \ No newline at end of file diff --git a/public/react/src/modules/user/usersInfo/banks/BanksIndex.js b/public/react/src/modules/user/usersInfo/banks/BanksIndex.js index 6b474b934..58100c41a 100644 --- a/public/react/src/modules/user/usersInfo/banks/BanksIndex.js +++ b/public/react/src/modules/user/usersInfo/banks/BanksIndex.js @@ -70,7 +70,7 @@ class BanksIndex extends Component{

    {crumbData && crumbData.title} { - crumbData && crumbData.is_public && {crumbData.is_public == true ? '公开':'私有'} + crumbData && {crumbData.is_public == true ? '公开':'私有'} }

    @@ -89,7 +89,12 @@ class BanksIndex extends Component{ return () } }> - + { + return () + } + }> diff --git a/public/react/src/modules/user/usersInfo/banks/BanksTabIndex.js b/public/react/src/modules/user/usersInfo/banks/BanksTabIndex.js index 874f82f55..2999bec55 100644 --- a/public/react/src/modules/user/usersInfo/banks/BanksTabIndex.js +++ b/public/react/src/modules/user/usersInfo/banks/BanksTabIndex.js @@ -12,6 +12,11 @@ const GtopicBanks = Loadable({ loader: () => import('./GtopicBanks'), loading: Loading, }) +// 问卷内容 +const PollBanks = Loadable({ + loader: () => import('./PollBanksContent'), + loading: Loading, +}) class BanksTabIndex extends Component{ constructor(props){ @@ -56,6 +61,12 @@ class BanksTabIndex extends Component{ return () } }> + { + return () + } + }> diff --git a/public/react/src/modules/user/usersInfo/banks/PollBanksContent.js b/public/react/src/modules/user/usersInfo/banks/PollBanksContent.js new file mode 100644 index 000000000..1b77290d1 --- /dev/null +++ b/public/react/src/modules/user/usersInfo/banks/PollBanksContent.js @@ -0,0 +1,64 @@ +import React, { Component } from 'react'; +import axios from 'axios' + +import PollDetailTabThirdInfo from '../../../courses/poll/PollDetailTabThirdInfo' + +class PollBanksContent extends Component{ + constructor(props){ + super(props); + this.state={ + pollDetail:undefined + } + } + + componentDidMount = () =>{ + let bankId=this.props.match.params.bankId; + let url = `/exercise_banks/${bankId}.json` + axios.get(url).then((result)=>{ + if(result){ + let pollDetail = { + poll:{ + id: result.data.poll && result.data.poll.id , + polls_description: result.data.poll && result.data.poll.description, + polls_name: result.data.poll && result.data.poll.name, + is_public:result.data.poll && result.data.poll.is_public + }, + question_types:result.data.question_types, + questions:result.data.questions, + } + const crumbData={ + title:result.data.poll && result.data.poll.name, + is_public:result.data.poll && result.data.poll.is_public, + crumbArray:[ + {content:'详情'}, + ] + } + const menuData={ + tab:'0',//tab选中的index + menuArray:[//tab以及tab路由 + {to:`/banks/poll/${bankId}`,content:'内容详情'} + ], + category:'poll',//毕设选题 + id:bankId + } + this.props.initPublic(crumbData,menuData); + this.setState({ + pollDetail + }) + } + }).catch((error)=>{ + console.log(error); + }) + } + + render(){ + let { pollDetail } = this.state + + return( +
    + +
    + ) + } +} +export default PollBanksContent