su-navbar.js 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  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("../../url/index.js");
  6. require("../../store/index.js");
  7. require("../../store/app.js");
  8. require("../../api/promotion/diy.js");
  9. require("../../request/index.js");
  10. require("../../config/index.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("../../helper/throttle.js");
  21. require("../../platform/pay.js");
  22. require("../../helper/index.js");
  23. require("../../helper/test.js");
  24. require("../../helper/digit.js");
  25. require("../../api/pay/order.js");
  26. require("../../store/user.js");
  27. require("../../store/cart.js");
  28. require("../../api/trade/cart.js");
  29. require("../../api/pay/wallet.js");
  30. require("../../api/trade/order.js");
  31. require("../../api/promotion/coupon.js");
  32. require("../../store/sys.js");
  33. require("../../store/modal.js");
  34. require("../../config/zIndex.js");
  35. require("../../api/member/signin.js");
  36. if (!Array) {
  37. const _easycom_su_status_bar2 = common_vendor.resolveComponent("su-status-bar");
  38. const _easycom_uni_search_bar2 = common_vendor.resolveComponent("uni-search-bar");
  39. (_easycom_su_status_bar2 + _easycom_uni_search_bar2)();
  40. }
  41. const _easycom_su_status_bar = () => "../su-status-bar/su-status-bar.js";
  42. const _easycom_uni_search_bar = () => "../../../uni_modules/uni-search-bar/components/uni-search-bar/uni-search-bar.js";
  43. if (!Math) {
  44. (_easycom_su_status_bar + _easycom_uni_search_bar)();
  45. }
  46. const _sfc_main = {
  47. __name: "su-navbar",
  48. props: {
  49. dark: {
  50. type: Boolean,
  51. default: false
  52. },
  53. modelValue: {
  54. type: String,
  55. default: ""
  56. },
  57. title: {
  58. type: String,
  59. default: ""
  60. },
  61. titleAlign: {
  62. type: String,
  63. default: "center"
  64. // left | center
  65. },
  66. rightText: {
  67. type: String,
  68. default: ""
  69. },
  70. leftIcon: {
  71. type: String,
  72. default: "left"
  73. },
  74. rightIcon: {
  75. type: String,
  76. default: ""
  77. },
  78. fixed: {
  79. type: [Boolean, String],
  80. default: true
  81. },
  82. placeholder: {
  83. type: [Boolean, String],
  84. default: true
  85. },
  86. color: {
  87. type: String,
  88. default: ""
  89. },
  90. backgroundColor: {
  91. type: String,
  92. default: ""
  93. },
  94. opacity: {
  95. type: [Boolean, String],
  96. default: false
  97. },
  98. opacityBgUi: {
  99. type: String,
  100. default: "bg-white"
  101. },
  102. statusBar: {
  103. type: [Boolean, String],
  104. default: false
  105. },
  106. shadow: {
  107. type: [Boolean, String],
  108. default: false
  109. },
  110. border: {
  111. type: [Boolean, String],
  112. default: false
  113. },
  114. height: {
  115. type: [Number, String],
  116. default: 44
  117. },
  118. leftWidth: {
  119. type: [Number, String],
  120. default: 80
  121. },
  122. rightWidth: {
  123. type: [Number, String],
  124. default: 0
  125. },
  126. tools: {
  127. type: String,
  128. default: "title"
  129. },
  130. defaultSearch: {
  131. type: String,
  132. default: ""
  133. }
  134. },
  135. emits: ["clickLeft", "clickRight", "clickTitle", "search"],
  136. setup(__props, { emit: __emit }) {
  137. const getVal = (val) => typeof val === "number" ? val + "px" : val;
  138. const emits = __emit;
  139. const props = __props;
  140. common_vendor.computed(() => {
  141. return {
  142. width: sheep_index.sheep.$platform.capsule.width + "px",
  143. height: sheep_index.sheep.$platform.capsule.height + "px",
  144. margin: "0 " + (sheep_index.sheep.$platform.device.windowWidth - sheep_index.sheep.$platform.capsule.right) + "px"
  145. };
  146. });
  147. const searchModel = common_vendor.computed(() => {
  148. return props.defaultSearch;
  149. });
  150. common_vendor.computed(() => {
  151. if (props.dark) {
  152. if (props.backgroundColor) {
  153. return props.backgroundColor;
  154. } else {
  155. return props.dark ? "#333" : "#FFF";
  156. }
  157. }
  158. return props.backgroundColor || "#FFF";
  159. });
  160. const themeColor = common_vendor.computed(() => {
  161. if (props.dark) {
  162. if (props.color) {
  163. return props.color;
  164. } else {
  165. return props.dark ? "#fff" : "#333";
  166. }
  167. }
  168. return props.color || "#333";
  169. });
  170. const navbarHeight = common_vendor.computed(() => {
  171. return getVal(props.height);
  172. });
  173. const leftIconWidth = common_vendor.computed(() => {
  174. return getVal(props.leftWidth);
  175. });
  176. common_vendor.computed(() => {
  177. return getVal(props.rightWidth);
  178. });
  179. function onSearch(e) {
  180. emits("search", e.value);
  181. }
  182. common_vendor.onLoad(() => {
  183. if (common_vendor.index.report && props.title !== "") {
  184. common_vendor.index.report("title", props.title);
  185. }
  186. });
  187. const hasHistory = sheep_index.sheep.$router.hasHistory();
  188. function onClickLeft() {
  189. if (hasHistory) {
  190. sheep_index.sheep.$router.back();
  191. } else {
  192. sheep_index.sheep.$router.go("/pages/index/index");
  193. }
  194. emits("clickLeft");
  195. }
  196. function onClickTitle() {
  197. emits("clickTitle");
  198. }
  199. return (_ctx, _cache) => {
  200. return common_vendor.e({
  201. a: common_vendor.n(__props.opacity ? "" : __props.opacityBgUi),
  202. b: __props.statusBar
  203. }, __props.statusBar ? {} : {}, {
  204. c: __props.leftIcon.length > 0
  205. }, __props.leftIcon.length > 0 ? common_vendor.e({
  206. d: common_vendor.unref(hasHistory)
  207. }, common_vendor.unref(hasHistory) ? {} : {}, {
  208. e: common_vendor.o(onClickLeft),
  209. f: common_vendor.o((...args) => common_vendor.unref(sheep_hooks_useModal.showMenuTools) && common_vendor.unref(sheep_hooks_useModal.showMenuTools)(...args))
  210. }) : {}, {
  211. g: __props.titleAlign === "left" && __props.title.length && common_vendor.unref(sheep_index.sheep).$platform.name !== "WechatOfficialAccount"
  212. }, __props.titleAlign === "left" && __props.title.length && common_vendor.unref(sheep_index.sheep).$platform.name !== "WechatOfficialAccount" ? {
  213. h: common_vendor.t(__props.title),
  214. i: themeColor.value,
  215. j: !__props.leftIcon.length > 0 ? 1 : ""
  216. } : {}, {
  217. k: leftIconWidth.value,
  218. l: __props.tools === "search"
  219. }, __props.tools === "search" ? {
  220. m: common_vendor.o(onSearch),
  221. n: common_vendor.o(($event) => searchModel.value = $event),
  222. o: common_vendor.p({
  223. radius: 20,
  224. placeholder: "请输入关键词",
  225. cancelButton: "none",
  226. modelValue: searchModel.value
  227. })
  228. } : common_vendor.e({
  229. p: __props.tools === "title" && __props.titleAlign === "center" && __props.title.length
  230. }, __props.tools === "title" && __props.titleAlign === "center" && __props.title.length ? {
  231. q: common_vendor.t(__props.title),
  232. r: themeColor.value
  233. } : {}, {
  234. s: common_vendor.o(onClickTitle)
  235. }), {
  236. t: themeColor.value,
  237. v: navbarHeight.value,
  238. w: __props.backgroundColor,
  239. x: __props.fixed ? 1 : "",
  240. y: __props.shadow ? 1 : "",
  241. z: __props.border ? 1 : "",
  242. A: __props.placeholder
  243. }, __props.placeholder ? common_vendor.e({
  244. B: __props.statusBar
  245. }, __props.statusBar ? {} : {}, {
  246. C: navbarHeight.value
  247. }) : {}, {
  248. D: __props.dark ? 1 : ""
  249. });
  250. };
  251. }
  252. };
  253. 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"]]);
  254. wx.createComponent(Component);