index.js 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. "use strict";
  2. const common_vendor = require("../../../../common/vendor.js");
  3. const sheep_index = require("../../../index.js");
  4. const sheep_components_sShareModal_canvasPoster_useCanvas = require("./useCanvas.js");
  5. require("../../../api/index.js");
  6. require("../../../api/distri/score.js");
  7. require("../../../request/index.js");
  8. require("../../../config/index.js");
  9. require("../../../store/index.js");
  10. require("../../../store/app.js");
  11. require("../../../api/promotion/diy.js");
  12. require("../../../platform/index.js");
  13. require("../../../platform/provider/wechat/index.js");
  14. require("../../../platform/provider/wechat/miniProgram.js");
  15. require("../../../api/member/auth.js");
  16. require("../../../api/member/social.js");
  17. require("../../../api/member/user.js");
  18. require("../../../platform/provider/apple/index.js");
  19. require("../../../platform/share.js");
  20. require("../../../router/index.js");
  21. require("../../../hooks/useModal.js");
  22. require("../../../helper/index.js");
  23. require("../../../helper/test.js");
  24. require("../../../helper/digit.js");
  25. require("../../../api/member/signin.js");
  26. require("../../../helper/throttle.js");
  27. require("../../../url/index.js");
  28. require("../../../platform/pay.js");
  29. require("../../../api/pay/order.js");
  30. require("../../../store/user.js");
  31. require("../../../store/cart.js");
  32. require("../../../api/trade/cart.js");
  33. require("../../../api/pay/wallet.js");
  34. require("../../../api/trade/order.js");
  35. require("../../../api/promotion/coupon.js");
  36. require("../../../store/sys.js");
  37. require("../../../store/modal.js");
  38. require("../../../api/distri/share.js");
  39. require("../../../api/distri/team.js");
  40. require("../../../api/infra/file.js");
  41. require("../../../api/member/address.js");
  42. require("../../../api/member/point.js");
  43. require("../../../api/migration/app.js");
  44. require("../../../api/migration/chat.js");
  45. require("../../../api/migration/index.js");
  46. require("../../../api/migration/third.js");
  47. require("../../../api/pay/channel.js");
  48. require("../../../api/product/category.js");
  49. require("../../../api/product/comment.js");
  50. require("../../../api/product/favorite.js");
  51. require("../../../api/product/history.js");
  52. require("../../../api/product/spu.js");
  53. require("../../../api/promotion/activity.js");
  54. require("../../../api/promotion/article.js");
  55. require("../../../api/promotion/bargain.js");
  56. require("../../../api/promotion/combination.js");
  57. require("../../../api/promotion/rewardActivity.js");
  58. require("../../../api/promotion/seckill.js");
  59. require("../../../api/system/area.js");
  60. require("../../../api/system/voice.js");
  61. require("../../../api/trade/afterSale.js");
  62. require("../../../api/trade/brokerage.js");
  63. require("../../../api/trade/config.js");
  64. require("../../../api/trade/delivery.js");
  65. require("../../../config/zIndex.js");
  66. require("./poster/index.js");
  67. require("./poster/user.js");
  68. require("./poster/goods.js");
  69. require("./poster/groupon.js");
  70. if (!Array) {
  71. const _easycom_su_popup2 = common_vendor.resolveComponent("su-popup");
  72. _easycom_su_popup2();
  73. }
  74. const _easycom_su_popup = () => "../../../ui/su-popup/su-popup.js";
  75. if (!Math) {
  76. _easycom_su_popup();
  77. }
  78. const _sfc_main = {
  79. __name: "index",
  80. props: {
  81. show: {
  82. type: Boolean,
  83. default: false
  84. },
  85. shareInfo: {
  86. type: Object,
  87. default() {
  88. }
  89. }
  90. },
  91. emits: ["success", "close"],
  92. setup(__props, { expose: __expose, emit: __emit }) {
  93. const props = __props;
  94. const poster = common_vendor.reactive({
  95. canvasId: "canvasId",
  96. width: sheep_index.sheep.$platform.device.windowWidth * 0.9,
  97. height: 600,
  98. src: "",
  99. imgData: ""
  100. });
  101. const emits = __emit;
  102. const vm = common_vendor.getCurrentInstance();
  103. const onClosePoster = () => {
  104. emits("close");
  105. };
  106. const onSavePoster = () => {
  107. if (["WechatOfficialAccount", "H5"].includes(sheep_index.sheep.$platform.name)) {
  108. sheep_index.sheep.$helper.toast("请长按图片保存");
  109. return;
  110. }
  111. common_vendor.index.saveImageToPhotosAlbum({
  112. filePath: poster.src,
  113. success: (res) => {
  114. onClosePoster();
  115. sheep_index.sheep.$helper.toast("保存成功");
  116. },
  117. fail: (err) => {
  118. sheep_index.sheep.$helper.toast("保存失败");
  119. console.log("图片保存失败:", err);
  120. }
  121. });
  122. };
  123. common_vendor.ref("");
  124. async function getPoster(params) {
  125. poster.src = "";
  126. poster.shareInfo = props.shareInfo;
  127. const canvas = await sheep_components_sShareModal_canvasPoster_useCanvas.useCanvas(poster, vm);
  128. return canvas;
  129. }
  130. __expose({
  131. getPoster
  132. });
  133. return (_ctx, _cache) => {
  134. return common_vendor.e({
  135. a: poster.src === ""
  136. }, poster.src === "" ? {
  137. b: poster.height + "px",
  138. c: poster.width + "px"
  139. } : {
  140. d: poster.src,
  141. e: poster.height + "px",
  142. f: poster.width + "px"
  143. }, {
  144. g: poster.canvasId,
  145. h: poster.canvasId,
  146. i: poster.height + "px",
  147. j: poster.width + "px",
  148. k: poster.src !== ""
  149. }, poster.src !== "" ? {
  150. l: common_vendor.o(onClosePoster),
  151. m: common_vendor.o(onSavePoster)
  152. } : {}, {
  153. n: common_vendor.o(onClosePoster),
  154. o: common_vendor.p({
  155. show: __props.show,
  156. round: "10",
  157. type: "center"
  158. })
  159. });
  160. };
  161. }
  162. };
  163. const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-199e8f1d"], ["__file", "D:/zx/mall-front-app/sheep/components/s-share-modal/canvas-poster/index.vue"]]);
  164. wx.createComponent(Component);