<template>
  <div class="page_activity">
    <div class="content">
      <div
        class="contentOne"
        v-for="it in Activitieslist"
        :key="it.id"
        @click="singleActivitInfo(it.id,it.user_org_id)"
      >
        <div class="img">
          <img :src="it.poster_photo" style="width:100%;height:100%" alt />
        </div>
        <div class="detail">
          <p class="detailTitle">{{it.title}}</p>
          <div class="detailBox">
            <div class="activityTime">
              <p>
                {{staffCreateTime(it.start_time)}}开始
                <br />
                <!-- {{it.address}} -->
              </p>
            </div>
            <div class="people">
              <p>{{it.join_num}}已报名</p>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
  <script>
import { getFileExtension, uParseTime } from "@/utils/tools";
import { Activitiesmore } from "@/api/micro/micro";
export default {
  data() {
    return {
      Activitieslist: []
    };
  },
  methods: {
    Activitiesmore(id, orgid) {
      Activitiesmore(id, orgid).then(response => {
        if (response.data.state == 1) {
          var activity = response.data.data.activity;
          this.Activitieslist = response.data.data.activity;
          console.log("获取活动列表", activity);
        }
      });
    },
    staffCreateTime(time) {
      return uParseTime(time, "{y}-{m}-{d} {h}:{i}:{s}");
    },
    singleActivitInfo(id, orgid) {
      this.$router.push({
        path: "/activityDetail",
        query: {
          id: id,
          orgid,
          orgid
        }
      });
    }
  },
  created() {
    const id = this.$route.query.id;
    const orgid = this.$route.query.orgid;
    console.log("id是多少", id);
    console.log("orgid是多少", orgid);
    this.Activitiesmore(id, orgid);
  }
};
</script>
<style lang="scss" scoped>
.page_activity {
  overflow: hidden;
}
.contentOne {
  margin: auto;
  margin-top: 1.125rem;
  width: 20.875rem;
  height: 7.4375rem;
  background: rgba(255, 255, 255, 1);
  box-shadow: 0px 6px 20px 0px rgba(0, 0, 0, 0.05);
  border-radius: 16px;
  padding-left: 1rem;
  padding-top: 1.125rem;
  box-sizing: border-box;
  .img {
    float: left;
    width: 5rem;
    height: 5rem;
    img {
      border-radius: 0.75rem;
    }
  }
  .detail {
    float: left;
    margin-left: 0.8125rem;
    width: 13.125rem;
    .detailTitle {
      margin-top: 0.5rem;
      width: 12.6875rem;
      height: 1.0625rem;
      line-height: 1.0625rem;
      font-size: 0.9375rem;
      font-weight: 600;
      color: rgba(7, 18, 40, 1);
    }
    .detailMessage {
      margin-top: 0.25rem;
      width: 13.25rem;
      height: 3.625rem;
      font-size: 0.8125rem;
      font-weight: 400;
      color: rgba(155, 155, 155, 1);
      line-height: 1.125rem;
    }
  }
}
.detailBox {
  margin-top: 0.625rem;
  height: 3rem;
  .activityTime {
    float: left;
    width: 7.375rem;
    height: 2.1875rem;
    font-size: 0.8125rem;
    color: rgba(155, 155, 155, 1);
    line-height: 1.5rem;
  }
  .people {
    margin-top: 1rem;
    float: left;
    width: 5.375rem;
    height: 1.875rem;
    background: rgba(57, 124, 254, 0.1);
    border-radius: 30px;
    p {
      margin: auto;
      text-align: center;
      width: 4.375rem;
      height: 0.75rem;
      font-size: 0.75rem;
      color: rgba(57, 124, 254, 1);
      line-height: 1.875rem;
    }
  }
}
</style>
