info.js 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  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. _easycom_uni_icons2();
  6. }
  7. const _easycom_uni_icons = () => "../../uni_modules/uni-icons/components/uni-icons/uni-icons.js";
  8. if (!Math) {
  9. (_easycom_uni_icons + circle)();
  10. }
  11. const circle = () => "./components/circle.js";
  12. const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  13. __name: "info",
  14. setup(__props) {
  15. var _a;
  16. const $api = (_a = common_vendor.getCurrentInstance()) == null ? void 0 : _a.appContext.config.globalProperties.$api;
  17. const list = common_vendor.ref([{ id: 1, title: "测试球队" }, { id: 1, title: "肝帝集团队" }]);
  18. const pageNum = common_vendor.ref(1);
  19. const pageSize = common_vendor.ref(10);
  20. const total = common_vendor.ref(0);
  21. const info = common_vendor.ref({});
  22. const id = common_vendor.ref("");
  23. const config = common_vendor.ref({ logoUrl: "" });
  24. const user = common_vendor.ref({});
  25. const is_save = common_vendor.ref(true);
  26. const actInfo = common_vendor.ref({});
  27. const statusList = common_vendor.ref([]);
  28. common_vendor.onLoad(async (options) => {
  29. id.value = options && options.id;
  30. });
  31. common_vendor.onShow(async () => {
  32. await searchConfig();
  33. await searchOther();
  34. await search();
  35. await searchGame();
  36. });
  37. const searchConfig = async () => {
  38. config.value = common_vendor.index.getStorageSync("config");
  39. user.value = common_vendor.index.getStorageSync("user");
  40. };
  41. const searchOther = async () => {
  42. let res;
  43. res = await $api(`dict/data/list`, "GET", { dictType: "sys_game_status", status: "0" });
  44. if (res.code === 200 && res.total > 0)
  45. statusList.value = res.rows;
  46. };
  47. const search = async () => {
  48. if (id.value) {
  49. const res = await $api(`team/${id.value}`, "GET", {});
  50. if (res.code === 200) {
  51. if (res.data)
  52. info.value = res.data;
  53. } else {
  54. common_vendor.index.showToast({
  55. title: res.msg || "",
  56. icon: "error"
  57. });
  58. }
  59. }
  60. };
  61. const searchGame = async () => {
  62. if (id.value) {
  63. let res;
  64. res = await $api("game/list", "GET", {
  65. pageNum: pageNum.value,
  66. pageSize: pageSize.value,
  67. userId: user.value.id
  68. });
  69. if (res.code === 200) {
  70. list.value = res.rows;
  71. total.value = res.total;
  72. } else {
  73. common_vendor.index.showToast({
  74. title: res.msg || "",
  75. icon: "error"
  76. });
  77. }
  78. res = await $api("game/list", "GET", {
  79. pageNum: 1,
  80. pageSize: 1,
  81. status: "0"
  82. });
  83. if (res.code === 200 && res.total > 0) {
  84. is_save.value = false;
  85. actInfo.value = res.rows[0];
  86. } else {
  87. common_vendor.index.showToast({
  88. title: res.msg || "",
  89. icon: "error"
  90. });
  91. }
  92. }
  93. };
  94. const menuList = common_vendor.ref([
  95. { name: "队员", icon: "icon-a-14-chengyuanguanli", color: "#333333", route: "/pagesHome/team/person" },
  96. { name: "相册", icon: "icon-xiangce", color: "#333333", route: "/pagesHome/team/album" },
  97. { name: "账本", icon: "icon-zhangben", color: "#333333", route: "/pagesHome/team/book" },
  98. { name: "战术板", icon: "icon-cricket-pitch", color: "#333333", route: "/pagesHome/team/board" }
  99. ]);
  100. const toEdit = (item) => {
  101. common_vendor.index.navigateTo({
  102. url: `/pagesHome/team/index?id=${item._id || item.id}`
  103. });
  104. };
  105. const toInfo = (item) => {
  106. common_vendor.index.navigateTo({
  107. url: `${item.route}?id=${id.value}`
  108. });
  109. };
  110. const toActivity = (item) => {
  111. common_vendor.index.navigateTo({
  112. url: `/pagesHome/activity/info?id=${item._id || item.id}&name=${item.name || ""}`
  113. });
  114. };
  115. const toSave = () => {
  116. common_vendor.index.navigateTo({
  117. url: `/pagesHome/create/index?id=${id.value}`
  118. });
  119. };
  120. const getDayOfWeek = (dateString) => {
  121. if (dateString) {
  122. const date = new Date(dateString);
  123. const dayOfWeek = date.getDay();
  124. const weekdays = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];
  125. return weekdays[dayOfWeek];
  126. } else
  127. return "暂无日期";
  128. };
  129. const getStatus = (value) => {
  130. if (value) {
  131. const data = statusList.value.find((i) => i.dictValue == value);
  132. if (data)
  133. return data.dictLabel;
  134. } else
  135. return "暂无状态";
  136. };
  137. const onLeave = async () => {
  138. console.log("请假");
  139. };
  140. const onEnroll = async () => {
  141. console.log("报名");
  142. };
  143. const onAgree = async () => {
  144. console.log("同意");
  145. };
  146. return (_ctx, _cache) => {
  147. var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
  148. return common_vendor.e({
  149. a: info.value.logo || "/static/qiudui.png",
  150. b: common_vendor.t(info.value.name || "暂无名称"),
  151. c: common_vendor.t(info.value.ranking || "暂无排名"),
  152. d: common_vendor.o(($event) => toEdit(info.value)),
  153. e: common_vendor.p({
  154. type: "plusempty",
  155. size: "12",
  156. color: "#ffffff"
  157. }),
  158. f: common_vendor.o(toSave),
  159. g: is_save.value
  160. }, is_save.value ? {} : {}, {
  161. h: is_save.value
  162. }, is_save.value ? {
  163. i: common_vendor.o(toSave)
  164. } : common_vendor.e({
  165. j: common_vendor.t(common_vendor.unref(common_vendor.hooks)(actInfo.value.startTime).format("MM-DD") || "暂无日期"),
  166. k: common_vendor.t(getDayOfWeek(actInfo.value.startTime)),
  167. l: common_vendor.t(common_vendor.unref(common_vendor.hooks)(actInfo.value.startTime).format("HH:mm") || "暂无时间"),
  168. m: actInfo.value.type == "0"
  169. }, actInfo.value.type == "0" ? {} : {}, {
  170. n: ((_b = (_a2 = actInfo.value) == null ? void 0 : _a2.blueInfo) == null ? void 0 : _b.logo) || "/static/qiudui.png",
  171. o: common_vendor.t((_d = (_c = actInfo.value) == null ? void 0 : _c.blueInfo) == null ? void 0 : _d.name),
  172. p: actInfo.value.type == "0"
  173. }, actInfo.value.type == "0" ? {
  174. q: common_vendor.t(((_f = (_e = actInfo.value) == null ? void 0 : _e.matchInfo) == null ? void 0 : _f.address) || "暂无地址")
  175. } : {
  176. r: common_vendor.t(((_h = (_g = actInfo.value) == null ? void 0 : _g.leagueInfo) == null ? void 0 : _h.address) || "暂无地址")
  177. }, {
  178. s: common_vendor.o(($event) => toActivity(actInfo.value)),
  179. t: common_vendor.o(onEnroll),
  180. v: common_vendor.o(onLeave),
  181. w: ((_j = (_i = actInfo.value) == null ? void 0 : _i.blueInfo) == null ? void 0 : _j.userId) == user.value.id
  182. }, ((_l = (_k = actInfo.value) == null ? void 0 : _k.blueInfo) == null ? void 0 : _l.userId) == user.value.id ? {} : {}, {
  183. x: ((_n = (_m = actInfo.value) == null ? void 0 : _m.blueInfo) == null ? void 0 : _n.userId) == user.value.id
  184. }, ((_p = (_o = actInfo.value) == null ? void 0 : _o.blueInfo) == null ? void 0 : _p.userId) == user.value.id ? {
  185. y: common_vendor.o(onAgree)
  186. } : {}), {
  187. z: common_vendor.p({
  188. type: "list",
  189. size: "18"
  190. }),
  191. A: common_vendor.o(($event) => toInfo({
  192. route: "/pagesHome/activity/index"
  193. })),
  194. B: common_vendor.f(menuList.value, (item, index, i0) => {
  195. return {
  196. a: "b14ffc51-2-" + i0,
  197. b: common_vendor.p({
  198. ["custom-prefix"]: "iconfont",
  199. type: item.icon,
  200. size: "25",
  201. color: item.color
  202. }),
  203. c: common_vendor.t(item.name),
  204. d: index,
  205. e: common_vendor.o(($event) => toInfo(item), index)
  206. };
  207. }),
  208. C: common_vendor.t(total.value || 0),
  209. D: common_vendor.p({
  210. pro: 16 / 100,
  211. border_back_color: "#f1f1f1",
  212. border_color: "#FF0000",
  213. content: "16"
  214. }),
  215. E: common_vendor.p({
  216. pro: 5 / 100,
  217. border_back_color: "#f1f1f1",
  218. border_color: "#35BD7B",
  219. content: "5"
  220. }),
  221. F: common_vendor.p({
  222. pro: 17 / 100,
  223. border_back_color: "#f1f1f1",
  224. border_color: "#FFA500",
  225. content: "17"
  226. }),
  227. G: common_vendor.p({
  228. type: "forward",
  229. size: "25",
  230. color: "#858585"
  231. }),
  232. H: common_vendor.p({
  233. ["custom-prefix"]: "iconfont",
  234. type: "icon-xiangce",
  235. size: "20",
  236. color: "#333333"
  237. }),
  238. I: common_vendor.o(($event) => toInfo({
  239. route: "/pagesHome/team/album"
  240. })),
  241. J: common_vendor.f(list.value, (item, index, i0) => {
  242. var _a3, _b2, _c2, _d2, _e2, _f2;
  243. return common_vendor.e({
  244. a: common_vendor.t(common_vendor.unref(common_vendor.hooks)(item.startTime).format("MM-DD") || "暂无日期"),
  245. b: common_vendor.t(getDayOfWeek(item.startTime)),
  246. c: common_vendor.t(getStatus(item.status)),
  247. d: common_vendor.n(item.status == "0" ? "status0" : item.status == "1" ? "status1" : item.status == "2" ? "status2" : "status3"),
  248. e: item.type == "0"
  249. }, item.type == "0" ? {
  250. f: common_vendor.t(((_a3 = item == null ? void 0 : item.matchInfo) == null ? void 0 : _a3.title) || "友谊赛")
  251. } : {
  252. g: common_vendor.t(((_b2 = item == null ? void 0 : item.leagueInfo) == null ? void 0 : _b2.title) || "联赛")
  253. }, {
  254. h: common_vendor.t(((_c2 = item == null ? void 0 : item.redInfo) == null ? void 0 : _c2.name) || "暂无红方名称"),
  255. i: ((_d2 = item == null ? void 0 : item.redInfo) == null ? void 0 : _d2.logo) || config.value.logoUrl,
  256. j: common_vendor.t(item.redScore || 0),
  257. k: common_vendor.t(item.blueScore || 0),
  258. l: ((_e2 = item == null ? void 0 : item.blueInfo) == null ? void 0 : _e2.logo) || config.value.logoUrl,
  259. m: common_vendor.t(((_f2 = item == null ? void 0 : item.blueInfo) == null ? void 0 : _f2.name) || "暂无蓝方名称"),
  260. n: index,
  261. o: common_vendor.o(($event) => toActivity(item), index)
  262. });
  263. })
  264. });
  265. };
  266. }
  267. });
  268. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-b14ffc51"], ["__file", "D:/project/足球比赛/match_applet/pagesHome/team/info.vue"]]);
  269. wx.createPage(MiniProgramPage);