su-navbar.js 7.8 KB

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