<template>
  <div class="padding" v-if="pageShow">
    <header>{{ detail.taskName }}</header>
    <div class="info">
      <span>{{ detail.userName }} {{ detail.releaswTime && detail.releaswTime.slice(0, 16) }}</span>
      <!-- <div class="right">
        <em>{{ detail.views }}</em>人看过
      </div> -->
    </div>
    <p>评选开始时间：{{detail.startTime.slice(0, 16) }}</p>
    <p>评选结束时间：{{detail.endTime.slice(0, 16) }}</p>
    <div class="notice-content">
      <u-parse :html="detail.taskDescription"/>
    </div>
    <!-- <div class="photo">
      <img :src="item.url" alt="" v-for="(item,index) in images" :key="index" @click="preview(index)">
    </div> -->
    <div class="footer" @click="toAppStore">
      <div class="btn">我要评选</div>
    </div>
  </div>
</template>

<script>

export default {
  name: "AppNotice",
  appName:"通知公告",
  data() {
    return {
      id: null,
      pageShow: false,
      detail: {},
      images: [],
      showStore: false
    }
  },
  onLoad({id}) {
    this.$loading()
    this.id = id;
    this.getDetail();
  },
  methods: {
    preview(index) {
      this.$previewImage(this.images, index, 'path');
    },
    getDetail() {
      this.$instance.post("/app/apptaskmanage/queryDetailById", null, {
        params: {id: this.id}
      }).then(res => {
        if (res?.data) {
          this.detail = res.data;
          this.images = JSON.parse(res.data.images || '[]');
          this.$nextTick(() => {
            this.pageShow = true
          })
        }

        this.$hideLoading()
      })
    },
    toAppStore() {
      uni.switchTab({url: '/pages/AppStore/AppStore?tabIndex=1'})
    }
  },
}
</script>

<style lang="scss" scoped>
.padding {
  min-height: 100%;
  box-sizing: border-box;
  padding: 40px 32px;
  background-color: #fff;

  header {
    font-size: 48px;
    font-weight: 600;
    color: #333333;
    line-height: 66px;
  }

  .info {
    display: flex;
    justify-content: space-between;
    font-size: 30px;
    font-weight: 400;
    color: #999;
    padding: 16px 0;

    .right {
      display: flex;
      flex-shrink: 0;
      margin-left: 16px;

      & > em {
        font-style: normal;
        color: #4181FF;
      }
    }
  }

  .notice-content {
    font-size: 28px;
    // color: #333;
    // line-height: 64px;
    padding-top: 64px;
  }

  .photo {
    display: flex;
    flex-direction: column;

    & > img {
      width: 100%;
      margin-top: 32px;
    }
  }
  p {
    line-height: 44px;
    margin-bottom: 16px;
    color: #666;
    font-size: 28px;
    
  }
  .footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 20px 32px 88px 32px;
    box-sizing: border-box;
    background: #FFF;
    z-index: 999;
    .btn {
      width: 100%;
      height: 80px;
      background: #2D7DFF;
      border-radius: 40px;
      font-family: PingFangSC-Medium;
      font-weight: 500;
      font-size: 34px;
      color: #FFF;
      text-align: center;
      line-height: 80px;
    }
  }
}
</style>
