<template>
  <view class="container ask-container">
    <view v-if="haveData">
      <view class="collect-item" v-for="(item, index) in askList" :key="index" @click="goDetail(item)">
        <view class="item-row">
          <text class="item-content-title">问题内容:</text>
          <text>{{ item.Content }}</text>
        </view>
        <view class="item-title">
          <view class="item-row">
            <text class="item-content-title">相关{{ item.AskType == "Activity" ? "活动" : "报告" }}:</text>
            <text class="item-content-text">{{ item.Title }}</text>
          </view>
        </view>
        <text class="time">{{ item.CreateTime }}</text>
      </view>
    </view>
    <view class="nodata" v-else>
      <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/act_search.png" mode="" class="nodata_ico"></image>
      <text>暂时没有提问的内容</text>
    </view>
    <freeCharge class="free-charge" :isShowFreeBtn="isShowFree" />
  </view>
</template>

<script>
import { User } from "@/config/api.js";
import freeCharge from "@/components/freeCharge";
export default {
  components: {
    freeCharge,
  },
  data() {
    return {
      askList: [],
      haveData: true,
    };
  },
  methods: {
    async getAsk() {
      const res = await User.getAskList();
      if (res.Ret === 200) {
        this.haveData = res.Data.List ? true : false;
        this.askList = res.Data.List || [];
      }
    },
    goDetail(item) {
      item.AskType == "Activity"
        ? uni.navigateTo({
            url: "/activityPages/activityDetail/activityDetail?id=" + item.ReportOrActivityId,
          })
        : uni.navigateTo({
            url: "/pageMy/reportDetail/reportDetail?id=" + item.ReportOrActivityId,
          });
    },
  },
  onLoad() {
    this.$store.commit("setRouterActivity", "活动提问");
    this.$store.commit("setRouterReport", "活动提问");
    this.getAsk();
  },
};
</script>

<style lang="scss" scoped>
.ask-container {
  background: #f7f7f7;
  padding: 20rpx 30rpx;
  .collect-item {
    padding: 30rpx 30rpx;
    color: #333333;
    font-size: 28rpx;
    background: #fff;
    margin-bottom: 20rpx;
  }
  .item-row {
    font-size: 28rpx;
    color: #333;
    margin-bottom: 20rpx;
    border-radius: 4rpx;
    .item-content-title {
      font-size: 24rpx;
      color: #999;
    }
    .item-content-text {
      color: #3385ff;
    }
  }
  .item-title {
    padding-top: 20rpx;
    border-top: 2px dashed #dcdfe6;
  }
  .time {
    text-align: right;
    font-size: 22rpx;
    color: #999;
  }
}
</style>
