<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>问题内容:</text>
          <text>{{ item.Content }}</text>
        </view>
        <view class="item-title">
          <view class="item-row">
            <text>相关{{ item.AskType == "Activity" ? "活动" : "报告" }}:</text>
            <text class="title">{{ item.Title }}</text>
          </view>
          <u-icon class="ico" name="arrow-right" color="#BDBDBD" size="34"></u-icon>
        </view>
        <text class="time">提问时间: {{ item.CreateTime }}</text>
      </view>
    </view>
    <view class="nodata" v-else>
      <image src="@/static/img/nodata.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.getAsk();
  },
};
</script>

<style lang="scss" scoped>
.ask-container {
  background: #f7f7f7;
  padding-top: 10rpx;
  .collect-item {
    padding: 30rpx 30rpx 20rpx 34rpx;
    color: #333333;
    font-size: 30rpx;
    background: #fff;
    margin-bottom: 10rpx;
  }
  .item-row {
    :first-child {
      flex-shrink: 0;
      padding-right: 10rpx;
    }
    display: flex;
  }
  .item-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 30rpx 0;
    font-size: 28rpx;
    .ico {
      width: 16px;
    }
    .title {
      color: #2c83ff;
    }
  }
  .time {
    font-size: 24rpx;
  }
}
</style>
