index.js 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. if (!Array) {
  4. const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
  5. const _easycom_uni_segmented_control2 = common_vendor.resolveComponent("uni-segmented-control");
  6. const _easycom_uni_popup2 = common_vendor.resolveComponent("uni-popup");
  7. const _easycom_uni_fab2 = common_vendor.resolveComponent("uni-fab");
  8. (_easycom_uni_icons2 + _easycom_uni_segmented_control2 + _easycom_uni_popup2 + _easycom_uni_fab2)();
  9. }
  10. const _easycom_uni_icons = () => "../../uni_modules/uni-icons/components/uni-icons/uni-icons.js";
  11. const _easycom_uni_segmented_control = () => "../../uni_modules/uni-segmented-control/components/uni-segmented-control/uni-segmented-control.js";
  12. const _easycom_uni_popup = () => "../../uni_modules/uni-popup/components/uni-popup/uni-popup.js";
  13. const _easycom_uni_fab = () => "../../uni_modules/uni-fab/components/uni-fab/uni-fab.js";
  14. if (!Math) {
  15. (_easycom_uni_icons + _easycom_uni_segmented_control + team + activity + game + _easycom_uni_popup + _easycom_uni_fab)();
  16. }
  17. const activity = () => "./components/activity.js";
  18. const game = () => "./components/game.js";
  19. const team = () => "./components/team.js";
  20. const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  21. __name: "index",
  22. setup(__props) {
  23. var _a;
  24. const $api = (_a = common_vendor.getCurrentInstance()) == null ? void 0 : _a.appContext.config.globalProperties.$api;
  25. const openid = common_vendor.computed(() => {
  26. return common_vendor.index.getStorageSync("openid");
  27. });
  28. const config = common_vendor.ref({});
  29. const user = common_vendor.ref({});
  30. const show = common_vendor.ref(false);
  31. const menuList = common_vendor.ref([
  32. { name: "球队", num: "5", icon: "icon-qi", color: "#1E90FF" },
  33. { name: "|" },
  34. { name: "出勤", num: "16%", icon: "icon-kaoqinchuqin", color: "#FF4500" },
  35. { name: "|" },
  36. { name: "进球", num: "1", icon: "icon-zuqiu", color: "#FFFFFF" }
  37. ]);
  38. const list = common_vendor.ref(["球队", "活动", "赛事"]);
  39. const current = common_vendor.ref(0);
  40. const pattern = common_vendor.ref({
  41. color: "#3c3e49",
  42. backgroundColor: "#fff",
  43. selectedColor: "#fff",
  44. buttonColor: "#fff",
  45. iconColor: "#3c3e49"
  46. });
  47. const content = common_vendor.ref([
  48. {
  49. iconPath: "/static/qiudui.png",
  50. text: "建球队",
  51. route: "/pagesHome/team/index"
  52. },
  53. {
  54. iconPath: "/static/saishi.png",
  55. text: "建赛事",
  56. route: "/pagesHome/match/index"
  57. }
  58. ]);
  59. const popup = common_vendor.ref(null);
  60. common_vendor.onShow(() => {
  61. common_vendor.index.hideHomeButton();
  62. search();
  63. searchConfig();
  64. });
  65. common_vendor.onPullDownRefresh(() => {
  66. common_vendor.index.stopPullDownRefresh();
  67. });
  68. const search = async () => {
  69. const res = await $api(`matchUser/find`, "GET", {
  70. openid: openid.value
  71. });
  72. if (res.code === 200) {
  73. if (res.data)
  74. console.log(res.data);
  75. else
  76. popup.value.open();
  77. } else {
  78. common_vendor.index.showToast({
  79. title: res.msg || "",
  80. icon: "error"
  81. });
  82. }
  83. };
  84. const searchConfig = async () => {
  85. config.value = common_vendor.index.getStorageSync("config");
  86. };
  87. const change = (e) => {
  88. show.value = e.show;
  89. };
  90. const toBasic = () => {
  91. common_vendor.index.navigateTo({
  92. url: `/pagesMy/basic/index`
  93. });
  94. };
  95. const toLogin = () => {
  96. common_vendor.index.navigateTo({
  97. url: `/pages/login/index`
  98. });
  99. };
  100. const onClickItem = (e) => {
  101. if (current.value !== e.currentIndex)
  102. current.value = e.currentIndex;
  103. };
  104. const trigger = (e) => {
  105. common_vendor.index.navigateTo({
  106. url: e.item.route
  107. });
  108. };
  109. const toClose = () => {
  110. popup.value.close();
  111. };
  112. return (_ctx, _cache) => {
  113. return {
  114. a: "overflow:" + (show.value ? "hidden" : "visible"),
  115. b: user.value.icon || config.value.logoUrl,
  116. c: common_vendor.t(user.value.nickname || "体验账号"),
  117. d: common_vendor.p({
  118. type: "forward",
  119. size: "20",
  120. color: "#ffffff"
  121. }),
  122. e: common_vendor.o(toBasic),
  123. f: common_vendor.f(menuList.value, (item, index, i0) => {
  124. return {
  125. a: "4978fed5-1-" + i0,
  126. b: common_vendor.p({
  127. ["custom-prefix"]: "iconfont",
  128. type: item.icon,
  129. size: "18",
  130. color: item.color
  131. }),
  132. c: common_vendor.t(item.name),
  133. d: common_vendor.t(item.num),
  134. e: index,
  135. f: common_vendor.o(($event) => _ctx.toInfo(item), index)
  136. };
  137. }),
  138. g: common_vendor.o(onClickItem),
  139. h: common_vendor.p({
  140. current: current.value,
  141. values: list.value,
  142. styleType: "text",
  143. activeColor: "#dd524d"
  144. }),
  145. i: current.value === 0,
  146. j: current.value === 1,
  147. k: current.value === 2,
  148. l: common_vendor.o(toClose),
  149. m: common_vendor.p({
  150. type: "closeempty",
  151. size: "18",
  152. color: "#999999"
  153. }),
  154. n: common_vendor.o(toLogin),
  155. o: common_vendor.sr(popup, "4978fed5-6", {
  156. "k": "popup"
  157. }),
  158. p: common_vendor.o(change),
  159. q: common_vendor.p({
  160. ["background-color"]: "#fff",
  161. type: "bottom"
  162. }),
  163. r: common_vendor.o(trigger),
  164. s: common_vendor.p({
  165. pattern: pattern.value,
  166. content: content.value,
  167. horizontal: "right",
  168. direction: "vertical"
  169. })
  170. };
  171. };
  172. }
  173. });
  174. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-4978fed5"], ["__file", "D:/project/足球比赛/match_applet/pages/home/index.vue"]]);
  175. wx.createPage(MiniProgramPage);