You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
366 lines
10 KiB
366 lines
10 KiB
import http from '../../../utils/api'
|
|
const baseUr = require('../../../utils/baseUrl')
|
|
Page({
|
|
data: {
|
|
// 搜索关键词
|
|
searchKeyword: '',
|
|
|
|
// 当前筛选条件
|
|
currentFilter: '全部',
|
|
|
|
// 所有专家数据
|
|
allExperts: [{
|
|
id: 1,
|
|
name: '张建国',
|
|
title: '畜牧学博士',
|
|
expertise: '牛类养殖与疾病防治',
|
|
experience: 15,
|
|
online: true,
|
|
senior: true,
|
|
phone: '138-0013-8001',
|
|
email: 'zhangjg@agri-expert.com',
|
|
institution: '国家畜牧业研究所',
|
|
address: '北京市朝阳区农业科技大厦',
|
|
bio: '15年牛类养殖研究经验,发表SCI论文20余篇,擅长规模化养殖场管理与疾病防控。',
|
|
tags: ['肉牛养殖', '疾病预防', '饲料配方', '规模化养殖'],
|
|
successRate: 98,
|
|
responseTime: '15分钟内响应',
|
|
avatar: '/pagesA/images/1.png'
|
|
},
|
|
{
|
|
id: 2,
|
|
name: '李秀英',
|
|
title: '兽医学硕士',
|
|
expertise: '猪病诊断与治疗',
|
|
experience: 12,
|
|
online: true,
|
|
senior: true,
|
|
phone: '139-0013-9002',
|
|
email: 'lixy@vet-hospital.cn',
|
|
institution: '农业大学动物医学院',
|
|
address: '上海市徐汇区农业路58号',
|
|
bio: '资深猪病防治专家,参与多项国家级科研项目,成功解决多个大规模猪场疫情。',
|
|
tags: ['猪病诊疗', '疫苗管理', '养殖场规划', '传染病防治'],
|
|
successRate: 96,
|
|
responseTime: '20分钟内响应',
|
|
avatar: '/pagesA/images/2.png'
|
|
},
|
|
{
|
|
id: 3,
|
|
name: '王伟民',
|
|
title: '高级畜牧师',
|
|
expertise: '羊类繁殖与饲养管理',
|
|
experience: 20,
|
|
online: false,
|
|
senior: true,
|
|
phone: '137-0013-7003',
|
|
email: 'wangwm@livestock.cn',
|
|
institution: '草原畜牧业研究中心',
|
|
address: '内蒙古呼和浩特市牧业科技园',
|
|
bio: '羊类养殖领域权威专家,拥有20年草原牧区养殖经验,精通各类羊只繁殖技术。',
|
|
tags: ['绵羊养殖', '山羊繁殖', '牧草种植', '草原管理'],
|
|
successRate: 95,
|
|
responseTime: '1小时内响应',
|
|
avatar: '/pagesA/images/3.png'
|
|
},
|
|
{
|
|
id: 4,
|
|
name: '陈秀兰',
|
|
title: '家禽养殖专家',
|
|
expertise: '鸡鸭养殖技术',
|
|
experience: 18,
|
|
online: true,
|
|
senior: false,
|
|
phone: '136-0013-6004',
|
|
email: 'chenxl@poultry-expert.com',
|
|
institution: '家禽养殖技术中心',
|
|
address: '广东省广州市禽业科技园',
|
|
bio: '家禽养殖技术推广专家,帮助300+养殖户实现科学化、标准化养殖管理。',
|
|
tags: ['蛋鸡养殖', '肉鸭饲养', '疾病防控', '禽舍设计'],
|
|
successRate: 94,
|
|
responseTime: '30分钟内响应',
|
|
avatar: '/pagesA/images/1.png'
|
|
},
|
|
{
|
|
id: 5,
|
|
name: '刘志强',
|
|
title: '特种养殖专家',
|
|
expertise: '鹿、兔等特种动物养殖',
|
|
experience: 10,
|
|
online: false,
|
|
senior: false,
|
|
phone: '135-0013-5005',
|
|
email: 'liuzq@special-livestock.cn',
|
|
institution: '特种动物养殖研究所',
|
|
address: '四川省成都市农业科技园',
|
|
bio: '特种动物养殖新兴力量,专注于梅花鹿、肉兔等特种动物的现代化养殖技术。',
|
|
tags: ['梅花鹿养殖', '肉兔饲养', '市场分析', '特色养殖'],
|
|
successRate: 92,
|
|
responseTime: '2小时内响应',
|
|
avatar: '/pagesA/images/2.png'
|
|
},
|
|
{
|
|
id: 6,
|
|
name: '赵雪梅',
|
|
title: '畜牧营养学博士',
|
|
expertise: '牲畜饲料配方与营养',
|
|
experience: 14,
|
|
online: true,
|
|
senior: true,
|
|
phone: '134-0013-4006',
|
|
email: 'zhaoxm@feed-research.cn',
|
|
institution: '农业科学院饲料研究所',
|
|
address: '江苏省南京市科研路88号',
|
|
bio: '饲料营养学专家,研发多个高效饲料配方,帮助养殖户降低30%饲料成本。',
|
|
tags: ['饲料配方', '营养管理', '成本控制', '饲料安全'],
|
|
successRate: 97,
|
|
responseTime: '25分钟内响应',
|
|
avatar: '/pagesA/images/3.png'
|
|
},
|
|
{
|
|
id: 7,
|
|
name: '孙建国',
|
|
title: '养殖场管理专家',
|
|
expertise: '现代化养殖场设计与运营',
|
|
experience: 22,
|
|
online: true,
|
|
senior: true,
|
|
phone: '133-0013-3007',
|
|
email: 'sunjg@farm-management.com',
|
|
institution: '现代农业发展中心',
|
|
address: '浙江省杭州市创新产业园',
|
|
bio: '养殖场规划设计专家,参与设计200+现代化养殖场,精通自动化养殖设备应用。',
|
|
tags: ['场舍设计', '设备管理', '成本核算', '环保处理'],
|
|
successRate: 99,
|
|
responseTime: '10分钟内响应',
|
|
avatar: '/pagesA/images/2.png'
|
|
},
|
|
{
|
|
id: 8,
|
|
name: '周小芳',
|
|
title: '兽医病理学硕士',
|
|
expertise: '牲畜常见病与传染病防治',
|
|
experience: 11,
|
|
online: false,
|
|
senior: false,
|
|
phone: '132-0013-2008',
|
|
email: 'zhouxf@vet-pathology.cn',
|
|
institution: '动物疫病防控中心',
|
|
address: '湖北省武汉市动物防疫站',
|
|
bio: '专攻牲畜病理诊断与传染病防控,在快速诊断和精准治疗方面有丰富经验。',
|
|
tags: ['传染病防治', '病理诊断', '用药指导', '疫情处理'],
|
|
successRate: 93,
|
|
responseTime: '1.5小时内响应',
|
|
avatar: '/pagesA/images/3.png'
|
|
}
|
|
],
|
|
baseUr: baseUr,
|
|
|
|
formzj: {
|
|
isOnline: null,
|
|
realName: null,
|
|
expert: null,
|
|
expertiseArea: null
|
|
},
|
|
|
|
// 筛选后的专家列表
|
|
filteredExperts: [],
|
|
|
|
|
|
// 当前选中的专家
|
|
currentExpert: null,
|
|
|
|
// 是否显示联系方式弹窗
|
|
showContactDialog: false
|
|
},
|
|
|
|
onLoad() {
|
|
this.getexpertsList()
|
|
},
|
|
|
|
onShow() {
|
|
|
|
},
|
|
|
|
|
|
// 专家列表
|
|
getexpertsList() {
|
|
http.expertsList({
|
|
data: this.data.formzj,
|
|
success: res => {
|
|
console.log(111, res);
|
|
this.setData({
|
|
allExperts: res.rows
|
|
})
|
|
}
|
|
})
|
|
},
|
|
|
|
|
|
// 处理搜索输入
|
|
onSearchInput(e) {
|
|
this.setData({
|
|
searchKeyword: e.detail.value
|
|
});
|
|
this.sortAndFilterExperts();
|
|
},
|
|
|
|
// 清空搜索
|
|
clearSearch() {
|
|
this.setData({
|
|
searchKeyword: '',
|
|
currentFilter: 'all'
|
|
});
|
|
this.sortAndFilterExperts();
|
|
},
|
|
|
|
// 更改筛选条件
|
|
changeFilter(e) {
|
|
console.log(2222, e);
|
|
const filter = e.currentTarget.dataset.filter;
|
|
this.setData({
|
|
currentFilter: filter
|
|
});
|
|
if (filter == '全部') {
|
|
this.data.formzj.isOnline = null
|
|
this.getexpertsList()
|
|
} else {
|
|
this.data.formzj.isOnline = filter
|
|
this.getexpertsList()
|
|
}
|
|
},
|
|
|
|
|
|
// 显示专家联系方式
|
|
showContactInfo(e) {
|
|
console.log(234,e);
|
|
const index = e.currentTarget.dataset.index;
|
|
const expert = this.data.allExperts[index];
|
|
console.log(33333,expert);
|
|
|
|
this.setData({
|
|
currentExpert: expert,
|
|
showContactDialog: true
|
|
});
|
|
},
|
|
|
|
// 隐藏联系方式弹窗
|
|
hideContactDialog() {
|
|
this.setData({
|
|
showContactDialog: false
|
|
});
|
|
},
|
|
|
|
// 阻止事件冒泡
|
|
stopPropagation() {
|
|
// 阻止事件冒泡
|
|
},
|
|
|
|
// 拨打电话
|
|
makePhoneCall(e) {
|
|
const phone = e.currentTarget.dataset.phone;
|
|
const cleanPhone = phone.replace(/-/g, '');
|
|
|
|
wx.showModal({
|
|
title: '拨打电话',
|
|
content: `确定要拨打 ${phone} 吗?`,
|
|
success: (res) => {
|
|
if (res.confirm) {
|
|
wx.makePhoneCall({
|
|
phoneNumber: cleanPhone,
|
|
success: () => {
|
|
wx.showToast({
|
|
title: '拨号成功',
|
|
icon: 'success'
|
|
});
|
|
},
|
|
fail: (err) => {
|
|
console.error('拨打电话失败:', err);
|
|
wx.showToast({
|
|
title: '拨号失败',
|
|
icon: 'none'
|
|
});
|
|
}
|
|
});
|
|
}
|
|
}
|
|
});
|
|
},
|
|
|
|
// 复制邮箱
|
|
copyEmail(e) {
|
|
const email = e.currentTarget.dataset.email;
|
|
|
|
wx.setClipboardData({
|
|
data: email,
|
|
success: () => {
|
|
wx.showToast({
|
|
title: '邮箱已复制',
|
|
icon: 'success'
|
|
});
|
|
},
|
|
fail: () => {
|
|
wx.showToast({
|
|
title: '复制失败',
|
|
icon: 'none'
|
|
});
|
|
}
|
|
});
|
|
},
|
|
|
|
// 查看位置
|
|
viewLocation(e) {
|
|
const address = e.currentTarget.dataset.address
|
|
wx.showModal({
|
|
title: '单位地址',
|
|
content: address,
|
|
showCancel: false,
|
|
confirmText: '知道了'
|
|
});
|
|
},
|
|
|
|
// 开始咨询
|
|
startConsultation() {
|
|
const expert = this.data.currentExpert;
|
|
console.log(1111,expert);
|
|
|
|
wx.showModal({
|
|
title: '咨询确认',
|
|
content: expert.isOnline=='在线' ?
|
|
`确定要立即咨询 ${expert.realName} 专家吗?` : `确定要预约咨询 ${expert.realName} 专家吗?`,
|
|
success: (res) => {
|
|
if (res.confirm) {
|
|
if (expert.isOnline=='在线') {
|
|
wx.showToast({
|
|
title: '正在为您连接',
|
|
icon: 'loading',
|
|
duration: 2000
|
|
});
|
|
setTimeout(() => {
|
|
// 跳转一对一咨询专家
|
|
wx.navigateTo({
|
|
url: '/pagesA/pages/expertChat/expertChat',
|
|
})
|
|
this.hideContactDialog();
|
|
}, 2000);
|
|
} else {
|
|
wx.showToast({
|
|
title: '预约成功,专家将尽快回复',
|
|
icon: 'success'
|
|
});
|
|
this.hideContactDialog();
|
|
}
|
|
}
|
|
}
|
|
});
|
|
},
|
|
|
|
// 分享专家
|
|
onShareAppMessage() {
|
|
return {
|
|
title: '牲畜专家咨询平台',
|
|
path: '/pages/expert/expert',
|
|
imageUrl: '/images/share-cover.jpg'
|
|
}
|
|
}
|
|
});
|