trainList.js
4.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
"use strict";
const common_vendor = require("../common/vendor.js");
const config = require("../config.js");
const training_train = require("./train.js");
require("../common/request.js");
require("../common/login.js");
require("../common/aes.js");
if (!Array) {
const _easycom_uni_search_bar2 = common_vendor.resolveComponent("uni-search-bar");
const _easycom_uni_load_more2 = common_vendor.resolveComponent("uni-load-more");
(_easycom_uni_search_bar2 + _easycom_uni_load_more2)();
}
const _easycom_uni_search_bar = () => "../uni_modules/uni-search-bar/components/uni-search-bar/uni-search-bar.js";
const _easycom_uni_load_more = () => "../uni_modules/uni-load-more/components/uni-load-more/uni-load-more.js";
if (!Math) {
(_easycom_uni_search_bar + common_vendor.unref(uniList) + _easycom_uni_load_more)();
}
const uniList = () => "./components/ulist/ulist.js";
const _sfc_main = {
__name: "trainList",
setup(__props) {
common_vendor.ref();
const items = common_vendor.ref(["全部", "报名中", "培训进行中", "已结束"]);
const current = common_vendor.ref(0);
const name = common_vendor.ref();
const Nindex = common_vendor.ref(0);
common_vendor.ref([
{
value: 1,
text: "全部"
},
{
value: 2,
text: "报名中"
},
{
value: 3,
text: "进行中"
},
{
value: 4,
text: "即将开始"
},
{
value: 5,
text: "报名未开始"
},
{
value: 6,
text: "培训未开始"
},
{
value: 7,
text: "已结束"
}
]);
const list = common_vendor.ref();
const total = common_vendor.ref();
const status = common_vendor.ref("more");
common_vendor.ref();
const data = common_vendor.reactive({
query: {
flag: "",
pageSize: 10,
pageNum: 1
},
contentText: {
contentdown: "",
contentrefresh: "加载中",
contentnomore: "没有更多"
}
});
const {
query,
contentText
} = common_vendor.toRefs(data);
common_vendor.onLoad((option) => {
initData();
});
function initData() {
query.value.flag = current.value;
training_train.getTrainList(query.value).then((res) => {
list.value = res.rows;
total.value = res.total;
});
}
function detail(item) {
let path = `/training/detailPage?trainId=${item.id}`;
common_vendor.index.navigateTo({
url: path
});
}
function nvaText(index) {
Nindex.value = index;
current.value = index;
initData();
console.log(index);
}
common_vendor.onPullDownRefresh(() => {
query.value.flag = 0;
initData();
common_vendor.wx$1.stopPullDownRefresh();
});
common_vendor.onReachBottom(async () => {
console.log(list.value.length, total.value);
if (list.value.length >= total.value) {
status.value = "noMore";
return false;
} else {
status.value = "loading";
query.value.pageNum += 1;
let res = await training_train.getTrainList(query.value);
let arr = res.rows;
list.value = list.value.concat(arr);
total.value = res.total;
status.value = "noMore";
}
});
return (_ctx, _cache) => {
return {
a: common_vendor.o(initData),
b: common_vendor.o(initData),
c: common_vendor.o(initData),
d: common_vendor.o(($event) => name.value = $event),
e: common_vendor.p({
radius: "30",
placeholder: "搜索",
clearButton: "auto",
Button: "none",
cancelText: "",
bgColor: "#F4F6FA",
modelValue: name.value
}),
f: common_vendor.f(items.value, (item, index, i0) => {
return {
a: common_vendor.t(item),
b: common_vendor.o(($event) => nvaText(index), index),
c: Nindex.value == index ? 1 : "",
d: index
};
}),
g: common_vendor.f(list.value, (item, k0, i0) => {
return {
a: "75917cce-1-" + i0,
b: common_vendor.p({
pic: common_vendor.unref(config.config).trainUrl_api + item.cover.replaceAll("\\", "/"),
title: item.name,
card: item.signStatusStr,
tags: item.projectsStr,
timer: item.signTimeRange
}),
c: item.trainId,
d: common_vendor.o(($event) => detail(item), item.trainId)
};
}),
h: common_vendor.p({
status: status.value,
["content-text"]: common_vendor.unref(contentText)
})
};
};
}
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__file", "/Users/yangyang/ztx_wx_minapp/training/trainList.vue"]]);
_sfc_main.__runtimeHooks = 6;
wx.createPage(MiniProgramPage);