s-share-modal.js 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. "use strict";
  2. const common_vendor = require("../../../common/vendor.js");
  3. const sheep_index = require("../../index.js");
  4. const sheep_hooks_useModal = require("../../hooks/useModal.js");
  5. const sheep_api_distri_share = require("../../api/distri/share.js");
  6. require("../../api/index.js");
  7. require("../../api/distri/score.js");
  8. require("../../request/index.js");
  9. require("../../config/index.js");
  10. require("../../store/index.js");
  11. require("../../store/app.js");
  12. require("../../api/promotion/diy.js");
  13. require("../../platform/index.js");
  14. require("../../platform/provider/wechat/index.js");
  15. require("../../platform/provider/wechat/miniProgram.js");
  16. require("../../api/member/auth.js");
  17. require("../../api/member/social.js");
  18. require("../../api/member/user.js");
  19. require("../../platform/provider/apple/index.js");
  20. require("../../platform/share.js");
  21. require("../../router/index.js");
  22. require("../../helper/throttle.js");
  23. require("../../url/index.js");
  24. require("../../platform/pay.js");
  25. require("../../helper/index.js");
  26. require("../../helper/test.js");
  27. require("../../helper/digit.js");
  28. require("../../api/pay/order.js");
  29. require("../../store/user.js");
  30. require("../../store/cart.js");
  31. require("../../api/trade/cart.js");
  32. require("../../api/pay/wallet.js");
  33. require("../../api/trade/order.js");
  34. require("../../api/promotion/coupon.js");
  35. require("../../store/sys.js");
  36. require("../../store/modal.js");
  37. require("../../api/distri/team.js");
  38. require("../../api/infra/file.js");
  39. require("../../api/member/address.js");
  40. require("../../api/member/point.js");
  41. require("../../api/member/signin.js");
  42. require("../../api/migration/app.js");
  43. require("../../api/migration/chat.js");
  44. require("../../api/migration/index.js");
  45. require("../../api/migration/third.js");
  46. require("../../api/pay/channel.js");
  47. require("../../api/product/category.js");
  48. require("../../api/product/comment.js");
  49. require("../../api/product/favorite.js");
  50. require("../../api/product/history.js");
  51. require("../../api/product/spu.js");
  52. require("../../api/promotion/activity.js");
  53. require("../../api/promotion/article.js");
  54. require("../../api/promotion/bargain.js");
  55. require("../../api/promotion/combination.js");
  56. require("../../api/promotion/rewardActivity.js");
  57. require("../../api/promotion/seckill.js");
  58. require("../../api/system/area.js");
  59. require("../../api/system/voice.js");
  60. require("../../api/trade/afterSale.js");
  61. require("../../api/trade/brokerage.js");
  62. require("../../api/trade/config.js");
  63. require("../../api/trade/delivery.js");
  64. require("../../config/zIndex.js");
  65. if (!Array) {
  66. const _easycom_su_popup2 = common_vendor.resolveComponent("su-popup");
  67. _easycom_su_popup2();
  68. }
  69. const _easycom_su_popup = () => "../../ui/su-popup/su-popup.js";
  70. if (!Math) {
  71. (_easycom_su_popup + canvasPoster)();
  72. }
  73. const canvasPoster = () => "./canvas-poster/index.js";
  74. const _sfc_main = {
  75. __name: "s-share-modal",
  76. props: {
  77. shareInfo: {
  78. type: Object,
  79. default() {
  80. }
  81. }
  82. },
  83. setup(__props) {
  84. const show = common_vendor.computed(() => sheep_index.sheep.$store("modal").share);
  85. const shareConfig = common_vendor.computed(() => sheep_index.sheep.$store("app").platform.share);
  86. const SharePosterRef = common_vendor.ref("");
  87. const props = __props;
  88. const state = common_vendor.reactive({
  89. showShareGuide: false,
  90. // H5 的指引
  91. showPosterModal: false
  92. // 海报弹窗
  93. });
  94. let ShareInfo = common_vendor.computed(() => {
  95. return {
  96. ...props.shareInfo
  97. };
  98. });
  99. const onShareByPoster = () => {
  100. const shareId = common_vendor.computed(() => sheep_index.sheep.$store("modal").shareInfo.spuId);
  101. sheep_hooks_useModal.closeShareModal();
  102. if (!sheep_index.sheep.$store("user").isLogin) {
  103. sheep_hooks_useModal.showAuthModal();
  104. return;
  105. }
  106. if (shareId.value) {
  107. sheep_api_distri_share.ShareApi.getLinkId(3, shareId.value).then((res) => {
  108. if (res.code !== 0) {
  109. return;
  110. }
  111. ShareInfo.value.link = ShareInfo.value.link.replace("0", res.data.linkId);
  112. ShareInfo.value.query = ShareInfo.value.query.replace("0", res.data.linkId);
  113. });
  114. }
  115. common_vendor.unref(SharePosterRef).getPoster();
  116. state.showPosterModal = true;
  117. };
  118. const onShareByForward = () => {
  119. sheep_hooks_useModal.closeShareModal();
  120. };
  121. function onCloseGuide() {
  122. state.showShareGuide = false;
  123. }
  124. return (_ctx, _cache) => {
  125. return common_vendor.e({
  126. a: common_vendor.o(onCloseGuide),
  127. b: common_vendor.p({
  128. show: state.showShareGuide,
  129. showClose: false
  130. }),
  131. c: state.showShareGuide
  132. }, state.showShareGuide ? {
  133. d: common_vendor.unref(sheep_index.sheep).$url.static("/static/images/share_guide.png")
  134. } : {}, {
  135. e: shareConfig.value.methods.includes("forward")
  136. }, shareConfig.value.methods.includes("forward") ? {
  137. f: common_vendor.unref(sheep_index.sheep).$url.static("/static/images/share_wx.png"),
  138. g: common_vendor.o(onShareByForward)
  139. } : {}, {
  140. h: shareConfig.value.methods.includes("poster")
  141. }, shareConfig.value.methods.includes("poster") ? {
  142. i: common_vendor.unref(sheep_index.sheep).$url.static("/static/images/share_poster.png"),
  143. j: common_vendor.o(onShareByPoster)
  144. } : {}, {
  145. k: common_vendor.o((...args) => common_vendor.unref(sheep_hooks_useModal.closeShareModal) && common_vendor.unref(sheep_hooks_useModal.closeShareModal)(...args)),
  146. l: common_vendor.o(common_vendor.unref(sheep_hooks_useModal.closeShareModal)),
  147. m: common_vendor.p({
  148. show: show.value,
  149. round: "10",
  150. showClose: false
  151. }),
  152. n: common_vendor.sr(SharePosterRef, "a2a58660-2", {
  153. "k": "SharePosterRef"
  154. }),
  155. o: common_vendor.o(($event) => state.showPosterModal = false),
  156. p: common_vendor.p({
  157. show: state.showPosterModal,
  158. shareInfo: common_vendor.unref(ShareInfo)
  159. })
  160. });
  161. };
  162. }
  163. };
  164. const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-a2a58660"], ["__file", "D:/zx/mall-front-app/sheep/components/s-share-modal/s-share-modal.vue"]]);
  165. wx.createComponent(Component);