<template>
  <div class="news" v-if="pageShow">
    <header class="header">
      <div class="header-title">{{ info.title }}</div>
      <!-- <div class="header-info flex-align">
        <span>百得家</span>
        <i>{{ info.createDate }}</i>
      </div> -->
    </header>
    <div class="news-content">
      <u-parse :html="info.rtf"/>
    </div>
    <div class="qrcode" @click="showQrcode">
      <image :src="qrcode" />
    </div>
  </div>
</template>
<script>
  export default {
    data () {
      return {
        pageShow: false,
        info: {}
      }
    },

    onLoad (query) {
      this.getNews(query.id)
    },

    methods: {
      getNews (id) {
        this.$loading()
        this.$instance.post(`/api/appbanner/detail`, null, {
          params: {id}
        }).then(res => {
          if (res?.data) {
            this.$hideLoading()
            this.info = res.data
            this.pageShow = true
          }
        })
      },

      showQrcode () {
        uni.previewImage({
          current: this.qrcode,
          urls: [this.qrcode]
        })
      }
    }
  }
</script>

<style lang="scss">
  page {
    padding-bottom: 60px;
  }

  .content {
    padding: 0 30px;
    line-height: 1.4;

    image {
      width: 690px!important;
      margin: 20px auto;
    }
  }

  page {
    min-height: 100%;
    background: #fff;
  }
  .header {
    padding: 0 30px;
  }
  .header {
    margin-bottom: 20px;
  }
  .header-title {
    color: #333;
    font-size: 34px;
    line-height: 1.4;
    font-weight: 600;
    text-align: center;
    margin: 30px 0 0 0;
  }
  .header-info {
    color: #999;
    font-size: 24px;
  }

  .news-content {
    color: #666;
    font-size: 28px;
    line-height: 1.8;
    margin: 0 26px;
  }
  .news-content img {
    width: 702px!important;
    margin: 24px auto;
    border-radius: 8px;
    text-align: center;
  }
  .news-content > p, .news-content > h2, .news-content > h1, .news-content > h3 {
    margin: 30px 0!important;
  }
</style>
