shareable.vue 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. }
  32. uni.setNavigationBarTitle({
  33. title: "活动抽奖",
  34. });
  35. },
  36. onShow() {
  37. if (!this.initialize) this.getDetail();
  38. },
  39. methods: {
  40. getDetail() {
  41. this.$Http
  42. .basic({
  43. id: 20240514101502,
  44. content: {
  45. sa_awardid: this.sa_awardid,
  46. },
  47. })
  48. .then((res) => {
  49. console.log("抽奖详情", res);
  50. if (this.cutoff(res.msg)) return;
  51. this.initialize = false;
  52. this.detail = res.data;
  53. this.$refs.sudoku.init();
  54. });
  55. },
  56. getSheraDate() {
  57. let detail = this.detail;
  58. return {
  59. title: detail.name, // 标题
  60. path:
  61. "/store/lottery/shareable?sa_awardid=" +
  62. detail.sa_awardid +
  63. "&shareUserid=" +
  64. this.shareUserid, // 分享路径
  65. imageUrl: "", // 分享图
  66. };
  67. },
  68. },
  69. onShareAppMessage() {
  70. return this.getSheraDate();
  71. },
  72. onShareTimeline() {
  73. return this.getSheraDate();
  74. },
  75. };
  76. </script>
  77. <style lang="scss" scoped></style>