activity.js 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. "use strict";
  2. const common_vendor = require("../../../common/vendor.js");
  3. const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  4. __name: "activity",
  5. setup(__props) {
  6. const config = common_vendor.ref({ bottomTitle: "", logoUrl: "" });
  7. const searchInfo = common_vendor.ref({ name: "" });
  8. const list = common_vendor.ref([{ name: "测试球队" }, { 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. console.log(item);
  34. };
  35. const toPage = () => {
  36. if (total.value > list.value.length) {
  37. common_vendor.index.showLoading({
  38. title: "加载中",
  39. mask: true
  40. });
  41. page.value = page.value + 1;
  42. skip.value = page.value * limit.value;
  43. search();
  44. common_vendor.index.hideLoading();
  45. } else
  46. is_bottom.value = true;
  47. };
  48. const toScroll = (e) => {
  49. let up = scrollTop.value;
  50. scrollTop.value = e.detail.scrollTop;
  51. let num = Math.sign(up - e.detail.scrollTop);
  52. if (num == 1)
  53. is_bottom.value = false;
  54. };
  55. const clearPage = () => {
  56. list.value = [];
  57. skip.value = 0;
  58. limit.value = 6;
  59. page.value = 0;
  60. };
  61. return (_ctx, _cache) => {
  62. return common_vendor.e({
  63. a: common_vendor.o([($event) => searchInfo.value.name = $event.detail.value, toInput]),
  64. b: searchInfo.value.name,
  65. c: common_vendor.f(list.value, (item, index, i0) => {
  66. return {
  67. a: index
  68. };
  69. }),
  70. d: common_vendor.f(list.value, (item, index, i0) => {
  71. return {
  72. a: common_vendor.t(item.date || "暂无日期"),
  73. b: common_vendor.t(item.status_name || "暂无状态"),
  74. c: common_vendor.n(item.status == "0" ? "status0" : item.status == "1" ? "status1" : "status2"),
  75. d: common_vendor.t(item.name || "暂无活动名称"),
  76. e: common_vendor.t(item.red_name || "暂无红方名称"),
  77. f: item.red_logo || config.value.logoUrl,
  78. g: common_vendor.t(item.red_score || 0),
  79. h: common_vendor.t(item.blue_score || 0),
  80. i: item.blue_logo || config.value.logoUrl,
  81. j: common_vendor.t(item.blue_name || "暂无蓝方名称"),
  82. k: index,
  83. l: common_vendor.o(($event) => toInfo(item), index)
  84. };
  85. }),
  86. e: is_bottom.value
  87. }, is_bottom.value ? {
  88. f: common_vendor.t(config.value.bottomTitle || "到底了!")
  89. } : {}, {
  90. g: common_vendor.o(toPage),
  91. h: common_vendor.o(toScroll)
  92. });
  93. };
  94. }
  95. });
  96. const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-8f22acf3"], ["__file", "D:/project/足球比赛/match_applet/pages/home/components/activity.vue"]]);
  97. wx.createComponent(Component);