shareable.vue 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <template>
  2. <view>
  3. <sudoku
  4. ref="sudoku"
  5. :detail="detail"
  6. :sa_awardid="sa_awardid"
  7. :shareuserid="shareuserid"
  8. />
  9. </view>
  10. </template>
  11. <script>
  12. import sudoku from "./modules/sudoku";
  13. import { winTheCustomer } from "../../utils/share";
  14. export default {
  15. components: { sudoku },
  16. data() {
  17. return {
  18. sa_awardid: 0,
  19. shareuserid: 0,
  20. detail: {},
  21. initialize: true,
  22. };
  23. },
  24. onLoad(options) {
  25. console.log("options", options);
  26. this.sa_awardid = options.sa_awardid || 0;
  27. this.isInitializeLogin(render.bind(this));
  28. function render() {
  29. this.getDetail();
  30. this.shareUserid = winTheCustomer(options.shareUserid || 0, "活动抽奖", {
  31. ownertable: "sa_award",
  32. ownerid: this.sa_awardid,
  33. });
  34. }
  35. uni.setNavigationBarTitle({
  36. title: "活动抽奖",
  37. });
  38. },
  39. onShow() {
  40. if (!this.initialize) this.getDetail();
  41. },
  42. methods: {
  43. getDetail() {
  44. this.$Http
  45. .basic({
  46. id: 20240514101502,
  47. content: {
  48. sa_awardid: this.sa_awardid,
  49. },
  50. })
  51. .then((res) => {
  52. console.log("抽奖详情", res);
  53. if (this.cutoff(res.msg)) return;
  54. this.initialize = false;
  55. this.detail = res.data;
  56. this.$refs.sudoku.init();
  57. });
  58. },
  59. getSheraDate() {
  60. let detail = this.detail;
  61. return {
  62. title: detail.name, // 标题
  63. path:
  64. "/store/lottery/shareable?sa_awardid=" +
  65. detail.sa_awardid +
  66. "&shareUserid=" +
  67. this.shareUserid, // 分享路径
  68. imageUrl: "", // 分享图
  69. };
  70. },
  71. },
  72. onShareAppMessage() {
  73. return this.getSheraDate();
  74. },
  75. onShareTimeline() {
  76. return this.getSheraDate();
  77. },
  78. };
  79. </script>
  80. <style lang="scss" scoped></style>