Browse Source

在线培训,政策解读

master
ZhaoYang 4 weeks ago
parent
commit
a4b7bb861b
  1. 4
      app.json
  2. 14
      pages/home/home.js
  3. 4
      pages/home/home.wxml
  4. BIN
      pagesA/images/amxl.png
  5. BIN
      pagesA/images/blf.png
  6. BIN
      pagesA/images/lh.png
  7. BIN
      pagesA/images/wc.png
  8. 635
      pagesA/pages/medicine/medicine.js
  9. 57
      pagesA/pages/medicine/medicine.wxml
  10. 52
      pagesA/pages/medicine/medicine.wxss
  11. 541
      pagesA/pages/medicineDetails/medicineDetails.js
  12. 61
      pagesA/pages/medicineDetails/medicineDetails.wxml
  13. 22
      pagesA/pages/medicineDetails/medicineDetails.wxss
  14. BIN
      pagesB/images/bo.png
  15. BIN
      pagesB/images/lll.png
  16. BIN
      pagesB/images/you.png
  17. 312
      pagesB/pages/policyElucidation/policyElucidation.js
  18. 4
      pagesB/pages/policyElucidation/policyElucidation.json
  19. 195
      pagesB/pages/policyElucidation/policyElucidation.wxml
  20. 498
      pagesB/pages/policyElucidation/policyElucidation.wxss
  21. 323
      pagesB/pages/repository/repository.js
  22. 86
      pagesB/pages/repository/repository.wxml
  23. 86
      pagesB/pages/repository/repository.wxss
  24. 457
      pagesB/pages/training/training.js
  25. 4
      pagesB/pages/training/training.json
  26. 298
      pagesB/pages/training/training.wxml
  27. 1066
      pagesB/pages/training/training.wxss
  28. 22
      utils/api.js
  29. 16
      utils/tool.wxs

4
app.json

@ -24,7 +24,9 @@
{ {
"root": "pagesB", "root": "pagesB",
"pages": [ "pages": [
"pages/repository/repository"
"pages/repository/repository",
"pages/training/training",
"pages/policyElucidation/policyElucidation"
], ],
"independent": true "independent": true
} }

