"use strict";
|
const common_vendor = require("../../common/vendor.js");
|
if (!Array) {
|
const _easycom_uni_load_more2 = common_vendor.resolveComponent("uni-load-more");
|
_easycom_uni_load_more2();
|
}
|
const _easycom_uni_load_more = () => "../../node-modules/@dcloudio/uni-ui/lib/uni-load-more/uni-load-more.js";
|
if (!Math) {
|
_easycom_uni_load_more();
|
}
|
const _sfc_main = {
|
__name: "list",
|
setup(__props) {
|
const categories = [
|
{ value: "all", name: "全部" },
|
{ value: "notice", name: "通知公告" },
|
{ value: "health", name: "健康科普" },
|
{ value: "service", name: "就医服务" },
|
{ value: "special", name: "专科介绍" },
|
{ value: "expert", name: "专家风采" }
|
];
|
const currentCategory = common_vendor.ref("all");
|
const newsList = common_vendor.ref([
|
{
|
id: 1,
|
type: "large",
|
title: "青岛镜湖医院引进最新达芬奇手术机器人,提升微创手术水平",
|
image: "/static/news/news1.jpg",
|
tag: "医院动态",
|
time: "2024-03-25",
|
views: 1580
|
},
|
{
|
id: 2,
|
title: "春季养生指南:中医专家教你调理身体",
|
description: "春季养生重在养肝,专家建议从饮食、运动等多方面入手,助您轻松养生。",
|
image: "/static/news/news2.jpg",
|
tag: "健康科普",
|
time: "2024-03-24",
|
views: 2360
|
},
|
{
|
id: 3,
|
type: "large",
|
title: '医院举办"世界睡眠日"主题义诊活动',
|
image: "/static/news/news3.jpg",
|
tag: "活动资讯",
|
time: "2024-03-23",
|
views: 986
|
}
|
]);
|
const refreshing = common_vendor.ref(false);
|
const loadMoreStatus = common_vendor.ref("more");
|
const selectCategory = (category) => {
|
currentCategory.value = category;
|
refreshing.value = true;
|
setTimeout(() => {
|
refreshing.value = false;
|
}, 1e3);
|
};
|
const onRefresh = () => {
|
setTimeout(() => {
|
refreshing.value = false;
|
}, 1e3);
|
};
|
const loadMore = () => {
|
if (loadMoreStatus.value !== "more")
|
return;
|
loadMoreStatus.value = "loading";
|
setTimeout(() => {
|
loadMoreStatus.value = "noMore";
|
}, 1e3);
|
};
|
const viewNews = (news) => {
|
common_vendor.index.navigateTo({
|
url: `/pages/news/detail?id=${news.id}`
|
});
|
};
|
return (_ctx, _cache) => {
|
return {
|
a: common_vendor.f(categories, (item, index, i0) => {
|
return {
|
a: common_vendor.t(item.name),
|
b: index,
|
c: currentCategory.value === item.value ? 1 : "",
|
d: common_vendor.o(($event) => selectCategory(item.value), index)
|
};
|
}),
|
b: common_vendor.f(newsList.value, (item, index, i0) => {
|
return common_vendor.e({
|
a: item.type === "large"
|
}, item.type === "large" ? common_vendor.e({
|
b: item.image,
|
c: common_vendor.t(item.title),
|
d: item.tag
|
}, item.tag ? {
|
e: common_vendor.t(item.tag)
|
} : {}, {
|
f: common_vendor.t(item.time),
|
g: common_vendor.t(item.views)
|
}) : common_vendor.e({
|
h: common_vendor.t(item.title),
|
i: common_vendor.t(item.description),
|
j: item.tag
|
}, item.tag ? {
|
k: common_vendor.t(item.tag)
|
} : {}, {
|
l: common_vendor.t(item.time),
|
m: common_vendor.t(item.views),
|
n: item.image
|
}), {
|
o: index,
|
p: common_vendor.o(($event) => viewNews(item), index)
|
});
|
}),
|
c: common_vendor.p({
|
status: loadMoreStatus.value,
|
["content-text"]: {
|
contentdown: "上拉加载更多",
|
contentrefresh: "加载中...",
|
contentnomore: "没有更多了"
|
}
|
}),
|
d: refreshing.value,
|
e: common_vendor.o(onRefresh),
|
f: common_vendor.o(loadMore),
|
g: common_vendor.gei(_ctx, "")
|
};
|
};
|
}
|
};
|
wx.createPage(_sfc_main);
|
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/news/list.js.map
|