<template>
  <view>
		<navbar title="动态详情" leftClick @leftClick="$utils.navigateBack" />
    
    <view class="content">
      <view class="title">{{ detail.title || '' }}</view>

      <view class="desc">{{ detail.createTime ? `发布于${detail.createTime}` : '' }}</view>
      
      <uv-parse :content="detail.details"></uv-parse>
    </view>
  </view>
</template>

<script>
  import popupUnlock from '../components/popupUnlock.vue'
  import popupQrCode from '../components/popupQrCode.vue'

	export default {
    components: {
      popupUnlock,
      popupQrCode,
    },
		data() {
			return {
        detail: {
          id: null,
          title: null,
          image: null,
          details: null,
          createTime: null,
        },
        isLocked: true,
      }
    },
    async onLoad(option) {
      const { id } = option
      
      await this.fetchDetails(id)
    },
    methods: {
      async fetchDetails(id) {
        try {
          this.detail = await this.$fetch('getNewsById', { id })
        } catch (err) {
          
        }
      },
    }
  }
</script>

<style scoped lang="scss">
.content {
  padding: 40rpx 20rpx;
}

.title {
  color: #474747;
  font-size: 36rpx;
  font-weight: 700;
}

.desc {
  color: #A2A2A2;
  font-size: 24rpx;
  margin-top: 6rpx;
}
</style>