diff --git a/app.json b/app.json
index 3d899bb..1505b19 100644
--- a/app.json
+++ b/app.json
@@ -24,7 +24,9 @@
{
"root": "pagesB",
"pages": [
- "pages/repository/repository"
+ "pages/repository/repository",
+ "pages/training/training",
+ "pages/policyElucidation/policyElucidation"
],
"independent": true
}
diff --git a/pages/home/home.js b/pages/home/home.js
index a00964a..a47f4a1 100644
--- a/pages/home/home.js
+++ b/pages/home/home.js
@@ -74,6 +74,20 @@ Page({
})
},
+ // 在线培训
+ bindPx(){
+ wx.navigateTo({
+ url: '/pagesB/pages/training/training',
+ })
+ },
+
+ // 政策解读
+ bindJd(){
+ wx.navigateTo({
+ url: '/pagesB/pages/policyElucidation/policyElucidation',
+ })
+ },
+
//获取当前位置信息
getLocation() {
diff --git a/pages/home/home.wxml b/pages/home/home.wxml
index 788dd09..eb1f912 100644
--- a/pages/home/home.wxml
+++ b/pages/home/home.wxml
@@ -64,11 +64,11 @@
养殖知识库
快速查询养殖知识
-
+
在线培训
提高养殖技能
-
+
政策解读
提供政策指导
diff --git a/pagesA/images/amxl.png b/pagesA/images/amxl.png
deleted file mode 100644
index 6e24ef8..0000000
Binary files a/pagesA/images/amxl.png and /dev/null differ
diff --git a/pagesA/images/blf.png b/pagesA/images/blf.png
deleted file mode 100644
index 6a3836c..0000000
Binary files a/pagesA/images/blf.png and /dev/null differ
diff --git a/pagesA/images/lh.png b/pagesA/images/lh.png
deleted file mode 100644
index 2220243..0000000
Binary files a/pagesA/images/lh.png and /dev/null differ
diff --git a/pagesA/images/wc.png b/pagesA/images/wc.png
deleted file mode 100644
index 459d89e..0000000
Binary files a/pagesA/images/wc.png and /dev/null differ
diff --git a/pagesA/pages/medicine/medicine.js b/pagesA/pages/medicine/medicine.js
index c3ae8a3..c53b176 100644
--- a/pagesA/pages/medicine/medicine.js
+++ b/pagesA/pages/medicine/medicine.js
@@ -1,25 +1,22 @@
+import http from '../../../utils/api'
+const baseUr = require('../../../utils/baseUrl')
+
Page({
data: {
- // 原始药品列表数据
- medicineList: [],
- // 筛选后的列表
+ // 药品列表数据
filteredList: [],
-
// 搜索相关
searchKeyword: '',
-
// 筛选相关
- currentCategory: 'all',
+ currentCategory: '全部',
+ baseUr: baseUr,
// 分页相关
- page: 1,
- pageSize: 12,
+ pageNum: 1,
+ pageSize: 10,
hasMore: true,
loading: false,
-
- // 弹窗控制
- showDetailModal: false,
- currentMedicine: null,
+ isRefreshing: false,
// 滚动相关
showBackToTop: false,
@@ -27,7 +24,8 @@ Page({
},
onLoad: function() {
- this.initData();
+ // 初始化加载数据
+ this.resetListAndLoad();
},
onShow: function() {
@@ -57,556 +55,175 @@ Page({
this.setData({ scrollTop: e.scrollTop });
},
-
- // 初始化数据
- initData: function() {
- const mockData = this.getMockData();
- this.setData({
- medicineList: mockData,
- filteredList: mockData
+
+ /**
+ * 获取药品列表数据
+ * @param {number} pageNum - 页码
+ * @param {boolean} isLoadMore - 是否为加载更多
+ * @param {string} searchKeywords - 搜索关键词
+ * @param {string} medicineType - 药品类型筛选
+ */
+ getRecommendationList: function(pageNum = 1, isLoadMore = false, searchKeywords = '', medicineType = '') {
+ // 如果正在加载,防止重复请求
+ if (this.data.loading) return;
+
+ this.setData({
+ loading: true,
+ pageNum: pageNum
});
- },
-
- // 获取模拟数据
- getMockData: function() {
- return [
- {
- id: 1,
- name: "阿莫西林胶囊",
- manufacturer: "华北制药股份有限公司",
- specification: "0.25g*24粒/盒",
- category: "prescription",
- categoryText: "处方药",
- indication: "用于敏感菌所致的呼吸道感染、泌尿系统感染等",
- price: 25.8,
- originalPrice: 32.0,
- isHot: true,
- salesCount: 1280,
- stock: 150,
- image: "https://via.placeholder.com/300x300/3a7ff3/ffffff?text=阿莫西林",
-
- expert: {
- name: "张明华",
- title: "主任医师",
- hospital: "北京协和医院",
- avatar: "https://via.placeholder.com/100x100/3a7ff3/ffffff?text=张",
- reason: "本品为广谱抗生素,对多数革兰氏阳性菌和革兰氏阴性菌均有良好的抗菌作用,是临床常用的一线抗生素。",
- expertise: "呼吸内科",
- years: 15,
- recommendTime: "2024-01-15"
- },
-
- store: {
- name: "仁和堂大药房",
- address: "北京市朝阳区建国路88号",
- phone: "010-88888888",
- businessHours: "8:00-22:00",
- features: "24小时营业,专业药师咨询,医保定点药店",
- distance: "1.2",
- latitude: 39.9042,
- longitude: 116.4074,
- rating: 4.8,
- images: [
- "https://via.placeholder.com/400x300/4CAF50/ffffff?text=药店外观",
- "https://via.placeholder.com/400x300/2196F3/ffffff?text=店内环境"
- ]
- },
-
- details: {
- usage: "口服。成人一次0.5g,每6~8小时1次,一日剂量不超过4g。",
- precautions: "青霉素过敏者禁用,用药期间可能出现腹泻、恶心等胃肠道反应。",
- storage: "密封,在干燥处保存。",
- validity: "24个月"
- }
- },
- {
- id: 2,
- name: "连花清瘟胶囊",
- manufacturer: "石家庄以岭药业股份有限公司",
- specification: "0.35g*24粒/盒",
- category: "chinese",
- categoryText: "中成药",
- indication: "用于治疗流行性感冒属热毒袭肺证",
- price: 28.5,
- originalPrice: 35.0,
- isHot: true,
- salesCount: 2560,
- stock: 89,
- image: "https://via.placeholder.com/300x300/4CAF50/ffffff?text=连花清瘟",
-
- expert: {
- name: "李芳",
- title: "副主任医师",
- hospital: "上海瑞金医院",
- avatar: "https://via.placeholder.com/100x100/4CAF50/ffffff?text=李",
- reason: "在新冠肺炎疫情防控中显示出良好效果,具有清瘟解毒、宣肺泄热的功效,适用于流感治疗。",
- expertise: "中医科",
- years: 12,
- recommendTime: "2024-01-14"
- },
-
- store: {
- name: "同济堂药店",
- address: "上海市黄浦区南京东路100号",
- phone: "021-66666666",
- businessHours: "9:00-21:00",
- features: "中药配方齐全,提供代煎服务,老字号药店",
- distance: "2.5",
- latitude: 31.2304,
- longitude: 121.4737,
- rating: 4.7,
- images: [
- "https://via.placeholder.com/400x300/FF9800/ffffff?text=中药柜台"
- ]
- },
-
- details: {
- usage: "口服。一次4粒,一日3次。",
- precautions: "风寒感冒者不适用,高血压、心脏病患者慎用。",
- storage: "密封,置阴凉干燥处。",
- validity: "36个月"
- }
- },
- {
- id: 3,
- name: "维生素C片",
- manufacturer: "养生堂药业有限公司",
- specification: "100mg*60片/瓶",
- category: "health",
- categoryText: "保健品",
- indication: "用于预防和治疗维生素C缺乏症",
- price: 18.9,
- originalPrice: 24.0,
- isHot: false,
- salesCount: 890,
- stock: 320,
- image: "https://via.placeholder.com/300x300/FF9800/ffffff?text=维生素C",
-
- expert: {
- name: "王建国",
- title: "执业药师",
- hospital: "广州中医药大学附属医院",
- avatar: "https://via.placeholder.com/100x100/FF9800/ffffff?text=王",
- reason: "增强免疫力,促进铁吸收,抗氧化作用明显,适合日常保健和预防感冒。",
- expertise: "临床药学",
- years: 8,
- recommendTime: "2024-01-13"
- },
-
- store: {
- name: "老百姓大药房",
- address: "广州市天河区体育西路189号",
- phone: "020-77777777",
- businessHours: "7:30-23:00",
- features: "连锁品牌,价格实惠,会员优惠,支持医保",
- distance: "0.8",
- latitude: 23.1358,
- longitude: 113.3269,
- rating: 4.6,
- images: []
- },
-
- details: {
- usage: "口服。成人一次1片,一日1次。",
- precautions: "不宜长期过量服用,肾功能不全者慎用。",
- storage: "避光,密封保存。",
- validity: "24个月"
- }
- },
- {
- id: 4,
- name: "布洛芬缓释胶囊",
- manufacturer: "中美天津史克制药有限公司",
- specification: "0.3g*20粒/盒",
- category: "otc",
- categoryText: "非处方药",
- indication: "用于缓解轻至中度疼痛如头痛、关节痛、偏头痛等",
- price: 22.5,
- originalPrice: 28.0,
- isHot: true,
- salesCount: 1870,
- stock: 120,
- image: "https://via.placeholder.com/300x300/9C27B0/ffffff?text=布洛芬",
-
- expert: {
- name: "陈晓东",
- title: "主任医师",
- hospital: "武汉同济医院",
- avatar: "https://via.placeholder.com/100x100/9C27B0/ffffff?text=陈",
- reason: "解热镇痛效果确切,缓释剂型作用持久,胃肠道刺激小,适合各种疼痛的缓解。",
- expertise: "疼痛科",
- years: 20,
- recommendTime: "2024-01-12"
- },
-
- store: {
- name: "九州通大药房",
- address: "武汉市江汉区解放大道688号",
- phone: "027-55555555",
- businessHours: "8:30-21:30",
- features: "药品齐全,支持线上订购,送货上门",
- distance: "3.2",
- latitude: 30.5928,
- longitude: 114.3052,
- rating: 4.9,
- images: [
- "https://via.placeholder.com/400x300/3F51B5/ffffff?text=现代药店",
- "https://via.placeholder.com/400x300/E91E63/ffffff?text=专业服务"
- ]
- },
-
- details: {
- usage: "口服。成人一次1粒,一日2次。",
- precautions: "胃肠道溃疡患者禁用,不宜长期服用。",
- storage: "密封,在阴凉干燥处保存。",
- validity: "36个月"
- }
- },
- {
- id: 5,
- name: "盐酸左氧氟沙星片",
- manufacturer: "浙江医药股份有限公司",
- specification: "0.5g*6片/盒",
- category: "prescription",
- categoryText: "处方药",
- indication: "用于敏感细菌引起的呼吸系统、泌尿系统感染",
- price: 42.8,
- originalPrice: 56.0,
- isHot: false,
- salesCount: 560,
- stock: 75,
- image: "https://via.placeholder.com/300x300/2196F3/ffffff?text=左氧氟沙星",
-
- expert: {
- name: "刘涛",
- title: "副主任医师",
- hospital: "南京鼓楼医院",
- avatar: "https://via.placeholder.com/100x100/2196F3/ffffff?text=刘",
- reason: "抗菌谱广,对多种革兰氏阴性菌和阳性菌有效,特别适用于泌尿系统感染的治疗。",
- expertise: "泌尿外科",
- years: 10,
- recommendTime: "2024-01-11"
- },
-
- store: {
- name: "金陵大药房",
- address: "南京市鼓楼区中山路321号",
- phone: "025-44444444",
- businessHours: "8:00-21:00",
- features: "专业处方药房,药师驻店咨询",
- distance: "1.8",
- latitude: 32.0603,
- longitude: 118.7969,
- rating: 4.5,
- images: []
- },
-
- details: {
- usage: "口服。一次1片,一日1次。",
- precautions: "18岁以下患者禁用,孕妇及哺乳期妇女禁用。",
- storage: "遮光,密封保存。",
- validity: "24个月"
+
+ // 构建请求参数
+ const params = {
+ pageNum: pageNum,
+ pageSize: this.data.pageSize,
+ searchKeywords: searchKeywords || this.data.searchKeyword
+ };
+
+ // 添加药品类型筛选(如果不是"全部")
+ if (medicineType && medicineType !== '全部') {
+ params.medicineType = medicineType;
+ } else if (this.data.currentCategory && this.data.currentCategory !== '全部') {
+ params.medicineType = this.data.currentCategory;
+ }
+
+ http.recommendationList({
+ data: params,
+ success: res => {
+ const newData = res.rows || [];
+ const total = res.total || 0;
+
+ // 计算是否还有更多数据
+ const hasMore = newData.length >= this.data.pageSize &&
+ (this.data.filteredList.length + newData.length) < total;
+
+ if (isLoadMore) {
+ // 加载更多:追加数据
+ this.setData({
+ filteredList: [...this.data.filteredList, ...newData],
+ hasMore: hasMore,
+ loading: false
+ });
+ } else {
+ // 刷新或首次加载:替换数据
+ this.setData({
+ filteredList: newData,
+ hasMore: hasMore,
+ loading: false
+ });
}
- },
- {
- id: 6,
- name: "板蓝根颗粒",
- manufacturer: "广州白云山和记黄埔中药有限公司",
- specification: "10g*20袋/盒",
- category: "chinese",
- categoryText: "中成药",
- indication: "清热解毒,凉血利咽,用于肺胃热盛所致的咽喉肿痛",
- price: 15.9,
- originalPrice: 19.9,
- isHot: true,
- salesCount: 3200,
- stock: 450,
- image: "https://via.placeholder.com/300x300/FF5722/ffffff?text=板蓝根",
-
- expert: {
- name: "孙丽",
- title: "主治医师",
- hospital: "成都中医药大学附属医院",
- avatar: "https://via.placeholder.com/100x100/FF5722/ffffff?text=孙",
- reason: "传统经典方剂,清热解毒效果显著,特别适合预防和治疗感冒初期症状。",
- expertise: "中医内科",
- years: 6,
- recommendTime: "2024-01-10"
- },
- store: {
- name: "康恩贝大药房",
- address: "成都市锦江区春熙路58号",
- phone: "028-33333333",
- businessHours: "9:00-22:00",
- features: "连锁品牌,中药西药齐全",
- distance: "0.5",
- latitude: 30.6578,
- longitude: 104.0657,
- rating: 4.4,
- images: []
- },
-
- details: {
- usage: "开水冲服。一次1袋,一日3次。",
- precautions: "风寒感冒者不适用,糖尿病患者慎用。",
- storage: "密封,防潮。",
- validity: "36个月"
+ // 停止下拉刷新
+ if (this.data.isRefreshing) {
+ wx.stopPullDownRefresh();
+ this.setData({ isRefreshing: false });
}
- },
- {
- id: 7,
- name: "复方甘草片",
- manufacturer: "北京双鹤药业股份有限公司",
- specification: "100片/瓶",
- category: "prescription",
- categoryText: "处方药",
- indication: "用于镇咳祛痰,适用于感冒咳嗽",
- price: 12.5,
- originalPrice: 16.0,
- isHot: false,
- salesCount: 780,
- stock: 200,
- image: "https://via.placeholder.com/300x300/673AB7/ffffff?text=甘草片",
-
- expert: {
- name: "赵国强",
- title: "主任医师",
- hospital: "天津医科大学总医院",
- avatar: "https://via.placeholder.com/100x100/673AB7/ffffff?text=赵",
- reason: "传统止咳良药,镇咳祛痰效果确切,价格实惠,适合普通感冒咳嗽。",
- expertise: "呼吸内科",
- years: 18,
- recommendTime: "2024-01-09"
- },
- store: {
- name: "天津医药大药房",
- address: "天津市和平区南京路128号",
- phone: "022-22222222",
- businessHours: "8:00-21:30",
- features: "国营药店,药品质量有保障",
- distance: "2.0",
- latitude: 39.1172,
- longitude: 117.2056,
- rating: 4.3,
- images: []
- },
-
- details: {
- usage: "口服。一次3-4片,一日3次。",
- precautions: "不宜长期服用,孕妇及哺乳期妇女慎用。",
- storage: "密封,在干燥处保存。",
- validity: "36个月"
- }
+ console.log('加载成功,当前数据量:', this.data.filteredList.length, '是否有更多:', hasMore);
},
- {
- id: 8,
- name: "葡萄糖酸钙口服液",
- manufacturer: "哈药集团制药六厂",
- specification: "10ml*12支/盒",
- category: "otc",
- categoryText: "非处方药",
- indication: "用于预防和治疗钙缺乏症",
- price: 35.0,
- originalPrice: 42.0,
- isHot: true,
- salesCount: 1560,
- stock: 180,
- image: "https://via.placeholder.com/300x300/00BCD4/ffffff?text=葡萄糖酸钙",
-
- expert: {
- name: "周敏",
- title: "副主任医师",
- hospital: "西安交通大学第一附属医院",
- avatar: "https://via.placeholder.com/100x100/00BCD4/ffffff?text=周",
- reason: "钙吸收好,口感适宜,特别适合儿童、孕妇和老年人补钙。",
- expertise: "儿科",
- years: 14,
- recommendTime: "2024-01-08"
- },
-
- store: {
- name: "西安医药大药房",
- address: "西安市碑林区南大街58号",
- phone: "029-11111111",
- businessHours: "8:30-21:00",
- features: "专业儿科用药,儿童健康咨询",
- distance: "1.5",
- latitude: 34.2583,
- longitude: 108.9426,
- rating: 4.7,
- images: []
- },
+ fail: err => {
+ console.error('加载数据失败:', err);
+ wx.showToast({
+ title: '加载失败',
+ icon: 'none'
+ });
+ this.setData({
+ loading: false,
+ isRefreshing: false
+ });
- details: {
- usage: "口服。一次1-2支,一日3次。",
- precautions: "肾功能不全者慎用,不宜与洋地黄类药物同时使用。",
- storage: "密封,置阴凉处。",
- validity: "24个月"
- }
+ // 停止下拉刷新
+ wx.stopPullDownRefresh();
}
- ];
+ });
},
-
- // 获取简短文本(修复undefined问题)
- getShortText: function(text, maxLength) {
- if (!text || typeof text !== 'string') {
- return '';
- }
- if (text.length <= maxLength) {
- return text;
- }
- return text.substring(0, maxLength) + '...';
+
+ /**
+ * 重置列表并加载第一页
+ */
+ resetListAndLoad: function() {
+ this.setData({
+ pageNum: 1,
+ hasMore: true,
+ filteredList: []
+ }, () => {
+ this.getRecommendationList(1, false);
+ });
},
-
- // 搜索输入处理(输入时自动搜索)
+
+ /**
+ * 刷新列表(第一页)
+ */
+ refreshList: function() {
+ this.setData({
+ pageNum: 1,
+ hasMore: true,
+ isRefreshing: true
+ });
+ this.getRecommendationList(1, false);
+ },
+
+ /**
+ * 加载更多数据
+ */
+ loadMore: function() {
+ if (!this.data.hasMore || this.data.loading) return;
+
+ const nextPage = this.data.pageNum + 1;
+ this.getRecommendationList(nextPage, true);
+ },
+
+ /**
+ * 搜索输入处理
+ */
onSearchInput: function(e) {
- const keyword = e.detail.value;
+ const keyword = e.detail.value.trim();
this.setData({
searchKeyword: keyword
}, () => {
- // 输入后立即执行筛选
- this.filterList();
+ // 防抖处理,避免频繁请求
+ clearTimeout(this.searchTimer);
+ this.searchTimer = setTimeout(() => {
+ this.resetListAndLoad();
+ }, 500);
});
},
-
- // 清除搜索
+
+ /**
+ * 清除搜索
+ */
clearSearch: function() {
this.setData({
searchKeyword: ''
}, () => {
- this.filterList();
+ this.resetListAndLoad();
});
},
-
- // 分类筛选切换
+
+ /**
+ * 分类筛选切换
+ */
onCategoryChange: function(e) {
const category = e.currentTarget.dataset.category;
this.setData({
currentCategory: category
}, () => {
- this.filterList();
+ this.resetListAndLoad();
});
},
-
- // 筛选列表
- filterList: function() {
- const { searchKeyword, currentCategory, medicineList } = this.data;
- let filteredList = [...medicineList];
-
- // 搜索筛选
- if (searchKeyword && searchKeyword.trim()) {
- const keyword = searchKeyword.trim().toLowerCase();
- filteredList = filteredList.filter(item => {
- // 搜索药品名称
- if (item.name && item.name.toLowerCase().includes(keyword)) {
- return true;
- }
- // 搜索专家姓名
- if (item.expert && item.expert.name && item.expert.name.toLowerCase().includes(keyword)) {
- return true;
- }
- // 搜索适用症状
- if (item.indication && item.indication.toLowerCase().includes(keyword)) {
- return true;
- }
- // 搜索生产厂家
- if (item.manufacturer && item.manufacturer.toLowerCase().includes(keyword)) {
- return true;
- }
- return false;
- });
- }
-
- // 分类筛选
- if (currentCategory !== 'all') {
- filteredList = filteredList.filter(item => item.category === currentCategory);
- }
-
- this.setData({
- filteredList: filteredList,
- page: 1,
- hasMore: filteredList.length > this.data.pageSize
- });
- },
-
- // 刷新列表
- refreshList: function() {
- wx.showLoading({
- title: '刷新中...',
- });
-
- // 模拟网络请求
- setTimeout(() => {
- const mockData = this.getMockData();
- this.setData({
- medicineList: mockData
- }, () => {
- // 刷新后重新筛选
- this.filterList();
- });
-
- wx.hideLoading();
- wx.stopPullDownRefresh();
- }, 800);
- },
-
- // 加载更多
- loadMore: function() {
- if (!this.data.hasMore) return;
-
- this.setData({ loading: true });
-
- // 模拟网络请求
- setTimeout(() => {
- const currentList = this.data.filteredList;
-
- // 这里简化为直接追加数据(实际项目中应该从服务器获取新数据)
- if (currentList.length < this.data.medicineList.length) {
- const allData = this.data.medicineList;
- const startIndex = currentList.length;
- const endIndex = Math.min(startIndex + 4, allData.length);
- const newData = allData.slice(startIndex, endIndex);
-
- const updatedList = [...currentList, ...newData];
-
- this.setData({
- filteredList: updatedList,
- hasMore: updatedList.length < allData.length,
- loading: false
- });
- } else {
- this.setData({
- hasMore: false,
- loading: false
- });
- }
- }, 1000);
- },
-
- // 显示药品详情
+
+ /**
+ * 显示药品详情
+ */
showMedicineDetail: function(e) {
const medId = e.currentTarget.dataset.id;
- // const medicine = this.data.filteredList[index];
- // this.setData({
- // showDetailModal: true,
- // currentMedicine: medicine
- // });
-
wx.navigateTo({
url: `/pagesA/pages/medicineDetails/medicineDetails?id=${medId}`,
- })
- },
-
- // 详情弹窗关闭
- onDetailModalClose: function() {
- this.setData({
- showDetailModal: false
});
},
-
- // 返回顶部
+
+ /**
+ * 返回顶部
+ */
scrollToTop: function() {
wx.pageScrollTo({
scrollTop: 0,
diff --git a/pagesA/pages/medicine/medicine.wxml b/pagesA/pages/medicine/medicine.wxml
index aee55c8..8a34700 100644
--- a/pagesA/pages/medicine/medicine.wxml
+++ b/pagesA/pages/medicine/medicine.wxml
@@ -5,7 +5,9 @@
- 🔍
+
+
+
-
+
全部推荐
-
+
处方药
-
+
非处方药
-
+
中成药
-
+
保健品
@@ -49,14 +51,12 @@
-
未找到"{{searchKeyword}}"相关的药品
暂无药品推荐
-
@@ -65,34 +65,24 @@
-
- {{item.categoryText}}
+
+ {{item.medicineType}}
-
- 热销
+
+ {{item.salesType}}
- {{item.name}}
-
-
-
- {{getShortText(item.indication, 12)}}
-
-
-
-
- {{getShortText(item.manufacturer, 14)}}
-
+ {{item.medicineName}}
🏪
- {{item.store.name}}
-
- {{item.store.distance}}km
-
+ {{item.storeName}}
diff --git a/pagesA/pages/medicine/medicine.wxss b/pagesA/pages/medicine/medicine.wxss
index 327b61a..f3db1a1 100644
--- a/pagesA/pages/medicine/medicine.wxss
+++ b/pagesA/pages/medicine/medicine.wxss
@@ -32,6 +32,11 @@
color: #999;
margin-right: 20rpx;
}
+
+ .search-icon image{
+ width: 45rpx;
+ height: 45rpx;
+ }
.search-input {
flex: 1;
@@ -131,21 +136,7 @@
background-color: #3a7ff3;
}
- .card-tag.prescription {
- background-color: #f44336;
- }
-
- .card-tag.otc {
- background-color: #4CAF50;
- }
-
- .card-tag.chinese {
- background-color: #FF9800;
- }
-
- .card-tag.health {
- background-color: #9C27B0;
- }
+
.card-tag.other {
background-color: #607D8B;
@@ -179,19 +170,7 @@
overflow: hidden;
min-height: 84rpx;
}
-
- .medicine-indication {
- font-size: 24rpx;
- color: #666;
- margin-bottom: 15rpx;
- line-height: 1.4;
- }
-
- .manufacturer {
- font-size: 24rpx;
- color: #999;
- margin-bottom: 20rpx;
- }
+
/* 卡片底部 */
.card-footer {
@@ -267,11 +246,6 @@
white-space: nowrap;
}
- .distance {
- color: #3a7ff3;
- font-size: 22rpx;
- }
-
/* 空状态 */
.empty-state {
grid-column: 1 / -1;
@@ -282,13 +256,7 @@
padding: 100rpx 0;
}
- .empty-image {
- width: 200rpx;
- height: 200rpx;
- margin-bottom: 30rpx;
- opacity: 0.5;
- }
-
+
.empty-text {
font-size: 32rpx;
color: #999;
@@ -302,15 +270,7 @@
margin-bottom: 40rpx;
}
- .empty-btn {
- width: 300rpx;
- height: 80rpx;
- line-height: 80rpx;
- background-color: #3a7ff3;
- color: white;
- border-radius: 12rpx;
- font-size: 30rpx;
- }
+
/* 加载更多 */
.load-more,
diff --git a/pagesA/pages/medicineDetails/medicineDetails.js b/pagesA/pages/medicineDetails/medicineDetails.js
index aa3a032..264cd16 100644
--- a/pagesA/pages/medicineDetails/medicineDetails.js
+++ b/pagesA/pages/medicineDetails/medicineDetails.js
@@ -1,21 +1,21 @@
+import http from '../../../utils/api'
+const baseUr = require('../../../utils/baseUrl')
Page({
data: {
// 药品数据
medicineData: null,
// 是否收藏
isFavorite: false,
+ baseUr: baseUr,
// 加载状态
loading: true,
- // 分享配置
- shareTitle: '',
- sharePath: '',
- shareImageUrl: ''
+ imageUrl:''
},
-
- onLoad: function(options) {
+
+ onLoad: function (options) {
// 获取传递过来的药品ID
const medicineId = options.id;
-
+
if (medicineId) {
// 根据ID加载药品数据
this.loadMedicineData(medicineId);
@@ -32,509 +32,43 @@ Page({
});
}
},
-
- onShow: function() {
- // 检查收藏状态
- this.checkFavoriteStatus();
+
+ onShow: function () {
+
},
-
- onShareAppMessage: function() {
- // 分享配置
- return {
- title: this.data.shareTitle || '专家推荐药品',
- path: this.data.sharePath || '/pages/index/index',
- imageUrl: this.data.shareImageUrl || '/images/share-default.jpg'
- };
- },
-
+
+
// 根据ID加载药品数据
- loadMedicineData: function(id) {
- this.setData({ loading: true });
-
+ loadMedicineData: function (id) {
+ this.setData({
+ loading: true
+ });
+
// 模拟网络请求,实际项目中应该从服务器获取
setTimeout(() => {
- const mockData = this.getMockData();
- const medicine = mockData.find(item => item.id == id);
-
- if (medicine) {
- this.setData({
- medicineData: medicine,
- loading: false,
- shareTitle: `${medicine.name} - ${medicine.expert.name}专家推荐`,
- sharePath: `/pages/detail/detail?id=${medicine.id}`,
- shareImageUrl: medicine.image
- });
-
- // 更新页面标题
- wx.setNavigationBarTitle({
- title: medicine.name
- });
- } else {
- this.setData({ loading: false });
- wx.showToast({
- title: '药品信息加载失败',
- icon: 'error',
- duration: 2000,
- complete: () => {
- setTimeout(() => {
- wx.navigateBack();
- }, 1500);
- }
- });
- }
- }, 500);
- },
-
- // 获取模拟数据(应与列表页保持一致)
- getMockData: function() {
- return [
- {
- id: 1,
- name: "阿莫西林胶囊",
- manufacturer: "华北制药股份有限公司",
- specification: "0.25g*24粒/盒",
- category: "prescription",
- categoryText: "处方药",
- indication: "用于敏感菌所致的呼吸道感染、泌尿系统感染等",
- price: 25.8,
- originalPrice: 32.0,
- isHot: true,
- salesCount: 1280,
- stock: 150,
- image: "https://via.placeholder.com/300x300/3a7ff3/ffffff?text=阿莫西林",
-
- expert: {
- name: "张明华",
- title: "主任医师",
- hospital: "北京协和医院",
- avatar: "https://via.placeholder.com/100x100/3a7ff3/ffffff?text=张",
- reason: "本品为广谱抗生素,对多数革兰氏阳性菌和革兰氏阴性菌均有良好的抗菌作用,是临床常用的一线抗生素。",
- expertise: "呼吸内科",
- years: 15,
- recommendTime: "2024-01-15"
- },
-
- store: {
- name: "仁和堂大药房",
- address: "北京市朝阳区建国路88号",
- phone: "010-88888888",
- businessHours: "8:00-22:00",
- features: "24小时营业,专业药师咨询,医保定点药店",
- distance: "1.2",
- latitude: 39.9042,
- longitude: 116.4074,
- rating: 4.8,
- images: [
- "/pagesA/images/5.png",
- "/pagesA/images/6.jpg",
- "/pagesA/images/6.jpg"
- ]
- },
-
- details: {
- usage: "口服。成人一次0.5g,每6~8小时1次,一日剂量不超过4g。",
- precautions: "青霉素过敏者禁用,用药期间可能出现腹泻、恶心等胃肠道反应。",
- storage: "密封,在干燥处保存。",
- validity: "24个月"
- }
- },
- {
- id: 2,
- name: "连花清瘟胶囊",
- manufacturer: "石家庄以岭药业股份有限公司",
- specification: "0.35g*24粒/盒",
- category: "chinese",
- categoryText: "中成药",
- indication: "用于治疗流行性感冒属热毒袭肺证",
- price: 28.5,
- originalPrice: 35.0,
- isHot: true,
- salesCount: 2560,
- stock: 89,
- image: "https://via.placeholder.com/300x300/4CAF50/ffffff?text=连花清瘟",
-
- expert: {
- name: "李芳",
- title: "副主任医师",
- hospital: "上海瑞金医院",
- avatar: "https://via.placeholder.com/100x100/4CAF50/ffffff?text=李",
- reason: "在新冠肺炎疫情防控中显示出良好效果,具有清瘟解毒、宣肺泄热的功效,适用于流感治疗。",
- expertise: "中医科",
- years: 12,
- recommendTime: "2024-01-14"
- },
-
- store: {
- name: "同济堂药店",
- address: "上海市黄浦区南京东路100号",
- phone: "021-66666666",
- businessHours: "9:00-21:00",
- features: "中药配方齐全,提供代煎服务,老字号药店",
- distance: "2.5",
- latitude: 31.2304,
- longitude: 121.4737,
- rating: 4.7,
- images: [
- "https://via.placeholder.com/400x300/FF9800/ffffff?text=中药柜台"
- ]
- },
-
- details: {
- usage: "口服。一次4粒,一日3次。",
- precautions: "风寒感冒者不适用,高血压、心脏病患者慎用。",
- storage: "密封,置阴凉干燥处。",
- validity: "36个月"
- }
- },
- {
- id: 3,
- name: "维生素C片",
- manufacturer: "养生堂药业有限公司",
- specification: "100mg*60片/瓶",
- category: "health",
- categoryText: "保健品",
- indication: "用于预防和治疗维生素C缺乏症",
- price: 18.9,
- originalPrice: 24.0,
- isHot: false,
- salesCount: 890,
- stock: 320,
- image: "https://via.placeholder.com/300x300/FF9800/ffffff?text=维生素C",
-
- expert: {
- name: "王建国",
- title: "执业药师",
- hospital: "广州中医药大学附属医院",
- avatar: "https://via.placeholder.com/100x100/FF9800/ffffff?text=王",
- reason: "增强免疫力,促进铁吸收,抗氧化作用明显,适合日常保健和预防感冒。",
- expertise: "临床药学",
- years: 8,
- recommendTime: "2024-01-13"
- },
-
- store: {
- name: "老百姓大药房",
- address: "广州市天河区体育西路189号",
- phone: "020-77777777",
- businessHours: "7:30-23:00",
- features: "连锁品牌,价格实惠,会员优惠,支持医保",
- distance: "0.8",
- latitude: 23.1358,
- longitude: 113.3269,
- rating: 4.6,
- images: []
- },
-
- details: {
- usage: "口服。成人一次1片,一日1次。",
- precautions: "不宜长期过量服用,肾功能不全者慎用。",
- storage: "避光,密封保存。",
- validity: "24个月"
- }
- },
- {
- id: 4,
- name: "布洛芬缓释胶囊",
- manufacturer: "中美天津史克制药有限公司",
- specification: "0.3g*20粒/盒",
- category: "otc",
- categoryText: "非处方药",
- indication: "用于缓解轻至中度疼痛如头痛、关节痛、偏头痛等",
- price: 22.5,
- originalPrice: 28.0,
- isHot: true,
- salesCount: 1870,
- stock: 120,
- image: "https://via.placeholder.com/300x300/9C27B0/ffffff?text=布洛芬",
-
- expert: {
- name: "陈晓东",
- title: "主任医师",
- hospital: "武汉同济医院",
- avatar: "https://via.placeholder.com/100x100/9C27B0/ffffff?text=陈",
- reason: "解热镇痛效果确切,缓释剂型作用持久,胃肠道刺激小,适合各种疼痛的缓解。",
- expertise: "疼痛科",
- years: 20,
- recommendTime: "2024-01-12"
- },
-
- store: {
- name: "九州通大药房",
- address: "武汉市江汉区解放大道688号",
- phone: "027-55555555",
- businessHours: "8:30-21:30",
- features: "药品齐全,支持线上订购,送货上门",
- distance: "3.2",
- latitude: 30.5928,
- longitude: 114.3052,
- rating: 4.9,
- images: [
- "https://via.placeholder.com/400x300/3F51B5/ffffff?text=现代药店",
- "https://via.placeholder.com/400x300/E91E63/ffffff?text=专业服务"
- ]
- },
-
- details: {
- usage: "口服。成人一次1粒,一日2次。",
- precautions: "胃肠道溃疡患者禁用,不宜长期服用。",
- storage: "密封,在阴凉干燥处保存。",
- validity: "36个月"
- }
- },
- {
- id: 5,
- name: "盐酸左氧氟沙星片",
- manufacturer: "浙江医药股份有限公司",
- specification: "0.5g*6片/盒",
- category: "prescription",
- categoryText: "处方药",
- indication: "用于敏感细菌引起的呼吸系统、泌尿系统感染",
- price: 42.8,
- originalPrice: 56.0,
- isHot: false,
- salesCount: 560,
- stock: 75,
- image: "https://via.placeholder.com/300x300/2196F3/ffffff?text=左氧氟沙星",
-
- expert: {
- name: "刘涛",
- title: "副主任医师",
- hospital: "南京鼓楼医院",
- avatar: "https://via.placeholder.com/100x100/2196F3/ffffff?text=刘",
- reason: "抗菌谱广,对多种革兰氏阴性菌和阳性菌有效,特别适用于泌尿系统感染的治疗。",
- expertise: "泌尿外科",
- years: 10,
- recommendTime: "2024-01-11"
- },
-
- store: {
- name: "金陵大药房",
- address: "南京市鼓楼区中山路321号",
- phone: "025-44444444",
- businessHours: "8:00-21:00",
- features: "专业处方药房,药师驻店咨询",
- distance: "1.8",
- latitude: 32.0603,
- longitude: 118.7969,
- rating: 4.5,
- images: []
- },
-
- details: {
- usage: "口服。一次1片,一日1次。",
- precautions: "18岁以下患者禁用,孕妇及哺乳期妇女禁用。",
- storage: "遮光,密封保存。",
- validity: "24个月"
- }
- },
- {
- id: 6,
- name: "板蓝根颗粒",
- manufacturer: "广州白云山和记黄埔中药有限公司",
- specification: "10g*20袋/盒",
- category: "chinese",
- categoryText: "中成药",
- indication: "清热解毒,凉血利咽,用于肺胃热盛所致的咽喉肿痛",
- price: 15.9,
- originalPrice: 19.9,
- isHot: true,
- salesCount: 3200,
- stock: 450,
- image: "https://via.placeholder.com/300x300/FF5722/ffffff?text=板蓝根",
-
- expert: {
- name: "孙丽",
- title: "主治医师",
- hospital: "成都中医药大学附属医院",
- avatar: "https://via.placeholder.com/100x100/FF5722/ffffff?text=孙",
- reason: "传统经典方剂,清热解毒效果显著,特别适合预防和治疗感冒初期症状。",
- expertise: "中医内科",
- years: 6,
- recommendTime: "2024-01-10"
- },
-
- store: {
- name: "康恩贝大药房",
- address: "成都市锦江区春熙路58号",
- phone: "028-33333333",
- businessHours: "9:00-22:00",
- features: "连锁品牌,中药西药齐全",
- distance: "0.5",
- latitude: 30.6578,
- longitude: 104.0657,
- rating: 4.4,
- images: []
- },
-
- details: {
- usage: "开水冲服。一次1袋,一日3次。",
- precautions: "风寒感冒者不适用,糖尿病患者慎用。",
- storage: "密封,防潮。",
- validity: "36个月"
- }
- },
- {
- id: 7,
- name: "复方甘草片",
- manufacturer: "北京双鹤药业股份有限公司",
- specification: "100片/瓶",
- category: "prescription",
- categoryText: "处方药",
- indication: "用于镇咳祛痰,适用于感冒咳嗽",
- price: 12.5,
- originalPrice: 16.0,
- isHot: false,
- salesCount: 780,
- stock: 200,
- image: "https://via.placeholder.com/300x300/673AB7/ffffff?text=甘草片",
-
- expert: {
- name: "赵国强",
- title: "主任医师",
- hospital: "天津医科大学总医院",
- avatar: "https://via.placeholder.com/100x100/673AB7/ffffff?text=赵",
- reason: "传统止咳良药,镇咳祛痰效果确切,价格实惠,适合普通感冒咳嗽。",
- expertise: "呼吸内科",
- years: 18,
- recommendTime: "2024-01-09"
- },
-
- store: {
- name: "天津医药大药房",
- address: "天津市和平区南京路128号",
- phone: "022-22222222",
- businessHours: "8:00-21:30",
- features: "国营药店,药品质量有保障",
- distance: "2.0",
- latitude: 39.1172,
- longitude: 117.2056,
- rating: 4.3,
- images: []
- },
-
- details: {
- usage: "口服。一次3-4片,一日3次。",
- precautions: "不宜长期服用,孕妇及哺乳期妇女慎用。",
- storage: "密封,在干燥处保存。",
- validity: "36个月"
- }
- },
- {
- id: 8,
- name: "葡萄糖酸钙口服液",
- manufacturer: "哈药集团制药六厂",
- specification: "10ml*12支/盒",
- category: "otc",
- categoryText: "非处方药",
- indication: "用于预防和治疗钙缺乏症",
- price: 35.0,
- originalPrice: 42.0,
- isHot: true,
- salesCount: 1560,
- stock: 180,
- image: "https://via.placeholder.com/300x300/00BCD4/ffffff?text=葡萄糖酸钙",
-
- expert: {
- name: "周敏",
- title: "副主任医师",
- hospital: "西安交通大学第一附属医院",
- avatar: "https://via.placeholder.com/100x100/00BCD4/ffffff?text=周",
- reason: "钙吸收好,口感适宜,特别适合儿童、孕妇和老年人补钙。",
- expertise: "儿科",
- years: 14,
- recommendTime: "2024-01-08"
- },
-
- store: {
- name: "西安医药大药房",
- address: "西安市碑林区南大街58号",
- phone: "029-11111111",
- businessHours: "8:30-21:00",
- features: "专业儿科用药,儿童健康咨询",
- distance: "1.5",
- latitude: 34.2583,
- longitude: 108.9426,
- rating: 4.7,
- images: []
- },
-
- details: {
- usage: "口服。一次1-2支,一日3次。",
- precautions: "肾功能不全者慎用,不宜与洋地黄类药物同时使用。",
- storage: "密封,置阴凉处。",
- validity: "24个月"
- }
- }
- ];
- },
-
- // 检查收藏状态
- checkFavoriteStatus: function() {
- const medicineData = this.data.medicineData;
- if (!medicineData) return;
-
- try {
- const favorites = wx.getStorageSync('medicineFavorites') || [];
- const isFavorite = favorites.some(item => item.id === medicineData.id);
- this.setData({ isFavorite });
- } catch (e) {
- console.error('读取收藏失败', e);
- }
- },
-
- // 切换收藏状态
- toggleFavorite: function() {
- const medicineData = this.data.medicineData;
- if (!medicineData) return;
-
- const newFavorite = !this.data.isFavorite;
- this.setData({ isFavorite: newFavorite });
-
- // 保存到本地缓存
- this.saveFavorite(newFavorite);
-
- wx.showToast({
- title: newFavorite ? '已收藏' : '已取消收藏',
- icon: 'success',
- duration: 1500
- });
- },
-
- // 保存收藏状态到本地缓存
- saveFavorite: function(isFavorite) {
- const medicineData = this.data.medicineData;
- if (!medicineData) return;
-
- try {
- let favorites = wx.getStorageSync('medicineFavorites') || [];
-
- if (isFavorite) {
- // 添加收藏
- if (!favorites.some(item => item.id === medicineData.id)) {
- favorites.push({
- id: medicineData.id,
- name: medicineData.name,
- price: medicineData.price,
- image: medicineData.image,
- expert: medicineData.expert.name,
- store: medicineData.store.name,
- time: new Date().getTime()
+ http.recommendationXq({
+ data: {
+ id: id
+ },
+ success: res => {
+ const mockData = res.data
+ const imageUrl = mockData.imageUrl.split(',')
+
+ this.setData({
+ medicineData: mockData,
+ imageUrl: imageUrl
});
}
- } else {
- // 取消收藏
- favorites = favorites.filter(item => item.id !== medicineData.id);
- }
-
- wx.setStorageSync('medicineFavorites', favorites);
- } catch (e) {
- console.error('保存收藏失败', e);
- }
+ })
+
+ }, 500);
},
-
+
+
+
// 打开位置地图
- openLocation: function() {
- const { store } = this.data.medicineData;
+ openLocation: function () {
+ const store = this.data.medicineData;
if (store.latitude && store.longitude) {
wx.openLocation({
latitude: parseFloat(store.latitude),
@@ -550,20 +84,20 @@ Page({
});
}
},
-
+
// 拨打电话
- makePhoneCall: function() {
- const phone = this.data.medicineData.store.phone;
+ makePhoneCall: function () {
+ const phone = this.data.medicineData.storePhone;
if (phone) {
wx.makePhoneCall({
phoneNumber: phone
})
}
},
-
+
// 预览主图片
- previewMainImage: function() {
- const url = this.data.medicineData.image;
+ previewMainImage: function () {
+ const url = this.data.imageUrl.split(',');
if (url) {
wx.previewImage({
current: url,
@@ -571,35 +105,30 @@ Page({
});
}
},
-
+
// 预览轮播图片
- previewImage: function(e) {
+ previewImage: function (e) {
+ const imageUrl = this.data.imageUrl
const index = parseInt(e.currentTarget.dataset.index);
- const images = this.data.medicineData.store.images || [];
- const urls = [this.data.medicineData.image, ...images];
-
+ const images = imageUrl|| [];
+ const urls = [imageUrl, ...images];
+
wx.previewImage({
current: urls[index + 1], // +1 因为第一个是主图
urls: urls
});
},
-
+
// 预览店铺图片
- previewStoreImage: function(e) {
+ previewStoreImage: function (e) {
const index = parseInt(e.currentTarget.dataset.index);
- const images = this.data.medicineData.store.images || [];
-
+ const images = this.data.imageUrl || [];
+
wx.previewImage({
current: images[index],
urls: images
});
},
-
- // 分享给朋友
- onShareToFriend: function() {
- wx.showShareMenu({
- withShareTicket: true,
- menus: ['shareAppMessage', 'shareTimeline']
- });
- }
+
+
});
\ No newline at end of file
diff --git a/pagesA/pages/medicineDetails/medicineDetails.wxml b/pagesA/pages/medicineDetails/medicineDetails.wxml
index 3c2321c..208f8fb 100644
--- a/pagesA/pages/medicineDetails/medicineDetails.wxml
+++ b/pagesA/pages/medicineDetails/medicineDetails.wxml
@@ -1,20 +1,20 @@
-
+
-
+
-
- {{medicineData.categoryText}}
- 热销
+
+ {{medicineData.medicineType}}
+ {{medicineData.salesType}}
- {{medicineData.name}}
+ {{medicineData.medicineName}}
{{medicineData.specification}}
{{medicineData.manufacturer}}
@@ -47,7 +47,7 @@
原价:¥{{medicineData.originalPrice}}
- 已售:{{medicineData.salesCount}}件
+ 已售:{{medicineData.soldQuantity}}件
@@ -55,7 +55,7 @@
适用症状
- {{medicineData.indication}}
+ {{medicineData.indications}}
@@ -64,24 +64,23 @@
推荐理由
- {{medicineData.expert.reason}}
+ {{medicineData.recommendReason}}
- 推荐时间:{{medicineData.expert.recommendTime}}
+ 推荐时间:{{medicineData.recommendTime}}
@@ -90,35 +89,27 @@
推荐店铺
-
📍
- {{medicineData.store.address}}
-
- 距离:{{medicineData.store.distance}}km
-
+ {{medicineData.storeAddress}}
📞
- {{medicineData.store.phone}}
+ {{medicineData.storePhone}}
🕒
- {{medicineData.store.businessHours}}
+ {{medicineData.businessHours}}
-
+
⭐
- {{medicineData.store.features}}
+ {{medicineData.storeRemark}}
@@ -153,22 +144,22 @@
用法用量
- {{medicineData.details.usage}}
+ {{medicineData.usageDosage}}
注意事项
- {{medicineData.details.precautions}}
+ {{medicineData.precautions}}
贮藏方式
- {{medicineData.details.storage}}
+ {{medicineData.storageMethod}}
有效期
- {{medicineData.details.validity}}
+ {{medicineData.expiryDate}}
diff --git a/pagesA/pages/medicineDetails/medicineDetails.wxss b/pagesA/pages/medicineDetails/medicineDetails.wxss
index b8b55cd..03fa6b7 100644
--- a/pagesA/pages/medicineDetails/medicineDetails.wxss
+++ b/pagesA/pages/medicineDetails/medicineDetails.wxss
@@ -249,21 +249,6 @@
flex: 1;
}
- .store-rating {
- display: flex;
- align-items: center;
- color: #ff9900;
- }
-
- .rating-value {
- font-size: 28rpx;
- font-weight: bold;
- margin-right: 5rpx;
- }
-
- .rating-star {
- font-size: 24rpx;
- }
.store-info {
margin-bottom: 20rpx;
@@ -287,14 +272,7 @@
.info-text {
flex: 1;
}
-
- .store-distance {
- color: #3a7ff3;
- font-size: 24rpx;
- margin-left: 20rpx;
- flex-shrink: 0;
- }
-
+
/* 店铺图片 */
.store-images {
margin-bottom: 20rpx;
diff --git a/pagesB/images/bo.png b/pagesB/images/bo.png
new file mode 100644
index 0000000..70f5106
Binary files /dev/null and b/pagesB/images/bo.png differ
diff --git a/pagesB/images/lll.png b/pagesB/images/lll.png
new file mode 100644
index 0000000..e40135b
Binary files /dev/null and b/pagesB/images/lll.png differ
diff --git a/pagesB/images/you.png b/pagesB/images/you.png
new file mode 100644
index 0000000..a655424
Binary files /dev/null and b/pagesB/images/you.png differ
diff --git a/pagesB/pages/policyElucidation/policyElucidation.js b/pagesB/pages/policyElucidation/policyElucidation.js
new file mode 100644
index 0000000..b795d62
--- /dev/null
+++ b/pagesB/pages/policyElucidation/policyElucidation.js
@@ -0,0 +1,312 @@
+// policy-interpretation.js
+Page({
+ data: {
+ currentDate: '2023年11月15日',
+ searchKeyword: '',
+ activeFilter: 'all',
+ showPolicyDetail: false,
+ currentPolicy: {},
+
+ // 所有政策数据
+ allPolicies: [
+ {
+ id: 1,
+ title: '2023年农业补贴资金申报指南',
+ summary: '明确了今年农业补贴的申请条件、标准和流程,重点支持粮食生产和特色农业',
+ date: '2023-10-20',
+ source: '农业农村部',
+ type: 'financial',
+ typeText: '财政补贴',
+ keyPoints: [
+ '提高粮食生产者补贴标准,每亩增加10-20元',
+ '新增特色农产品种植补贴,最高每亩补贴500元',
+ '简化申报流程,推行线上申报系统',
+ '强化补贴资金监管,确保专款专用'
+ ],
+ interpretation: '此次农业补贴政策调整体现了国家保障粮食安全和促进农业高质量发展的决心。通过提高补贴标准、扩大补贴范围,调动农民种粮积极性,同时支持特色农业发展,优化农业产业结构。',
+ applicableObjects: [
+ '种粮大户',
+ '家庭农场',
+ '农民专业合作社',
+ '农业企业'
+ ],
+ applicationGuide: [
+ '登录农业农村部政务服务平台',
+ '填写申报信息并上传证明材料',
+ '乡镇农业部门初审',
+ '县级农业农村部门审核',
+ '公示7个工作日',
+ '拨付补贴资金'
+ ],
+ expertAdvice: '建议符合条件的农业经营主体尽早准备申报材料,重点关注今年新增的特色农产品补贴项目。同时注意申报时间节点,避免错过申报期限。',
+ relatedLinks: [
+ { name: '政策原文链接', url: 'https://example.com/policy1' },
+ { name: '申报平台入口', url: 'https://example.com/apply1' }
+ ]
+ },
+ {
+ id: 2,
+ title: '畜牧业高质量发展支持政策',
+ summary: '针对畜牧业规模化、标准化发展提出具体扶持措施,加强动物疫病防控',
+ date: '2023-09-15',
+ source: '农业农村部',
+ type: 'financial',
+ typeText: '财政补贴',
+ keyPoints: [
+ '对标准化养殖场建设给予30%资金补贴',
+ '引进优良种畜每头补贴500-2000元',
+ '支持畜禽粪污资源化利用项目',
+ '加强动物疫病防控体系建设'
+ ],
+ interpretation: '本政策旨在推动畜牧业转型升级,提高产业竞争力。通过支持标准化养殖和粪污资源化利用,促进畜牧业绿色发展,保障畜产品有效供给和质量安全。',
+ applicableObjects: [
+ '规模化养殖场',
+ '畜牧专业合作社',
+ '畜禽育种企业'
+ ],
+ applicationGuide: [
+ '准备养殖场备案证明等相关材料',
+ '向县级畜牧部门提交申请',
+ '现场审核验收',
+ '审批公示',
+ '拨付补贴资金'
+ ],
+ expertAdvice: '建议养殖场重点考虑粪污资源化利用项目申报,这既是政策支持重点,也符合环保要求。同时加强疫病防控,确保养殖安全。',
+ relatedLinks: [
+ { name: '政策详细解读', url: 'https://example.com/policy2' }
+ ]
+ },
+ {
+ id: 3,
+ title: '智慧农业技术推广实施方案',
+ summary: '推动物联网、大数据等现代信息技术在农业生产中的应用',
+ date: '2023-11-05',
+ source: '农业农村部、工信部',
+ type: 'technology',
+ typeText: '技术推广',
+ keyPoints: [
+ '建设智慧农业示范基地,每个补贴50-100万元',
+ '推广农业物联网设备,补贴比例达40%',
+ '开展智慧农业技术培训,每年培训10万人次',
+ '支持农业大数据平台建设'
+ ],
+ interpretation: '智慧农业是农业现代化的重要方向。本方案通过示范基地建设、设备补贴和技术培训,加快现代信息技术与农业深度融合,提升农业生产智能化水平。',
+ applicableObjects: [
+ '农业科技示范园',
+ '现代农业园区',
+ '农业科技企业',
+ '新型农业经营主体'
+ ],
+ applicationGuide: [
+ '制定智慧农业建设方案',
+ '县级农业农村部门推荐',
+ '市级部门审核',
+ '省级部门审批立项',
+ '组织项目实施',
+ '验收评估'
+ ],
+ expertAdvice: '建议有条件的农业经营主体积极申报智慧农业项目,重点关注物联网设备应用和数据平台建设。同时加强技术人员培训,确保技术有效应用。',
+ relatedLinks: [
+ { name: '技术标准手册', url: 'https://example.com/policy3' }
+ ]
+ },
+ {
+ id: 4,
+ title: '草原生态保护补助奖励政策',
+ summary: '实施草原禁牧、草畜平衡奖励,促进草原生态恢复',
+ date: '2023-08-30',
+ source: '国家林草局',
+ type: 'environment',
+ typeText: '生态保护',
+ keyPoints: [
+ '禁牧草原每亩每年补贴7.5元',
+ '草畜平衡草原每亩每年补贴2.5元',
+ '实施草原生态修复工程',
+ '支持草原畜牧业转型发展'
+ ],
+ interpretation: '草原生态保护补助奖励政策是生态文明建设的重要内容。通过实施禁牧和草畜平衡,减轻草原生态压力,促进草原植被恢复,实现生态保护和牧民增收双赢。',
+ applicableObjects: [
+ '草原牧户',
+ '草原生态保护合作社',
+ '草原管护员'
+ ],
+ applicationGuide: [
+ '牧户申报草原承包面积',
+ '村级公示',
+ '乡镇审核',
+ '县级审定',
+ '资金发放'
+ ],
+ expertAdvice: '建议牧户严格按照核定的载畜量放牧,避免超载过牧。同时可考虑发展草原生态旅游等替代产业,增加收入来源。',
+ relatedLinks: [
+ { name: '政策实施细则', url: 'https://example.com/policy4' }
+ ]
+ },
+ {
+ id: 5,
+ title: '农业保险保费补贴管理办法',
+ summary: '扩大农业保险覆盖面,提高保障水平,优化理赔服务',
+ date: '2023-10-10',
+ source: '财政部、农业农村部',
+ type: 'insurance',
+ typeText: '农业保险',
+ keyPoints: [
+ '三大粮食作物保险保费补贴比例提高至70%',
+ '扩大特色农产品保险试点范围',
+ '简化理赔流程,缩短理赔时间',
+ '建立农业保险信息共享平台'
+ ],
+ interpretation: '农业保险是防范农业风险的重要工具。新办法通过提高补贴比例、扩大保险范围,增强农业抗风险能力,为农民提供更全面的风险保障。',
+ applicableObjects: [
+ '所有从事农业生产的农户',
+ '农业经营主体',
+ '农业保险公司'
+ ],
+ applicationGuide: [
+ '选择符合条件的农业保险产品',
+ '与保险公司签订保险合同',
+ '缴纳自付部分保费',
+ '出险后及时报案',
+ '保险公司查勘定损',
+ '理赔款支付'
+ ],
+ expertAdvice: '建议农户积极投保农业保险,特别是特色农产品保险。注意了解保险责任范围、免赔条款等重要内容,确保自身权益。',
+ relatedLinks: [
+ { name: '农业保险产品目录', url: 'https://example.com/policy5' }
+ ]
+ }
+ ],
+
+ // 筛选后的政策
+ filteredPolicies: []
+ },
+
+ onLoad: function(options) {
+ // 初始化时显示所有政策
+ this.setData({
+ filteredPolicies: this.data.allPolicies
+ });
+ },
+
+ // 搜索输入处理
+ onSearchInput: function(e) {
+ this.setData({
+ searchKeyword: e.detail.value
+ });
+ },
+
+ // 搜索按钮点击
+ onSearch: function() {
+ this.filterPolicies();
+ },
+
+ // 筛选标签点击
+ onFilterTap: function(e) {
+ const filter = e.currentTarget.dataset.filter;
+ this.setData({
+ activeFilter: filter
+ }, () => {
+ this.filterPolicies();
+ });
+ },
+
+ // 筛选政策
+ filterPolicies: function() {
+ const { allPolicies, activeFilter, searchKeyword } = this.data;
+
+ let filtered = allPolicies;
+
+ // 按类型筛选
+ if (activeFilter !== 'all') {
+ if (activeFilter === 'latest') {
+ // 最新政策:最近30天内发布的
+ const thirtyDaysAgo = new Date();
+ thirtyDaysAgo.setDate(thirtyDaysAgo.getDate() - 30);
+
+ filtered = filtered.filter(policy => {
+ const policyDate = new Date(policy.date);
+ return policyDate >= thirtyDaysAgo;
+ });
+ } else {
+ filtered = filtered.filter(policy => policy.type === activeFilter);
+ }
+ }
+
+ // 按关键词搜索
+ if (searchKeyword.trim() !== '') {
+ const keyword = searchKeyword.toLowerCase();
+ filtered = filtered.filter(policy =>
+ policy.title.toLowerCase().includes(keyword) ||
+ policy.summary.toLowerCase().includes(keyword) ||
+ (policy.keyPoints && policy.keyPoints.some(point => point.toLowerCase().includes(keyword)))
+ );
+ }
+
+ this.setData({
+ filteredPolicies: filtered
+ });
+ },
+
+ // 政策卡片点击
+ onPolicyTap: function(e) {
+ const policyId = e.currentTarget.dataset.id;
+ const policy = this.data.allPolicies.find(p => p.id === policyId);
+
+ if (policy) {
+ this.setData({
+ currentPolicy: policy,
+ showPolicyDetail: true
+ });
+ }
+ },
+
+ // 隐藏政策详情
+ hidePolicyDetail: function() {
+ this.setData({
+ showPolicyDetail: false
+ });
+ },
+
+ // 阻止事件冒泡
+ stopPropagation: function() {
+ // 空函数,仅用于阻止事件冒泡
+ },
+
+ // 链接点击
+ onLinkTap: function(e) {
+ const url = e.currentTarget.dataset.url;
+ wx.showModal({
+ title: '提示',
+ content: '即将打开外部链接: ' + url,
+ success: function(res) {
+ if (res.confirm) {
+ // 在实际小程序中,这里需要使用web-view或复制链接
+ wx.setClipboardData({
+ data: url,
+ success: function() {
+ wx.showToast({
+ title: '链接已复制',
+ icon: 'success'
+ });
+ }
+ });
+ }
+ }
+ });
+ },
+
+ // 收藏政策
+ onSavePolicy: function() {
+ const policyTitle = this.data.currentPolicy.title;
+ wx.showToast({
+ title: `"${policyTitle}"已收藏`,
+ icon: 'success',
+ duration: 2000
+ });
+
+ // 在实际应用中,这里可以将政策保存到本地或发送到服务器
+ setTimeout(() => {
+ this.hidePolicyDetail();
+ }, 1500);
+ }
+});
\ No newline at end of file
diff --git a/pagesB/pages/policyElucidation/policyElucidation.json b/pagesB/pages/policyElucidation/policyElucidation.json
new file mode 100644
index 0000000..e6beaf1
--- /dev/null
+++ b/pagesB/pages/policyElucidation/policyElucidation.json
@@ -0,0 +1,4 @@
+{
+ "navigationBarTitleText":"政策解读",
+ "usingComponents": {}
+}
\ No newline at end of file
diff --git a/pagesB/pages/policyElucidation/policyElucidation.wxml b/pagesB/pages/policyElucidation/policyElucidation.wxml
new file mode 100644
index 0000000..25eee2e
--- /dev/null
+++ b/pagesB/pages/policyElucidation/policyElucidation.wxml
@@ -0,0 +1,195 @@
+
+
+
+
+
+
+
+
+
+
+ 搜索
+
+
+
+
+ 全部
+ 财政补贴
+ 技术推广
+ 农业保险
+ 生态保护
+ 最新政策
+
+
+
+
+
+
+
+
+ 暂无相关政策
+ 请尝试其他筛选条件
+
+
+
+
+
+
+ {{item.title}}
+
+
+ {{item.summary}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 政策类型:
+ {{currentPolicy.typeText}}
+
+
+ 发布日期:
+ {{currentPolicy.date}}
+
+
+ 发布单位:
+ {{currentPolicy.source}}
+
+
+
+
+ 政策要点
+
+
+ {{index + 1}}. {{item}}
+
+
+
+
+
+ 详细解读
+
+ {{currentPolicy.interpretation}}
+
+
+
+
+ 适用对象
+
+
+
+ {{item}}
+
+
+
+
+
+
+ 申报指南
+
+
+
+ {{index + 1}}
+ {{item}}
+
+
+
+
+
+
+ 专家建议
+
+
+
+ {{currentPolicy.expertAdvice}}
+
+
+
+
+
+ 相关链接
+
+
+
+ {{item.name}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 已加载 {{filteredPolicies.length}} 条政策解读
+ 数据仅供参考,具体以官方发布为准
+
+
\ No newline at end of file
diff --git a/pagesB/pages/policyElucidation/policyElucidation.wxss b/pagesB/pages/policyElucidation/policyElucidation.wxss
new file mode 100644
index 0000000..5f99eb7
--- /dev/null
+++ b/pagesB/pages/policyElucidation/policyElucidation.wxss
@@ -0,0 +1,498 @@
+/* policy-interpretation.wxss */
+.container {
+ min-height: 100vh;
+ background-color: #f5f7fa;
+ padding-bottom: 40rpx;
+ }
+
+ /* 头部样式 */
+ .header {
+ background: linear-gradient(135deg, #1a5f23 0%, #2d8c3c 100%);
+ color: white;
+ padding: 40rpx 30rpx 30rpx;
+ border-radius: 0 0 30rpx 30rpx;
+ box-shadow: 0 4rpx 20rpx rgba(26, 95, 35, 0.2);
+ }
+
+ .title-section {
+ margin-bottom: 20rpx;
+ }
+
+ .page-title {
+ font-size: 48rpx;
+ font-weight: bold;
+ display: block;
+ margin-bottom: 10rpx;
+ }
+
+ .page-subtitle {
+ font-size: 28rpx;
+ opacity: 0.9;
+ }
+
+ .date-info {
+ font-size: 24rpx;
+ text-align: right;
+ opacity: 0.8;
+ }
+
+ /* 搜索区域 */
+ .search-section {
+ background-color: white;
+ margin: -20rpx 30rpx 30rpx;
+ border-radius: 20rpx;
+ padding: 30rpx;
+ box-shadow: 0 8rpx 30rpx rgba(0, 0, 0, 0.06);
+ }
+
+ .search-box {
+ display: flex;
+ align-items: center;
+ background-color: #f5f7fa;
+ border-radius: 50rpx;
+ margin-bottom: 30rpx;
+ }
+
+ .search-icon {
+ width: 36rpx;
+ height: 36rpx;
+ margin: 0 20rpx;
+ }
+
+ .search-input {
+ flex: 1;
+ height: 80rpx;
+ font-size: 28rpx;
+ }
+
+ .placeholder-style {
+ color: #999;
+ }
+
+ .search-btn {
+ background-color: #2d8c3c;
+ color: white;
+ font-size: 28rpx;
+ padding: 16rpx 30rpx;
+ border-radius: 40rpx;
+ margin-left: 20rpx;
+ }
+
+ /* 筛选区域 */
+ .filter-scroll {
+ white-space: nowrap;
+ width: 100%;
+ }
+
+ .filter-tag {
+ display: inline-block;
+ padding: 16rpx 30rpx;
+ margin-right: 20rpx;
+ background-color: #f5f7fa;
+ border-radius: 40rpx;
+ font-size: 26rpx;
+ color: #666;
+ }
+
+ .filter-tag.active {
+ background-color: #2d8c3c;
+ color: white;
+ }
+
+ /* 政策列表 */
+ .policy-list {
+ padding: 0 30rpx;
+ }
+
+ .policy-card {
+ background-color: white;
+ border-radius: 20rpx;
+ padding: 30rpx;
+ margin-bottom: 30rpx;
+ box-shadow: 0 8rpx 30rpx rgba(0, 0, 0, 0.06);
+ transition: transform 0.3s, box-shadow 0.3s;
+ }
+
+ .policy-card:active {
+ transform: translateY(-4rpx);
+ box-shadow: 0 12rpx 40rpx rgba(0, 0, 0, 0.1);
+ }
+
+ .policy-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-bottom: 20rpx;
+ }
+
+ .policy-tag {
+ font-size: 22rpx;
+ padding: 6rpx 20rpx;
+ border-radius: 20rpx;
+ }
+
+ .policy-tag.financial {
+ background-color: #e8f4ea;
+ color: #1a5f23;
+ }
+
+ .policy-tag.technology {
+ background-color: #e8f0fb;
+ color: #1a5b8c;
+ }
+
+ .policy-tag.insurance {
+ background-color: #fff7e6;
+ color: #d48806;
+ }
+
+ .policy-tag.environment {
+ background-color: #e6f7ff;
+ color: #006d75;
+ }
+
+ .policy-date {
+ font-size: 24rpx;
+ color: #999;
+ }
+
+ .policy-title {
+ font-size: 32rpx;
+ font-weight: bold;
+ color: #333;
+ margin-bottom: 20rpx;
+ line-height: 1.4;
+ }
+
+ .policy-summary {
+ font-size: 28rpx;
+ color: #666;
+ line-height: 1.5;
+ display: -webkit-box;
+ -webkit-box-orient: vertical;
+ -webkit-line-clamp: 2;
+ overflow: hidden;
+ }
+
+ .policy-footer {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-top: 25rpx;
+ padding-top: 20rpx;
+ border-top: 1rpx solid #eee;
+ }
+
+ .policy-source {
+ font-size: 24rpx;
+ color: #999;
+ }
+
+ .policy-arrow {
+ width: 26rpx;
+ height: 26rpx;
+ }
+
+ /* 空状态 */
+ .empty-state {
+ text-align: center;
+ padding: 80rpx 30rpx;
+ }
+
+ .empty-icon {
+ width: 200rpx;
+ height: 200rpx;
+ margin-bottom: 30rpx;
+ opacity: 0.5;
+ }
+
+ .empty-text {
+ display: block;
+ font-size: 32rpx;
+ color: #999;
+ margin-bottom: 15rpx;
+ }
+
+ .empty-tip {
+ font-size: 26rpx;
+ color: #ccc;
+ }
+
+ /* 政策详情弹窗 */
+ .modal {
+ position: fixed;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ background-color: rgba(0, 0, 0, 0.5);
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ z-index: 1000;
+ opacity: 0;
+ visibility: hidden;
+ transition: all 0.3s;
+ }
+
+ .modal.show {
+ opacity: 1;
+ visibility: visible;
+ }
+
+ .modal-content {
+ background-color: white;
+ width: 90%;
+ max-height: 80vh;
+ border-radius: 20rpx;
+ overflow: hidden;
+ transform: translateY(50rpx);
+ transition: transform 0.3s;
+ }
+
+ .modal.show .modal-content {
+ transform: translateY(0);
+ }
+
+ .modal-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ padding: 30rpx;
+ border-bottom: 1rpx solid #eee;
+ background-color: #f9f9f9;
+ }
+
+ .modal-title {
+ font-size: 32rpx;
+ font-weight: bold;
+ color: #333;
+ flex: 1;
+ margin-right: 20rpx;
+ }
+
+ .modal-close {
+ font-size: 50rpx;
+ color: #999;
+ width: 60rpx;
+ height: 60rpx;
+ text-align: center;
+ line-height: 50rpx;
+ }
+
+ .modal-body {
+ max-height: 60vh;
+ padding: 30rpx;
+ box-sizing: border-box;
+ }
+
+ .policy-info-row {
+ display: flex;
+ flex-wrap: wrap;
+ background-color: #f9f9f9;
+ border-radius: 12rpx;
+ padding: 20rpx;
+ margin-bottom: 30rpx;
+ }
+
+ .info-item {
+ width: 50%;
+ margin-bottom: 15rpx;
+ }
+
+ .info-label {
+ font-size: 26rpx;
+ color: #999;
+ margin-right: 10rpx;
+ }
+
+ .info-value {
+ font-size: 26rpx;
+ color: #333;
+ font-weight: 500;
+ }
+
+ .section {
+ margin-bottom: 40rpx;
+ }
+
+ .section-title {
+ font-size: 30rpx;
+ font-weight: bold;
+ color: #1a5f23;
+ margin-bottom: 20rpx;
+ padding-bottom: 10rpx;
+ border-bottom: 2rpx solid #e8f4ea;
+ }
+
+ .section-content {
+ font-size: 28rpx;
+ color: #333;
+ line-height: 1.6;
+ }
+
+ .key-point {
+ margin-bottom: 15rpx;
+ padding-left: 20rpx;
+ position: relative;
+ }
+
+ .key-point:before {
+ content: "";
+ position: absolute;
+ left: 0;
+ top: 16rpx;
+ width: 8rpx;
+ height: 8rpx;
+ background-color: #2d8c3c;
+ border-radius: 50%;
+ }
+
+ .interpretation-text {
+ text-align: justify;
+ }
+
+ .applicable-objects {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 20rpx;
+ }
+
+ .object-tag {
+ background-color: #f0f9ff;
+ color: #1a5b8c;
+ font-size: 24rpx;
+ padding: 10rpx 20rpx;
+ border-radius: 20rpx;
+ }
+
+ .guide-item {
+ display: flex;
+ align-items: flex-start;
+ margin-bottom: 25rpx;
+ }
+
+ .guide-step {
+ width: 40rpx;
+ height: 40rpx;
+ background-color: #2d8c3c;
+ color: white;
+ border-radius: 50%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ font-size: 24rpx;
+ margin-right: 20rpx;
+ flex-shrink: 0;
+ }
+
+ .guide-text {
+ flex: 1;
+ line-height: 1.5;
+ }
+
+ .expert-advice {
+ background-color: #f9f9f9;
+ border-radius: 12rpx;
+ padding: 25rpx;
+ }
+
+ .advice-header {
+ display: flex;
+ align-items: center;
+ margin-bottom: 20rpx;
+ }
+
+ .expert-avatar {
+ width: 80rpx;
+ height: 80rpx;
+ border-radius: 50%;
+ margin-right: 20rpx;
+ }
+
+ .expert-info {
+ display: flex;
+ flex-direction: column;
+ }
+
+ .expert-name {
+ font-size: 28rpx;
+ font-weight: bold;
+ color: #333;
+ }
+
+ .expert-title {
+ font-size: 24rpx;
+ color: #999;
+ margin-top: 5rpx;
+ }
+
+ .advice-content {
+ font-size: 26rpx;
+ color: #666;
+ line-height: 1.6;
+ }
+
+ .link-item {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ padding: 20rpx 0;
+ border-bottom: 1rpx solid #eee;
+ }
+
+ .link-item:last-child {
+ border-bottom: none;
+ }
+
+ .link-text {
+ font-size: 28rpx;
+ color: #1a5f23;
+ }
+
+ .link-icon {
+ width: 30rpx;
+ height: 30rpx;
+ }
+
+ .modal-footer {
+ display: flex;
+ padding: 30rpx;
+ border-top: 1rpx solid #eee;
+ gap: 20rpx;
+ }
+
+ .btn {
+ flex: 1;
+ height: 80rpx;
+ line-height: 80rpx;
+ border-radius: 40rpx;
+ font-size: 28rpx;
+ }
+ .btn::after{
+ border: none;
+ }
+
+ .btn-secondary {
+ background-color: #f5f7fa;
+ color: #666;
+ border:1px solid rgb(243, 241, 241);
+ }
+
+ .btn-primary {
+ background-color: #2d8c3c;
+ color: white;
+ }
+
+ /* 底部提示 */
+ .bottom-tip {
+ text-align: center;
+ padding: 30rpx;
+ }
+
+ .tip-text {
+ display: block;
+ font-size: 24rpx;
+ color: #999;
+ margin-bottom: 10rpx;
+ }
\ No newline at end of file
diff --git a/pagesB/pages/repository/repository.js b/pagesB/pages/repository/repository.js
index 994a78b..4835554 100644
--- a/pagesB/pages/repository/repository.js
+++ b/pagesB/pages/repository/repository.js
@@ -1,105 +1,131 @@
-// 模拟知识库数据
-const knowledgeBase = [
- {
- id: 1,
- title: "猪瘟防治",
- content: "猪瘟是由猪瘟病毒引起的高度接触性传染病。防治措施:1. 定期接种猪瘟疫苗 2. 加强饲养管理 3. 发现病猪立即隔离 4. 猪舍定期消毒",
- category: "疾病防治",
- tags: ["猪", "传染病", "疫苗"],
- date: "2024-01-15"
- },
- {
- id: 2,
- title: "鸡新城疫预防",
- content: "新城疫主要症状:呼吸困难、下痢、神经紊乱。预防:1. 接种新城疫疫苗 2. 加强鸡舍卫生 3. 严格控制人员进出 4. 定期检测抗体水平",
- category: "疾病防治",
- tags: ["鸡", "禽类", "病毒病"],
- date: "2024-01-10"
- },
- {
- id: 3,
- title: "奶牛饲养管理",
- content: "科学饲养要点:1. 合理搭配精粗饲料 2. 保证充足饮水 3. 定时定量饲喂 4. 保持牛舍清洁干燥 5. 定期进行健康检查",
- category: "饲养管理",
- tags: ["奶牛", "饲养", "管理"],
- date: "2024-01-05"
- },
- {
- id: 4,
- title: "仔猪腹泻治疗",
- content: "常见原因:细菌感染、病毒感染、饲养不当。治疗:1. 补充电解质 2. 使用抗生素(需兽医指导)3. 改善饲养环境 4. 加强母猪管理",
- category: "疾病防治",
- tags: ["猪", "腹泻", "治疗"],
- date: "2024-01-08"
- },
- {
- id: 5,
- title: "羊的饲料配方",
- content: "育肥羊饲料配方:玉米60%、豆粕20%、麦麸15%、预混料5%。注意事项:1. 逐渐换料 2. 保证粗纤维摄入 3. 添加适量食盐",
- category: "饲养管理",
- tags: ["羊", "饲料", "营养"],
- date: "2024-01-12"
- },
- {
- id: 6,
- title: "犬细小病毒防治",
- content: "症状:呕吐、腹泻、精神萎靡。防治:1. 定期接种疫苗 2. 发病早期使用血清 3. 补液治疗 4. 严格隔离病犬",
- category: "疾病防治",
- tags: ["犬", "宠物", "病毒"],
- date: "2024-01-18"
- },
- {
- id: 7,
- title: "水产养殖水质管理",
- content: "水质指标控制:1. pH值7.5-8.5 2. 溶解氧>5mg/L 3. 氨氮<0.2mg/L 4. 定期换水 5. 使用微生物制剂",
- category: "饲养管理",
- tags: ["水产", "水质", "管理"],
- date: "2024-01-14"
- }
-];
+// pages/search/index.js
+import http from '../../../utils/api'
Page({
data: {
searchValue: '',
searchResults: [],
- allKnowledge: knowledgeBase,
- recentSearches: [],
isLoading: false,
+ loadingMore: false,
activeCategory: '全部',
- categories: ['全部', '疾病防治', '饲养管理'],
+ categories: [
+ { name: '全部', value: '全部' },
+ { name: '疾病防治', value: '疾病防治' },
+ { name: '饲养管理', value: '饲养管理' }
+ ],
showTipsModal: false,
- searchTimer: null // 搜索防抖定时器
+ searchTimer: null,
+ // 分页相关
+ pageNum: 1,
+ pageSize: 10,
+ total: 0,
+ hasMore: true,
+ // 当前搜索参数
+ currentSearchKey: '',
+ currentCategory: '全部'
},
- onLoad() {
- // 初始显示所有知识
- this.setData({
- searchResults: this.data.allKnowledge
- });
-
- // 页面加载后显示提示弹框
- setTimeout(() => {
- this.setData({ showTipsModal: true });
- }, 500);
+ onLoad() {
+ // 初始加载数据
+ this.loadData(true);
+ this.gettipList()
+ },
+
+ // 知识库查询提示
+ gettipList(){
+ http.tipList({
+ data:{},
+ success:res=>{
+ console.log(res)
+ const tip = res.rows[0].tips.split('。')
+ this.setData({
+ tip:tip,
+ showTipsModal:true
+ })
+ }
+ })
},
- onShow() {
- const hasShownTips = wx.getStorageSync('hasShownTips');
- if (!hasShownTips) {
- setTimeout(() => {
- this.setData({ showTipsModal: true });
- wx.setStorageSync('hasShownTips', true);
- }, 500);
+ // 加载数据
+ loadData(isRefresh = false) {
+ if (isRefresh) {
+ this.setData({
+ pageNum: 1,
+ hasMore: true,
+ isLoading: true
+ });
+ } else {
+ if (!this.data.hasMore || this.data.loadingMore) return;
+ this.setData({ loadingMore: true });
+ }
+
+ const params = {
+ pageNum: this.data.pageNum,
+ pageSize: this.data.pageSize
+ };
+
+ // 添加搜索关键词
+ if (this.data.currentSearchKey) {
+ params.searchKey = this.data.currentSearchKey;
}
+
+ // 添加分类筛选(全部不传值)
+ if (this.data.currentCategory !== '全部') {
+ params.categoryType = this.data.currentCategory;
+ }
+
+ console.log('加载参数:', params); // 调试用
+
+ http.queryList({
+ data: params,
+ success: res => {
+ const newData = res.rows || [];
+ const total = res.total || 0;
+
+ let searchResults;
+ if (isRefresh) {
+ searchResults = newData;
+ } else {
+ searchResults = [...this.data.searchResults, ...newData];
+ }
+
+ const hasMore = searchResults.length < total;
+
+ this.setData({
+ searchResults,
+ total,
+ hasMore,
+ isLoading: false,
+ loadingMore: false
+ });
+
+ // 如果没有搜索结果且有关键词,显示提示
+ if (isRefresh && searchResults.length === 0 && this.data.currentSearchKey) {
+ wx.showToast({
+ title: '未找到相关结果',
+ icon: 'none',
+ duration: 2000
+ });
+ }
+ },
+ fail: () => {
+ this.setData({
+ isLoading: false,
+ loadingMore: false
+ });
+ wx.showToast({
+ title: '加载失败',
+ icon: 'error',
+ duration: 2000
+ });
+ }
+ });
},
// 输入搜索关键词(自动搜索)
onInputSearch(e) {
const value = e.detail.value;
- this.setData({
- searchValue: value,
- isLoading: true
- });
+ this.setData({ searchValue: value });
// 清除之前的定时器
if (this.data.searchTimer) {
@@ -108,35 +134,27 @@ Page({
// 设置新的定时器(防抖处理)
this.data.searchTimer = setTimeout(() => {
- if (!value.trim()) {
- // 如果搜索框为空,显示所有知识
+ const keyword = value.trim();
+
+ if (keyword) {
+ // 保持当前分类,只在当前分类中搜索
this.setData({
- searchResults: this.data.allKnowledge,
- isLoading: false
+ currentSearchKey: keyword,
+ // 不清除 currentCategory,保持当前分类筛选
+ // 只有搜索框清空时才重置分类
});
+ this.loadData(true);
} else {
- // 执行搜索
- this.performSearch(value.trim());
+ // 搜索框清空时,重置为初始状态
+ this.setData({
+ currentSearchKey: '',
+ // 不清除 currentCategory,让用户保持在当前分类
+ // 如果需要重置,可以取消下面这行的注释
+ // currentCategory: '全部'
+ });
+ this.loadData(true);
}
- }, 300); // 300ms防抖延迟
- },
-
- // 执行搜索操作
- performSearch(keyword) {
- const results = this.searchKnowledge(keyword);
- this.setData({
- searchResults: results,
- isLoading: false
- });
-
- // 如果没有搜索结果且有关键词,显示提示
- if (results.length === 0 && keyword) {
- wx.showToast({
- title: '未找到相关结果',
- icon: 'none',
- duration: 2000
- });
- }
+ }, 500); // 500ms防抖延迟
},
// 手动搜索(点击搜索按钮或按回车)
@@ -144,38 +162,63 @@ Page({
const keyword = this.data.searchValue.trim();
if (!keyword) {
+ // 如果搜索框为空,重置搜索
+ this.setData({
+ currentSearchKey: '',
+ // 保持当前分类,不清除分类筛选
+ });
+ } else {
+ // 保持当前分类,只在当前分类中搜索
this.setData({
- searchResults: this.data.allKnowledge
+ currentSearchKey: keyword,
+ // 保持 currentCategory 不变
});
- return;
}
+
+ this.loadData(true);
+ },
- this.setData({ isLoading: true });
+ // 按分类筛选
+ onFilterCategory(e) {
+ const category = e.currentTarget.dataset.category;
- // 清除定时器
- if (this.data.searchTimer) {
- clearTimeout(this.data.searchTimer);
- }
+ this.setData({
+ activeCategory: category,
+ currentCategory: category,
+ // 切换分类时清空搜索关键词
+ currentSearchKey: '',
+ searchValue: ''
+ });
- // 立即执行搜索
- this.performSearch(keyword);
+ this.loadData(true);
},
- // 搜索知识库
- searchKnowledge(keyword) {
- const lowerKeyword = keyword.toLowerCase();
-
- return this.data.allKnowledge.filter(item => {
- return item.title.toLowerCase().includes(lowerKeyword) ||
- item.content.toLowerCase().includes(lowerKeyword) ||
- item.tags.some(tag => tag.toLowerCase().includes(lowerKeyword)) ||
- item.category.toLowerCase().includes(lowerKeyword);
+ // 清空搜索
+ onClearSearch() {
+ this.setData({
+ searchValue: '',
+ currentSearchKey: '',
+ // 保持当前分类,不清除分类筛选
});
+
+ this.loadData(true);
+ },
+
+ // 上拉加载更多
+ onScrollToLower() {
+ if (this.data.hasMore && !this.data.loadingMore) {
+ this.setData({
+ pageNum: this.data.pageNum + 1
+ });
+ this.loadData(false);
+ }
},
// 隐藏提示弹框
hideTips() {
- this.setData({ showTipsModal: false });
+ this.setData({
+ showTipsModal: false
+ });
},
// 阻止事件冒泡
@@ -185,46 +228,12 @@ Page({
// 查看详情
onViewDetail(e) {
- const id = e.currentTarget.dataset.id;
- const item = this.data.allKnowledge.find(item => item.id === id);
- if (item) {
- wx.showModal({
- title: item.title,
- content: item.content,
- showCancel: false,
- confirmText: '知道了'
- });
- }
- },
-
- // 按分类筛选
- onFilterCategory(e) {
- const category = e.currentTarget.dataset.category;
- this.setData({
- activeCategory: category,
- searchValue: '' // 清空搜索框
- });
-
- if (category === '全部') {
- this.setData({
- searchResults: this.data.allKnowledge
- });
- } else {
- const results = this.data.allKnowledge.filter(item =>
- item.category === category
- );
- this.setData({
- searchResults: results
- });
- }
- },
-
- // 清空搜索
- onClearSearch() {
- this.setData({
- searchValue: '',
- searchResults: this.data.allKnowledge,
- activeCategory: '全部'
+ const item = e.currentTarget.dataset.value;
+ wx.showModal({
+ title: item.title,
+ content: item.content,
+ showCancel: false,
+ confirmText: '知道了'
});
},
diff --git a/pagesB/pages/repository/repository.wxml b/pagesB/pages/repository/repository.wxml
index 5e208fc..ea072cf 100644
--- a/pagesB/pages/repository/repository.wxml
+++ b/pagesB/pages/repository/repository.wxml
@@ -1,3 +1,4 @@
+
@@ -25,14 +26,14 @@
- {{item}}
-
+ {{item.name}}
+
@@ -48,11 +49,19 @@
-
+
- 找到 {{searchResults.length}} 条相关结果
+ 找到 {{total}} 条相关结果
+ (在{{currentCategory}}中搜索)
+ 关键词:"{{currentSearchKey}}"
@@ -60,26 +69,26 @@
class="knowledge-item"
wx:for="{{searchResults}}"
wx:key="id"
- data-id="{{item.id}}"
+ data-value="{{item}}"
bindtap="onViewDetail"
>
{{item.content}}
@@ -124,21 +163,8 @@
-
- 1
- 可以搜索疾病名称(如:猪瘟)
-
-
- 2
- 可以搜索动物种类(如:鸡、牛)
-
-
- 3
- 可以搜索症状(如:腹泻)
-
-
- 4
- 可以搜索管理方法(如:饲料、消毒)
+
+ {{item}}
diff --git a/pagesB/pages/repository/repository.wxss b/pagesB/pages/repository/repository.wxss
index cd06f69..8836074 100644
--- a/pagesB/pages/repository/repository.wxss
+++ b/pagesB/pages/repository/repository.wxss
@@ -138,13 +138,9 @@
}
@keyframes bounce {
-
- 0%,
- 80%,
- 100% {
+ 0%, 80%, 100% {
transform: scale(0);
}
-
40% {
transform: scale(1);
}
@@ -254,7 +250,6 @@
align-items: center;
}
-
.date {
font-size: 24rpx;
color: #94A3B8;
@@ -276,6 +271,59 @@
background: #F1F5F9;
}
+/* 加载更多样式 */
+.load-more {
+ padding: 40rpx 0;
+ text-align: center;
+ color: #94A3B8;
+ font-size: 26rpx;
+}
+
+.load-more-loading {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+}
+
+.loading-dots {
+ display: flex;
+ gap: 8rpx;
+ margin-bottom: 16rpx;
+}
+
+.loading-dots .dot {
+ width: 12rpx;
+ height: 12rpx;
+ background: #3B82F6;
+ border-radius: 50%;
+ animation: dotPulse 1.5s infinite ease-in-out;
+}
+
+.loading-dots .dot:nth-child(2) {
+ animation-delay: 0.2s;
+}
+
+.loading-dots .dot:nth-child(3) {
+ animation-delay: 0.4s;
+}
+
+@keyframes dotPulse {
+ 0%, 60%, 100% {
+ transform: translateY(0);
+ opacity: 0.6;
+ }
+ 30% {
+ transform: translateY(-20rpx);
+ opacity: 1;
+ }
+}
+
+.no-more {
+ padding: 40rpx 0;
+ text-align: center;
+ color: #94A3B8;
+ font-size: 26rpx;
+}
/* 空状态 */
.empty-state {
@@ -286,7 +334,6 @@
text-align: center;
}
-
.empty-text {
font-size: 32rpx;
font-weight: 600;
@@ -338,13 +385,8 @@
}
@keyframes fadeIn {
- from {
- opacity: 0;
- }
-
- to {
- opacity: 1;
- }
+ from { opacity: 0; }
+ to { opacity: 1; }
}
.modal-content {
@@ -361,7 +403,6 @@
opacity: 0;
transform: translateY(80rpx);
}
-
to {
opacity: 1;
transform: translateY(0);
@@ -402,20 +443,7 @@
margin-bottom: 0;
}
-.tip-number {
- width: 48rpx;
- height: 48rpx;
- background: linear-gradient(135deg, #60A5FA 0%, #3B82F6 100%);
- color: #FFFFFF;
- border-radius: 50%;
- display: flex;
- align-items: center;
- justify-content: center;
- font-size: 24rpx;
- font-weight: 600;
- margin-right: 20rpx;
- flex-shrink: 0;
-}
+
.tip-text {
font-size: 28rpx;
diff --git a/pagesB/pages/training/training.js b/pagesB/pages/training/training.js
new file mode 100644
index 0000000..fae7197
--- /dev/null
+++ b/pagesB/pages/training/training.js
@@ -0,0 +1,457 @@
+// pages/training/training.js
+Page({
+ data: {
+ currentTab: 0,
+ searchKeyword: '',
+ articleActiveCategory: 'all',
+ videoActiveCategory: 'all',
+
+ // 文章数据
+ articles: [
+ {
+ id: 1,
+ title: '微信小程序开发最佳实践',
+ description: '深度解析小程序性能优化方案,助你打造流畅用户体验',
+ cover: 'https://via.placeholder.com/400x300/3498db/ffffff?text=小程序',
+ category: '技术干货',
+ author: '张技术',
+ readTime: 15,
+ date: '2024-01-15',
+ views: 2345,
+ likes: 189,
+ categoryId: 'tech'
+ },
+ {
+ id: 2,
+ title: '企业数字化转型的关键路径',
+ description: '传统企业如何通过数字化实现业务增长与效率提升',
+ cover: 'https://via.placeholder.com/400x300/2ecc71/ffffff?text=数字化',
+ category: '商业思维',
+ author: '李商业',
+ readTime: 20,
+ date: '2024-01-12',
+ views: 1567,
+ likes: 234,
+ categoryId: 'business'
+ },
+ {
+ id: 3,
+ title: '高效团队管理的7个秘诀',
+ description: '打造高绩效团队的实用方法与技巧',
+ cover: 'https://via.placeholder.com/400x300/e74c3c/ffffff?text=管理',
+ category: '管理技能',
+ author: '王经理',
+ readTime: 12,
+ date: '2024-01-10',
+ views: 3210,
+ likes: 456,
+ categoryId: 'management'
+ },
+ {
+ id: 4,
+ title: '前端工程师的职业发展路径',
+ description: '从初级到专家,前端工程师的成长路线图',
+ cover: 'https://via.placeholder.com/400x300/9b59b6/ffffff?text=前端',
+ category: '职业发展',
+ author: '赵前端',
+ readTime: 18,
+ date: '2024-01-08',
+ views: 1890,
+ likes: 345,
+ categoryId: 'career'
+ },
+ {
+ id: 5,
+ title: '云原生架构设计与实践',
+ description: '基于云原生技术的现代应用架构方案',
+ cover: 'https://via.placeholder.com/400x300/1abc9c/ffffff?text=云原生',
+ category: '技术干货',
+ author: '钱架构',
+ readTime: 25,
+ date: '2024-01-05',
+ views: 2789,
+ likes: 512,
+ categoryId: 'tech'
+ },
+ {
+ id: 6,
+ title: '人工智能在商业中的应用',
+ description: 'AI技术如何赋能传统行业实现智能化升级',
+ cover: 'https://via.placeholder.com/400x300/f39c12/ffffff?text=AI',
+ category: '商业思维',
+ author: '孙智能',
+ readTime: 22,
+ date: '2024-01-03',
+ views: 4321,
+ likes: 678,
+ categoryId: 'business'
+ }
+ ],
+
+ // 视频数据
+ videos: [
+ {
+ id: 1,
+ title: 'Vue.js 3.0 核心源码解析',
+ cover: 'https://via.placeholder.com/400x300/3498db/ffffff?text=Vue3',
+ duration: '45:23',
+ instructor: {
+ name: '前端大神',
+ avatar: 'https://via.placeholder.com/40/3498db/ffffff?text=FS'
+ },
+ level: '高级',
+ views: '12.3k',
+ tags: ['Vue', '前端', '源码'],
+ category: 'tech',
+ isRecommended: true
+ },
+ {
+ id: 2,
+ title: 'React Hooks 深度解析',
+ cover: 'https://via.placeholder.com/400x300/2ecc71/ffffff?text=React',
+ duration: '38:45',
+ instructor: {
+ name: 'React专家',
+ avatar: 'https://via.placeholder.com/40/2ecc71/ffffff?text=RE'
+ },
+ level: '中级',
+ views: '8.7k',
+ tags: ['React', 'Hooks', '前端'],
+ category: 'tech',
+ isRecommended: true
+ },
+ {
+ id: 3,
+ title: '产品经理必备的7个思维模型',
+ cover: 'https://via.placeholder.com/400x300/e74c3c/ffffff?text=产品',
+ duration: '52:12',
+ instructor: {
+ name: '产品专家',
+ avatar: 'https://via.placeholder.com/40/e74c3c/ffffff?text=PM'
+ },
+ level: '中级',
+ views: '15.2k',
+ tags: ['产品', '思维', '方法论'],
+ category: 'business',
+ isRecommended: false
+ },
+ {
+ id: 4,
+ title: 'Python 数据分析实战',
+ cover: 'https://via.placeholder.com/400x300/9b59b6/ffffff?text=Python',
+ duration: '41:36',
+ instructor: {
+ name: '数据科学家',
+ avatar: 'https://via.placeholder.com/40/9b59b6/ffffff?text=DS'
+ },
+ level: '初级',
+ views: '23.4k',
+ tags: ['Python', '数据分析', '实战'],
+ category: 'tech',
+ isRecommended: true
+ },
+ {
+ id: 5,
+ title: '高效沟通的艺术与技巧',
+ cover: 'https://via.placeholder.com/400x300/1abc9c/ffffff?text=沟通',
+ duration: '36:58',
+ instructor: {
+ name: '沟通专家',
+ avatar: 'https://via.placeholder.com/40/1abc9c/ffffff?text=CM'
+ },
+ level: '初级',
+ views: '9.8k',
+ tags: ['沟通', '职场', '技巧'],
+ category: 'management',
+ isRecommended: false
+ },
+ {
+ id: 6,
+ title: 'Node.js 高性能服务开发',
+ cover: 'https://via.placeholder.com/400x300/f39c12/ffffff?text=Node',
+ duration: '55:42',
+ instructor: {
+ name: '后端架构师',
+ avatar: 'https://via.placeholder.com/40/f39c12/ffffff?text=BE'
+ },
+ level: '高级',
+ views: '6.5k',
+ tags: ['Node.js', '后端', '性能'],
+ category: 'tech',
+ isRecommended: false
+ },
+ {
+ id: 7,
+ title: '职场晋升的底层逻辑',
+ cover: 'https://via.placeholder.com/400x300/34495e/ffffff?text=晋升',
+ duration: '33:27',
+ instructor: {
+ name: '职业规划师',
+ avatar: 'https://via.placeholder.com/40/34495e/ffffff?text=CD'
+ },
+ level: '中级',
+ views: '11.2k',
+ tags: ['职场', '晋升', '规划'],
+ category: 'career',
+ isRecommended: true
+ },
+ {
+ id: 8,
+ title: 'JavaScript 入门到精通',
+ cover: 'https://via.placeholder.com/400x300/e74c3c/ffffff?text=JS',
+ duration: '1:15:30',
+ instructor: {
+ name: '前端导师',
+ avatar: 'https://via.placeholder.com/40/e74c3c/ffffff?text=JS'
+ },
+ level: '初级',
+ views: '45.6k',
+ tags: ['JavaScript', '入门', '教程'],
+ category: 'tech',
+ isRecommended: true
+ },
+ {
+ id: 9,
+ title: '商业计划书撰写指南',
+ cover: 'https://via.placeholder.com/400x300/1abc9c/ffffff?text=商业',
+ duration: '28:45',
+ instructor: {
+ name: '商业顾问',
+ avatar: 'https://via.placeholder.com/40/1abc9c/ffffff?text=BC'
+ },
+ level: '中级',
+ views: '7.3k',
+ tags: ['商业', '创业', '计划书'],
+ category: 'business',
+ isRecommended: false
+ },
+ {
+ id: 10,
+ title: '团队领导力提升训练',
+ cover: 'https://via.placeholder.com/400x300/9b59b6/ffffff?text=领导力',
+ duration: '49:18',
+ instructor: {
+ name: '领导力教练',
+ avatar: 'https://via.placeholder.com/40/9b59b6/ffffff?text=LC'
+ },
+ level: '高级',
+ views: '5.9k',
+ tags: ['领导力', '管理', '团队'],
+ category: 'management',
+ isRecommended: true
+ }
+ ],
+
+ filteredArticles: [],
+ filteredVideos: []
+ },
+
+ onLoad() {
+ // 初始化数据
+ this.setData({
+ filteredArticles: this.data.articles,
+ filteredVideos: this.data.videos
+ });
+ },
+
+ // 切换主选项卡
+ switchTab(e) {
+ const tab = parseInt(e.currentTarget.dataset.tab);
+ this.setData({
+ currentTab: tab,
+ searchKeyword: ''
+ });
+
+ // 重置筛选结果
+ if (tab === 0) {
+ this.setData({
+ filteredArticles: this.filterArticles('', this.data.articleActiveCategory)
+ });
+ } else {
+ this.setData({
+ filteredVideos: this.filterVideos('', this.data.videoActiveCategory)
+ });
+ }
+ },
+
+ // 搜索输入
+ onSearchInput(e) {
+ const keyword = e.detail.value;
+ this.setData({ searchKeyword: keyword });
+
+ if (this.data.currentTab === 0) {
+ this.setData({
+ filteredArticles: this.filterArticles(keyword, this.data.articleActiveCategory)
+ });
+ } else {
+ this.setData({
+ filteredVideos: this.filterVideos(keyword, this.data.videoActiveCategory)
+ });
+ }
+ },
+
+ // 选择文章分类
+ selectArticleCategory(e) {
+ const category = e.currentTarget.dataset.category;
+ this.setData({ articleActiveCategory: category });
+ this.setData({
+ filteredArticles: this.filterArticles(this.data.searchKeyword, category)
+ });
+ },
+
+ // 选择视频分类
+ selectVideoCategory(e) {
+ const category = e.currentTarget.dataset.category;
+ this.setData({ videoActiveCategory: category });
+ this.setData({
+ filteredVideos: this.filterVideos(this.data.searchKeyword, category)
+ });
+ },
+
+ // 筛选文章函数
+ filterArticles(keyword, category) {
+ let filtered = this.data.articles;
+
+ // 按分类筛选
+ if (category !== 'all') {
+ const categoryMap = {
+ 'tech': '技术干货',
+ 'business': '商业思维',
+ 'management': '管理技能',
+ 'career': '职业发展'
+ };
+
+ filtered = filtered.filter(item => item.category === categoryMap[category]);
+ }
+
+ // 按关键词筛选
+ if (keyword) {
+ const lowerKeyword = keyword.toLowerCase();
+ filtered = filtered.filter(item =>
+ item.title.toLowerCase().includes(lowerKeyword) ||
+ item.description.toLowerCase().includes(lowerKeyword) ||
+ item.author.toLowerCase().includes(lowerKeyword) ||
+ item.category.toLowerCase().includes(lowerKeyword)
+ );
+ }
+
+ return filtered;
+ },
+
+ // 筛选视频函数
+ filterVideos(keyword, category) {
+ let filtered = this.data.videos;
+
+ // 按分类筛选
+ if (category !== 'all') {
+ switch (category) {
+ case 'recommend':
+ filtered = filtered.filter(item => item.isRecommended);
+ break;
+ case 'tech':
+ filtered = filtered.filter(item => item.category === 'tech');
+ break;
+ case 'business':
+ filtered = filtered.filter(item => item.category === 'business');
+ break;
+ case 'management':
+ filtered = filtered.filter(item => item.category === 'management');
+ break;
+ case 'career':
+ filtered = filtered.filter(item => item.category === 'career');
+ break;
+ case 'beginner':
+ filtered = filtered.filter(item => item.level === '初级');
+ break;
+ case 'advanced':
+ filtered = filtered.filter(item => item.level === '中级' || item.level === '高级');
+ break;
+ }
+ }
+
+ // 按关键词筛选
+ if (keyword) {
+ const lowerKeyword = keyword.toLowerCase();
+ filtered = filtered.filter(item =>
+ item.title.toLowerCase().includes(lowerKeyword) ||
+ item.tags.some(tag => tag.toLowerCase().includes(lowerKeyword)) ||
+ item.instructor.name.toLowerCase().includes(lowerKeyword) ||
+ item.level.toLowerCase().includes(lowerKeyword)
+ );
+ }
+
+ return filtered;
+ },
+
+ // 查看文章详情
+ viewArticleDetail(e) {
+ const id = e.currentTarget.dataset.id;
+
+ },
+
+ // 播放视频
+ playVideo(e) {
+ const id = e.currentTarget.dataset.id;
+
+
+ },
+
+ // 下拉刷新
+ onPullDownRefresh() {
+ wx.showLoading({
+ title: '刷新中...'
+ });
+
+ // 模拟网络请求
+ setTimeout(() => {
+ // 重置数据
+ this.setData({
+ filteredArticles: this.data.articles,
+ filteredVideos: this.data.videos,
+ articleActiveCategory: 'all',
+ videoActiveCategory: 'all',
+ searchKeyword: ''
+ });
+
+ wx.hideLoading();
+ wx.stopPullDownRefresh();
+ wx.showToast({
+ title: '刷新成功',
+ icon: 'success'
+ });
+ }, 1000);
+ },
+
+ // 上拉加载更多
+ onReachBottom() {
+ if (this.data.currentTab === 0) {
+ // 文章加载更多
+ wx.showLoading({
+ title: '加载更多文章...'
+ });
+
+ setTimeout(() => {
+ // 这里可以添加更多文章数据
+ wx.hideLoading();
+ wx.showToast({
+ title: '没有更多了',
+ icon: 'none'
+ });
+ }, 1000);
+ } else {
+ // 视频加载更多
+ wx.showLoading({
+ title: '加载更多视频...'
+ });
+
+ setTimeout(() => {
+ // 这里可以添加更多视频数据
+ wx.hideLoading();
+ wx.showToast({
+ title: '没有更多了',
+ icon: 'none'
+ });
+ }, 1000);
+ }
+ }
+});
\ No newline at end of file
diff --git a/pagesB/pages/training/training.json b/pagesB/pages/training/training.json
new file mode 100644
index 0000000..867b5eb
--- /dev/null
+++ b/pagesB/pages/training/training.json
@@ -0,0 +1,4 @@
+{
+ "navigationBarTitleText":"在线培训",
+ "usingComponents": {}
+}
\ No newline at end of file
diff --git a/pagesB/pages/training/training.wxml b/pagesB/pages/training/training.wxml
new file mode 100644
index 0000000..8af1f91
--- /dev/null
+++ b/pagesB/pages/training/training.wxml
@@ -0,0 +1,298 @@
+
+
+
+
+
+
+
+
+ 文章
+
+
+
+ 视频
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 全部
+
+
+
+ 技术干货
+
+
+
+ 商业思维
+
+
+
+ 管理技能
+
+
+
+ 职业发展
+
+
+
+
+
+
+
+
+
+
+
+
+ {{item.category}}
+
+
+
+
+
+ {{item.title}}
+ {{item.description}}
+
+
+
+
+ {{item.author}}
+
+
+
+ {{item.date}}
+
+
+
+
+
+
+ {{item.likes}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 暂无相关文章
+ 换个关键词试试吧
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 全部视频
+
+
+
+ 热门推荐
+
+
+
+ 技术教程
+
+
+
+ 商业知识
+
+
+
+ 管理技能
+
+
+
+ 职业发展
+
+
+
+ 初级入门
+
+
+
+ 进阶提升
+
+
+
+
+
+
+
+
+
+
+
+
+ {{item.duration}}
+
+
+
+
+
+
+
+
+
+ {{item.title}}
+
+
+ {{item.instructor.name}}
+
+
+
+
+ 2026-01-12
+
+
+ {{item.views}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 暂无相关视频
+ 换个关键词试试吧
+
+
+
\ No newline at end of file
diff --git a/pagesB/pages/training/training.wxss b/pagesB/pages/training/training.wxss
new file mode 100644
index 0000000..9d9607b
--- /dev/null
+++ b/pagesB/pages/training/training.wxss
@@ -0,0 +1,1066 @@
+/* pages/training/training.wxss */
+.training-container {
+ min-height: 100vh;
+ background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
+ padding: 20rpx 30rpx 100rpx;
+ position: relative;
+ overflow-x: hidden;
+}
+
+/* 头部样式优化 */
+.header {
+ text-align: center;
+ margin-bottom: 50rpx;
+ padding-top: 60rpx;
+ position: relative;
+ z-index: 1;
+}
+
+.title {
+ font-size: 56rpx;
+ font-weight: 800;
+ color: transparent;
+ background: linear-gradient(45deg, #3498db, #2ecc71, #3498db);
+ background-size: 200% auto;
+ -webkit-background-clip: text;
+ background-clip: text;
+ margin-bottom: 20rpx;
+ letter-spacing: 1rpx;
+ position: relative;
+ display: inline-block;
+ animation: gradientText 3s ease infinite;
+}
+
+@keyframes gradientText {
+
+ 0%,
+ 100% {
+ background-position: 0% center;
+ }
+
+ 50% {
+ background-position: 100% center;
+ }
+}
+
+.title::after {
+ content: '';
+ position: absolute;
+ bottom: -8rpx;
+ left: 50%;
+ transform: translateX(-50%);
+ width: 80rpx;
+ height: 4rpx;
+ background: linear-gradient(45deg, #3498db, #2ecc71);
+ border-radius: 2rpx;
+}
+
+.subtitle {
+ font-size: 28rpx;
+ color: #64748b;
+ letter-spacing: 2rpx;
+ font-weight: 400;
+ opacity: 0.9;
+ position: relative;
+ padding-top: 10rpx;
+}
+
+.header-decoration {
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ pointer-events: none;
+ z-index: -1;
+}
+
+.decoration-circle {
+ position: absolute;
+ border-radius: 50%;
+ background: linear-gradient(45deg, rgba(52, 152, 219, 0.1), rgba(46, 204, 113, 0.1));
+ animation: float 6s ease-in-out infinite;
+}
+
+.circle-1 {
+ width: 120rpx;
+ height: 120rpx;
+ top: 20rpx;
+ left: 10%;
+ animation-delay: 0s;
+}
+
+.circle-2 {
+ width: 80rpx;
+ height: 80rpx;
+ top: 60rpx;
+ right: 15%;
+ animation-delay: 2s;
+}
+
+.circle-3 {
+ width: 60rpx;
+ height: 60rpx;
+ top: 100rpx;
+ left: 20%;
+ animation-delay: 4s;
+}
+
+@keyframes float {
+
+ 0%,
+ 100% {
+ transform: translateY(0) scale(1);
+ }
+
+ 50% {
+ transform: translateY(-20rpx) scale(1.05);
+ }
+}
+
+/* 主选项卡样式优化 - 去除图标,优化切换样式 */
+.tabs {
+ display: flex;
+ background: rgba(255, 255, 255, 0.95);
+ backdrop-filter: blur(10rpx);
+ border-radius: 18rpx;
+ margin-bottom: 50rpx;
+ box-shadow:
+ 0 8rpx 30rpx rgba(0, 0, 0, 0.08),
+ inset 0 1rpx 0 rgba(255, 255, 255, 0.9);
+ border: 1rpx solid rgba(226, 232, 240, 0.8);
+ position: relative;
+ overflow: hidden;
+ z-index: 1;
+ padding: 6rpx;
+ height: 88rpx;
+}
+
+.tab-item {
+ flex: 1;
+ text-align: center;
+ font-size: 32rpx;
+ color: #64748b;
+ position: relative;
+ transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
+ font-weight: 500;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ height: 100%;
+ border-radius: 12rpx;
+ z-index: 2;
+ letter-spacing: 1rpx;
+}
+
+.tab-item.active {
+ color: #ffffff;
+ font-weight: 600;
+ text-shadow: 0 1rpx 2rpx rgba(0, 0, 0, 0.1);
+}
+
+.tab-slider {
+ position: absolute;
+ top: 6rpx;
+ width: calc(50% - 6rpx);
+ height: calc(100% - 12rpx);
+ background: linear-gradient(135deg, #3498db, #2ecc71);
+ border-radius: 12rpx;
+ transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
+ box-shadow:
+ 0 4rpx 20rpx rgba(52, 152, 219, 0.25),
+ 0 2rpx 8rpx rgba(52, 152, 219, 0.15);
+ z-index: 1;
+}
+
+.tab-slider.left {
+ left: 6rpx;
+ transform: translateX(0);
+}
+
+.tab-slider.right {
+ left: 6rpx;
+ transform: translateX(100%);
+}
+
+.tab-highlight {
+ position: absolute;
+ bottom: -6rpx;
+ left: 50%;
+ transform: translateX(-50%);
+ width: 24rpx;
+ height: 4rpx;
+ background: linear-gradient(135deg, #3498db, #2ecc71);
+ border-radius: 2rpx;
+ opacity: 0;
+ transition: all 0.3s ease;
+ box-shadow: 0 2rpx 6rpx rgba(52, 152, 219, 0.3);
+}
+
+.tab-item.active .tab-highlight {
+ opacity: 1;
+ animation: highlightPulse 2s ease infinite;
+}
+
+@keyframes highlightPulse {
+
+ 0%,
+ 100% {
+ box-shadow: 0 2rpx 6rpx rgba(52, 152, 219, 0.3);
+ transform: translateX(-50%) scale(1);
+ }
+
+ 50% {
+ box-shadow: 0 2rpx 12rpx rgba(52, 152, 219, 0.5);
+ transform: translateX(-50%) scale(1.1);
+ }
+}
+
+/* 内容区域 */
+.content-section {
+ animation: slideUp 0.6s cubic-bezier(0.4, 0, 0.2, 1);
+}
+
+@keyframes slideUp {
+ from {
+ opacity: 0;
+ transform: translateY(40rpx);
+ }
+
+ to {
+ opacity: 1;
+ transform: translateY(0);
+ }
+}
+
+/* 搜索框样式优化 */
+.search-box {
+ position: relative;
+ margin-bottom: 50rpx;
+ animation: slideIn 0.8s ease;
+}
+
+@keyframes slideIn {
+ from {
+ opacity: 0;
+ transform: translateX(-30rpx);
+ }
+
+ to {
+ opacity: 1;
+ transform: translateX(0);
+ }
+}
+
+.search-input {
+ background: rgba(255, 255, 255, 0.95);
+ backdrop-filter: blur(10rpx);
+ border-radius: 25rpx;
+ padding: 20rpx 40rpx 20rpx 100rpx;
+ font-size: 28rpx;
+ box-shadow:
+ 0 8rpx 30rpx rgba(0, 0, 0, 0.08),
+ inset 0 1rpx 0 rgba(255, 255, 255, 0.8);
+ border: 1rpx solid rgba(255, 255, 255, 0.5);
+ transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
+ position: relative;
+ z-index: 2;
+}
+
+.search-input:focus {
+ border-color: rgba(52, 152, 219, 0.3);
+ box-shadow:
+ 0 12rpx 40rpx rgba(52, 152, 219, 0.15),
+ inset 0 1rpx 0 rgba(255, 255, 255, 0.8);
+ transform: translateY(-2rpx);
+}
+
+.search-icon {
+ position: absolute;
+ left: 40rpx;
+ top: 50%;
+ transform: translateY(-50%);
+ width: 36rpx;
+ height: 36rpx;
+ z-index: 3;
+ transition: all 0.3s ease;
+}
+
+.search-input:focus+.search-decoration .search-wave,
+.search-input:focus .search-icon {
+ animation: pulse 2s ease infinite;
+}
+
+.search-decoration {
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ border-radius: 25rpx;
+ overflow: hidden;
+ z-index: 1;
+}
+
+.search-wave {
+ position: absolute;
+ top: 0;
+ left: -100%;
+ width: 200%;
+ height: 100%;
+ background: linear-gradient(90deg,
+ transparent,
+ rgba(52, 152, 219, 0.1),
+ transparent);
+ animation: waveFlow 3s ease-in-out infinite;
+}
+
+@keyframes waveFlow {
+ 0% {
+ transform: translateX(0);
+ }
+
+ 100% {
+ transform: translateX(50%);
+ }
+}
+
+@keyframes pulse {
+
+ 0%,
+ 100% {
+ transform: translateY(-50%) scale(1);
+ opacity: 1;
+ }
+
+ 50% {
+ transform: translateY(-50%) scale(1.1);
+ opacity: 0.8;
+ }
+}
+
+.placeholder-style {
+ color: #94a3b8;
+ font-size: 28rpx;
+}
+
+/* 分类筛选样式优化 - 去除图标 */
+.category-scroll {
+ white-space: nowrap;
+ margin-bottom: 50rpx;
+ padding: 0 10rpx;
+}
+
+.category-list {
+ display: inline-flex;
+ padding: 0 20rpx 20rpx;
+ gap: 20rpx;
+}
+
+.category-item {
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ padding: 20rpx 36rpx;
+ background: rgba(255, 255, 255, 0.9);
+ backdrop-filter: blur(10rpx);
+ border-radius: 25rpx;
+ font-size: 28rpx;
+ color: #64748b;
+ box-shadow:
+ 0 4rpx 15rpx rgba(0, 0, 0, 0.05),
+ inset 0 1rpx 0 rgba(255, 255, 255, 0.8);
+ border: 1rpx solid rgba(255, 255, 255, 0.3);
+ transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
+ position: relative;
+ overflow: hidden;
+ white-space: nowrap;
+ font-weight: 500;
+ min-width: 120rpx;
+}
+
+.category-item:active {
+ transform: scale(0.96);
+}
+
+.category-item.active {
+ background: linear-gradient(135deg, #3498db, #2ecc71);
+ color: white;
+ box-shadow:
+ 0 8rpx 25rpx rgba(52, 152, 219, 0.25),
+ inset 0 1rpx 0 rgba(255, 255, 255, 0.3);
+ border-color: transparent;
+ font-weight: 600;
+ animation: categoryPulse 2s ease infinite;
+}
+
+@keyframes categoryPulse {
+
+ 0%,
+ 100% {
+ box-shadow:
+ 0 8rpx 25rpx rgba(52, 152, 219, 0.25),
+ inset 0 1rpx 0 rgba(255, 255, 255, 0.3);
+ }
+
+ 50% {
+ box-shadow:
+ 0 12rpx 35rpx rgba(52, 152, 219, 0.4),
+ inset 0 1rpx 0 rgba(255, 255, 255, 0.3);
+ }
+}
+
+.category-indicator {
+ position: absolute;
+ bottom: 8rpx;
+ left: 50%;
+ transform: translateX(-50%);
+ width: 6rpx;
+ height: 6rpx;
+ background: white;
+ border-radius: 50%;
+ opacity: 0;
+ transition: all 0.3s ease;
+}
+
+.category-item.active .category-indicator {
+ opacity: 1;
+ animation: indicatorBounce 1s ease infinite;
+}
+
+@keyframes indicatorBounce {
+
+ 0%,
+ 100% {
+ transform: translateX(-50%) translateY(0);
+ }
+
+ 50% {
+ transform: translateX(-50%) translateY(-4rpx);
+ }
+}
+
+/* 文章列表样式优化 */
+.articles-list {
+ margin-top: 10rpx;
+}
+
+.article-card {
+ background: rgba(255, 255, 255, 0.95);
+ backdrop-filter: blur(10rpx);
+ border-radius: 25rpx;
+ margin-bottom: 35rpx;
+ overflow: hidden;
+ box-shadow:
+ 0 10rpx 35rpx rgba(0, 0, 0, 0.08),
+ inset 0 1rpx 0 rgba(255, 255, 255, 0.8);
+ border: 1rpx solid rgba(255, 255, 255, 0.5);
+ transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
+ position: relative;
+ opacity: 0;
+ transform: translateY(30rpx);
+ animation: cardAppear 0.6s ease forwards;
+}
+
+@keyframes cardAppear {
+ to {
+ opacity: 1;
+ transform: translateY(0);
+ }
+}
+
+.article-card:nth-child(1) {
+ animation-delay: 0.1s;
+}
+
+.article-card:nth-child(2) {
+ animation-delay: 0.2s;
+}
+
+.article-card:nth-child(3) {
+ animation-delay: 0.3s;
+}
+
+.article-card:nth-child(4) {
+ animation-delay: 0.4s;
+}
+
+.article-card:nth-child(5) {
+ animation-delay: 0.5s;
+}
+
+.article-card:active {
+ transform: translateY(-8rpx);
+ box-shadow:
+ 0 20rpx 50rpx rgba(0, 0, 0, 0.15),
+ inset 0 1rpx 0 rgba(255, 255, 255, 0.8);
+}
+
+.article-card::before {
+ content: '';
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
+ height: 4rpx;
+ background: linear-gradient(45deg, #3498db, #2ecc71);
+ opacity: 0;
+ transition: opacity 0.4s ease;
+ z-index: 2;
+}
+
+.article-card:active::before {
+ opacity: 1;
+}
+
+.article-cover-container {
+ position: relative;
+ height: 320rpx;
+ overflow: hidden;
+ border-radius: 25rpx 25rpx 0 0;
+}
+
+.article-cover {
+ width: 100%;
+ height: 100%;
+ transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
+}
+
+.article-card:active .article-cover {
+ transform: scale(1.08);
+}
+
+.cover-overlay {
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ background: linear-gradient(to bottom, transparent 50%, rgba(0, 0, 0, 0.3));
+}
+
+.category-tag {
+ position: absolute;
+ top: 25rpx;
+ right: 25rpx;
+ background: rgba(52, 152, 219, 0.95);
+ backdrop-filter: blur(10rpx);
+ color: white;
+ padding: 10rpx 25rpx;
+ border-radius: 20rpx;
+ font-size: 22rpx;
+ font-weight: 600;
+ box-shadow: 0 4rpx 15rpx rgba(0, 0, 0, 0.2);
+ z-index: 2;
+}
+
+.article-hover-effect {
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ background: linear-gradient(45deg, transparent, rgba(52, 152, 219, 0.1), transparent);
+ opacity: 0;
+ transition: opacity 0.4s ease;
+}
+
+.article-card:active .article-hover-effect {
+ opacity: 1;
+}
+
+.article-info {
+ padding: 35rpx;
+}
+
+.article-title {
+ font-size: 34rpx;
+ font-weight: 700;
+ color: #1e293b;
+ margin-bottom: 20rpx;
+ line-height: 1.4;
+ letter-spacing: 0.5rpx;
+ display: -webkit-box;
+ -webkit-box-orient: vertical;
+ -webkit-line-clamp: 2;
+ overflow: hidden;
+ transition: color 0.3s ease;
+}
+
+.article-card:active .article-title {
+ color: #3498db;
+}
+
+.article-desc {
+ font-size: 26rpx;
+ color: #64748b;
+ line-height: 1.6;
+ margin-bottom: 25rpx;
+ display: -webkit-box;
+ -webkit-box-orient: vertical;
+ -webkit-line-clamp: 2;
+ overflow: hidden;
+}
+
+.article-meta {
+ display: flex;
+ justify-content: space-between;
+ margin-bottom: 25rpx;
+ padding-bottom: 25rpx;
+ border-bottom: 1rpx solid rgba(226, 232, 240, 0.8);
+}
+
+.meta-item {
+ display: flex;
+ align-items: center;
+ gap: 10rpx;
+}
+
+.meta-icon {
+ width: 30rpx;
+ height: 30rpx;
+ transition: all 0.3s ease;
+}
+
+.meta-item:active .meta-icon {
+ opacity: 1;
+ transform: scale(1.1);
+}
+
+.meta-text {
+ font-size: 24rpx;
+ color: #94a3b8;
+ font-weight: 400;
+}
+
+.article-stats {
+ display: flex;
+ justify-content: flex-end;
+ align-items: center;
+}
+
+.stat-item {
+ display: flex;
+ align-items: center;
+ gap: 10rpx;
+ font-size: 24rpx;
+ color: #64748b;
+ font-weight: 500;
+}
+
+.stat-icon {
+ width: 28rpx;
+ height: 28rpx;
+ opacity: 0.7;
+ transition: all 0.3s ease;
+}
+
+.stat-item:active .stat-icon {
+ opacity: 1;
+ transform: scale(1.1);
+}
+
+
+
+/* 视频列表样式优化 */
+.videos-grid {
+ display: grid;
+ grid-template-columns: repeat(2, 1fr);
+ gap: 35rpx;
+ margin-top: 20rpx;
+}
+
+.video-card {
+ background: rgba(255, 255, 255, 0.95);
+ backdrop-filter: blur(10rpx);
+ border-radius: 25rpx;
+ overflow: hidden;
+ box-shadow:
+ 0 10rpx 35rpx rgba(0, 0, 0, 0.08),
+ inset 0 1rpx 0 rgba(255, 255, 255, 0.8);
+ border: 1rpx solid rgba(255, 255, 255, 0.5);
+ transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
+ position: relative;
+ opacity: 0;
+ transform: scale(0.9);
+ animation: videoCardAppear 0.6s ease forwards;
+}
+
+@keyframes videoCardAppear {
+ to {
+ opacity: 1;
+ transform: scale(1);
+ }
+}
+
+.video-card:nth-child(1) {
+ animation-delay: 0.1s;
+}
+
+.video-card:nth-child(2) {
+ animation-delay: 0.2s;
+}
+
+.video-card:nth-child(3) {
+ animation-delay: 0.3s;
+}
+
+.video-card:nth-child(4) {
+ animation-delay: 0.4s;
+}
+
+.video-card:nth-child(5) {
+ animation-delay: 0.5s;
+}
+
+.video-card:nth-child(6) {
+ animation-delay: 0.6s;
+}
+
+.video-card:active {
+ transform: scale(0.95);
+ box-shadow:
+ 0 20rpx 50rpx rgba(0, 0, 0, 0.15),
+ inset 0 1rpx 0 rgba(255, 255, 255, 0.8);
+}
+
+.video-card::before {
+ content: '';
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
+ height: 4rpx;
+ background: linear-gradient(45deg, #3498db, #2ecc71);
+ opacity: 0;
+ transition: opacity 0.4s ease;
+ z-index: 2;
+}
+
+.video-card:active::before {
+ opacity: 1;
+}
+
+.video-cover-container {
+ position: relative;
+ height: 280rpx;
+ overflow: hidden;
+ border-radius: 25rpx 25rpx 0 0;
+}
+
+.video-cover {
+ width: 100%;
+ height: 100%;
+ transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
+}
+
+.video-card:active .video-cover {
+ transform: scale(1.08);
+}
+
+.video-duration {
+ position: absolute;
+ bottom: 15rpx;
+ right: 15rpx;
+ background: rgba(0, 0, 0, 0.9);
+ backdrop-filter: blur(10rpx);
+ color: white;
+ padding: 8rpx 18rpx;
+ border-radius: 15rpx;
+ font-size: 22rpx;
+ font-weight: 600;
+ z-index: 2;
+}
+
+.play-button {
+ position: absolute;
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -50%);
+ width: 80rpx;
+ height: 80rpx;
+ background: rgba(255, 255, 255, 0.95);
+ backdrop-filter: blur(10rpx);
+ border-radius: 50%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ box-shadow:
+ 0 10rpx 30rpx rgba(0, 0, 0, 0.3),
+ inset 0 1rpx 0 rgba(255, 255, 255, 0.8);
+ z-index: 2;
+ transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
+}
+
+.video-card:active .play-button {
+ transform: translate(-50%, -50%) scale(1.1);
+ box-shadow:
+ 0 15rpx 40rpx rgba(0, 0, 0, 0.4),
+ inset 0 1rpx 0 rgba(255, 255, 255, 0.8);
+}
+
+.play-icon {
+ width: 30rpx;
+ height: 30rpx;
+ margin-left: 4rpx;
+ transition: transform 0.3s ease;
+}
+
+.video-card:active .play-icon {
+ transform: scale(1.1);
+}
+
+.play-ripple {
+ position: absolute;
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -50%);
+ width: 0;
+ height: 0;
+ border-radius: 50%;
+ background: rgba(255, 255, 255, 0.3);
+ transition: all 0.6s ease;
+}
+
+.video-card:active .play-ripple {
+ width: 120rpx;
+ height: 120rpx;
+ animation: playRipple 0.8s ease-out;
+}
+
+@keyframes playRipple {
+ from {
+ opacity: 1;
+ transform: translate(-50%, -50%) scale(0);
+ }
+
+ to {
+ opacity: 0;
+ transform: translate(-50%, -50%) scale(1);
+ }
+}
+
+.video-hover-effect {
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ background: linear-gradient(45deg, transparent, rgba(52, 152, 219, 0.1), transparent);
+ opacity: 0;
+ transition: opacity 0.4s ease;
+}
+
+.video-card:active .video-hover-effect {
+ opacity: 1;
+}
+
+.video-info {
+ padding: 25rpx;
+}
+
+.video-title {
+ font-size: 28rpx;
+ font-weight: 700;
+ color: #1e293b;
+ margin-bottom: 20rpx;
+ line-height: 1.4;
+ display: -webkit-box;
+ -webkit-box-orient: vertical;
+ -webkit-line-clamp: 2;
+ overflow: hidden;
+ letter-spacing: 0.5rpx;
+}
+
+.video-instructor {
+ display: flex;
+ align-items: center;
+ margin-bottom: 20rpx;
+ gap: 12rpx;
+}
+
+.instructor-avatar {
+ width: 40rpx;
+ height: 40rpx;
+ border-radius: 50%;
+ border: 2rpx solid rgba(52, 152, 219, 0.3);
+ box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.1);
+ transition: all 0.3s ease;
+}
+
+.video-card:active .instructor-avatar {
+ border-color: #3498db;
+ transform: scale(1.05);
+}
+
+.instructor-name {
+ font-size: 24rpx;
+ color: #64748b;
+ font-weight: 500;
+}
+
+
+.video-meta {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+}
+
+.video-meta-item {
+ display: flex;
+ align-items: center;
+ gap: 8rpx;
+ font-size: 22rpx;
+ color: #94a3b8;
+}
+
+.video-meta-item image {
+ width: 22rpx;
+ height: 22rpx;
+ opacity: 0.6;
+ transition: all 0.3s ease;
+}
+
+.video-meta-item:active image {
+ opacity: 1;
+ transform: scale(1.1);
+}
+
+
+
+/* 空状态样式优化 */
+.empty-state {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ padding: 150rpx 0;
+ text-align: center;
+ position: relative;
+}
+
+.empty-animation {
+ position: absolute;
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -50%);
+ width: 300rpx;
+ height: 300rpx;
+}
+
+.empty-circle {
+ position: absolute;
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -50%);
+ width: 100rpx;
+ height: 100rpx;
+ border: 8rpx solid rgba(52, 152, 219, 0.1);
+ border-radius: 50%;
+ animation: emptyFloat 4s ease-in-out infinite;
+}
+
+.empty-circle.circle-2 {
+ width: 150rpx;
+ height: 150rpx;
+ border-width: 6rpx;
+ animation-delay: 1s;
+}
+
+.empty-circle.circle-3 {
+ width: 200rpx;
+ height: 200rpx;
+ border-width: 4rpx;
+ animation-delay: 2s;
+}
+
+@keyframes emptyFloat {
+
+ 0%,
+ 100% {
+ transform: translate(-50%, -50%) scale(1);
+ opacity: 0.3;
+ }
+
+ 50% {
+ transform: translate(-50%, -50%) scale(1.1);
+ opacity: 0.1;
+ }
+}
+
+
+.empty-text {
+ font-size: 32rpx;
+ color: #64748b;
+ font-weight: 600;
+ margin-bottom: 15rpx;
+ letter-spacing: 1rpx;
+ position: relative;
+ z-index: 1;
+}
+
+.empty-hint {
+ font-size: 26rpx;
+ color: #94a3b8;
+ position: relative;
+ z-index: 1;
+}
+
+/* 响应式调整 */
+@media screen and (max-width: 750rpx) {
+ .videos-grid {
+ grid-template-columns: 1fr;
+ }
+
+ .articles-list {
+ padding: 0 10rpx;
+ }
+
+ .category-item {
+ font-size: 26rpx;
+ padding: 18rpx 28rpx;
+ min-width: 110rpx;
+ }
+
+ .header {
+ padding-top: 40rpx;
+ }
+
+ .title {
+ font-size: 48rpx;
+ }
+
+ .tabs {
+ height: 80rpx;
+ }
+
+ .tab-item {
+ font-size: 30rpx;
+ }
+}
+
+/* 加载动画优化 */
+@keyframes pulse {
+
+ 0%,
+ 100% {
+ opacity: 1;
+ transform: scale(1);
+ }
+
+ 50% {
+ opacity: 0.7;
+ transform: scale(0.95);
+ }
+}
+
+.loading {
+ animation: pulse 1.5s ease-in-out infinite;
+}
+
+/* 滚动条样式 */
+::-webkit-scrollbar {
+ width: 0;
+ height: 0;
+ color: transparent;
+}
\ No newline at end of file
diff --git a/utils/api.js b/utils/api.js
index 5992203..fdc3a1a 100644
--- a/utils/api.js
+++ b/utils/api.js
@@ -76,10 +76,30 @@ function expertsList(params) {
http('/vet/experts/list', 'get', params)
}
+// 药品推荐列表
+function recommendationList(params) {
+ http('/system/recommendation/list', 'get', params)
+}
+
+// 药品推荐详情
+function recommendationXq(params) {
+ http('/system/recommendation/'+ params.data.id , 'get', params)
+}
+
+// 知识库查询列表
+function queryList(params) {
+ http('/system/query/list', 'get', params)
+}
+
+// 知识库查询提示
+function tipList(params) {
+ http('/system/tip/list', 'get', params)
+}
export default { // 暴露接口
login,carousel,disaster,pharmacy,guidance,getPhoneNumber,inquiry,
- search,trend,feed,sales,wzd,wzdxq,wzdAdd,expertsList
+ search,trend,feed,sales,wzd,wzdxq,wzdAdd,expertsList,recommendationList,
+ recommendationXq,queryList,tipList
}
diff --git a/utils/tool.wxs b/utils/tool.wxs
index 2f0e4a4..797bd6e 100644
--- a/utils/tool.wxs
+++ b/utils/tool.wxs
@@ -20,6 +20,19 @@ function ztLevel(type) {
}
}
+// 药品标签
+function medicineType(type) {
+ if(type=='处方药'){
+ return 'prescription'
+ }else if(type=='非处方药'){
+ return 'otc'
+ }else if(type=='中成药'){
+ return 'chinese'
+ }else{
+ return 'health'
+ }
+}
+
@@ -27,5 +40,6 @@ function ztLevel(type) {
module.exports = {
type:type,
- ztLevel:ztLevel
+ ztLevel:ztLevel,
+ medicineType:medicineType
}
\ No newline at end of file