index.js 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  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. const list = common_vendor.ref(["球队", "活动", "赛事"]);
  33. const current = common_vendor.ref(0);
  34. const pattern = common_vendor.ref({
  35. color: "#3c3e49",
  36. backgroundColor: "#fff",
  37. selectedColor: "#fff",
  38. buttonColor: "#fff",
  39. iconColor: "#3c3e49"
  40. });
  41. const content = common_vendor.ref([
  42. {
  43. iconPath: "/static/qiudui.png",
  44. text: "建球队",
  45. route: "/pagesHome/team/index"
  46. },
  47. {
  48. iconPath: "/static/saishi.png",
  49. text: "建赛事",
  50. route: "/pagesHome/match/index"
  51. }
  52. ]);
  53. const popup = common_vendor.ref(null);
  54. common_vendor.onShow(async () => {
  55. common_vendor.index.hideHomeButton();
  56. await searchConfig();
  57. await search();
  58. });
  59. common_vendor.onPullDownRefresh(() => {
  60. common_vendor.index.stopPullDownRefresh();
  61. });
  62. const searchConfig = async () => {
  63. config.value = common_vendor.index.getStorageSync("config");
  64. };
  65. const search = async () => {
  66. const res = await $api(`matchUser/find`, "GET", {
  67. openid: openid.value
  68. });
  69. if (res.code === 200) {
  70. if (res.data) {
  71. user.value = res.data;
  72. common_vendor.index.setStorageSync("user", res.data);
  73. const arr = await $api(`matchUser/statistics/${res.data.id}`, "GET", {});
  74. if (arr.code === 200) {
  75. menuList.value = arr.data;
  76. } else {
  77. common_vendor.index.showToast({
  78. title: arr.msg || "",
  79. icon: "error"
  80. });
  81. }
  82. } else
  83. popup.value.open();
  84. } else {
  85. common_vendor.index.showToast({
  86. title: res.msg || "",
  87. icon: "error"
  88. });
  89. }
  90. };
  91. const change = (e) => {
  92. show.value = e.show;
  93. };
  94. const toBasic = () => {
  95. common_vendor.index.navigateTo({
  96. url: `/pagesMy/basic/index`
  97. });
  98. };
  99. const toLogin = () => {
  100. common_vendor.index.navigateTo({
  101. url: `/pages/login/index`
  102. });
  103. };
  104. const onClickItem = (e) => {
  105. if (current.value !== e.currentIndex)
  106. current.value = e.currentIndex;
  107. };
  108. const trigger = (e) => {
  109. common_vendor.index.navigateTo({
  110. url: e.item.route
  111. });
  112. };
  113. const toClose = () => {
  114. popup.value.close();
  115. };
  116. return (_ctx, _cache) => {
  117. return {
  118. a: "overflow:" + (show.value ? "hidden" : "visible"),
  119. b: user.value.icon || config.value.logoUrl,
  120. c: common_vendor.t(user.value.nickname || "体验账号"),
  121. d: common_vendor.p({
  122. type: "forward",
  123. size: "20",
  124. color: "#ffffff"
  125. }),
  126. e: common_vendor.o(toBasic),
  127. f: common_vendor.f(menuList.value, (item, index, i0) => {
  128. return {
  129. a: "4978fed5-1-" + i0,
  130. b: common_vendor.p({
  131. ["custom-prefix"]: "iconfont",
  132. type: item.icon,
  133. size: "18",
  134. color: item.color
  135. }),
  136. c: common_vendor.t(item.name),
  137. d: common_vendor.t(item.num),
  138. e: index
  139. };
  140. }),
  141. g: common_vendor.o(onClickItem),
  142. h: common_vendor.p({
  143. current: current.value,
  144. values: list.value,
  145. styleType: "text",
  146. activeColor: "#dd524d"
  147. }),
  148. i: common_vendor.p({
  149. config: config.value
  150. }),
  151. j: current.value === 0,
  152. k: common_vendor.p({
  153. config: config.value
  154. }),
  155. l: current.value === 1,
  156. m: common_vendor.p({
  157. config: config.value
  158. }),
  159. n: current.value === 2,
  160. o: common_vendor.o(toClose),
  161. p: common_vendor.p({
  162. type: "closeempty",
  163. size: "18",
  164. color: "#999999"
  165. }),
  166. q: common_vendor.o(toLogin),
  167. r: common_vendor.sr(popup, "4978fed5-6", {
  168. "k": "popup"
  169. }),
  170. s: common_vendor.o(change),
  171. t: common_vendor.p({
  172. ["background-color"]: "rgba(0,0,0,0)",
  173. type: "bottom"
  174. }),
  175. v: common_vendor.o(trigger),
  176. w: common_vendor.p({
  177. pattern: pattern.value,
  178. content: content.value,
  179. horizontal: "right",
  180. direction: "vertical"
  181. })
  182. };
  183. };
  184. }
  185. });
  186. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-4978fed5"], ["__file", "D:/project/足球比赛/match_applet/pages/home/index.vue"]]);
  187. wx.createPage(MiniProgramPage);