<template>
  <section class="contentDetail">
    <AiDetail :detail="detail" :props="props"/>
    <u-gap height="16"/>
    <AiComment v-if="detail.id" :bid="detail.id"/>
  </section>
</template>

<script>

import AiComment from "dvcp-wui/AiComment/AiComment";

export default {
  name: "contentDetail",
  components: {AiComment},
  appName: "内容详情",
  data() {
    return {
      detail: {title: "内容详情"},
      props: {
        count: "viewCount"
      },
      id: "",
    }
  },
  onLoad({id}) {
    if (id) {
      this.id = id;
      this.getDetail(id);
    }
  },
  methods: {
    getDetail(id) {
      this.$instance.post(`/app/appcontentinfo/queryDetailById`, null, {
        params: {id}
      }).then(res => {
        if (res?.data) {
          this.detail = res.data
        }
      })
    },
  },
  onShareAppMessage() {
    return {
      title: this.detail.title,
      path: '/mods/AppContent/contentDetail?id=' + this.id
    };
  },
  onReachBottom() {
    uni.$emit("moreComments")
  }
}
</script>

<style lang="scss" scoped>
.contentDetail {
}
</style>
