forked from nsjcy/frontEnd/nsjcy

xuxj
2020-04-26 b8fa0fa65e994fb0a7067e3348ee8604db815a9b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import React from 'react';
import { Table, Tag } from 'antd';
 
const QuestionnairAnswer = ({ answer, index }) => {
  // console.log(answer);
  // const columns = [
  //   {
  //     title: 'Name',
  //     dataIndex: 'name',
  //     key: 'name',
  //     render: text => <a>{text}</a>,
  //   },
  //   {
  //     title: 'Age',
  //     dataIndex: 'age',
  //     key: 'age',
  //   },
  //   {
  //     title: 'Address',
  //     dataIndex: 'address',
  //     key: 'address',
  //   },
  return (
    // {`${index + 1}.
    <div style={{ minHeight: 60 }}>
      {answer.answer && (
        <React.Fragment>
          <div style={{ color: '#666' }}>
            {index + 1}、
            {answer.type === 'input'
              ? answer.completionForwards
              : answer.title + ':'}
          </div>
          <div style={{ paddingLeft: 12, color: '#151515' }}>
            {typeof answer.answer[answer.type] !== 'string'
              ? typeof answer.answer[answer.type].optionValue !== 'string'
                ? answer.answer[answer.type].optionValue.map((item, index) => {
                    return (
                      item && (
                        <span key={index} style={{ marginRight: 15 }}>
                          {item}
                        </span>
                      )
                    );
                  })
                : answer.answer[answer.type].optionValue
              : answer.answer[answer.type]}
          </div>
        </React.Fragment>
      )}
    </div>
  );
};
 
export default QuestionnairAnswer;