index.js 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  4. __name: "index",
  5. setup(__props) {
  6. const config = common_vendor.ref({ bottomTitle: "", logoUrl: "" });
  7. const searchInfo = common_vendor.ref({ name: "" });
  8. const list = common_vendor.ref([{ id: 1, name: "测试球队" }, { id: 1, name: "肝帝集团队" }]);
  9. const skip = common_vendor.ref(0);
  10. const limit = common_vendor.ref(6);
  11. const page = common_vendor.ref(0);
  12. const total = common_vendor.ref(0);
  13. const scrollTop = common_vendor.ref(0);
  14. const is_bottom = common_vendor.ref(false);
  15. common_vendor.onShow(() => {
  16. searchConfig();
  17. search();
  18. });
  19. const searchConfig = async () => {
  20. config.value = common_vendor.index.getStorageSync("config");
  21. };
  22. const search = async () => {
  23. console.log("查询");
  24. };
  25. const toInput = (e) => {
  26. if (searchInfo.value.name)
  27. searchInfo.value.name = e.detail.value;
  28. searchInfo.value = { name: "" };
  29. clearPage();
  30. search();
  31. };
  32. const toInfo = (item) => {
  33. common_vendor.index.navigateTo({
  34. url: `/pagesHome/activity/info?id=${item._id || item.id}&name=${item.name}`
  35. });
  36. };
  37. const toPage = () => {
  38. if (total.value > list.value.length) {
  39. common_vendor.index.showLoading({
  40. title: "加载中",
  41. mask: true
  42. });
  43. page.value = page.value + 1;
  44. skip.value = page.value * limit.value;
  45. search();
  46. common_vendor.index.hideLoading();
  47. } else
  48. is_bottom.value = true;
  49. };
  50. const toScroll = (e) => {
  51. let up = scrollTop.value;
  52. scrollTop.value = e.detail.scrollTop;
  53. let num = Math.sign(up - e.detail.scrollTop);
  54. if (num == 1)
  55. is_bottom.value = false;
  56. };
  57. const clearPage = () => {
  58. list.value = [];
  59. skip.value = 0;
  60. limit.value = 6;
  61. };
  62. return (_ctx, _cache) => {
  63. return common_vendor.e({
  64. a: common_vendor.o([($event) => searchInfo.value.name = $event.detail.value, toInput]),
  65. b: searchInfo.value.name,
  66. c: common_vendor.f(list.value, (item, index, i0) => {
  67. return {
  68. a: index
  69. };
  70. }),
  71. d: common_vendor.f(list.value, (item, index, i0) => {
  72. return {
  73. a: common_vendor.t(item.date || "暂无日期"),
  74. b: common_vendor.t(item.status_name || "暂无状态"),
  75. c: common_vendor.n(item.status == "0" ? "status0" : item.status == "1" ? "status1" : "status2"),
  76. d: common_vendor.t(item.name || "暂无活动名称"),
  77. e: common_vendor.t(item.red_name || "暂无红方名称"),
  78. f: item.red_logo || config.value.logoUrl,
  79. g: common_vendor.t(item.red_score || 0),
  80. h: common_vendor.t(item.blue_score || 0),
  81. i: item.blue_logo || config.value.logoUrl,
  82. j: common_vendor.t(item.blue_name || "暂无蓝方名称"),
  83. k: index,
  84. l: common_vendor.o(($event) => toInfo(item), index)
  85. };
  86. }),
  87. e: is_bottom.value
  88. }, is_bottom.value ? {
  89. f: common_vendor.t(config.value.bottomTitle || "到底了!")
  90. } : {}, {
  91. g: common_vendor.o(toPage),
  92. h: common_vendor.o(toScroll)
  93. });
  94. };
  95. }
  96. });
  97. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-2863df91"], ["__file", "D:/project/足球比赛/match_applet/pagesHome/activity/index.vue"]]);
  98. wx.createPage(MiniProgramPage);