index.js 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  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(async () => {
  61. common_vendor.index.hideHomeButton();
  62. await searchConfig();
  63. await search();
  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. user.value = res.data;
  75. common_vendor.index.setStorageSync("user", res.data);
  76. } else
  77. popup.value.open();
  78. } else {
  79. common_vendor.index.showToast({
  80. title: res.msg || "",
  81. icon: "error"
  82. });
  83. }
  84. };
  85. const searchConfig = async () => {
  86. config.value = common_vendor.index.getStorageSync("config");
  87. };
  88. const change = (e) => {
  89. show.value = e.show;
  90. };
  91. const toBasic = () => {
  92. common_vendor.index.navigateTo({
  93. url: `/pagesMy/basic/index`
  94. });
  95. };
  96. const toLogin = () => {
  97. common_vendor.index.navigateTo({
  98. url: `/pages/login/index`
  99. });
  100. };
  101. const onClickItem = (e) => {
  102. if (current.value !== e.currentIndex)
  103. current.value = e.currentIndex;
  104. };
  105. const trigger = (e) => {
  106. common_vendor.index.navigateTo({
  107. url: e.item.route
  108. });
  109. };
  110. const toClose = () => {
  111. popup.value.close();
  112. };
  113. return (_ctx, _cache) => {
  114. return {
  115. a: "overflow:" + (show.value ? "hidden" : "visible"),
  116. b: user.value.icon || config.value.logoUrl,
  117. c: common_vendor.t(user.value.nickname || "体验账号"),
  118. d: common_vendor.p({
  119. type: "forward",
  120. size: "20",
  121. color: "#ffffff"
  122. }),
  123. e: common_vendor.o(toBasic),
  124. f: common_vendor.f(menuList.value, (item, index, i0) => {
  125. return {
  126. a: "4978fed5-1-" + i0,
  127. b: common_vendor.p({
  128. ["custom-prefix"]: "iconfont",
  129. type: item.icon,
  130. size: "18",
  131. color: item.color
  132. }),
  133. c: common_vendor.t(item.name),
  134. d: common_vendor.t(item.num),
  135. e: 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: common_vendor.p({
  146. config: config.value
  147. }),
  148. j: current.value === 0,
  149. k: common_vendor.p({
  150. config: config.value
  151. }),
  152. l: current.value === 1,
  153. m: common_vendor.p({
  154. config: config.value
  155. }),
  156. n: current.value === 2,
  157. o: common_vendor.o(toClose),
  158. p: common_vendor.p({
  159. type: "closeempty",
  160. size: "18",
  161. color: "#999999"
  162. }),
  163. q: common_vendor.o(toLogin),
  164. r: common_vendor.sr(popup, "4978fed5-6", {
  165. "k": "popup"
  166. }),
  167. s: common_vendor.o(change),
  168. t: common_vendor.p({
  169. ["background-color"]: "rgba(0,0,0,0)",
  170. type: "bottom"
  171. }),
  172. v: common_vendor.o(trigger),
  173. w: common_vendor.p({
  174. pattern: pattern.value,
  175. content: content.value,
  176. horizontal: "right",
  177. direction: "vertical"
  178. })
  179. };
  180. };
  181. }
  182. });
  183. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-4978fed5"], ["__file", "D:/project/足球比赛/match_applet/pages/home/index.vue"]]);
  184. wx.createPage(MiniProgramPage);