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

@@ -44,73 +44,14 @@
color: var(--text-placeholder);
}
.quick-actions {
display: flex;
gap: var(--spacing-md);
padding: 0 var(--spacing-md) var(--spacing-md);
}
.action-btn {
flex: 1;
height: 80rpx;
border-radius: var(--border-radius-base);
display: flex;
align-items: center;
justify-content: center;
font-size: 28rpx;
font-weight: 500;
transition: opacity 0.2s;
}
.action-btn:active {
opacity: 0.8;
}
.hotline-btn {
background: rgba(142, 34, 48, 0.06);
/* Burgundy tint */
color: var(--primary-color);
}
.map-btn {
background: #fff;
color: var(--text-secondary);
border: 1rpx solid var(--border-color);
}
.list-wrap {
padding: 0 var(--spacing-md);
}
.card-item {
margin-bottom: var(--spacing-md);
background: #fff;
/* Ensure card background is white */
border-radius: var(--border-radius-base);
margin-bottom: 20rpx;
}
.list-bottom-space {
height: 120rpx;
}
/* History Floating Action Button styling */
.history-fab {
position: fixed;
right: var(--spacing-md);
bottom: calc(var(--spacing-lg) + env(safe-area-inset-bottom));
background: rgba(255, 255, 255, 0.9);
backdrop-filter: blur(10px);
padding: 16rpx 32rpx;
border-radius: 40rpx;
box-shadow: var(--shadow-lg);
display: flex;
align-items: center;
z-index: 20;
border: 1rpx solid var(--border-color);
}
.history-text {
font-size: 26rpx;
color: var(--text-main);
font-weight: 500;
}

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',
});
},
});

View File

@@ -12,6 +12,8 @@
placeholder="搜索律师姓名、专业领域..."
value="{{keyword}}"
bindinput="onSearchInput"
bindconfirm="onSearchConfirm"
confirm-type="search"
/>
</view>
</view>
@@ -26,21 +28,11 @@
></filter-bar>
</view>
<view class="quick-actions">
<view class="action-btn hotline-btn" bindtap="callHotline">
<image class="action-icon" src="/assets/icons/phone.svg" mode="aspectFit" wx:if="{{false}}"></image> <!-- Placeholder for icon -->
<text>联系电话</text>
</view>
<view class="action-btn map-btn" bindtap="openOffice">
<text>总部导航</text>
</view>
</view>
<scroll-view class="page-content list-scroll" scroll-y="true" type="list">
<view class="list-wrap">
<block wx:if="{{filteredLawyers.length}}">
<view class="card-item" wx:for="{{filteredLawyers}}" wx:key="id" wx:for-item="item">
<lawyer-card lawyer="{{item}}" bind:select="handleLawyerSelect"></lawyer-card>
<lawyer-card lawyer="{{item}}" layout="featured" bind:select="handleLawyerSelect"></lawyer-card>
</view>
</block>
<block wx:else>
@@ -49,8 +41,4 @@
<view class="list-bottom-space"></view>
</view>
</scroll-view>
<view class="history-fab" bindtap="goHistory">
<text class="history-text">浏览记录</text>
</view>
</view>