<template>
  <div id="report">
    <template v-for="(answer, index) in report.answers">
      <div :key="`${index}${new Date().getTime()}`" style="border-bottom: 1px solid #EBEEF5;">
        <el-row type="flex" align="middle" justify="center" class="btn_bar">
          <el-col :span="18"> {{ answer.topic }} [{{ answer.type | topicType }}] </el-col>
        </el-row>
        <el-row type="flex" align="middle" justify="center" class="btn_bar" style="color:blue">
          <el-col :span="18" v-if="answer.type != 1">{{ answer.answer }}</el-col>
          <el-col :span="18" v-else>{{ answer.answer | checkBoxAnswer }}</el-col>
        </el-row>
      </div>
    </template>
  </div>
</template>

<script>
import _ from 'lodash';
import { mapState, createNamespacedHelpers } from 'vuex';
export default {
  name: 'report',
  props: {
    report: { type: Object, default: () => [] },
  },
  components: {},
  data: function() {
    return {};
  },
  created() {},
  methods: {},
  computed: {
    ...mapState(['user']),
    pageTitle() {
      return `${this.$route.meta.title}`;
    },
  },
  filters: {
    topicType(val) {
      if (val == 0) return '单选题';
      if (val == 1) return '多选题';
      if (val == 2) return '简答题';
    },
    checkBoxAnswer(val) {
      return _.join(val, ';');
    },
  },
  metaInfo() {
    return { title: this.$route.meta.title };
  },
};
</script>

<style lang="less" scoped></style>
