activity.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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: item.logo || config.value.logoUrl,
  68. b: common_vendor.t(item.name || "暂无名称"),
  69. c: common_vendor.t(item.label || "成员"),
  70. d: common_vendor.n(item.user_type == "0" ? "label_1" : "label_2"),
  71. e: common_vendor.t(item.activity || "暂无活动"),
  72. f: index,
  73. g: common_vendor.o(($event) => toInfo(item), index)
  74. };
  75. }),
  76. d: is_bottom.value
  77. }, is_bottom.value ? {
  78. e: common_vendor.t(config.value.bottomTitle || "到底了!")
  79. } : {}, {
  80. f: common_vendor.o(toPage),
  81. g: common_vendor.o(toScroll)
  82. });
  83. };
  84. }
  85. });
  86. const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-8f22acf3"], ["__file", "D:/project/足球比赛/match_applet/pages/home/components/activity.vue"]]);
  87. wx.createComponent(Component);