"use strict"; const common_vendor = require("../../common/vendor.js"); const common_assets = require("../../common/assets.js"); const _sfc_main = { __name: "index", setup(__props) { const currentTab = common_vendor.ref(0); const techList = common_vendor.ref([ { id: 1, title: "水稻高产栽培技术指南", description: "详解水稻种植关键技术要点,包括育苗、插秧、水肥管理等全过程技术要领", viewCount: "289", image: "https://img.freepik.com/free-photo/rice-field-with-beautiful-sky_74190-7490.jpg", type: "农技", contentType: "article", // 标记为文章类型 source: "农业技术研究院" }, { id: 2, title: "果树病虫害防治方案视频教学", description: "常见果树病虫害的识别方法、防治时期、用药指导,助您果园增产增收", viewCount: "856", image: "https://img.freepik.com/free-photo/apple-tree-with-ripe-red-apples_1150-9301.jpg", type: "农技", contentType: "video", // 标记为视频类型 duration: "15:32", source: "中国农业科技" }, { id: 3, title: "科学施肥技术指南", description: "解析不同作物的施肥特点,平衡施肥技术,提高肥料利用率", viewCount: "667", image: "https://img.freepik.com/free-photo/farmer-holding-chemical-fertilizer-field_1150-7167.jpg", type: "农技", contentType: "article", // 标记为文章类型 source: "农业知识库" } ]); const policyList = common_vendor.ref([ { id: 1, title: "2024年农业补贴政策要点解读", description: "最新农业补贴政策要点解读,包括种粮补贴、农机补贴等各项补贴申请指南", viewCount: "2,341", date: "05-23", image: "https://img.freepik.com/free-photo/modern-agricultural-machinery-field_1157-46386.jpg", type: "政策", contentType: "article", // 标记为文章类型 source: "农业部官方" }, { id: 2, title: "农业保险政策专家解析视频", description: "农业保险覆盖范围扩大,新增多项保障内容,理赔流程优化", viewCount: "1,856", date: "05-22", image: "https://img.freepik.com/free-photo/farmer-working-field_1157-46384.jpg", type: "政策", contentType: "video", // 标记为视频类型 duration: "28:45", source: "农业部政策宣讲" }, { id: 3, title: "绿色种植认证办理指南", description: "绿色种植认证最新申请流程及注意事项说明", viewCount: "1,667", date: "05-21", image: "https://img.freepik.com/free-photo/organic-farm-harvest_1157-46078.jpg", type: "政策", contentType: "article", // 标记为文章类型 source: "农业部认证中心" } ]); const isRefreshing = common_vendor.ref(false); const handleTabChange = (index) => { currentTab.value = index; common_vendor.index.__f__("log", "at pages/knowledge/index.vue:222", "Tab changed to:", index); }; const onRefresh = async () => { isRefreshing.value = true; try { await new Promise((resolve) => setTimeout(resolve, 1e3)); if (currentTab.value === 0) { common_vendor.index.__f__("log", "at pages/knowledge/index.vue:233", "刷新农技知识数据"); } else { common_vendor.index.__f__("log", "at pages/knowledge/index.vue:236", "刷新政策解读数据"); } } finally { isRefreshing.value = false; } }; const loadMore = () => { common_vendor.index.__f__("log", "at pages/knowledge/index.vue:245", "Loading more content"); if (currentTab.value === 0) { common_vendor.index.__f__("log", "at pages/knowledge/index.vue:249", "加载更多农技知识数据"); } else { common_vendor.index.__f__("log", "at pages/knowledge/index.vue:252", "加载更多政策解读数据"); } }; const navigateToAI = () => { common_vendor.index.navigateTo({ url: "/pages/ai-chat/index" }); }; common_vendor.onMounted(() => { common_vendor.index.__f__("log", "at pages/knowledge/index.vue:264", "Page mounted, current tab:", currentTab.value); }); return (_ctx, _cache) => { return common_vendor.e({ a: currentTab.value === 0 ? 1 : "", b: currentTab.value === 0 ? 1 : "", c: common_vendor.o(($event) => handleTabChange(0)), d: currentTab.value === 1 ? 1 : "", e: currentTab.value === 1 ? 1 : "", f: common_vendor.o(($event) => handleTabChange(1)), g: currentTab.value === 0 }, currentTab.value === 0 ? { h: common_vendor.f(techList.value, (item, index, i0) => { return common_vendor.e({ a: item.image, b: item.contentType === "video" }, item.contentType === "video" ? { c: common_vendor.t(item.duration || "35:56") } : {}, { d: common_vendor.t(item.title), e: common_vendor.t(item.source || "中国农业科技"), f: common_vendor.t(item.viewCount), g: index, h: `/pages/knowledge/detail?id=${item.id}&type=tech` }); }) } : {}, { i: currentTab.value === 1 }, currentTab.value === 1 ? { j: common_vendor.f(policyList.value, (item, index, i0) => { return common_vendor.e({ a: item.image, b: item.contentType === "video" }, item.contentType === "video" ? { c: common_vendor.t(item.duration || "28:32") } : {}, { d: common_vendor.t(item.title), e: common_vendor.t(item.source || "农业部官方"), f: common_vendor.t(item.viewCount), g: index, h: `/pages/knowledge/detail?id=${item.id}&type=policy` }); }) } : {}, { k: currentTab.value === 0 && techList.value.length === 0 || currentTab.value === 1 && policyList.value.length === 0 }, currentTab.value === 0 && techList.value.length === 0 || currentTab.value === 1 && policyList.value.length === 0 ? { l: common_assets._imports_0$1 } : {}, { m: common_vendor.o(loadMore), n: common_vendor.o(onRefresh), o: isRefreshing.value, p: common_assets._imports_0, q: common_vendor.o(navigateToAI) }); }; } }; const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-502b983e"]]); wx.createPage(MiniProgramPage); //# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/knowledge/index.js.map