This commit is contained in:
2025-08-13 20:39:09 +08:00
parent c7b0b1e5b7
commit 1492f3930c
3 changed files with 240 additions and 226 deletions
+2 -67
View File
@@ -26,26 +26,13 @@
<text class="status-text">{{ getStatusText() }}</text>
</view>
<!-- 收藏按钮 -->
<view class="favorite-btn" @click="toggleFavorite">
<text class="favorite-icon">{{ pet.isFavorite ? '❤️' : '🤍' }}</text>
</view>
</view>
<!-- 宠物基本信息 -->
<view class="pet-basic-info">
<view class="pet-header">
<text class="pet-name">{{ pet.name }}</text>
<view class="pet-stats">
<view class="stat-item">
<text class="stat-icon">👁️</text>
<text class="stat-count">{{ pet.views }}</text>
</view>
<view class="stat-item">
<text class="stat-icon">❤️</text>
<text class="stat-count">{{ pet.favorites }}</text>
</view>
</view>
</view>
<view class="pet-tags">
@@ -260,16 +247,7 @@ export default {
})
},
toggleFavorite() {
this.pet.isFavorite = !this.pet.isFavorite
adoptionManager.toggleFavorite(this.petId, this.pet.isFavorite)
uni.showToast({
title: this.pet.isFavorite ? '已收藏' : '已取消收藏',
icon: 'success',
duration: 1000
})
},
makeCall() {
uni.makePhoneCall({
@@ -405,27 +383,7 @@ export default {
}
}
.favorite-btn {
position: absolute;
top: 32rpx;
right: 32rpx;
width: 80rpx;
height: 80rpx;
background: rgba(255, 255, 255, 0.9);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.3s ease;
&:active {
transform: scale(0.9);
}
.favorite-icon {
font-size: 32rpx;
}
}
}
/* 宠物基本信息 */
@@ -439,9 +397,6 @@ export default {
border: 1rpx solid rgba(255, 255, 255, 0.3);
.pet-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 16rpx;
.pet-name {
@@ -449,26 +404,6 @@ export default {
font-weight: bold;
color: #333333;
}
.pet-stats {
display: flex;
gap: 16rpx;
.stat-item {
display: flex;
align-items: center;
gap: 6rpx;
.stat-icon {
font-size: 18rpx;
}
.stat-count {
font-size: 20rpx;
color: #999999;
}
}
}
}
.pet-tags {
+51 -91
View File
@@ -217,9 +217,7 @@
<text class="status-icon">{{ getStatusIcon(pet.status) }}</text>
<text class="status-text">{{ getStatusText(pet.status) }}</text>
</view>
<view class="pet-favorite" @click.stop="toggleFavorite(pet)">
<text class="favorite-icon">{{ pet.isFavorite ? '❤️' : '🤍' }}</text>
</view>
</view>
<view class="pet-info">
@@ -237,7 +235,11 @@
<text class="detail-text">{{ pet.age }}岁</text>
</view>
<view class="detail-item">
<text class="detail-icon">{{ pet.gender === 'male' ? '♂️' : '♀️' }}</text>
<u-icon
:name="pet.gender === 'male' ? 'man' : 'woman'"
:color="pet.gender === 'male' ? '#4A90E2' : '#FF69B4'"
size="16"
></u-icon>
<text class="detail-text">{{ pet.gender === 'male' ? '公' : '母' }}</text>
</view>
<view class="detail-item">
@@ -255,21 +257,6 @@
<text class="trait-text">{{ trait }}</text>
</view>
</view>
<view class="pet-stats">
<view class="stat-item">
<text class="stat-icon">👁️</text>
<text class="stat-count">{{ pet.views }}</text>
</view>
<view class="stat-item">
<text class="stat-icon">❤️</text>
<text class="stat-count">{{ pet.favorites }}</text>
</view>
<view class="contact-type">
<text class="contact-icon">{{ pet.contact.type === 'organization' ? '🏢' : '👤' }}</text>
<text class="contact-text">{{ pet.contact.type === 'organization' ? '机构' : '个人' }}</text>
</view>
</view>
</view>
</view>
@@ -603,23 +590,9 @@ export default {
// 页面跳转
viewPetDetail(pet) {
// 增加浏览量
adoptionManager.incrementViews(pet.id)
uni.navigateTo({
url: `/pages/adoption/adoption-detail?petId=${pet.id}`
})
},
toggleFavorite(pet) {
pet.isFavorite = !pet.isFavorite
adoptionManager.toggleFavorite(pet.id, pet.isFavorite)
uni.showToast({
title: pet.isFavorite ? '已收藏' : '已取消收藏',
icon: 'success',
duration: 1000
})
}
}
}
@@ -629,14 +602,14 @@ export default {
.adoption-container {
background: linear-gradient(135deg, #FF8A80 0%, #FFB6C1 25%, #FECFEF 50%, #F8BBD9 100%);
min-height: 100vh;
overflow-x: hidden;
width: 100vw;
}
/* 头部搜索栏 */
.header-section {
background: rgba(255, 255, 255, 0.95);
backdrop-filter: blur(20rpx);
background: transparent;
padding: 24rpx 32rpx;
border-bottom: 1rpx solid rgba(255, 255, 255, 0.3);
.search-wrapper {
display: flex;
@@ -646,41 +619,52 @@ export default {
.search-input-container {
flex: 1;
position: relative;
background: rgba(255, 138, 128, 0.05);
border-radius: 20rpx;
background: transparent;
border: 2rpx solid rgba(255, 255, 255, 0.6);
border-radius: 24rpx;
padding: 0 20rpx;
display: flex;
align-items: center;
box-shadow: 0 2rpx 12rpx rgba(255, 255, 255, 0.1);
.search-icon {
font-size: 24rpx;
margin-right: 12rpx;
color: #999999;
color: #ffffff;
}
.search-input {
flex: 1;
height: 72rpx;
font-size: 24rpx;
color: #333333;
color: #ffffff;
background: transparent;
border: none;
outline: none;
&::placeholder {
color: #ffffff;
}
}
.search-clear {
width: 32rpx;
height: 32rpx;
background: #CCCCCC;
background: rgba(255, 255, 255, 0.3);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
margin-left: 12rpx;
transition: all 0.3s ease;
&:active {
background: rgba(255, 255, 255, 0.5);
}
.clear-icon {
font-size: 16rpx;
color: white;
color: #ffffff;
}
}
}
@@ -689,23 +673,26 @@ export default {
display: flex;
align-items: center;
gap: 8rpx;
background: rgba(255, 138, 128, 0.1);
background: transparent;
border: 2rpx solid rgba(255, 255, 255, 0.4);
border-radius: 16rpx;
padding: 16rpx 20rpx;
transition: all 0.3s ease;
&:active {
transform: scale(0.95);
background: rgba(255, 138, 128, 0.2);
background: rgba(255, 255, 255, 0.1);
border-color: rgba(255, 255, 255, 0.6);
}
.filter-icon {
font-size: 20rpx;
color: #ffffff;
}
.filter-text {
font-size: 22rpx;
color: #666666;
color: #ffffff;
font-weight: 500;
}
}
@@ -938,12 +925,17 @@ export default {
/* 宠物列表区域 */
.pets-scroll {
height: calc(100vh - 200rpx);
padding: 0 20rpx;
height: calc(100vh - 100rpx);
padding: 0 16rpx;
overflow-x: hidden;
width: 100%;
box-sizing: border-box;
}
.pets-list {
padding-bottom: 120rpx;
padding-bottom: 20rpx;
width: 100%;
box-sizing: border-box;
}
.result-summary {
@@ -960,29 +952,32 @@ export default {
.pet-card {
background: rgba(255, 255, 255, 0.95);
backdrop-filter: blur(20rpx);
border-radius: 20rpx;
padding: 20rpx;
margin-bottom: 16rpx;
box-shadow: 0 4rpx 16rpx rgba(255, 138, 128, 0.1);
border-radius: 16rpx;
padding: 16rpx;
margin: 0 0 16rpx 0;
box-shadow: 0 2rpx 12rpx rgba(255, 138, 128, 0.08);
border: 1rpx solid rgba(255, 255, 255, 0.3);
transition: all 0.3s ease;
width: 100%;
box-sizing: border-box;
&:active {
transform: scale(0.98);
box-shadow: 0 2rpx 8rpx rgba(255, 138, 128, 0.2);
box-shadow: 0 1rpx 6rpx rgba(255, 138, 128, 0.15);
}
.pet-image-container {
position: relative;
width: 100%;
height: 400rpx;
height: 280rpx;
border-radius: 16rpx;
overflow: hidden;
margin-bottom: 16rpx;
margin-bottom: 12rpx;
.pet-image {
width: 100%;
height: 100%;
object-fit: cover;
}
.pet-status {
@@ -1019,27 +1014,7 @@ export default {
}
}
.pet-favorite {
position: absolute;
top: 16rpx;
right: 16rpx;
width: 56rpx;
height: 56rpx;
background: rgba(255, 255, 255, 0.9);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.3s ease;
&:active {
transform: scale(0.9);
}
.favorite-icon {
font-size: 24rpx;
}
}
}
.pet-info {
@@ -1110,24 +1085,9 @@ export default {
.pet-stats {
display: flex;
justify-content: space-between;
justify-content: flex-end;
align-items: center;
.stat-item {
display: flex;
align-items: center;
gap: 6rpx;
.stat-icon {
font-size: 16rpx;
}
.stat-count {
font-size: 18rpx;
color: #999999;
}
}
.contact-type {
display: flex;
align-items: center;