info.js 7.6 KB

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