<template>
  <view>
    <page ref="list" />
  </view>
</template>

<script>
import page from "./modules/page.vue";
import { winTheCustomer } from "../../utils/share";
export default {
  components: { page },
  data() {
    return {
      id: "",
      detail: {},
    };
  },
  onLoad(options) {
    this.id = options.id - 0;
    this.isInitializeLogin(render.bind(this));
    function render() {
      this.$refs.list.getDetail(this.id).then((detail) => {
        this.detail = detail;
      });
      this.shareUserid = winTheCustomer(options.shareUserid || 0, "长图文");
    }
  },
  methods: {
    getSheraDate() {
      let detail = this.detail,
        path =
          "/packageA/advertising/shareable?id=" +
          detail.sat_sharematerialid +
          "&shareUserid=" +
          this.shareUserid;
      return {
        title: detail.title, // 标题
        path, // 分享路径
        imageUrl: "", // 分享图
      };
    },
  },
  onShareAppMessage(res) {
    return this.getSheraDate();
  },
  onShareTimeline() {
    return this.getSheraDate();
  },
};
</script>