<template>
  <div class="my-feedback">
    <div class="cell" v-for="(v,i) in feedbackList" :key="i">
      <div class="cell-top">
        <div class="title">{{showType(v.type)}}</div>
        <div class="time">{{v.createTime}}</div>
        <div class="status" :class="v.status === 2 ? 'active-status' : ''">{{v.status === 1 ? '待回复' : '已回复'}}</div>
      </div>
      <div class="content">{{v.content}}</div>
      <div class="img-list">
        <!-- <img v-for="(pic,idx) in v.pictures" :key="idx" :src="pic" alt=""> -->
        <el-image class="img" v-for="(pic,idx) in v.pictures" :key="idx" :src="pic" :preview-src-list="v.pictures">
        </el-image>
      </div>
      <div v-if="v.status === 2" class="cell-top cell-bot">
        <div class="title1">平台回复</div>
        <div class="time">{{v.updateTime}}</div>
      </div>
      <div v-if="v.answer" class="content">{{v.answer}}</div>
    </div>
  </div>
</template>

<script>
import { getFeedbackList } from "../../api/setting.js";
export default {
  name: "myFeedback",
  data() {
    return {
      feedbackList: [],
    };
  },
  // 监听属性 类似于data概念
  computed: {},
  // 监控data中的数据变化
  watch: {},
  // 方法集合
  methods: {
    showType(type) {
      let name = "";
      switch (type) {
        case 1:
          name = "账号问题";
          break;
        case 2:
          name = "功能问题";
          break;
        case 3:
          name = "优化建议";
          break;
        case 4:
          name = "其他问题";
          break;

        default:
          break;
      }
      return name;
    },
    getFeedbackList() {
      getFeedbackList().then((res) => {
        if (res.code === 200) {
          this.feedbackList = res.data.data;
        } else {
          this.$message.error(res.msg);
        }
      });
    },
  },
  // 生命周期 - 创建完成（可以访问当前this实例）
  created() {
    this.getFeedbackList();
  },
  // 生命周期 - 挂载完成（可以访问DOM元素）
  mounted() {},
  // 生命周期 - 创建之前
  beforeCreate() {},
  // 生命周期 - 挂载之前
  beforeMount() {},
  // 生命周期 - 更新之前
  beforeUpdate() {},
  // 生命周期 - 更新之后
  updated() {},
  // 生命周期 - 销毁之前
  beforeDestroy() {},
  // 生命周期 - 销毁完成
  destroyed() {},
  // 如果页面有keep-alive缓存功能，这个函数会触发
  activated() {},
};
</script>

<style lang="scss" scoped  type="text/css">
.cell {
  background: #f7f7f7;
  margin-top: 20px;
  padding: 20px;
  border-radius: 8px;
  .cell-top {
    display: flex;
    align-items: center;
    .title {
      position: relative;
      font-size: 16px;
      font-weight: bold;
      line-height: 22px;
      color: #333333;
      padding-left: 10px;
    }
    .title::before {
      width: 3px;
      height: 16px;
      background: rgba(252, 114, 0, 0.39);
      border-radius: 2px;
      content: "";
      position: absolute;
      top: 2px;
      left: 0;
    }
    .time {
      font-size: 14px;
      font-weight: 400;
      color: #999999;
      margin: 0 5px;
    }
    .status {
      font-size: 14px;
      font-weight: 400;
      color: #e70012;
      border: 1px solid #e70012;
      padding: 0 5px;
      border-radius: 2px;
    }
    .active-status {
      color: #007aff;
      border-color: #007aff;
    }
  }
  .cell-bot {
    margin-top: 40px;
    .title1 {
      line-height: 22px;
      font-size: 16px;
      font-weight: bold;
      color: #333333;
    }
  }
  .content {
    font-size: 14px;
    font-weight: 400;
    color: #333333;
    line-height: 20px;
    margin-top: 10px;
  }
  .img-list {
    display: flex;
    margin-top: 10px;
    .img {
      width: 120px;
      height: 120px;
      margin-right: 20px;
      cursor: pointer;
    }
  }
}
</style>