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

@@ -1,27 +1,47 @@
.lawyer-card {
display: flex;
align-items: center;
align-items: flex-start;
background: var(--bg-card);
border-radius: var(--border-radius-base);
border-radius: 18rpx;
padding: var(--spacing-md);
box-shadow: var(--shadow-sm);
box-shadow: var(--shadow-base);
position: relative;
overflow: hidden;
transition: transform 0.1s;
border: 1rpx solid rgba(142, 34, 48, 0.06);
}
.lawyer-card:active {
transform: scale(0.98);
}
.lawyer-card--featured {
padding: 28rpx;
border-radius: 20rpx;
background: linear-gradient(180deg, #fff 0%, #fffaf9 100%);
box-shadow: 0 10rpx 28rpx rgba(26, 26, 26, 0.08);
}
.lawyer-card--compact {
align-items: center;
}
.avatar {
width: 100rpx;
height: 100rpx;
border-radius: 50%;
border: 4rpx solid var(--bg-page);
width: 104rpx;
height: 104rpx;
border-radius: 28rpx;
border: 4rpx solid #fff;
flex-shrink: 0;
margin-right: var(--spacing-sm);
margin-right: 20rpx;
background: var(--bg-surface);
box-shadow: 0 6rpx 18rpx rgba(0, 0, 0, 0.08);
}
.lawyer-card--featured .avatar {
width: 132rpx;
height: 132rpx;
border-radius: 32rpx;
margin-right: 24rpx;
}
.content {
@@ -29,69 +49,148 @@
min-width: 0;
display: flex;
flex-direction: column;
justify-content: center;
gap: 14rpx;
}
.top-row {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 16rpx;
}
.identity-block {
flex: 1;
min-width: 0;
}
.header-row {
display: flex;
align-items: center;
margin-bottom: 6rpx;
flex-wrap: wrap;
gap: 10rpx;
}
.name {
font-size: 32rpx;
font-weight: 600;
color: var(--text-main);
margin-right: 12rpx;
line-height: 1.2;
}
.lawyer-card--featured .name {
font-size: 40rpx;
}
.title {
font-size: 22rpx;
color: var(--primary-color);
background: rgba(142, 34, 48, 0.08);
/* Primary opacity */
padding: 2rpx 10rpx;
border-radius: 8rpx;
padding: 6rpx 14rpx;
border-radius: 10rpx;
font-weight: 500;
line-height: 1;
}
.office {
.lawyer-card--featured .title {
font-size: 24rpx;
padding: 8rpx 16rpx;
background: rgba(142, 34, 48, 0.1);
}
.contact-row {
display: flex;
flex-wrap: wrap;
gap: 10rpx;
margin-top: 12rpx;
}
.contact-chip {
max-width: 100%;
font-size: 22rpx;
line-height: 1.2;
color: var(--text-secondary);
background: var(--bg-page);
border-radius: 999rpx;
padding: 8rpx 16rpx;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.lawyer-card--featured .contact-chip {
font-size: 24rpx;
padding: 10rpx 18rpx;
background: rgba(255, 255, 255, 0.86);
border: 1rpx solid rgba(142, 34, 48, 0.08);
}
.specialty-block {
display: flex;
flex-direction: column;
gap: 10rpx;
}
.specialty-label {
font-size: 22rpx;
color: var(--text-tertiary);
margin-bottom: 12rpx;
line-height: 1;
}
.tags-row {
display: flex;
flex-wrap: wrap;
gap: 8rpx;
gap: 10rpx;
}
.tag {
font-size: 20rpx;
font-size: 22rpx;
color: var(--text-secondary);
background: var(--bg-page);
padding: 4rpx 12rpx;
border-radius: 6rpx;
padding: 8rpx 14rpx;
border-radius: 999rpx;
line-height: 1.2;
}
.lawyer-card--featured .tag {
font-size: 22rpx;
color: var(--primary-dark);
background: rgba(142, 34, 48, 0.06);
padding: 8rpx 14rpx;
}
.tag-more {
font-size: 20rpx;
color: var(--text-tertiary);
padding: 4rpx 0;
font-size: 22rpx;
color: var(--primary-color);
background: rgba(142, 34, 48, 0.08);
padding: 8rpx 14rpx;
border-radius: 999rpx;
line-height: 1.2;
}
.action-col {
margin-left: var(--spacing-md);
display: flex;
align-items: center;
flex-shrink: 0;
padding-top: 2rpx;
}
.consult-btn {
font-size: 24rpx;
color: var(--primary-color);
background: #fff;
border: 1rpx solid var(--primary-color);
padding: 6rpx 20rpx;
border-radius: 24rpx;
padding: 10rpx 22rpx;
border-radius: 999rpx;
font-weight: 500;
}
line-height: 1;
}
.lawyer-card--featured .consult-btn {
font-size: 26rpx;
padding: 14rpx 28rpx;
color: #fff;
background: var(--primary-color);
border: none;
box-shadow: 0 8rpx 18rpx rgba(142, 34, 48, 0.18);
}

View File

@@ -1,24 +1,44 @@
Component({
data: {
specialtiesText: '',
isFeatured: false,
layoutClass: '',
visibleSpecialties: [] as string[],
moreSpecialtiesCount: 0,
contactItems: [] as string[],
},
properties: {
lawyer: {
type: Object,
value: null,
},
showOffice: {
type: Boolean,
value: true,
layout: {
type: String,
value: 'compact',
},
},
observers: {
lawyer(lawyer: { specialties?: string[] } | null) {
'lawyer, layout'(lawyer: {
specialties?: string[];
phone?: string;
email?: string;
} | null, layout: string) {
const specialties =
lawyer && Array.isArray(lawyer.specialties) ? lawyer.specialties : [];
const isFeatured = layout === 'featured';
const visibleLimit = isFeatured ? 4 : 3;
const phone = lawyer && typeof lawyer.phone === 'string' ? lawyer.phone.trim() : '';
const email = lawyer && typeof lawyer.email === 'string' ? lawyer.email.trim() : '';
const phoneText = phone ? `电话:${phone}` : '';
const emailText = email ? `邮箱:${email}` : '';
const contactItems = isFeatured
? [phoneText, emailText].filter((item) => Boolean(item)).slice(0, 2)
: [];
this.setData({
specialties, // Expose array for wx:for
specialtiesText: specialties.join(' | '),
isFeatured,
layoutClass: isFeatured ? 'lawyer-card--featured' : 'lawyer-card--compact',
visibleSpecialties: specialties.slice(0, visibleLimit),
moreSpecialtiesCount: Math.max(0, specialties.length - visibleLimit),
contactItems,
});
},
},

View File

@@ -1,21 +1,30 @@
<view class="lawyer-card" bindtap="handleTap">
<view class="lawyer-card {{layoutClass}}" bindtap="handleTap">
<image class="avatar" src="{{lawyer.avatar}}" mode="aspectFill"></image>
<view class="content">
<view class="header-row">
<text class="name">{{lawyer.name}}</text>
<text class="title">{{lawyer.title}}</text>
</view>
<text wx:if="{{showOffice}}" class="office">{{lawyer.office}}</text>
<view class="tags-row">
<text class="tag" wx:for="{{specialties}}" wx:key="*this" wx:if="{{index < 3}}">{{item}}</text>
<text class="tag-more" wx:if="{{specialties.length > 3}}">...</text>
</view>
</view>
<view class="action-col">
<text class="consult-btn">咨询</text>
<view class="content">
<view class="top-row">
<view class="identity-block">
<view class="header-row">
<text class="name">{{lawyer.name}}</text>
<text class="title" wx:if="{{lawyer.title}}">{{lawyer.title}}</text>
</view>
<view class="contact-row" wx:if="{{contactItems.length}}">
<text class="contact-chip" wx:for="{{contactItems}}" wx:key="*this">{{item}}</text>
</view>
</view>
<view class="action-col">
<text class="consult-btn">咨询</text>
</view>
</view>
<view class="specialty-block">
<text class="specialty-label" wx:if="{{isFeatured && visibleSpecialties.length}}">业务方向</text>
<view class="tags-row">
<text class="tag" wx:for="{{visibleSpecialties}}" wx:key="*this">{{item}}</text>
<text class="tag-more" wx:if="{{moreSpecialtiesCount > 0}}">...</text>
</view>
</view>
</view>
</view>