index.js
6.17 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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
"use strict";
const common_vendor = require("../../common/vendor.js");
const common_train = require("../../common/train.js");
require("../../common/request.js");
require("../../config.js");
require("../../common/login.js");
require("../../common/api.js");
if (!Array) {
const _easycom_uni_search_bar2 = common_vendor.resolveComponent("uni-search-bar");
const _easycom_uni_data_select2 = common_vendor.resolveComponent("uni-data-select");
const _easycom_uni_section2 = common_vendor.resolveComponent("uni-section");
const _easycom_uni_load_more2 = common_vendor.resolveComponent("uni-load-more");
(_easycom_uni_search_bar2 + _easycom_uni_data_select2 + _easycom_uni_section2 + _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_data_select = () => "../../uni_modules/uni-data-select/components/uni-data-select/uni-data-select.js";
const _easycom_uni_section = () => "../../uni_modules/uni-section/components/uni-section/uni-section.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 + _easycom_uni_data_select + _easycom_uni_section + common_vendor.unref(uniList) + _easycom_uni_load_more)();
}
const uniList = () => "../../components/train/ulist/ulist.js";
const _sfc_main = {
__name: "index",
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);
const range = 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({
addForm: {},
contentText: {
contentdown: "",
contentrefresh: "加载中",
contentnomore: "没有更多"
}
});
const {
addForm,
contentText
} = common_vendor.toRefs(data);
common_vendor.onLoad((option) => {
initData();
});
async function initData() {
addForm.value.flag = current.value;
addForm.value.pageNum = 1;
addForm.value.pageSize = 10;
let res = await common_train.tainList(addForm.value);
list.value = res.rows;
total.value = res.rows;
}
function detail(item) {
let path = "/pages/train/detailPage/detailPage?item=" + encodeURIComponent(JSON.stringify(item));
common_vendor.index.navigateTo({
url: path
});
}
function nvaText(index) {
Nindex.value = index;
current.value = index;
initData();
console.log(index);
}
function filterTime(num) {
if (num)
return num.slice(0, 16);
}
function change(e) {
if (e) {
addForm.value.flag = e - 1;
current.value = e - 1;
Nindex.value = e - 1;
console.log(e);
initData();
}
}
function search(res) {
if (res.value != "") {
addForm.value.trainName = res.value;
initData();
}
}
function clear(res) {
addForm.value.trainName = "";
initData();
}
common_vendor.onPullDownRefresh(() => {
addForm.value.flag = 0;
initData();
common_vendor.wx$1.stopPullDownRefresh();
});
common_vendor.onReachBottom(async () => {
if (list.value.length == total.value) {
status.value = "noMore";
return false;
} else {
status.value = "loading";
addForm.value.pageNum += 1;
let res = await common_train.tainList(addForm.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(search),
b: common_vendor.o(_ctx.blur),
c: common_vendor.o(clear),
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.o(change),
g: common_vendor.o(($event) => name.value = $event),
h: common_vendor.p({
localdata: range.value,
clear: false,
placeholder: "全部",
modelValue: name.value
}),
i: common_vendor.p({
title: "",
type: "line"
}),
j: 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
};
}),
k: common_vendor.f(list.value, (item, k0, i0) => {
return {
a: "076cf674-3-" + i0,
b: common_vendor.p({
pic: item.cover,
title: item.trainName,
card: item.statusStr,
timer: filterTime(item.enrollEndStr)
}),
c: item.trainId,
d: common_vendor.o(($event) => detail(item), item.trainId)
};
}),
l: common_vendor.p({
status: status.value,
["content-text"]: common_vendor.unref(contentText)
})
};
};
}
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__file", "/Users/yangyang/project/j-mini/Venue/pages/train/index.vue"]]);
_sfc_main.__runtimeHooks = 6;
wx.createPage(MiniProgramPage);