index.js
3.1 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
"use strict";
var common_vendor = require("../../common/vendor.js");
var api_index = require("../../api/index.js");
require("../../utils/request.js");
if (!Array) {
const _easycom_u_navbar2 = common_vendor.resolveComponent("u-navbar");
_easycom_u_navbar2();
}
const _easycom_u_navbar = () => "../../uni_modules/uview-plus/components/u-navbar/u-navbar.js";
if (!Math) {
(_easycom_u_navbar + search + shops)();
}
const search = () => "../../componets/searchBox.js";
const shops = () => "../../componets/shops.js";
const _sfc_main = {
setup(__props) {
const lastPage = common_vendor.ref(1);
const curPage = common_vendor.ref(1);
common_vendor.onShow(() => {
curPage.value = 1;
data.recommendList.splice(0);
getIndexs();
});
const toRecharg = () => {
common_vendor.index.navigateTo({
url: "/pages/mine/recharge"
});
};
let data = common_vendor.reactive({
classList: [],
specialList: [],
recommendList: []
});
const jumpClass = (item) => {
common_vendor.index.setStorageSync("classId", item.id);
common_vendor.index.switchTab({ url: "/pages/class/class" });
};
const jumpClassHandler = () => common_vendor.index.switchTab({ url: "/pages/class/class" });
const toBargainPriceMoreHandler = () => common_vendor.index.navigateTo({ url: "/pages/index/bargainPrice" });
const getIndexs = async () => {
try {
const res = await api_index.getIndex({ page: curPage.value });
data.classList = res.fenlei;
data.specialList = res.tjgoods;
data.recommendList = data.recommendList.concat(res.goods.data);
console.log(data.recommendList, "\u63A8\u8350\u5546\u54C1");
console.log("getIndex", res);
lastPage.value = res.goods.last_page;
} catch (err) {
common_vendor.index.showToast({ title: err, icon: "none" });
console.log("getIndex", err);
}
};
common_vendor.onReachBottom(() => {
curPage.value++;
if (curPage.value >= lastPage.value)
return;
api_index.getIndex();
});
return (_ctx, _cache) => {
return {
a: common_vendor.p({
bgColor: "transparent"
}),
b: common_vendor.o(toRecharg),
c: common_vendor.f(common_vendor.unref(data).classList, (item, k0, i0) => {
return {
a: item.image,
b: common_vendor.t(item.name),
c: item.id,
d: common_vendor.o(($event) => jumpClass(item), item.id)
};
}),
d: common_vendor.o(jumpClassHandler),
e: common_vendor.o(toBargainPriceMoreHandler),
f: common_vendor.p({
list: common_vendor.unref(data).specialList.slice(0, 2),
shopWidth: 322,
shopHeight: 322
}),
g: common_vendor.p({
list: common_vendor.unref(data).recommendList,
shopWidth: 344,
shopHeight: 344
})
};
};
}
};
var MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__file", "D:/vue/\u5927\u5065\u5EB7\u5546\u57CE/healthMall/pages/index/index.vue"]]);
wx.createPage(MiniProgramPage);