s-image-cube.js 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. "use strict";
  2. const common_vendor = require("../../../common/vendor.js");
  3. const sheep_index = require("../../index.js");
  4. require("../../api/index.js");
  5. require("../../api/distri/score.js");
  6. require("../../request/index.js");
  7. require("../../config/index.js");
  8. require("../../store/index.js");
  9. require("../../store/app.js");
  10. require("../../api/promotion/diy.js");
  11. require("../../platform/index.js");
  12. require("../../platform/provider/wechat/index.js");
  13. require("../../platform/provider/wechat/miniProgram.js");
  14. require("../../api/member/auth.js");
  15. require("../../api/member/social.js");
  16. require("../../api/member/user.js");
  17. require("../../platform/provider/apple/index.js");
  18. require("../../platform/share.js");
  19. require("../../router/index.js");
  20. require("../../hooks/useModal.js");
  21. require("../../helper/index.js");
  22. require("../../helper/test.js");
  23. require("../../helper/digit.js");
  24. require("../../api/member/signin.js");
  25. require("../../helper/throttle.js");
  26. require("../../url/index.js");
  27. require("../../platform/pay.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/share.js");
  38. require("../../api/distri/team.js");
  39. require("../../api/infra/file.js");
  40. require("../../api/member/address.js");
  41. require("../../api/member/point.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. const _sfc_main = {
  66. __name: "s-image-cube",
  67. props: {
  68. data: {
  69. type: Object,
  70. default() {
  71. }
  72. },
  73. styles: {
  74. type: Object,
  75. default() {
  76. }
  77. }
  78. },
  79. setup(__props) {
  80. const props = __props;
  81. const windowWidth = sheep_index.sheep.$platform.device.windowWidth;
  82. const cell = common_vendor.computed(() => {
  83. return (windowWidth - ((props.styles.marginLeft || 0) + (props.styles.marginRight || 0) + (props.styles.padding || 0) * 2)) / 4;
  84. });
  85. const parseAdWrap = common_vendor.computed(() => {
  86. var _a, _b, _c, _d;
  87. let heightArr = props.data.list.reduce(
  88. (prev, cur) => prev.includes(cur.height + cur.top) ? prev : [...prev, cur.height + cur.top],
  89. []
  90. );
  91. let heightMax = Math.max(...heightArr);
  92. return {
  93. height: heightMax * cell.value + "px",
  94. width: windowWidth - (((_b = (_a = props.data) == null ? void 0 : _a.style) == null ? void 0 : _b.marginLeft) + ((_d = (_c = props.data) == null ? void 0 : _c.style) == null ? void 0 : _d.marginRight) + props.styles.padding * 2) * 2 + "px"
  95. };
  96. });
  97. const parseImgStyle = (item) => {
  98. let obj = {
  99. width: item.width * cell.value - props.data.space + "px",
  100. height: item.height * cell.value - props.data.space + "px",
  101. left: item.left * cell.value + "px",
  102. top: item.top * cell.value + "px",
  103. "border-top-left-radius": props.data.borderRadiusTop + "px",
  104. "border-top-right-radius": props.data.borderRadiusTop + "px",
  105. "border-bottom-left-radius": props.data.borderRadiusBottom + "px",
  106. "border-bottom-right-radius": props.data.borderRadiusBottom + "px"
  107. };
  108. return obj;
  109. };
  110. return (_ctx, _cache) => {
  111. return {
  112. a: common_vendor.f(__props.data.list, (item, index, i0) => {
  113. return {
  114. a: common_vendor.unref(sheep_index.sheep).$url.cdn(item.imgUrl),
  115. b: common_vendor.s(parseImgStyle(item)),
  116. c: common_vendor.o(($event) => common_vendor.unref(sheep_index.sheep).$router.go(item.url), index),
  117. d: index
  118. };
  119. }),
  120. b: common_vendor.s({
  121. margin: __props.data.space + "px"
  122. }),
  123. c: common_vendor.s(parseAdWrap.value)
  124. };
  125. };
  126. }
  127. };
  128. const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-c67133d8"], ["__file", "D:/zx/mall-front-app/sheep/components/s-image-cube/s-image-cube.vue"]]);
  129. wx.createComponent(Component);