<template>
  <auth-wrap class="usr-regist-info-container" ref="authWrap">
    <template slot="content">
      <view class="u-page" v-if="indexList&&indexList.length>0">
        <view class="apply-item" v-for="item in indexList" @click="()=>onContentClick(item)">
          <view class="apply-item-header">
            <view>{{ item.applyTypeName }}</view>
            <view :style="{
                 background: `url(${getImageUrl(REVIEW_STATUS[item.reviewState].icon)}) no-repeat 100% 100%`,
                 backgroundSize: '100%',
                 width: '109rpx',
                 height: '109rpx',
                 position: 'absolute',
                 right:0,
                 top:0
               }">
            </view>
          </view>
          <view class="apply-item-title overflow-hidden" style="height: 50px;line-height: 25px" v-if="item.contentTitle">{{ item.contentTitle }}</view>
          <view class="apply-item-title overflow-hidden" style="height: 50px;line-height: 25px" v-if="item.themeTitle">
            {{ item.themeTitle }}
          </view>
          <view class="apply-item-footer">
            <view>参会人：{{ item.usrName }}</view>
            <view>{{ $u.timeFormat(item.createTime, 'yyyy-mm-dd hh:MM') }}</view>
          </view>
        </view>
      </view>
      <u-empty
          v-else
          mode="data"
          text="还没有报名，赶紧去报名吧！"
      >
      </u-empty>
    </template>
  </auth-wrap>
</template>

<script>
import { getUsrApplyInfo } from '@/common/api';
import { ICON_CFG, REVIEW_STATUS } from '@/common/EnumConst';
import AuthWrap from '@/components/AuthComp/index.vue';
import { getImageUrl } from '@/util';

export default {
  computed: {
    ICON_CFG() {
      return ICON_CFG;
    },
    REVIEW_STATUS() {
      return REVIEW_STATUS;
    },
  },
  components: {
    AuthWrap,
  },
  data() {
    return {
      keyword: '',
      indexList: [],
    };
  },
  onLoad() {
    this.$refs.authWrap.reloadPage();
    this.loadmore();
  },
  methods: {
    getImageUrl,
    onContentClick(item) {
      uni.navigateTo({
        url: `/pasbrg/pages/regmeeting/index?id=${item.id}`,
      });
    },
    async loadmore() {
      const { data } = await getUsrApplyInfo();
      if (data) {
        this.indexList = data;
      }

    },
  },
  onShareAppMessage() {
    return {
      title: '',
    };
  },
};
</script>

<style lang="scss" src="./index.scss" />
