info.js 9.4 KB

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