<template>
  <view>
    <sudoku
      ref="sudoku"
      :detail="detail"
      :sa_awardid="sa_awardid"
      :shareuserid="shareuserid"
    />
  </view>
</template>

<script>
import sudoku from "./modules/sudoku";
import { winTheCustomer } from "../../utils/share";
export default {
  components: { sudoku },
  data() {
    return {
      sa_awardid: 0,
      shareuserid: 0,
      detail: {},
      initialize: true,
    };
  },
  onLoad(options) {
    console.log("options", options);
    this.sa_awardid = options.sa_awardid || 0;
    this.isInitializeLogin(render.bind(this));
    function render() {
      this.getDetail();
      this.shareUserid = winTheCustomer(options.shareUserid || 0, "活动抽奖", {
        ownertable: "sa_award",
        ownerid: this.sa_awardid,
      });
    }

    uni.setNavigationBarTitle({
      title: "活动抽奖",
    });
  },
  onShow() {
    if (!this.initialize) this.getDetail();
  },
  methods: {
    getDetail() {
      this.$Http
        .basic({
          id: 20240514101502,
          content: {
            sa_awardid: this.sa_awardid,
          },
        })
        .then((res) => {
          console.log("抽奖详情", res);
          if (this.cutoff(res.msg)) return;
          this.initialize = false;
          this.detail = res.data;
          this.$refs.sudoku.init();
        });
    },
  },
};
</script>

<style lang="scss" scoped></style>