14
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() { getLocation() {

4
pages/home/home.wxml

@ -64,11 +64,11 @@
<view>养殖知识库</view> <view>养殖知识库</view>
<view>快速查询养殖知识</view> <view>快速查询养殖知识</view>
</view> </view>
<view class="repository1_2 zsk">
<view class="repository1_2 zsk" bind:tap="bindPx">
<view>在线培训</view> <view>在线培训</view>
<view>提高养殖技能</view> <view>提高养殖技能</view>
</view> </view>
<view class="repository1_3 zsk">
<view class="repository1_3 zsk" bind:tap="bindJd">
<view>政策解读</view> <view>政策解读</view>
<view>提供政策指导</view> <view>提供政策指导</view>
</view> </view>

BIN
pagesA/images/amxl.png

Before

Width: 305  |  Height: 271  |  Size: 107 KiB

BIN
pagesA/images/blf.png

Before

Width: 605  |  Height: 513  |  Size: 271 KiB

BIN
pagesA/images/lh.png

Before

Width: 366  |  Height: 337  |  Size: 123 KiB

BIN
pagesA/images/wc.png

Before

Width: 605  |  Height: 528  |  Size: 340 KiB

635
pagesA/pages/medicine/medicine.js

@ -1,25 +1,22 @@
import http from '../../../utils/api'
const baseUr = require('../../../utils/baseUrl')
Page({ Page({
data: { data: {
// 原始药品列表数据
medicineList: [],
// 筛选后的列表
// 药品列表数据
filteredList: [], filteredList: [],
// 搜索相关 // 搜索相关
searchKeyword: '', searchKeyword: '',
// 筛选相关 // 筛选相关
currentCategory: 'all',
currentCategory: '全部',
baseUr: baseUr,
// 分页相关 // 分页相关
page: 1,
pageSize: 12,
pageNum: 1,
pageSize: 10,
hasMore: true, hasMore: true,
loading: false, loading: false,
// 弹窗控制
showDetailModal: false,
currentMedicine: null,
isRefreshing: false,
// 滚动相关 // 滚动相关
showBackToTop: false, showBackToTop: false,
@ -27,7 +24,8 @@ Page({
}, },
onLoad: function() { onLoad: function() {
this.initData();
// 初始化加载数据
this.resetListAndLoad();
}, },
onShow: function() { onShow: function() {
@ -58,555 +56,174 @@ Page({
this.setData({ scrollTop: e.scrollTop }); this.setData({ scrollTop: e.scrollTop });
}, },
// 初始化数据
initData: function() {
const mockData = this.getMockData();
/**
* 获取药品列表数据
* @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({ this.setData({
medicineList: mockData,
filteredList: mockData
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"
},
// 构建请求参数
const params = {
pageNum: pageNum,
pageSize: this.data.pageSize,
searchKeywords: searchKeywords || this.data.searchKeyword
};
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个月"
// 添加药品类型筛选(如果不是"全部")
if (medicineType && medicineType !== '全部') {
params.medicineType = medicineType;
} else if (this.data.currentCategory && this.data.currentCategory !== '全部') {
params.medicineType = this.data.currentCategory;
} }
},
{
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"
},
http.recommendationList({
data: params,
success: res => {
const newData = res.rows || [];
const total = res.total || 0;
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=中药柜台"
]
},
// 计算是否还有更多数据
const hasMore = newData.length >= this.data.pageSize &&
(this.data.filteredList.length + newData.length) < total;
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个月"
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: []
console.log('加载成功,当前数据量:', this.data.filteredList.length, '是否有更多:', hasMore);
}, },
fail: err => {
console.error('加载数据失败:', err);
wx.showToast({
title: '加载失败',
icon: 'none'
});
this.setData({
loading: false,
isRefreshing: false
});
details: {
usage: "口服。一次3-4片,一日3次。",
precautions: "不宜长期服用,孕妇及哺乳期妇女慎用。",
storage: "密封,在干燥处保存。",
validity: "36个月"
// 停止下拉刷新
wx.stopPullDownRefresh();
} }
});
}, },
{
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"
/**
* 重置列表并加载第一页
*/
resetListAndLoad: function() {
this.setData({
pageNum: 1,
hasMore: true,
filteredList: []
}, () => {
this.getRecommendationList(1, false);
});
}, },
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: []
/**
* 刷新列表第一页
*/
refreshList: function() {
this.setData({
pageNum: 1,
hasMore: true,
isRefreshing: true
});
this.getRecommendationList(1, false);
}, },
details: {
usage: "口服。一次1-2支,一日3次。",
precautions: "肾功能不全者慎用,不宜与洋地黄类药物同时使用。",
storage: "密封,置阴凉处。",
validity: "24个月"
}
}
];
},
/**
* 加载更多数据
*/
loadMore: function() {
if (!this.data.hasMore || this.data.loading) return;
// 获取简短文本(修复undefined问题)
getShortText: function(text, maxLength) {
if (!text || typeof text !== 'string') {
return '';
}
if (text.length <= maxLength) {
return text;
}
return text.substring(0, maxLength) + '...';
const nextPage = this.data.pageNum + 1;
this.getRecommendationList(nextPage, true);
}, },
// 搜索输入处理(输入时自动搜索)
/**
* 搜索输入处理
*/
onSearchInput: function(e) { onSearchInput: function(e) {
const keyword = e.detail.value;
const keyword = e.detail.value.trim();
this.setData({ this.setData({
searchKeyword: keyword searchKeyword: keyword
}, () => { }, () => {
// 输入后立即执行筛选
this.filterList();
// 防抖处理,避免频繁请求
clearTimeout(this.searchTimer);
this.searchTimer = setTimeout(() => {
this.resetListAndLoad();
}, 500);
}); });
}, },
// 清除搜索
/**
* 清除搜索
*/
clearSearch: function() { clearSearch: function() {
this.setData({ this.setData({
searchKeyword: '' searchKeyword: ''
}, () => { }, () => {
this.filterList();
this.resetListAndLoad();
}); });
}, },
// 分类筛选切换
/**
* 分类筛选切换
*/
onCategoryChange: function(e) { onCategoryChange: function(e) {
const category = e.currentTarget.dataset.category; const category = e.currentTarget.dataset.category;
this.setData({ this.setData({
currentCategory: category 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) { showMedicineDetail: function(e) {
const medId = e.currentTarget.dataset.id; const medId = e.currentTarget.dataset.id;
// const medicine = this.data.filteredList[index];
// this.setData({
// showDetailModal: true,
// currentMedicine: medicine
// });
wx.navigateTo({ wx.navigateTo({
url: `/pagesA/pages/medicineDetails/medicineDetails?id=${medId}`, url: `/pagesA/pages/medicineDetails/medicineDetails?id=${medId}`,
})
},
// 详情弹窗关闭
onDetailModalClose: function() {
this.setData({
showDetailModal: false
}); });
}, },
// 返回顶部
/**
* 返回顶部
*/
scrollToTop: function() { scrollToTop: function() {
wx.pageScrollTo({ wx.pageScrollTo({
scrollTop: 0, scrollTop: 0,

57
pagesA/pages/medicine/medicine.wxml

@ -5,7 +5,9 @@
<!-- 搜索框 --> <!-- 搜索框 -->
<view class="search-container"> <view class="search-container">
<view class="search-box"> <view class="search-box">
<view class="search-icon">🔍</view>
<view class="search-icon">
<image src="/pagesB/images/sou.png" mode=""/>
</view>
<input <input
class="search-input" class="search-input"
placeholder="搜索药品名称、专家或症状" placeholder="搜索药品名称、专家或症状"
@ -21,24 +23,24 @@
<!-- 快捷分类筛选 --> <!-- 快捷分类筛选 -->
<view class="category-filters"> <view class="category-filters">
<scroll-view class="filters-scroll" scroll-x="true"> <scroll-view class="filters-scroll" scroll-x="true">
<view class="filter-tag {{currentCategory === 'all' ? 'active' : ''}}"
data-category="all" bindtap="onCategoryChange">
<view class="filter-tag {{currentCategory === '全部' ? 'active' : ''}}"
data-category="全部" bindtap="onCategoryChange">
全部推荐 全部推荐
</view> </view>
<view class="filter-tag {{currentCategory === 'prescription' ? 'active' : ''}}"
data-category="prescription" bindtap="onCategoryChange">
<view class="filter-tag {{currentCategory === '处方药' ? 'active' : ''}}"
data-category="处方药" bindtap="onCategoryChange">
处方药 处方药
</view> </view>
<view class="filter-tag {{currentCategory === 'otc' ? 'active' : ''}}"
data-category="otc" bindtap="onCategoryChange">
<view class="filter-tag {{currentCategory === '非处方药' ? 'active' : ''}}"
data-category="非处方药" bindtap="onCategoryChange">
非处方药 非处方药
</view> </view>
<view class="filter-tag {{currentCategory === 'chinese' ? 'active' : ''}}"
data-category="chinese" bindtap="onCategoryChange">
<view class="filter-tag {{currentCategory === '中成药' ? 'active' : ''}}"
data-category="中成药" bindtap="onCategoryChange">
中成药 中成药
</view> </view>
<view class="filter-tag {{currentCategory === 'health' ? 'active' : ''}}"
data-category="health" bindtap="onCategoryChange">
<view class="filter-tag {{currentCategory === '保健品' ? 'active' : ''}}"
data-category="保健品" bindtap="onCategoryChange">
保健品 保健品
</view> </view>
</scroll-view> </scroll-view>
@ -49,14 +51,12 @@
<view class="medicine-grid"> <view class="medicine-grid">
<!-- 空状态 --> <!-- 空状态 -->
<view class="empty-state" wx:if="{{filteredList.length === 0 && !loading}}"> <view class="empty-state" wx:if="{{filteredList.length === 0 && !loading}}">
<image class="empty-image" src="/images/empty-medicine.png" mode="aspectFit" />
<view class="empty-text" wx:if="{{searchKeyword}}"> <view class="empty-text" wx:if="{{searchKeyword}}">
未找到"{{searchKeyword}}"相关的药品 未找到"{{searchKeyword}}"相关的药品
</view> </view>
<view class="empty-text" wx:else> <view class="empty-text" wx:else>
暂无药品推荐 暂无药品推荐
</view> </view>
<button class="empty-btn" bindtap="refreshList">刷新推荐</button>
</view> </view>
<!-- 药品卡片 --> <!-- 药品卡片 -->
@ -65,34 +65,24 @@
<!-- 药品图片 --> <!-- 药品图片 -->
<view class="card-image"> <view class="card-image">
<image <image
src="{{item.image || '/images/default-medicine.png'}}"
src="{{baseUr+item.images}}"
mode="aspectFill" mode="aspectFill"
class="medicine-img" class="medicine-img"
/> />
<!-- 药品标签 --> <!-- 药品标签 -->
<view class="card-tag {{item.category}}">
{{item.categoryText}}
<view class="card-tag">
{{item.medicineType}}
</view> </view>
<!-- 热销标签 --> <!-- 热销标签 -->
<view class="hot-tag" wx:if="{{item.isHot}}">
热销
<view class="hot-tag" wx:if="{{item.salesType}}">
{{item.salesType}}
</view> </view>
</view> </view>
<!-- 药品基本信息 --> <!-- 药品基本信息 -->
<view class="card-content"> <view class="card-content">
<!-- 药品名称 --> <!-- 药品名称 -->
<view class="medicine-name">{{item.name}}</view>
<!-- 适用症状(简短) -->
<view class="medicine-indication" wx:if="{{item.indication}}">
{{getShortText(item.indication, 12)}}
</view>
<!-- 生产厂家 -->
<view class="manufacturer" wx:if="{{item.manufacturer}}">
{{getShortText(item.manufacturer, 14)}}
</view>
<view class="medicine-name">{{item.medicineName}}</view>
<!-- 价格和推荐信息 --> <!-- 价格和推荐信息 -->
<view class="card-footer"> <view class="card-footer">
@ -110,21 +100,18 @@
<!-- 推荐专家 --> <!-- 推荐专家 -->
<view class="expert-brief"> <view class="expert-brief">
<image <image
src="{{item.expert.avatar || '/images/default-avatar.png'}}"
src="{{baseUr+item.expertAvatar}}"
class="expert-avatar" class="expert-avatar"
mode="aspectFill" mode="aspectFill"
/> />
<text class="expert-name">{{item.expert.name}}</text>
<text class="expert-name">{{item.expertName}}</text>
</view> </view>
</view> </view>
<!-- 店铺信息 --> <!-- 店铺信息 -->
<view class="store-brief"> <view class="store-brief">
<view class="store-icon">🏪</view> <view class="store-icon">🏪</view>
<text class="store-name">{{item.store.name}}</text>
<view class="distance" wx:if="{{item.store.distance}}">
{{item.store.distance}}km
</view>
<text class="store-name">{{item.storeName}}</text>
</view> </view>
</view> </view>
</view> </view>

52
pagesA/pages/medicine/medicine.wxss

@ -33,6 +33,11 @@
margin-right: 20rpx; margin-right: 20rpx;
} }
.search-icon image{
width: 45rpx;
height: 45rpx;
}
.search-input { .search-input {
flex: 1; flex: 1;
font-size: 28rpx; font-size: 28rpx;
@ -131,21 +136,7 @@
background-color: #3a7ff3; 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 { .card-tag.other {
background-color: #607D8B; background-color: #607D8B;
@ -180,18 +171,6 @@
min-height: 84rpx; 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 { .card-footer {
@ -267,11 +246,6 @@
white-space: nowrap; white-space: nowrap;
} }
.distance {
color: #3a7ff3;
font-size: 22rpx;
}
/* 空状态 */ /* 空状态 */
.empty-state { .empty-state {
grid-column: 1 / -1; grid-column: 1 / -1;
@ -282,12 +256,6 @@
padding: 100rpx 0; padding: 100rpx 0;
} }
.empty-image {
width: 200rpx;
height: 200rpx;
margin-bottom: 30rpx;
opacity: 0.5;
}
.empty-text { .empty-text {
font-size: 32rpx; font-size: 32rpx;
@ -302,15 +270,7 @@
margin-bottom: 40rpx; 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, .load-more,

541
pagesA/pages/medicineDetails/medicineDetails.js

@ -1,18 +1,18 @@
import http from '../../../utils/api'
const baseUr = require('../../../utils/baseUrl')
Page({ Page({
data: { data: {
// 药品数据 // 药品数据
medicineData: null, medicineData: null,
// 是否收藏 // 是否收藏
isFavorite: false, isFavorite: false,
baseUr: baseUr,
// 加载状态 // 加载状态
loading: true, loading: true,
// 分享配置
shareTitle: '',
sharePath: '',
shareImageUrl: ''
imageUrl:''
}, },
onLoad: function(options) {
onLoad: function (options) {
// 获取传递过来的药品ID // 获取传递过来的药品ID
const medicineId = options.id; const medicineId = options.id;
@ -33,508 +33,42 @@ 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 });
// 模拟网络请求,实际项目中应该从服务器获取
setTimeout(() => {
const mockData = this.getMockData();
const medicine = mockData.find(item => item.id == id);
if (medicine) {
// 根据ID加载药品数据
loadMedicineData: function (id) {
this.setData({ this.setData({
medicineData: medicine,
loading: false,
shareTitle: `${medicine.name} - ${medicine.expert.name}专家推荐`,
sharePath: `/pages/detail/detail?id=${medicine.id}`,
shareImageUrl: medicine.image
loading: true
}); });
// 更新页面标题
wx.setNavigationBarTitle({
title: medicine.name
});
} else {
this.setData({ loading: false });
wx.showToast({
title: '药品信息加载失败',
icon: 'error',
duration: 2000,
complete: () => {
// 模拟网络请求,实际项目中应该从服务器获取
setTimeout(() => { 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个月"
}
}
];
http.recommendationXq({
data: {
id: id
}, },
success: res => {
const mockData = res.data
const imageUrl = mockData.imageUrl.split(',')
// 检查收藏状态
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);
this.setData({
medicineData: mockData,
imageUrl: imageUrl
});
} }
},
// 切换收藏状态
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
});
}, 500);
}, },
// 保存收藏状态到本地缓存
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()
});
}
} else {
// 取消收藏
favorites = favorites.filter(item => item.id !== medicineData.id);
}
wx.setStorageSync('medicineFavorites', favorites);
} catch (e) {
console.error('保存收藏失败', e);
}
},
// 打开位置地图 // 打开位置地图
openLocation: function() {
const { store } = this.data.medicineData;
openLocation: function () {
const store = this.data.medicineData;
if (store.latitude && store.longitude) { if (store.latitude && store.longitude) {
wx.openLocation({ wx.openLocation({
latitude: parseFloat(store.latitude), latitude: parseFloat(store.latitude),
@ -552,8 +86,8 @@ Page({
}, },
// 拨打电话 // 拨打电话
makePhoneCall: function() {
const phone = this.data.medicineData.store.phone;
makePhoneCall: function () {
const phone = this.data.medicineData.storePhone;
if (phone) { if (phone) {
wx.makePhoneCall({ wx.makePhoneCall({
phoneNumber: phone phoneNumber: phone
@ -562,8 +96,8 @@ Page({
}, },
// 预览主图片 // 预览主图片
previewMainImage: function() {
const url = this.data.medicineData.image;
previewMainImage: function () {
const url = this.data.imageUrl.split(',');
if (url) { if (url) {
wx.previewImage({ wx.previewImage({
current: url, current: url,
@ -573,10 +107,11 @@ Page({
}, },
// 预览轮播图片 // 预览轮播图片
previewImage: function(e) {
previewImage: function (e) {
const imageUrl = this.data.imageUrl
const index = parseInt(e.currentTarget.dataset.index); 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({ wx.previewImage({
current: urls[index + 1], // +1 因为第一个是主图 current: urls[index + 1], // +1 因为第一个是主图
@ -585,9 +120,9 @@ Page({
}, },
// 预览店铺图片 // 预览店铺图片
previewStoreImage: function(e) {
previewStoreImage: function (e) {
const index = parseInt(e.currentTarget.dataset.index); const index = parseInt(e.currentTarget.dataset.index);
const images = this.data.medicineData.store.images || [];
const images = this.data.imageUrl || [];
wx.previewImage({ wx.previewImage({
current: images[index], current: images[index],
@ -595,11 +130,5 @@ Page({
}); });
}, },
// 分享给朋友
onShareToFriend: function() {
wx.showShareMenu({
withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline']
});
}
}); });

61
pagesA/pages/medicineDetails/medicineDetails.wxml

@ -1,20 +1,20 @@
<!-- 药品详情页 -->
<wxs module="tool" src="../../../utils/tool.wxs"></wxs>
<view class="detail-page"> <view class="detail-page">
<!-- 药品图片轮播 --> <!-- 药品图片轮播 -->
<view class="medicine-images"> <view class="medicine-images">
<swiper <swiper
class="detail-swiper" class="detail-swiper"
indicator-dots="{{medicineData.store.images && medicineData.store.images.length > 0}}"
indicator-dots="{{imageUrl && imageUrl.length > 0}}"
indicator-color="rgba(255, 255, 255, 0.5)" indicator-color="rgba(255, 255, 255, 0.5)"
indicator-active-color="#3a7ff3" indicator-active-color="#3a7ff3"
autoplay="true" autoplay="true"
interval="3000" interval="3000"
duration="500" duration="500"
> >
<block wx:for="{{medicineData.store.images}}" wx:key="index">
<block wx:for="{{imageUrl}}" wx:key="index">
<swiper-item> <swiper-item>
<image <image
src="{{item}}"
src="{{baseUr+item}}"
class="detail-image" class="detail-image"
mode="aspectFill" mode="aspectFill"
bindtap="previewImage" bindtap="previewImage"
@ -25,15 +25,15 @@
</swiper> </swiper>
<!-- 药品标签 --> <!-- 药品标签 -->
<view class="detail-tag {{medicineData.category}}">
{{medicineData.categoryText}}
<view class="hot-badge" wx:if="{{medicineData.isHot}}">热销</view>
<view class="detail-tag {{tool.medicineType(medicineData.medicineType)}}">
{{medicineData.medicineType}}
<view class="hot-badge" wx:if="{{medicineData.salesType}}">{{medicineData.salesType}}</view>
</view> </view>
</view> </view>
<!-- 药品基本信息 --> <!-- 药品基本信息 -->
<view class="basic-info-section"> <view class="basic-info-section">
<view class="medicine-name">{{medicineData.name}}</view>
<view class="medicine-name">{{medicineData.medicineName}}</view>
<view class="medicine-spec">{{medicineData.specification}}</view> <view class="medicine-spec">{{medicineData.specification}}</view>
<view class="manufacturer">{{medicineData.manufacturer}}</view> <view class="manufacturer">{{medicineData.manufacturer}}</view>
@ -47,7 +47,7 @@
原价:¥{{medicineData.originalPrice}} 原价:¥{{medicineData.originalPrice}}
</view> </view>
<view class="sales-count"> <view class="sales-count">
已售:{{medicineData.salesCount}}件
已售:{{medicineData.soldQuantity}}件
</view> </view>
</view> </view>
</view> </view>
@ -55,7 +55,7 @@
<!-- 适用症状 --> <!-- 适用症状 -->
<view class="info-section"> <view class="info-section">
<view class="section-title">适用症状</view> <view class="section-title">适用症状</view>
<view class="section-content">{{medicineData.indication}}</view>
<view class="section-content">{{medicineData.indications}}</view>
</view> </view>
<!-- 专家推荐信息 --> <!-- 专家推荐信息 -->
@ -64,24 +64,23 @@
<view class="expert-card"> <view class="expert-card">
<view class="expert-header"> <view class="expert-header">
<image <image
src="{{medicineData.expert.avatar || '/images/default-avatar.png'}}"
src="{{baseUr+medicineData.expertAvatar}}"
class="expert-avatar" class="expert-avatar"
mode="aspectFill" mode="aspectFill"
/> />
<view class="expert-info"> <view class="expert-info">
<view class="expert-name">{{medicineData.expert.name}}<text class="expert-title"> | {{medicineData.expert.title}}</text></view>
<view class="expert-hospital">{{medicineData.expert.hospital}}</view>
<view class="expert-name">{{medicineData.expertName}}<text class="expert-title"> | {{medicineData.expertExpert}}</text></view>
<view class="expert-hospital">{{medicineData.expertExpertiseArea}}</view>
<view class="expert-experience"> <view class="expert-experience">
<text class="experience-label">专业:</text>{{medicineData.expert.expertise}}
<text class="experience-label">从业:</text>{{medicineData.expert.years}}年
<text class="experience-label">从业:</text>{{medicineData.expertWorkExperience}}
</view> </view>
</view> </view>
</view> </view>
<view class="expert-reason"> <view class="expert-reason">
<view class="reason-title">推荐理由</view> <view class="reason-title">推荐理由</view>
<view class="reason-content">{{medicineData.expert.reason}}</view>
<view class="reason-content">{{medicineData.recommendReason}}</view>
</view> </view>
<view class="recommend-time">推荐时间:{{medicineData.expert.recommendTime}}</view>
<view class="recommend-time">推荐时间:{{medicineData.recommendTime}}</view>
</view> </view>
</view> </view>
@ -90,35 +89,27 @@
<view class="section-title">推荐店铺</view> <view class="section-title">推荐店铺</view>
<view class="store-card"> <view class="store-card">
<view class="store-header"> <view class="store-header">
<view class="store-name">{{medicineData.store.name}}</view>
<view class="store-rating" wx:if="{{medicineData.store.rating}}">
<text class="rating-value">{{medicineData.store.rating}}</text>
<text class="rating-star">★</text>
</view>
<view class="store-name">{{medicineData.storeName}}</view>
</view> </view>
<view class="store-info"> <view class="store-info">
<view class="info-item"> <view class="info-item">
<text class="info-icon">📍</text> <text class="info-icon">📍</text>
<text class="info-text">{{medicineData.store.address}}</text>
<view class="store-distance" wx:if="{{medicineData.store.distance}}">
距离:{{medicineData.store.distance}}km
</view>
<text class="info-text">{{medicineData.storeAddress}}</text>
</view> </view>
<view class="info-item"> <view class="info-item">
<text class="info-icon">📞</text> <text class="info-icon">📞</text>
<text class="info-text">{{medicineData.store.phone}}</text>
<text class="info-text">{{medicineData.storePhone}}</text>
</view> </view>
<view class="info-item"> <view class="info-item">
<text class="info-icon">🕒</text> <text class="info-icon">🕒</text>
<text class="info-text">{{medicineData.store.businessHours}}</text>
<text class="info-text">{{medicineData.businessHours}}</text>
</view> </view>
<view class="info-item" wx:if="{{medicineData.store.features}}">
<view class="info-item" wx:if="{{medicineData.storeRemark}}">
<text class="info-icon">⭐</text> <text class="info-icon">⭐</text>
<text class="info-text">{{medicineData.store.features}}</text>
<text class="info-text">{{medicineData.storeRemark}}</text>
</view> </view>
</view> </view>
@ -153,22 +144,22 @@
<view class="details-grid"> <view class="details-grid">
<view class="detail-item"> <view class="detail-item">
<view class="item-label">用法用量</view> <view class="item-label">用法用量</view>
<view class="item-value">{{medicineData.details.usage}}</view>
<view class="item-value">{{medicineData.usageDosage}}</view>
</view> </view>
<view class="detail-item"> <view class="detail-item">
<view class="item-label">注意事项</view> <view class="item-label">注意事项</view>
<view class="item-value">{{medicineData.details.precautions}}</view>
<view class="item-value">{{medicineData.precautions}}</view>
</view> </view>
<view class="detail-item"> <view class="detail-item">
<view class="item-label">贮藏方式</view> <view class="item-label">贮藏方式</view>
<view class="item-value">{{medicineData.details.storage}}</view>
<view class="item-value">{{medicineData.storageMethod}}</view>
</view> </view>
<view class="detail-item"> <view class="detail-item">
<view class="item-label">有效期</view> <view class="item-label">有效期</view>
<view class="item-value">{{medicineData.details.validity}}</view>
<view class="item-value">{{medicineData.expiryDate}}</view>
</view> </view>
</view> </view>
</view> </view>

22
pagesA/pages/medicineDetails/medicineDetails.wxss

@ -249,21 +249,6 @@
flex: 1; 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 { .store-info {
margin-bottom: 20rpx; margin-bottom: 20rpx;
@ -288,13 +273,6 @@
flex: 1; flex: 1;
} }
.store-distance {
color: #3a7ff3;
font-size: 24rpx;
margin-left: 20rpx;
flex-shrink: 0;
}
/* 店铺图片 */ /* 店铺图片 */
.store-images { .store-images {
margin-bottom: 20rpx; margin-bottom: 20rpx;

BIN
pagesB/images/bo.png

After

Width: 200  |  Height: 200  |  Size: 2.5 KiB

BIN
pagesB/images/lll.png

After

Width: 200  |  Height: 200  |  Size: 3.6 KiB

BIN
pagesB/images/you.png

After

Width: 200  |  Height: 200  |  Size: 2.4 KiB

312
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);
}
});

4
pagesB/pages/policyElucidation/policyElucidation.json

@ -0,0 +1,4 @@
{
"navigationBarTitleText":"政策解读",
"usingComponents": {}
}

195
pagesB/pages/policyElucidation/policyElucidation.wxml

@ -0,0 +1,195 @@
<!-- policy-interpretation.wxml -->
<view class="container">
<!-- 头部区域 -->
<view class="header">
<view class="title-section">
<text class="page-title">农牧业政策解读</text>
<text class="page-subtitle">为您解读最新政策,助力农牧业发展</text>
</view>
<view class="date-info">数据更新至: {{currentDate}}</view>
</view>
<!-- 搜索和筛选区域 -->
<view class="search-section">
<view class="search-box">
<image class="search-icon" src="/pagesA/images/ss.png"></image>
<input
class="search-input"
placeholder="搜索政策关键词"
placeholder-class="placeholder-style"
bindinput="onSearchInput"
value="{{searchKeyword}}"
/>
<view class="search-btn" bindtap="onSearch">搜索</view>
</view>
<view class="filter-section">
<scroll-view class="filter-scroll" scroll-x="true">
<view
class="filter-tag {{activeFilter === 'all' ? 'active' : ''}}"
data-filter="all"
bindtap="onFilterTap"
>全部</view>
<view
class="filter-tag {{activeFilter === 'financial' ? 'active' : ''}}"
data-filter="financial"
bindtap="onFilterTap"
>财政补贴</view>
<view
class="filter-tag {{activeFilter === 'technology' ? 'active' : ''}}"
data-filter="technology"
bindtap="onFilterTap"
>技术推广</view>
<view
class="filter-tag {{activeFilter === 'insurance' ? 'active' : ''}}"
data-filter="insurance"
bindtap="onFilterTap"
>农业保险</view>
<view
class="filter-tag {{activeFilter === 'environment' ? 'active' : ''}}"
data-filter="environment"
bindtap="onFilterTap"
>生态保护</view>
<view
class="filter-tag {{activeFilter === 'latest' ? 'active' : ''}}"
data-filter="latest"
bindtap="onFilterTap"
>最新政策</view>
</scroll-view>
</view>
</view>
<!-- 政策列表区域 -->
<view class="policy-list">
<view wx:if="{{filteredPolicies.length === 0}}" class="empty-state">
<image class="empty-icon" src="/images/empty.png"></image>
<text class="empty-text">暂无相关政策</text>
<text class="empty-tip">请尝试其他筛选条件</text>
</view>
<block wx:for="{{filteredPolicies}}" wx:key="id">
<view class="policy-card" data-id="{{item.id}}" bindtap="onPolicyTap">
<view class="policy-header">
<view class="policy-tag {{item.type}}">{{item.typeText}}</view>
<view class="policy-date">{{item.date}}</view>
</view>
<view class="policy-title">{{item.title}}</view>
<view class="policy-content">
<text class="policy-summary">{{item.summary}}</text>
</view>
<view class="policy-footer">
<view class="policy-source">{{item.source}}</view>
<image class="policy-arrow" src="/pagesB/images/you.png" mode=""/>
</view>
</view>
</block>
</view>
<!-- 政策详情弹窗 -->
<view class="modal {{showPolicyDetail ? 'show' : ''}}" catchtap="hidePolicyDetail">
<view class="modal-content" catchtap="stopPropagation">
<view class="modal-header">
<view class="modal-title">{{currentPolicy.title}}</view>
<view class="modal-close" bindtap="hidePolicyDetail">×</view>
</view>
<scroll-view class="modal-body" scroll-y="true">
<view class="policy-info-row">
<view class="info-item">
<text class="info-label">政策类型:</text>
<text class="info-value">{{currentPolicy.typeText}}</text>
</view>
<view class="info-item">
<text class="info-label">发布日期:</text>
<text class="info-value">{{currentPolicy.date}}</text>
</view>
<view class="info-item">
<text class="info-label">发布单位:</text>
<text class="info-value">{{currentPolicy.source}}</text>
</view>
</view>
<view class="section">
<view class="section-title">政策要点</view>
<view class="section-content">
<block wx:for="{{currentPolicy.keyPoints}}" wx:key="index">
<view class="key-point">{{index + 1}}. {{item}}</view>
</block>
</view>
</view>
<view class="section">
<view class="section-title">详细解读</view>
<view class="section-content">
<text class="interpretation-text">{{currentPolicy.interpretation}}</text>
</view>
</view>
<view class="section">
<view class="section-title">适用对象</view>
<view class="section-content">
<view class="applicable-objects">
<block wx:for="{{currentPolicy.applicableObjects}}" wx:key="index">
<view class="object-tag">{{item}}</view>
</block>
</view>
</view>
</view>
<view class="section">
<view class="section-title">申报指南</view>
<view class="section-content">
<block wx:for="{{currentPolicy.applicationGuide}}" wx:key="index">
<view class="guide-item">
<view class="guide-step">{{index + 1}}</view>
<view class="guide-text">{{item}}</view>
</view>
</block>
</view>
</view>
<view class="section">
<view class="section-title">专家建议</view>
<view class="section-content">
<view class="expert-advice">
<view class="advice-header">
<image class="expert-avatar" src="/images/expert.png"></image>
<view class="expert-info">
<text class="expert-name">张农业</text>
<text class="expert-title">农业政策研究员</text>
</view>
</view>
<view class="advice-content">{{currentPolicy.expertAdvice}}</view>
</view>
</view>
</view>
<view class="section">
<view class="section-title">相关链接</view>
<view class="section-content">
<block wx:for="{{currentPolicy.relatedLinks}}" wx:key="index">
<view class="link-item" bindtap="onLinkTap" data-url="{{item.url}}">
<text class="link-text">{{item.name}}</text>
<image class="link-icon" src="/images/link.png"></image>
</view>
</block>
</view>
</view>
</scroll-view>
<view class="modal-footer">
<button class="btn btn-secondary" bindtap="hidePolicyDetail">关闭</button>
<button class="btn btn-primary" bindtap="onSavePolicy">收藏此政策</button>
</view>
</view>
</view>
<!-- 底部导航提示 -->
<view class="bottom-tip">
<text class="tip-text">已加载 {{filteredPolicies.length}} 条政策解读</text>
<text class="tip-text">数据仅供参考,具体以官方发布为准</text>
</view>
</view>

498
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;
}

323
pagesB/pages/repository/repository.js

@ -1,136 +1,106 @@
// 模拟知识库数据
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({ Page({
data: { data: {
searchValue: '', searchValue: '',
searchResults: [], searchResults: [],
allKnowledge: knowledgeBase,
recentSearches: [],
isLoading: false, isLoading: false,
loadingMore: false,
activeCategory: '全部', activeCategory: '全部',
categories: ['全部', '疾病防治', '饲养管理'],
categories: [
{ name: '全部', value: '全部' },
{ name: '疾病防治', value: '疾病防治' },
{ name: '饲养管理', value: '饲养管理' }
],
showTipsModal: false, showTipsModal: false,
searchTimer: null // 搜索防抖定时器
searchTimer: null,
// 分页相关
pageNum: 1,
pageSize: 10,
total: 0,
hasMore: true,
// 当前搜索参数
currentSearchKey: '',
currentCategory: '全部'
}, },
onLoad() { onLoad() {
// 初始显示所有知识
this.setData({
searchResults: this.data.allKnowledge
});
// 页面加载后显示提示弹框
setTimeout(() => {
this.setData({ showTipsModal: true });
}, 500);
// 初始加载数据
this.loadData(true);
this.gettipList()
}, },
onShow() {
const hasShownTips = wx.getStorageSync('hasShownTips');
if (!hasShownTips) {
setTimeout(() => {
this.setData({ showTipsModal: true });
wx.setStorageSync('hasShownTips', true);
}, 500);
// 知识库查询提示
gettipList(){
http.tipList({
data:{},
success:res=>{
console.log(res)
const tip = res.rows[0].tips.split('。')
this.setData({
tip:tip,
showTipsModal:true
})
} }
})
}, },
// 输入搜索关键词(自动搜索)
onInputSearch(e) {
const value = e.detail.value;
// 加载数据
loadData(isRefresh = false) {
if (isRefresh) {
this.setData({ this.setData({
searchValue: value,
pageNum: 1,
hasMore: true,
isLoading: true isLoading: true
}); });
} else {
if (!this.data.hasMore || this.data.loadingMore) return;
this.setData({ loadingMore: true });
}
// 清除之前的定时器
if (this.data.searchTimer) {
clearTimeout(this.data.searchTimer);
const params = {
pageNum: this.data.pageNum,
pageSize: this.data.pageSize
};
// 添加搜索关键词
if (this.data.currentSearchKey) {
params.searchKey = this.data.currentSearchKey;
} }
// 设置新的定时器(防抖处理)
this.data.searchTimer = setTimeout(() => {
if (!value.trim()) {
// 如果搜索框为空,显示所有知识
this.setData({
searchResults: this.data.allKnowledge,
isLoading: false
});
// 添加分类筛选(全部不传值)
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 { } else {
// 执行搜索
this.performSearch(value.trim());
searchResults = [...this.data.searchResults, ...newData];
} }
}, 300); // 300ms防抖延迟
},
// 执行搜索操作
performSearch(keyword) {
const results = this.searchKnowledge(keyword);
const hasMore = searchResults.length < total;
this.setData({ this.setData({
searchResults: results,
isLoading: false
searchResults,
total,
hasMore,
isLoading: false,
loadingMore: false
}); });
// 如果没有搜索结果且有关键词,显示提示 // 如果没有搜索结果且有关键词,显示提示
if (results.length === 0 && keyword) {
if (isRefresh && searchResults.length === 0 && this.data.currentSearchKey) {
wx.showToast({ wx.showToast({
title: '未找到相关结果', title: '未找到相关结果',
icon: 'none', icon: 'none',
@ -138,44 +108,117 @@ Page({
}); });
} }
}, },
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 });
// 清除之前的定时器
if (this.data.searchTimer) {
clearTimeout(this.data.searchTimer);
}
// 设置新的定时器(防抖处理)
this.data.searchTimer = setTimeout(() => {
const keyword = value.trim();
if (keyword) {
// 保持当前分类,只在当前分类中搜索
this.setData({
currentSearchKey: keyword,
// 不清除 currentCategory,保持当前分类筛选
// 只有搜索框清空时才重置分类
});
this.loadData(true);
} else {
// 搜索框清空时,重置为初始状态
this.setData({
currentSearchKey: '',
// 不清除 currentCategory,让用户保持在当前分类
// 如果需要重置,可以取消下面这行的注释
// currentCategory: '全部'
});
this.loadData(true);
}
}, 500); // 500ms防抖延迟
},
// 手动搜索(点击搜索按钮或按回车) // 手动搜索(点击搜索按钮或按回车)
onSearch() { onSearch() {
const keyword = this.data.searchValue.trim(); const keyword = this.data.searchValue.trim();
if (!keyword) { if (!keyword) {
// 如果搜索框为空,重置搜索
this.setData({ this.setData({
searchResults: this.data.allKnowledge
currentSearchKey: '',
// 保持当前分类,不清除分类筛选
});
} else {
// 保持当前分类,只在当前分类中搜索
this.setData({
currentSearchKey: keyword,
// 保持 currentCategory 不变
}); });
return;
} }
this.setData({ isLoading: true });
this.loadData(true);
},
// 清除定时器
if (this.data.searchTimer) {
clearTimeout(this.data.searchTimer);
}
// 按分类筛选
onFilterCategory(e) {
const category = e.currentTarget.dataset.category;
this.setData({
activeCategory: category,
currentCategory: category,
// 切换分类时清空搜索关键词
currentSearchKey: '',
searchValue: ''
});
// 立即执行搜索
this.performSearch(keyword);
this.loadData(true);
}, },
// 搜索知识库
searchKnowledge(keyword) {
const lowerKeyword = keyword.toLowerCase();
// 清空搜索
onClearSearch() {
this.setData({
searchValue: '',
currentSearchKey: '',
// 保持当前分类,不清除分类筛选
});
this.loadData(true);
},
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);
// 上拉加载更多
onScrollToLower() {
if (this.data.hasMore && !this.data.loadingMore) {
this.setData({
pageNum: this.data.pageNum + 1
}); });
this.loadData(false);
}
}, },
// 隐藏提示弹框 // 隐藏提示弹框
hideTips() { hideTips() {
this.setData({ showTipsModal: false });
this.setData({
showTipsModal: false
});
}, },
// 阻止事件冒泡 // 阻止事件冒泡
@ -185,47 +228,13 @@ Page({
// 查看详情 // 查看详情
onViewDetail(e) { onViewDetail(e) {
const id = e.currentTarget.dataset.id;
const item = this.data.allKnowledge.find(item => item.id === id);
if (item) {
const item = e.currentTarget.dataset.value;
wx.showModal({ wx.showModal({
title: item.title, title: item.title,
content: item.content, content: item.content,
showCancel: false, showCancel: false,
confirmText: '知道了' 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: '全部'
});
}, },
// 复制内容到剪贴板 // 复制内容到剪贴板

86
pagesB/pages/repository/repository.wxml

@ -1,3 +1,4 @@
<!-- pages/search/index.wxml -->
<view class="container_zsl"> <view class="container_zsl">
<!-- 搜索区域 --> <!-- 搜索区域 -->
<view class="search-area"> <view class="search-area">
@ -25,14 +26,14 @@
<!-- 分类筛选 --> <!-- 分类筛选 -->
<view class="category-filter"> <view class="category-filter">
<view <view
class="category-item {{activeCategory === item ? 'active' : ''}}"
class="category-item {{activeCategory === item.value ? 'active' : ''}}"
wx:for="{{categories}}" wx:for="{{categories}}"
wx:key="index"
data-category="{{item}}"
wx:key="value"
data-category="{{item.value}}"
bindtap="onFilterCategory" bindtap="onFilterCategory"
> >
{{item}}
<view class="category-dot" wx:if="{{activeCategory === item}}"></view>
{{item.name}}
<view class="category-dot" wx:if="{{activeCategory === item.value}}"></view>
</view> </view>
</view> </view>
</view> </view>
@ -48,11 +49,19 @@
</view> </view>
<!-- 搜索结果 --> <!-- 搜索结果 -->
<scroll-view wx:else class="result-list" scroll-y enable-back-to-top>
<scroll-view
wx:else
class="result-list"
scroll-y
enable-back-to-top
bindscrolltolower="onScrollToLower"
>
<!-- 搜索结果列表 --> <!-- 搜索结果列表 -->
<view wx:if="{{searchResults.length > 0}}"> <view wx:if="{{searchResults.length > 0}}">
<view class="result-count"> <view class="result-count">
<text>找到 {{searchResults.length}} 条相关结果</text>
<text>找到 {{total}} 条相关结果</text>
<text wx:if="{{currentCategory !== '全部'}}">(在{{currentCategory}}中搜索)</text>
<text wx:if="{{currentSearchKey && currentCategory !== '全部'}}">关键词:"{{currentSearchKey}}"</text>
</view> </view>
<view class="knowledge-list"> <view class="knowledge-list">
@ -60,26 +69,26 @@
class="knowledge-item" class="knowledge-item"
wx:for="{{searchResults}}" wx:for="{{searchResults}}"
wx:key="id" wx:key="id"
data-id="{{item.id}}"
data-value="{{item}}"
bindtap="onViewDetail" bindtap="onViewDetail"
> >
<view class="item-header"> <view class="item-header">
<view class="title-wrapper"> <view class="title-wrapper">
<view class="item-title">{{item.title}}</view> <view class="item-title">{{item.title}}</view>
<view class="item-category">{{item.category}}</view>
<view class="item-category">{{item.categoryType}}</view>
</view> </view>
</view> </view>
<view class="item-content">{{item.content}}</view> <view class="item-content">{{item.content}}</view>
<view class="item-footer"> <view class="item-footer">
<view class="tags"> <view class="tags">
<view class="tag" wx:for="{{item.tags}}" wx:key="*this">
{{item}}
<view class="tag">
{{item.keywords}}
</view> </view>
</view> </view>
<view class="actions"> <view class="actions">
<view class="date-info"> <view class="date-info">
<text class="date">{{item.date}}</text>
<text class="date">{{item.publishTime}}</text>
</view> </view>
<view <view
class="copy-btn" class="copy-btn"
@ -92,12 +101,32 @@
</view> </view>
</view> </view>
</view> </view>
<!-- 加载更多提示 -->
<view wx:if="{{hasMore}}" class="load-more">
<view wx:if="{{!loadingMore}}" class="load-more-text">上拉加载更多</view>
<view wx:else class="load-more-loading">
<view class="loading-dots">
<view class="dot"></view>
<view class="dot"></view>
<view class="dot"></view>
</view>
<text>加载中...</text>
</view>
</view>
<!-- 没有更多数据提示 -->
<view wx:if="{{!hasMore && searchResults.length > 0}}" class="no-more">
<text>没有更多数据了</text>
</view>
</view> </view>
<!-- 无结果 --> <!-- 无结果 -->
<view class="empty-state" wx:if="{{searchValue && searchResults.length==0}}">
<text class="empty-text">未找到"{{searchValue}}"的相关信息</text>
<view class="suggestions">
<view class="empty-state" wx:if="{{!isLoading && searchResults.length==0}}">
<text class="empty-text" wx:if="{{currentSearchKey}}">未找到"{{currentSearchKey}}"的相关信息</text>
<text class="empty-text" wx:if="{{!currentSearchKey && currentCategory !== '全部'}}">当前分类"{{currentCategory}}"暂无数据</text>
<text class="empty-text" wx:if="{{!currentSearchKey && currentCategory === '全部'}}">暂无数据</text>
<view class="suggestions" wx:if="{{currentSearchKey}}">
<view class="suggestion-item"> <view class="suggestion-item">
<view class="suggestion-dot"></view> <view class="suggestion-dot"></view>
<text>检查关键词拼写</text> <text>检查关键词拼写</text>
@ -111,6 +140,16 @@
<text>咨询专业兽医</text> <text>咨询专业兽医</text>
</view> </view>
</view> </view>
<view class="suggestions" wx:if="{{!currentSearchKey && currentCategory !== '全部'}}">
<view class="suggestion-item">
<view class="suggestion-dot"></view>
<text>尝试切换到"全部"分类</text>
</view>
<view class="suggestion-item">
<view class="suggestion-dot"></view>
<text>在搜索框中输入关键词进行搜索</text>
</view>
</view>
</view> </view>
</scroll-view> </scroll-view>
</view> </view>
@ -124,21 +163,8 @@
</view> </view>
<view class="modal-body"> <view class="modal-body">
<view class="tip-item">
<view class="tip-number">1</view>
<text class="tip-text">可以搜索疾病名称(如:猪瘟)</text>
</view>
<view class="tip-item">
<view class="tip-number">2</view>
<text class="tip-text">可以搜索动物种类(如:鸡、牛)</text>
</view>
<view class="tip-item">
<view class="tip-number">3</view>
<text class="tip-text">可以搜索症状(如:腹泻)</text>
</view>
<view class="tip-item">
<view class="tip-number">4</view>
<text class="tip-text">可以搜索管理方法(如:饲料、消毒)</text>
<view class="tip-item" wx:for="{{tip}}">
<text class="tip-text">{{item}}</text>
</view> </view>
</view> </view>

86
pagesB/pages/repository/repository.wxss

@ -138,13 +138,9 @@
} }
@keyframes bounce { @keyframes bounce {
0%,
80%,
100% {
0%, 80%, 100% {
transform: scale(0); transform: scale(0);
} }
40% { 40% {
transform: scale(1); transform: scale(1);
} }
@ -254,7 +250,6 @@
align-items: center; align-items: center;
} }
.date { .date {
font-size: 24rpx; font-size: 24rpx;
color: #94A3B8; color: #94A3B8;
@ -276,6 +271,59 @@
background: #F1F5F9; 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 { .empty-state {
@ -286,7 +334,6 @@
text-align: center; text-align: center;
} }
.empty-text { .empty-text {
font-size: 32rpx; font-size: 32rpx;
font-weight: 600; font-weight: 600;
@ -338,13 +385,8 @@
} }
@keyframes fadeIn { @keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
from { opacity: 0; }
to { opacity: 1; }
} }
.modal-content { .modal-content {
@ -361,7 +403,6 @@
opacity: 0; opacity: 0;
transform: translateY(80rpx); transform: translateY(80rpx);
} }
to { to {
opacity: 1; opacity: 1;
transform: translateY(0); transform: translateY(0);
@ -402,20 +443,7 @@
margin-bottom: 0; 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 { .tip-text {
font-size: 28rpx; font-size: 28rpx;

457
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);
}
}
});

4
pagesB/pages/training/training.json

@ -0,0 +1,4 @@
{
"navigationBarTitleText":"在线培训",
"usingComponents": {}
}

298
pagesB/pages/training/training.wxml

@ -0,0 +1,298 @@
<!-- pages/training/training.wxml -->
<view class="training-container">
<!-- 顶部标题 -->
<view class="header">
<view class="title">在线培训</view>
<view class="subtitle">专业学习资源,助您快速成长</view>
<view class="header-decoration">
<view class="decoration-circle circle-1"></view>
<view class="decoration-circle circle-2"></view>
<view class="decoration-circle circle-3"></view>
</view>
</view>
<!-- 主选项卡切换 -->
<view class="tabs">
<view
class="tab-item {{currentTab === 0 ? 'active' : ''}}"
bindtap="switchTab"
data-tab="0"
>
<text>文章</text>
<view class="tab-highlight {{currentTab === 0 ? 'active' : ''}}"></view>
</view>
<view
class="tab-item {{currentTab === 1 ? 'active' : ''}}"
bindtap="switchTab"
data-tab="1"
>
<text>视频</text>
<view class="tab-highlight {{currentTab === 1 ? 'active' : ''}}"></view>
</view>
<view class="tab-slider {{currentTab === 0 ? 'left' : 'right'}}"></view>
</view>
<!-- 文章板块 -->
<view class="content-section" wx:if="{{currentTab === 0}}">
<!-- 搜索框 -->
<view class="search-box">
<image class="search-icon" src="/pagesB/images/sou.png"></image>
<input
class="search-input"
placeholder="搜索文章..."
placeholder-class="placeholder-style"
bindinput="onSearchInput"
value="{{searchKeyword}}"
/>
<view class="search-decoration">
<view class="search-wave"></view>
</view>
</view>
<!-- 文章分类筛选 -->
<scroll-view class="category-scroll" scroll-x scroll-with-animation>
<view class="category-list">
<view
class="category-item {{articleActiveCategory === 'all' ? 'active' : ''}}"
bindtap="selectArticleCategory"
data-category="all"
>
<text>全部</text>
<view class="category-indicator"></view>
</view>
<view
class="category-item {{articleActiveCategory === 'tech' ? 'active' : ''}}"
bindtap="selectArticleCategory"
data-category="tech"
>
<text>技术干货</text>
<view class="category-indicator"></view>
</view>
<view
class="category-item {{articleActiveCategory === 'business' ? 'active' : ''}}"
bindtap="selectArticleCategory"
data-category="business"
>
<text>商业思维</text>
<view class="category-indicator"></view>
</view>
<view
class="category-item {{articleActiveCategory === 'management' ? 'active' : ''}}"
bindtap="selectArticleCategory"
data-category="management"
>
<text>管理技能</text>
<view class="category-indicator"></view>
</view>
<view
class="category-item {{articleActiveCategory === 'career' ? 'active' : ''}}"
bindtap="selectArticleCategory"
data-category="career"
>
<text>职业发展</text>
<view class="category-indicator"></view>
</view>
</view>
</scroll-view>
<!-- 文章列表 -->
<view class="articles-list">
<view
class="article-card"
wx:for="{{filteredArticles}}"
wx:key="id"
bindtap="viewArticleDetail"
data-id="{{item.id}}"
animation="{{item.animation}}"
>
<!-- 封面图片 -->
<view class="article-cover-container">
<image class="article-cover" src="{{item.cover}}" mode="aspectFill"></image>
<view class="cover-overlay"></view>
<view class="category-tag">{{item.category}}</view>
<view class="article-hover-effect"></view>
</view>
<!-- 文章信息 -->
<view class="article-info">
<view class="article-title">{{item.title}}</view>
<view class="article-desc">{{item.description}}</view>
<view class="article-meta">
<view class="meta-item">
<image class="meta-icon" src="/pages/images/tx.png"></image>
<text class="meta-text">{{item.author}}</text>
</view>
<view class="meta-item">
<text class="meta-text">{{item.date}}</text>
</view>
</view>
<view class="article-stats">
<view class="stat-item">
<image class="stat-icon" src="/pagesB/images/lll.png"></image>
<text>{{item.likes}}</text>
</view>
</view>
</view>
</view>
</view>
<!-- 空状态 -->
<view class="empty-state" wx:if="{{filteredArticles.length === 0}}">
<view class="empty-animation">
<view class="empty-circle"></view>
<view class="empty-circle circle-2"></view>
<view class="empty-circle circle-3"></view>
</view>
<text class="empty-text">暂无相关文章</text>
<text class="empty-hint">换个关键词试试吧</text>
</view>
</view>
<!-- 视频板块 -->
<view class="content-section" wx:if="{{currentTab === 1}}">
<!-- 搜索框 -->
<view class="search-box">
<image class="search-icon" src="/pagesB/images/sou.png"></image>
<input
class="search-input"
placeholder="搜索视频..."
placeholder-class="placeholder-style"
bindinput="onSearchInput"
value="{{searchKeyword}}"
/>
<view class="search-decoration">
<view class="search-wave"></view>
</view>
</view>
<!-- 视频分类筛选 -->
<scroll-view class="category-scroll" scroll-x scroll-with-animation>
<view class="category-list">
<view
class="category-item {{videoActiveCategory === 'all' ? 'active' : ''}}"
bindtap="selectVideoCategory"
data-category="all"
>
<text>全部视频</text>
<view class="category-indicator"></view>
</view>
<view
class="category-item {{videoActiveCategory === 'recommend' ? 'active' : ''}}"
bindtap="selectVideoCategory"
data-category="recommend"
>
<text>热门推荐</text>
<view class="category-indicator"></view>
</view>
<view
class="category-item {{videoActiveCategory === 'tech' ? 'active' : ''}}"
bindtap="selectVideoCategory"
data-category="tech"
>
<text>技术教程</text>
<view class="category-indicator"></view>
</view>
<view
class="category-item {{videoActiveCategory === 'business' ? 'active' : ''}}"
bindtap="selectVideoCategory"
data-category="business"
>
<text>商业知识</text>
<view class="category-indicator"></view>
</view>
<view
class="category-item {{videoActiveCategory === 'management' ? 'active' : ''}}"
bindtap="selectVideoCategory"
data-category="management"
>
<text>管理技能</text>
<view class="category-indicator"></view>
</view>
<view
class="category-item {{videoActiveCategory === 'career' ? 'active' : ''}}"
bindtap="selectVideoCategory"
data-category="career"
>
<text>职业发展</text>
<view class="category-indicator"></view>
</view>
<view
class="category-item {{videoActiveCategory === 'beginner' ? 'active' : ''}}"
bindtap="selectVideoCategory"
data-category="beginner"
>
<text>初级入门</text>
<view class="category-indicator"></view>
</view>
<view
class="category-item {{videoActiveCategory === 'advanced' ? 'active' : ''}}"
bindtap="selectVideoCategory"
data-category="advanced"
>
<text>进阶提升</text>
<view class="category-indicator"></view>
</view>
</view>
</scroll-view>
<!-- 视频列表 -->
<view class="videos-grid">
<view
class="video-card"
wx:for="{{filteredVideos}}"
wx:key="id"
bindtap="playVideo"
data-id="{{item.id}}"
animation="{{item.animation}}"
>
<!-- 视频封面 -->
<view class="video-cover-container">
<image class="video-cover" src="{{item.cover}}" mode="aspectFill"></image>
<view class="cover-overlay"></view>
<view class="video-duration">{{item.duration}}</view>
<view class="play-button">
<image class="play-icon" src="/pagesB/images/bo.png"></image>
<view class="play-ripple"></view>
</view>
<view class="video-hover-effect"></view>
</view>
<!-- 视频信息 -->
<view class="video-info">
<view class="video-title">{{item.title}}</view>
<view class="video-instructor">
<image class="instructor-avatar" src="/pages/images/tx.png"></image>
<text class="instructor-name">{{item.instructor.name}}</text>
</view>
<view class="video-meta">
<view class="video-meta-item">
<text>2026-01-12</text>
</view>
<view class="video-meta-item">
<text>{{item.views}}</text>
</view>
</view>
</view>
</view>
</view>
<!-- 空状态 -->
<view class="empty-state" wx:if="{{filteredVideos.length === 0}}">
<view class="empty-animation">
<view class="empty-circle"></view>
<view class="empty-circle circle-2"></view>
<view class="empty-circle circle-3"></view>
</view>
<text class="empty-text">暂无相关视频</text>
<text class="empty-hint">换个关键词试试吧</text>
</view>
</view>
</view>

1066
pagesB/pages/training/training.wxss
File diff suppressed because it is too large
View File

22
utils/api.js

@ -76,10 +76,30 @@ function expertsList(params) {
http('/vet/experts/list', 'get', 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 { // 暴露接口 export default { // 暴露接口
login,carousel,disaster,pharmacy,guidance,getPhoneNumber,inquiry, 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
} }

16
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 = { module.exports = {
type:type, type:type,
ztLevel:ztLevel
ztLevel:ztLevel,
medicineType:medicineType
} }
Loading…
Cancel
Save