gree_leran/unpackage/dist/dev/mp-weixin/pages/index/index.js

146 lines
4.8 KiB
JavaScript

"use strict";
const common_vendor = require("../../common/vendor.js");
if (!Array) {
const _easycom_up_search2 = common_vendor.resolveComponent("up-search");
const _easycom_up_swiper2 = common_vendor.resolveComponent("up-swiper");
const _easycom_up_grid_item2 = common_vendor.resolveComponent("up-grid-item");
const _easycom_up_grid2 = common_vendor.resolveComponent("up-grid");
const _easycom_up_text2 = common_vendor.resolveComponent("up-text");
const _easycom_CaseBox2 = common_vendor.resolveComponent("CaseBox");
const _easycom_up_loadmore2 = common_vendor.resolveComponent("up-loadmore");
(_easycom_up_search2 + _easycom_up_swiper2 + _easycom_up_grid_item2 + _easycom_up_grid2 + _easycom_up_text2 + _easycom_CaseBox2 + _easycom_up_loadmore2)();
}
const _easycom_up_search = () => "../../node-modules/uview-plus/components/u-search/u-search.js";
const _easycom_up_swiper = () => "../../node-modules/uview-plus/components/u-swiper/u-swiper.js";
const _easycom_up_grid_item = () => "../../node-modules/uview-plus/components/u-grid-item/u-grid-item.js";
const _easycom_up_grid = () => "../../node-modules/uview-plus/components/u-grid/u-grid.js";
const _easycom_up_text = () => "../../node-modules/uview-plus/components/u-text/u-text.js";
const _easycom_CaseBox = () => "../../components/CaseBox/CaseBox.js";
const _easycom_up_loadmore = () => "../../node-modules/uview-plus/components/u-loadmore/u-loadmore.js";
if (!Math) {
(_easycom_up_search + _easycom_up_swiper + _easycom_up_grid_item + _easycom_up_grid + _easycom_up_text + _easycom_CaseBox + _easycom_up_loadmore)();
}
const _sfc_main = {
__name: "index",
setup(__props) {
const swipe = common_vendor.reactive([
"/static/stu.png"
]);
const caseList = common_vendor.ref([
{},
{},
{}
]);
const isLoading = common_vendor.ref(false);
const status = common_vendor.ref("more");
const loadMore = async () => {
console.log("加载更多...");
status.value = "loading";
if (isLoading.value)
return;
isLoading.value = true;
await fetchCases();
caseList.value.push({});
caseList.value.push({});
caseList.value.push({});
caseList.value.push({});
console.log("加载更多2...");
isLoading.value = false;
status.value = "nomore";
console.log("加载更多2...");
};
const fetchCases = () => {
return new Promise((resolve) => {
setTimeout(() => {
const newCases = [
{ id: 1, title: "Case 1" },
{ id: 2, title: "Case 2" }
];
resolve(newCases);
}, 1e3);
});
};
const toTop = () => {
common_vendor.index.pageScrollTo({
scrollTop: 0,
duration: 300
});
};
const baseList = common_vendor.ref([
{
src: "/static/icon/video.png",
title: "视频",
url: "/pages/video/video"
},
{
src: "/static/icon/talk.png",
title: "讨论",
url: "/pages/discuss/discuss"
},
{
src: "/static/icon/score.png",
title: "积分",
url: "/pages/intergral/intergral"
},
{
src: "/static/icon/me.png",
title: "我的"
}
]);
function NavicatToBaseItems(item) {
common_vendor.index.navigateTo({
url: item.url
});
}
return (_ctx, _cache) => {
return common_vendor.e({
a: common_vendor.o(($event) => _ctx.keyword = $event),
b: common_vendor.p({
placeholder: "日照香炉生紫烟",
clearabled: true,
animation: "false",
modelValue: _ctx.keyword
}),
c: common_vendor.p({
height: "150",
list: swipe
}),
d: common_vendor.f(baseList.value, (baseListItem, baseListIndex, i0) => {
return {
a: baseListItem.src,
b: common_vendor.t(baseListItem.title),
c: baseListIndex,
d: common_vendor.o(($event) => NavicatToBaseItems(baseListItem), baseListIndex),
e: "adbc9592-3-" + i0 + ",adbc9592-2"
};
}),
e: common_vendor.p({
border: false,
col: "4"
}),
f: common_vendor.p({
margin: "1em",
type: "primary",
text: "新闻"
}),
g: common_vendor.o(toTop),
h: common_vendor.f(caseList.value, (item, index, i0) => {
return {
a: "adbc9592-5-" + i0,
b: index
};
}),
i: isLoading.value
}, isLoading.value ? {
j: common_vendor.p({
status: status.value
})
} : {}, {
k: common_vendor.o(loadMore)
});
};
}
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__file", "D:/uniapp1/gree_leran/pages/index/index.vue"]]);
wx.createPage(MiniProgramPage);