From 64a739e0ec5d0bed9d157ec1bc7764012880570b Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Fri, 8 Nov 2019 10:40:39 +0800 Subject: [PATCH] =?UTF-8?q?=E9=97=AE=E5=8D=B7=E5=8A=A0=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/poll/PollDetailTabSecond.js | 54 ++++++++++++------- .../courses/poll/PollDetailTabThird.js | 20 ++++--- 2 files changed, 48 insertions(+), 26 deletions(-) diff --git a/public/react/src/modules/courses/poll/PollDetailTabSecond.js b/public/react/src/modules/courses/poll/PollDetailTabSecond.js index f52e77dd8..8d73ec5da 100644 --- a/public/react/src/modules/courses/poll/PollDetailTabSecond.js +++ b/public/react/src/modules/courses/poll/PollDetailTabSecond.js @@ -1,5 +1,5 @@ import React,{ Component } from "react"; -import { Pagination} from "antd"; +import { Pagination , Spin } from "antd"; import NoneData from "../coursesPublic/NoneData" import '../css/members.css' @@ -16,10 +16,14 @@ class PollDetailTabSecond extends Component{ page:1, limit:10, questions:undefined, - questionsInfo:undefined + questionsInfo:undefined, + isSpin:false } } getInfo=(page)=>{ + this.setState({ + isSpin:true + }) let pollId=this.props.match.params.pollId; let url=`/polls/${pollId}/commit_result.json?page=${page}`; axios.get(url).then((result)=>{ @@ -27,7 +31,8 @@ class PollDetailTabSecond extends Component{ this.setState({ page: page, questions:result.data.questions, - questionsInfo:result.data.question_types + questionsInfo:result.data.question_types, + isSpin:false }) } }).catch((error)=>{ @@ -56,11 +61,12 @@ class PollDetailTabSecond extends Component{ } render(){ - let {page, limit, questions, questionsInfo} = this.state; + let {page, limit, questions, questionsInfo , isSpin} = this.state; return( +
{ - questions && questions.length>0?questions.map((item,key)=>{ + questions && questions.length>0 && questions.map((item,key)=>{ return(
@@ -91,7 +97,8 @@ class PollDetailTabSecond extends Component{ { item.question.question_type==3?
    - 文本答案 + 编号 + 文本答案
:
    @@ -105,19 +112,22 @@ class PollDetailTabSecond extends Component{ {/* 主观题 */} { item.question.question_type == 3 && item.question.vote_text && -
    -
      - - { - item.question.vote_text.map((txt,t)=>{ - return( -
    • {t+1}.{txt}
    • - ) - }) - } -
      -
    -
    + + { + item.question.vote_text.map((txt,t)=>{ + return( +
    +
      + {t+1} + +
    • {txt}
    • +
      +
    +
    + ) + }) + } +
    } {/* 单选和多选 */} { @@ -166,7 +176,10 @@ class PollDetailTabSecond extends Component{
) - }): + }) + } + { + questions && questions.length == 0 && } { questionsInfo && questionsInfo.q_counts > limit && @@ -177,6 +190,7 @@ class PollDetailTabSecond extends Component{ }
+
) } } diff --git a/public/react/src/modules/courses/poll/PollDetailTabThird.js b/public/react/src/modules/courses/poll/PollDetailTabThird.js index 32d35818d..1e03adb5a 100644 --- a/public/react/src/modules/courses/poll/PollDetailTabThird.js +++ b/public/react/src/modules/courses/poll/PollDetailTabThird.js @@ -1,5 +1,5 @@ import React,{ Component } from "react"; - +import { Spin } from 'antd'; import '../css/members.css' import '../css/busyWork.css' import './pollStyle.css' @@ -12,10 +12,14 @@ class PollDetailTabThird extends Component{ constructor(props){ super(props); this.state={ - pollDetail:undefined + pollDetail:undefined, + isSpin:false } } getPollInfo=()=>{ + this.setState({ + isSpin:true + }) let pollId=this.props.match.params.pollId; let url=`/polls/${pollId}.json`; axios.get(url).then((result)=>{ @@ -23,12 +27,14 @@ class PollDetailTabThird extends Component{ if (result.data.status === 401) { //未登入 this.setState({ - pollDetail: undefined + pollDetail: undefined, + isSpin:false }) return } this.setState({ - pollDetail:result.data + pollDetail:result.data, + isSpin:false }) } }).catch((error)=>{ @@ -39,10 +45,12 @@ class PollDetailTabThird extends Component{ this.getPollInfo(); } render(){ - let {pollDetail}=this.state; + let {pollDetail , isSpin}=this.state; return(
- + + +
) }