s-custom-navbar.js 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  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. 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("../../helper/throttle.js");
  22. require("../../url/index.js");
  23. require("../../platform/pay.js");
  24. require("../../helper/index.js");
  25. require("../../helper/test.js");
  26. require("../../helper/digit.js");
  27. require("../../api/pay/order.js");
  28. require("../../store/user.js");
  29. require("../../store/cart.js");
  30. require("../../api/trade/cart.js");
  31. require("../../api/pay/wallet.js");
  32. require("../../api/trade/order.js");
  33. require("../../api/promotion/coupon.js");
  34. require("../../store/sys.js");
  35. require("../../store/modal.js");
  36. require("../../api/distri/share.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 (!Math) {
  66. (NavbarItem + Navbar)();
  67. }
  68. const Navbar = () => "./components/navbar.js";
  69. const NavbarItem = () => "./components/navbar-item.js";
  70. const _sfc_main = {
  71. __name: "s-custom-navbar",
  72. props: {
  73. data: {
  74. type: Object,
  75. default: () => ({})
  76. },
  77. showLeftButton: {
  78. type: Boolean,
  79. default: false
  80. }
  81. },
  82. setup(__props) {
  83. const props = __props;
  84. const hasHistory = sheep_index.sheep.$router.hasHistory();
  85. const sticky = common_vendor.computed(() => {
  86. if (props.data.mode == "inner") {
  87. if (props.data.alway) {
  88. return false;
  89. }
  90. }
  91. if (props.data.mode == "normal") {
  92. return false;
  93. }
  94. });
  95. const navList = common_vendor.computed(() => {
  96. if (!props.data.list)
  97. return [];
  98. return props.data.list.mp;
  99. });
  100. const windowWidth = sheep_index.sheep.$platform.device.windowWidth;
  101. const cell = common_vendor.computed(() => {
  102. if (common_vendor.unref(navList).length) {
  103. let cell2 = (windowWidth - 90) / 8;
  104. cell2 = (windowWidth - 80 - common_vendor.unref(sheep_index.sheep.$platform.capsule).width) / 6;
  105. return cell2;
  106. }
  107. });
  108. const parseImgStyle = (item) => {
  109. let obj = {
  110. width: item.width * cell.value + (item.width - 1) * 10 + "px",
  111. left: item.left * cell.value + (item.left + 1) * 10 + "px",
  112. "border-radius": item.borderRadius + "px"
  113. };
  114. return obj;
  115. };
  116. const isAlway = common_vendor.computed(
  117. () => props.data.mode === "inner" ? Boolean(props.data.alwaysShow) : true
  118. );
  119. const isOpacity = common_vendor.computed(
  120. () => props.data.mode === "normal" ? false : props.showLeftButton ? false : props.data.mode === "inner"
  121. );
  122. const isPlaceholder = common_vendor.computed(() => props.data.mode === "normal");
  123. const bgStyles = common_vendor.computed(() => {
  124. if (props.data.type) {
  125. return {
  126. background: props.data.type == "color" ? props.data.color : `url(${sheep_index.sheep.$url.cdn(props.data.src)}) no-repeat top center / 100% 100%`
  127. };
  128. }
  129. });
  130. function onClickLeft() {
  131. if (hasHistory) {
  132. sheep_index.sheep.$router.back();
  133. } else {
  134. sheep_index.sheep.$router.go("/pages/index/index");
  135. }
  136. }
  137. function onClickRight() {
  138. sheep_hooks_useModal.showMenuTools();
  139. }
  140. return (_ctx, _cache) => {
  141. return common_vendor.e({
  142. a: __props.showLeftButton
  143. }, __props.showLeftButton ? common_vendor.e({
  144. b: common_vendor.unref(hasHistory)
  145. }, common_vendor.unref(hasHistory) ? {} : {}, {
  146. c: common_vendor.o(onClickLeft),
  147. d: common_vendor.o(onClickRight),
  148. e: __props.data.mode == "inner" ? 1 : ""
  149. }) : {}, {
  150. f: common_vendor.f(navList.value, (item, index, i0) => {
  151. return {
  152. a: "6417c6b5-1-" + i0 + ",6417c6b5-0",
  153. b: common_vendor.p({
  154. data: item,
  155. width: parseImgStyle(item).width
  156. }),
  157. c: index,
  158. d: common_vendor.s(parseImgStyle(item)),
  159. e: common_vendor.n({
  160. "ss-flex ss-col-center ss-row-center": item.type !== "search"
  161. })
  162. };
  163. }),
  164. g: common_vendor.p({
  165. alway: isAlway.value,
  166. back: false,
  167. bg: "",
  168. placeholder: isPlaceholder.value,
  169. bgStyles: bgStyles.value,
  170. opacity: isOpacity.value,
  171. sticky: sticky.value
  172. })
  173. });
  174. };
  175. }
  176. };
  177. const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-6417c6b5"], ["__file", "D:/zx/mall-front-app/sheep/components/s-custom-navbar/s-custom-navbar.vue"]]);
  178. wx.createComponent(Component);