feat: 重构律师列表卡片展示

- 简化筛选栏与列表快捷入口

- 为律师卡片增加 featured 布局和联系方式展示
This commit is contained in:
2026-03-21 22:02:15 +08:00
parent 63685f8644
commit 96feda4364
8 changed files with 193 additions and 187 deletions

View File

@@ -8,17 +8,12 @@ let searchDebounceTimer: number | null = null;
Page({
data: {
firmName: '',
firmAddress: '',
firmLatitude: 0,
firmLongitude: 0,
keyword: '',
selectedOffice: ALL_OFFICES,
selectedArea: ALL_AREAS,
officeOptions: [ALL_OFFICES],
areaOptions: [ALL_AREAS],
filteredLawyers: [] as Lawyer[],
hotlinePhone: '',
loading: false,
},
@@ -31,11 +26,6 @@ Page({
try {
const firm = await getFirmProfile();
this.setData({
firmName: firm.name,
firmAddress: firm.hqAddress,
firmLatitude: firm.hqLatitude,
firmLongitude: firm.hqLongitude,
hotlinePhone: firm.hotlinePhone,
officeOptions: [ALL_OFFICES, ...firm.officeList],
areaOptions: [ALL_AREAS, ...firm.practiceAreas],
});
@@ -68,6 +58,14 @@ Page({
}, 250) as unknown as number;
},
onSearchConfirm() {
if (searchDebounceTimer !== null) {
clearTimeout(searchDebounceTimer);
searchDebounceTimer = null;
}
this.loadLawyers();
},
handleOfficeChange(event: WechatMiniprogram.CustomEvent<{ value: string }>) {
this.setData({ selectedOffice: event.detail.value });
this.loadLawyers();
@@ -104,44 +102,4 @@ Page({
url: `/pages/lawyer-detail/index?id=${lawyerId}`,
});
},
callHotline() {
if (!this.data.hotlinePhone) {
wx.showToast({
title: '暂无联系电话',
icon: 'none',
});
return;
}
wx.makePhoneCall({
phoneNumber: this.data.hotlinePhone,
fail: () => {
wx.showToast({ title: '拨号失败', icon: 'none' });
},
});
},
openOffice() {
if (!this.data.firmLatitude || !this.data.firmLongitude) {
wx.showToast({ title: '暂未配置地图位置', icon: 'none' });
return;
}
wx.openLocation({
latitude: this.data.firmLatitude,
longitude: this.data.firmLongitude,
name: this.data.firmName,
address: this.data.firmAddress,
scale: 18,
fail: () => {
wx.showToast({ title: '打开地图失败', icon: 'none' });
},
});
},
goHistory() {
wx.navigateTo({
url: '/pages/history/index',
});
},
});