su-navbar.js 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  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 (!Array) {
  66. const _easycom_su_status_bar2 = common_vendor.resolveComponent("su-status-bar");
  67. const _easycom_uni_search_bar2 = common_vendor.resolveComponent("uni-search-bar");
  68. (_easycom_su_status_bar2 + _easycom_uni_search_bar2)();
  69. }
  70. const _easycom_su_status_bar = () => "../su-status-bar/su-status-bar.js";
  71. const _easycom_uni_search_bar = () => "../../../uni_modules/uni-search-bar/components/uni-search-bar/uni-search-bar.js";
  72. if (!Math) {
  73. (_easycom_su_status_bar + _easycom_uni_search_bar)();
  74. }
  75. const _sfc_main = {
  76. __name: "su-navbar",
  77. props: {
  78. dark: {
  79. type: Boolean,
  80. default: false
  81. },
  82. modelValue: {
  83. type: String,
  84. default: ""
  85. },
  86. title: {
  87. type: String,
  88. default: ""
  89. },
  90. titleAlign: {
  91. type: String,
  92. default: "center"
  93. // left | center
  94. },
  95. rightText: {
  96. type: String,
  97. default: ""
  98. },
  99. leftIcon: {
  100. type: String,
  101. default: "left"
  102. },
  103. rightIcon: {
  104. type: String,
  105. default: ""
  106. },
  107. fixed: {
  108. type: [Boolean, String],
  109. default: true
  110. },
  111. placeholder: {
  112. type: [Boolean, String],
  113. default: true
  114. },
  115. color: {
  116. type: String,
  117. default: ""
  118. },
  119. backgroundColor: {
  120. type: String,
  121. default: ""
  122. },
  123. opacity: {
  124. type: [Boolean, String],
  125. default: false
  126. },
  127. opacityBgUi: {
  128. type: String,
  129. default: "bg-white"
  130. },
  131. statusBar: {
  132. type: [Boolean, String],
  133. default: false
  134. },
  135. shadow: {
  136. type: [Boolean, String],
  137. default: false
  138. },
  139. border: {
  140. type: [Boolean, String],
  141. default: false
  142. },
  143. height: {
  144. type: [Number, String],
  145. default: 44
  146. },
  147. leftWidth: {
  148. type: [Number, String],
  149. default: 80
  150. },
  151. rightWidth: {
  152. type: [Number, String],
  153. default: 0
  154. },
  155. tools: {
  156. type: String,
  157. default: "title"
  158. },
  159. defaultSearch: {
  160. type: String,
  161. default: ""
  162. }
  163. },
  164. emits: ["clickLeft", "clickRight", "clickTitle", "search"],
  165. setup(__props, { emit: __emit }) {
  166. const getVal = (val) => typeof val === "number" ? val + "px" : val;
  167. const emits = __emit;
  168. const props = __props;
  169. common_vendor.computed(() => {
  170. return {
  171. width: sheep_index.sheep.$platform.capsule.width + "px",
  172. height: sheep_index.sheep.$platform.capsule.height + "px",
  173. margin: "0 " + (sheep_index.sheep.$platform.device.windowWidth - sheep_index.sheep.$platform.capsule.right) + "px"
  174. };
  175. });
  176. const searchModel = common_vendor.computed(() => {
  177. return props.defaultSearch;
  178. });
  179. common_vendor.computed(() => {
  180. if (props.dark) {
  181. if (props.backgroundColor) {
  182. return props.backgroundColor;
  183. } else {
  184. return props.dark ? "#333" : "#FFF";
  185. }
  186. }
  187. return props.backgroundColor || "#FFF";
  188. });
  189. const themeColor = common_vendor.computed(() => {
  190. if (props.dark) {
  191. if (props.color) {
  192. return props.color;
  193. } else {
  194. return props.dark ? "#fff" : "#333";
  195. }
  196. }
  197. return props.color || "#333";
  198. });
  199. const navbarHeight = common_vendor.computed(() => {
  200. return getVal(props.height);
  201. });
  202. const leftIconWidth = common_vendor.computed(() => {
  203. return getVal(props.leftWidth);
  204. });
  205. common_vendor.computed(() => {
  206. return getVal(props.rightWidth);
  207. });
  208. function onSearch(e) {
  209. emits("search", e.value);
  210. }
  211. common_vendor.onLoad(() => {
  212. if (common_vendor.index.report && props.title !== "") {
  213. common_vendor.index.report("title", props.title);
  214. }
  215. });
  216. const hasHistory = sheep_index.sheep.$router.hasHistory();
  217. function onClickLeft() {
  218. if (hasHistory) {
  219. sheep_index.sheep.$router.back();
  220. } else {
  221. sheep_index.sheep.$router.go("/pages/index/index");
  222. }
  223. emits("clickLeft");
  224. }
  225. function onClickTitle() {
  226. emits("clickTitle");
  227. }
  228. return (_ctx, _cache) => {
  229. return common_vendor.e({
  230. a: common_vendor.n(__props.opacity ? "" : __props.opacityBgUi),
  231. b: __props.statusBar
  232. }, __props.statusBar ? {} : {}, {
  233. c: __props.leftIcon.length > 0
  234. }, __props.leftIcon.length > 0 ? common_vendor.e({
  235. d: common_vendor.unref(hasHistory)
  236. }, common_vendor.unref(hasHistory) ? {} : {}, {
  237. e: common_vendor.o(onClickLeft),
  238. f: common_vendor.o((...args) => common_vendor.unref(sheep_hooks_useModal.showMenuTools) && common_vendor.unref(sheep_hooks_useModal.showMenuTools)(...args))
  239. }) : {}, {
  240. g: __props.titleAlign === "left" && __props.title.length && common_vendor.unref(sheep_index.sheep).$platform.name !== "WechatOfficialAccount"
  241. }, __props.titleAlign === "left" && __props.title.length && common_vendor.unref(sheep_index.sheep).$platform.name !== "WechatOfficialAccount" ? {
  242. h: common_vendor.t(__props.title),
  243. i: themeColor.value,
  244. j: !__props.leftIcon.length > 0 ? 1 : ""
  245. } : {}, {
  246. k: leftIconWidth.value,
  247. l: __props.tools === "search"
  248. }, __props.tools === "search" ? {
  249. m: common_vendor.o(onSearch),
  250. n: common_vendor.o(($event) => searchModel.value = $event),
  251. o: common_vendor.p({
  252. radius: 20,
  253. placeholder: "请输入关键词",
  254. cancelButton: "none",
  255. modelValue: searchModel.value
  256. })
  257. } : common_vendor.e({
  258. p: __props.tools === "title" && __props.titleAlign === "center" && __props.title.length
  259. }, __props.tools === "title" && __props.titleAlign === "center" && __props.title.length ? {
  260. q: common_vendor.t(__props.title),
  261. r: themeColor.value
  262. } : {}, {
  263. s: common_vendor.o(onClickTitle)
  264. }), {
  265. t: themeColor.value,
  266. v: navbarHeight.value,
  267. w: __props.backgroundColor,
  268. x: __props.fixed ? 1 : "",
  269. y: __props.shadow ? 1 : "",
  270. z: __props.border ? 1 : "",
  271. A: __props.placeholder
  272. }, __props.placeholder ? common_vendor.e({
  273. B: __props.statusBar
  274. }, __props.statusBar ? {} : {}, {
  275. C: navbarHeight.value
  276. }) : {}, {
  277. D: __props.dark ? 1 : ""
  278. });
  279. };
  280. }
  281. };
  282. const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-305eaf98"], ["__file", "D:/zx/mall-front-app/sheep/ui/su-navbar/su-navbar.vue"]]);
  283. wx.createComponent(Component);