s-menu-button.js 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  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-menu-button",
  67. props: {
  68. data: {
  69. type: Object,
  70. default() {
  71. }
  72. },
  73. styles: {
  74. type: Object,
  75. default() {
  76. }
  77. },
  78. circular: {
  79. type: Boolean,
  80. default: true
  81. },
  82. autoplay: {
  83. type: Boolean,
  84. default: false
  85. },
  86. interval: {
  87. type: Number,
  88. default: 5e3
  89. },
  90. duration: {
  91. type: Number,
  92. default: 500
  93. },
  94. ui: {
  95. type: String,
  96. default: ""
  97. },
  98. mode: {
  99. //default
  100. type: String,
  101. default: "default"
  102. },
  103. dotStyle: {
  104. type: String,
  105. default: "long"
  106. //default long tag
  107. },
  108. dotCur: {
  109. type: String,
  110. default: "ui-BG-Main"
  111. },
  112. bg: {
  113. type: String,
  114. default: "bg-none"
  115. },
  116. height: {
  117. type: Number,
  118. default: 300
  119. },
  120. // 是否有边框
  121. hasBorder: {
  122. type: Boolean,
  123. default: true
  124. },
  125. // 边框颜色
  126. borderColor: {
  127. type: String,
  128. default: "red"
  129. },
  130. background: {
  131. type: String,
  132. default: "blue"
  133. },
  134. hoverClass: {
  135. type: String,
  136. default: "ss-hover-class"
  137. //'none'为没有hover效果
  138. },
  139. // 一排宫格数
  140. col: {
  141. type: [Number, String],
  142. default: 3
  143. },
  144. iconSize: {
  145. type: Number,
  146. default: 80
  147. },
  148. color: {
  149. type: String,
  150. default: "#000"
  151. }
  152. },
  153. setup(__props) {
  154. const state = common_vendor.reactive({
  155. cur: 0
  156. });
  157. const props = __props;
  158. const menuList = common_vendor.computed(() => splitData(props.data.list, props.data.row * props.data.column));
  159. const swiperHeight = common_vendor.computed(() => props.data.row * (props.data.layout === "iconText" ? 200 : 180));
  160. sheep_index.sheep.$platform.device.windowWidth;
  161. const swiperChange = (e) => {
  162. state.cur = e.detail.current;
  163. };
  164. const splitData = (oArr = [], length = 1) => {
  165. let arr = [];
  166. let minArr = [];
  167. oArr.forEach((c) => {
  168. if (minArr.length === length) {
  169. minArr = [];
  170. }
  171. if (minArr.length === 0) {
  172. arr.push(minArr);
  173. }
  174. minArr.push(c);
  175. });
  176. return arr;
  177. };
  178. return (_ctx, _cache) => {
  179. return common_vendor.e({
  180. a: common_vendor.f(menuList.value, (arr, index, i0) => {
  181. return {
  182. a: common_vendor.f(arr, (item, index2, i1) => {
  183. return common_vendor.e({
  184. a: item.badge.show
  185. }, item.badge.show ? {
  186. b: common_vendor.t(item.badge.text),
  187. c: common_vendor.s({
  188. background: item.badge.bgColor,
  189. color: item.badge.textColor
  190. })
  191. } : {}, {
  192. d: item.iconUrl
  193. }, item.iconUrl ? {
  194. e: common_vendor.s({
  195. width: props.iconSize + "rpx",
  196. height: props.iconSize + "rpx"
  197. }),
  198. f: common_vendor.unref(sheep_index.sheep).$url.cdn(item.iconUrl)
  199. } : {}, __props.data.layout === "iconText" ? {
  200. g: common_vendor.t(item.title),
  201. h: common_vendor.s({
  202. color: item.titleColor
  203. })
  204. } : {}, {
  205. i: index2,
  206. j: common_vendor.o(($event) => common_vendor.unref(sheep_index.sheep).$router.go(item.url), index2)
  207. });
  208. }),
  209. b: index,
  210. c: state.cur == index ? 1 : ""
  211. };
  212. }),
  213. b: __props.data.layout === "iconText",
  214. c: common_vendor.s({
  215. width: `${100 * (1 / __props.data.column)}%`,
  216. height: "200rpx"
  217. }),
  218. d: props.circular,
  219. e: state.cur,
  220. f: props.autoplay,
  221. g: props.interval,
  222. h: props.duration,
  223. i: common_vendor.s({
  224. height: swiperHeight.value + "rpx"
  225. }),
  226. j: common_vendor.o(swiperChange),
  227. k: menuList.value.length > 1
  228. }, menuList.value.length > 1 ? common_vendor.e({
  229. l: props.dotStyle != "tag"
  230. }, props.dotStyle != "tag" ? {
  231. m: common_vendor.f(menuList.value.length, (item, index, i0) => {
  232. return {
  233. a: index,
  234. b: common_vendor.n(state.cur == index ? "cur" : "")
  235. };
  236. }),
  237. n: common_vendor.n(props.dotCur),
  238. o: common_vendor.n(props.dotStyle)
  239. } : {}, {
  240. p: props.dotStyle == "tag"
  241. }, props.dotStyle == "tag" ? {
  242. q: common_vendor.t(state.cur + 1),
  243. r: common_vendor.t(menuList.value.length),
  244. s: common_vendor.n(props.dotCur),
  245. t: common_vendor.n(props.dotStyle)
  246. } : {}) : {}, {
  247. v: common_vendor.n(props.mode),
  248. w: common_vendor.n(props.bg),
  249. x: common_vendor.n(props.ui),
  250. y: common_vendor.s({
  251. height: swiperHeight.value + (menuList.value.length > 1 ? 50 : 0) + "rpx"
  252. })
  253. });
  254. };
  255. }
  256. };
  257. const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-75f856ac"], ["__file", "D:/zx/mall-front-app/sheep/components/s-menu-button/s-menu-button.vue"]]);
  258. wx.createComponent(Component);