hookehuyr

feat: 添加精品推荐页面及导航功能

实现精品推荐页面,包含车辆列表展示、筛选和收藏功能
在首页和帖子页添加跳转到精品推荐页面的导航
更新搜索框占位文本和收藏按钮样式
1 /* 1 /*
2 * @Date: 2025-06-28 10:33:00 2 * @Date: 2025-06-28 10:33:00
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2025-07-04 10:34:25 4 + * @LastEditTime: 2025-07-04 16:18:21
5 * @FilePath: /jgdl/src/app.config.js 5 * @FilePath: /jgdl/src/app.config.js
6 * @Description: 配置文件 6 * @Description: 配置文件
7 */ 7 */
...@@ -27,6 +27,7 @@ export default { ...@@ -27,6 +27,7 @@ export default {
27 'pages/feedBack/index', 27 'pages/feedBack/index',
28 'pages/helpCenter/index', 28 'pages/helpCenter/index',
29 'pages/search/index', 29 'pages/search/index',
30 + 'pages/recommendCarList/index',
30 ], 31 ],
31 subpackages: [ // 配置在tabBar中的页面不能分包写到subpackages中去 32 subpackages: [ // 配置在tabBar中的页面不能分包写到subpackages中去
32 { 33 {
......
1 <!-- 1 <!--
2 * @Date: 2022-09-19 14:11:06 2 * @Date: 2022-09-19 14:11:06
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2025-07-03 21:10:36 4 + * @LastEditTime: 2025-07-04 16:27:02
5 * @FilePath: /jgdl/src/pages/goodCarList/index.vue 5 * @FilePath: /jgdl/src/pages/goodCarList/index.vue
6 * @Description: 特价好车页面 6 * @Description: 特价好车页面
7 --> 7 -->
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
17 </nut-col> 17 </nut-col>
18 <nut-col span="18"> 18 <nut-col span="18">
19 <!-- Search Bar --> 19 <!-- Search Bar -->
20 - <nut-searchbar v-model="searchValue" placeholder="搜索品牌型号" @blur="onBlurSearch" shape="round" background="transparent" input-background="#ffffff"> 20 + <nut-searchbar v-model="searchValue" placeholder="搜索商品名称、品牌、型号" @blur="onBlurSearch" shape="round" background="transparent" input-background="#ffffff">
21 <template #leftin> 21 <template #leftin>
22 <Search2 /> 22 <Search2 />
23 </template> 23 </template>
...@@ -67,8 +67,8 @@ ...@@ -67,8 +67,8 @@
67 </view> 67 </view>
68 <view class="flex-1 p-3 relative"> 68 <view class="flex-1 p-3 relative">
69 <view class="absolute top-3 right-4" @tap.stop="() => toggleFavorite(car.id)"> 69 <view class="absolute top-3 right-4" @tap.stop="() => toggleFavorite(car.id)">
70 - <Heart1 v-if="!favoriteIds.includes(car.id)" size="16" color="#9ca3af" /> 70 + <Heart1 v-if="!favoriteIds.includes(car.id)" size="22" color="#9ca3af" />
71 - <HeartFill v-else size="16" color="#ef4444" /> 71 + <HeartFill v-else size="22" color="#ef4444" />
72 </view> 72 </view>
73 <text class="font-medium text-sm block">{{ car.name }}</text> 73 <text class="font-medium text-sm block">{{ car.name }}</text>
74 <text class="text-xs text-gray-600 mt-1 block"> 74 <text class="text-xs text-gray-600 mt-1 block">
...@@ -82,7 +82,7 @@ ...@@ -82,7 +82,7 @@
82 <text v-if="car.originalPrice" class="text-xs text-gray-400 line-through mr-2"> 82 <text v-if="car.originalPrice" class="text-xs text-gray-400 line-through mr-2">
83 ¥{{ car.originalPrice.toLocaleString() }} 83 ¥{{ car.originalPrice.toLocaleString() }}
84 </text> 84 </text>
85 - <text class="text-orange-500 font-bold"> 85 + <text class="text-orange-500 font-bold" style="font-size: 1.2rem;">
86 ¥{{ car.price.toLocaleString() }} 86 ¥{{ car.price.toLocaleString() }}
87 </text> 87 </text>
88 </view> 88 </view>
...@@ -111,7 +111,7 @@ ...@@ -111,7 +111,7 @@
111 </view> 111 </view>
112 112
113 <!-- 自定义TabBar --> 113 <!-- 自定义TabBar -->
114 - <TabBar /> 114 + <!-- <TabBar /> -->
115 115
116 <!-- 成功提示 --> 116 <!-- 成功提示 -->
117 <nut-toast 117 <nut-toast
......
1 <!-- 1 <!--
2 * @Date: 2025-06-28 10:33:00 2 * @Date: 2025-06-28 10:33:00
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2025-07-04 16:04:15 4 + * @LastEditTime: 2025-07-04 16:26:05
5 * @FilePath: /jgdl/src/pages/index/index.vue 5 * @FilePath: /jgdl/src/pages/index/index.vue
6 * @Description: 捡个电驴首页 6 * @Description: 捡个电驴首页
7 --> 7 -->
...@@ -64,10 +64,10 @@ ...@@ -64,10 +64,10 @@
64 <view class="px-4 mt-4"> 64 <view class="px-4 mt-4">
65 <view class="flex justify-between items-center mb-2"> 65 <view class="flex justify-between items-center mb-2">
66 <text class="text-lg font-medium">精品推荐</text> 66 <text class="text-lg font-medium">精品推荐</text>
67 - <!-- <view class="text-sm text-gray-500 flex items-center"> 67 + <view class="text-sm text-gray-500 flex items-center" @tap="onMoreRecommendClick">
68 <text>更多</text> 68 <text>更多</text>
69 <RectRight size="12" /> 69 <RectRight size="12" />
70 - </view> --> 70 + </view>
71 </view> 71 </view>
72 <view class="grid grid-cols-2 gap-3"> 72 <view class="grid grid-cols-2 gap-3">
73 <view v-for="scooter in featuredScooters" :key="scooter.id" 73 <view v-for="scooter in featuredScooters" :key="scooter.id"
...@@ -284,6 +284,12 @@ const toggleFavorite = (scooterId) => { ...@@ -284,6 +284,12 @@ const toggleFavorite = (scooterId) => {
284 } 284 }
285 } 285 }
286 286
287 +const onMoreRecommendClick = () => {
288 + Taro.navigateTo({
289 + url: '/pages/recommendCarList/index'
290 + })
291 +}
292 +
287 /** 293 /**
288 * 点击产品卡片 294 * 点击产品卡片
289 * @param {Object} scooter - 电动车信息 295 * @param {Object} scooter - 电动车信息
......
1 <!-- 1 <!--
2 * @Date: 2022-09-19 14:11:06 2 * @Date: 2022-09-19 14:11:06
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2025-07-02 22:59:12 4 + * @LastEditTime: 2025-07-04 16:26:55
5 * @FilePath: /jgdl/src/pages/newCarList/index.vue 5 * @FilePath: /jgdl/src/pages/newCarList/index.vue
6 * @Description: 最新上架页面 6 * @Description: 最新上架页面
7 --> 7 -->
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
17 </nut-col> 17 </nut-col>
18 <nut-col span="18"> 18 <nut-col span="18">
19 <!-- Search Bar --> 19 <!-- Search Bar -->
20 - <nut-searchbar v-model="searchValue" placeholder="搜索品牌型号" @blur="onBlurSearch" shape="round" background="transparent" input-background="#ffffff"> 20 + <nut-searchbar v-model="searchValue" placeholder="搜索商品名称、品牌、型号" @blur="onBlurSearch" shape="round" background="transparent" input-background="#ffffff">
21 <template #leftin> 21 <template #leftin>
22 <Search2 /> 22 <Search2 />
23 </template> 23 </template>
...@@ -62,8 +62,8 @@ ...@@ -62,8 +62,8 @@
62 </view> 62 </view>
63 <view class="flex-1 p-3 relative"> 63 <view class="flex-1 p-3 relative">
64 <view class="absolute top-3 right-4" @tap.stop="() => toggleFavorite(car.id)"> 64 <view class="absolute top-3 right-4" @tap.stop="() => toggleFavorite(car.id)">
65 - <Heart1 v-if="!favoriteIds.includes(car.id)" size="16" color="#9ca3af" /> 65 + <Heart1 v-if="!favoriteIds.includes(car.id)" size="22" color="#9ca3af" />
66 - <HeartFill v-else size="16" color="#ef4444" /> 66 + <HeartFill v-else size="22" color="#ef4444" />
67 </view> 67 </view>
68 <text class="font-medium text-sm block">{{ car.name }}</text> 68 <text class="font-medium text-sm block">{{ car.name }}</text>
69 <text class="text-xs text-gray-600 mt-1 block"> 69 <text class="text-xs text-gray-600 mt-1 block">
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
72 <text v-if="car.mileage"> 行驶{{ car.mileage }}公里</text> 72 <text v-if="car.mileage"> 行驶{{ car.mileage }}公里</text>
73 </text> 73 </text>
74 <view class="mt-2"> 74 <view class="mt-2">
75 - <text class="text-orange-500 font-bold"> 75 + <text class="text-orange-500 font-bold" style="font-size: 1.2rem;">
76 ¥{{ car.price.toLocaleString() }} 76 ¥{{ car.price.toLocaleString() }}
77 </text> 77 </text>
78 <text class="text-xs text-gray-500 mt-1 block">{{ car.school }}</text> 78 <text class="text-xs text-gray-500 mt-1 block">{{ car.school }}</text>
...@@ -100,7 +100,7 @@ ...@@ -100,7 +100,7 @@
100 </view> 100 </view>
101 101
102 <!-- 自定义TabBar --> 102 <!-- 自定义TabBar -->
103 - <TabBar /> 103 + <!-- <TabBar /> -->
104 104
105 <!-- 成功提示 --> 105 <!-- 成功提示 -->
106 <nut-toast 106 <nut-toast
......
...@@ -86,10 +86,10 @@ ...@@ -86,10 +86,10 @@
86 <view class="mt-6 mb-20 ml-4 mr-4"> 86 <view class="mt-6 mb-20 ml-4 mr-4">
87 <view class="flex justify-between items-center mb-3"> 87 <view class="flex justify-between items-center mb-3">
88 <text class="text-lg font-medium">精品推荐</text> 88 <text class="text-lg font-medium">精品推荐</text>
89 - <!-- <view class="text-sm text-gray-500 flex items-center" @tap="onViewMore"> 89 + <view class="text-sm text-gray-500 flex items-center" @tap="onMoreRecommendClick">
90 <text>更多</text> 90 <text>更多</text>
91 <RectRight size="12" /> 91 <RectRight size="12" />
92 - </view> --> 92 + </view>
93 </view> 93 </view>
94 <view class="grid grid-cols-2 gap-3"> 94 <view class="grid grid-cols-2 gap-3">
95 <view v-for="scooter in featuredScooters" :key="scooter.id" 95 <view v-for="scooter in featuredScooters" :key="scooter.id"
...@@ -304,10 +304,9 @@ const onProductClick = (scooter) => { ...@@ -304,10 +304,9 @@ const onProductClick = (scooter) => {
304 /** 304 /**
305 * 查看更多点击事件 305 * 查看更多点击事件
306 */ 306 */
307 -const onViewMore = () => { 307 +const onMoreRecommendClick = () => {
308 - Taro.showToast({ 308 + Taro.navigateTo({
309 - title: '查看更多精品推荐', 309 + url: '/pages/recommendCarList/index'
310 - icon: 'none'
311 }) 310 })
312 } 311 }
313 312
......
1 +/*
2 + * @Date: 2025-07-02 22:16:48
3 + * @LastEditors: hookehuyr hookehuyr@gmail.com
4 + * @LastEditTime: 2025-07-02 22:17:11
5 + * @FilePath: /jgdl/src/pages/newCarList/index.config.js
6 + * @Description: 文件描述
7 + */
8 +export default {
9 + navigationBarTitleText: '',
10 + usingComponents: {
11 + },
12 +}
1 +/* 精品推荐页面样式 */
2 +.recommend-car-list {
3 + width: 100%;
4 + box-sizing: border-box;
5 +
6 + /* 滚动条样式 */
7 + &::-webkit-scrollbar {
8 + width: 6rpx;
9 + }
10 +
11 + &::-webkit-scrollbar-track {
12 + background: #f1f1f1;
13 + border-radius: 3rpx;
14 + }
15 +
16 + &::-webkit-scrollbar-thumb {
17 + background: #c1c1c1;
18 + border-radius: 3rpx;
19 +
20 + &:hover {
21 + background: #a8a8a8;
22 + }
23 + }
24 +}
25 +
26 +/* 车辆卡片样式 */
27 +.recommend-car-list .bg-white {
28 + background-color: #ffffff;
29 + border: 1px solid #f0f0f0;
30 + border-radius: 16rpx;
31 + box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.08);
32 + overflow: hidden;
33 + margin-bottom: 24rpx;
34 + transition: all 0.3s ease;
35 +}
36 +
37 +.recommend-car-list .bg-white:hover {
38 + transform: translateY(-2rpx);
39 + box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.12);
40 + border-color: #e5e7eb;
41 +}
42 +
43 +.recommend-car-list .bg-white:active {
44 + transform: scale(0.98);
45 + transition: transform 0.1s ease;
46 +}
47 +
48 +/* 车辆图片容器 */
49 +.recommend-car-list .w-32 {
50 + width: 200rpx;
51 + height: 150rpx;
52 + flex-shrink: 0;
53 +}
54 +
55 +.recommend-car-list image {
56 + border-radius: 12rpx;
57 + object-fit: cover;
58 +}
59 +
60 +/* 推荐标识样式优化 */
61 +.recommend-car-list .absolute.bottom-3.right-3 {
62 + background: linear-gradient(45deg, #ef4444, #dc2626);
63 + box-shadow: 0 2rpx 4rpx rgba(239, 68, 68, 0.3);
64 + border-radius: 8rpx;
65 + padding: 4rpx 8rpx;
66 + font-size: 20rpx;
67 + font-weight: 600;
68 +}
69 +
70 +/* 车辆信息区域 */
71 +.recommend-car-list .flex-1 {
72 + flex: 1;
73 + min-width: 0;
74 +}
75 +
76 +/* 收藏按钮样式 */
77 +.recommend-car-list .absolute {
78 + transition: transform 0.2s ease;
79 +}
80 +
81 +.recommend-car-list .absolute:active {
82 + transform: scale(0.9);
83 +}
84 +
85 +/* 价格样式 */
86 +.recommend-car-list .text-orange-500 {
87 + color: #f97316;
88 + font-weight: bold;
89 +}
90 +
91 +/* 推荐理由样式 */
92 +.recommend-car-list .text-green-600 {
93 + color: #10b981;
94 + font-weight: 500;
95 +}
96 +
97 +/* 文字省略 */
98 +.recommend-car-list .font-medium {
99 + overflow: hidden;
100 + text-overflow: ellipsis;
101 + white-space: nowrap;
102 +}
103 +
104 +/* 加载状态样式 */
105 +.loading-container {
106 + padding: 32rpx 0 100rpx 0; /* 增加底部间距避免被TabBar遮挡 */
107 + text-align: center;
108 +
109 + .loading-text {
110 + color: #9ca3af;
111 + font-size: 28rpx;
112 + }
113 +}
114 +
115 +/* 无更多数据样式 */
116 +.no-more-container {
117 + padding: 32rpx 0 100rpx 0; /* 增加底部间距避免被TabBar遮挡 */
118 + text-align: center;
119 +
120 + text {
121 + color: #d1d5db;
122 + font-size: 24rpx;
123 + }
124 +}
125 +
126 +/* 动画效果 */
127 +.recommend-car-list .bg-white {
128 + animation: fadeInUp 0.3s ease-out;
129 +}
130 +
131 +@keyframes fadeInUp {
132 + from {
133 + opacity: 0;
134 + transform: translateY(20rpx);
135 + }
136 + to {
137 + opacity: 1;
138 + transform: translateY(0);
139 + }
140 +}
141 +
142 +/* 响应式适配 */
143 +@media screen and (max-width: 750rpx) {
144 + .recommend-car-list .w-32 {
145 + width: 180rpx;
146 + height: 135rpx;
147 + }
148 +
149 + .recommend-car-list .text-xl {
150 + font-size: 32rpx;
151 + }
152 +
153 + .recommend-car-list .text-sm {
154 + font-size: 24rpx;
155 + }
156 +
157 + .recommend-car-list .text-xs {
158 + font-size: 20rpx;
159 + }
160 +}
161 +
162 +/* 深色模式适配 */
163 +@media (prefers-color-scheme: dark) {
164 + .recommend-car-list .bg-white {
165 + background-color: #1f2937;
166 + border-color: #374151;
167 + }
168 +
169 + .recommend-car-list .text-gray-600 {
170 + color: #9ca3af;
171 + }
172 +
173 + .recommend-car-list .text-gray-500 {
174 + color: #6b7280;
175 + }
176 +
177 + .recommend-car-list .text-gray-400 {
178 + color: #9ca3af;
179 + }
180 +}
181 +
182 +/* NutUI组件样式覆盖 */
183 +:deep(.nut-sticky) {
184 + z-index: 999;
185 +}
186 +
187 +:deep(.nut-searchbar) {
188 + .nut-searchbar__content {
189 + border-radius: 50rpx;
190 + background: #fff;
191 +
192 + .nut-searchbar__input {
193 + font-size: 28rpx;
194 + color: #374151;
195 +
196 + &::placeholder {
197 + color: #9ca3af;
198 + }
199 + }
200 + }
201 +}
202 +
203 +:deep(.nut-menu) {
204 + background: #fff;
205 + border-bottom: 1rpx solid #e5e7eb;
206 +
207 + .nut-menu__item {
208 + font-size: 28rpx;
209 + color: #374151;
210 +
211 + &.active {
212 + color: #f97316;
213 + }
214 + }
215 +
216 + .nut-menu__title {
217 + font-size: 28rpx;
218 +
219 + &::after {
220 + border-color: #9ca3af;
221 + }
222 + }
223 +}
224 +
225 +:deep(.nut-toast) {
226 + .nut-toast__inner {
227 + background: rgba(0, 0, 0, 0.8);
228 + color: #fff;
229 + border-radius: 16rpx;
230 + font-size: 28rpx;
231 + }
232 +}
233 +
234 +/* 响应式适配 */
235 +@media (max-width: 750rpx) {
236 + .car-image-container {
237 + width: 200rpx;
238 + height: 150rpx;
239 + padding: 12rpx;
240 + }
241 +
242 + .car-info {
243 + padding: 20rpx;
244 +
245 + .car-name {
246 + font-size: 26rpx;
247 + }
248 +
249 + .car-details {
250 + font-size: 22rpx;
251 + }
252 +
253 + .car-price {
254 + font-size: 28rpx;
255 + }
256 +
257 + .car-school {
258 + font-size: 20rpx;
259 + }
260 +
261 + .listing-time {
262 + font-size: 20rpx;
263 + }
264 + }
265 +}
266 +
267 +/* 深色模式适配 */
268 +@media (prefers-color-scheme: dark) {
269 + .car-card {
270 + background: #1f2937;
271 + box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.3);
272 +
273 + &:hover {
274 + box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.4);
275 + }
276 + }
277 +
278 + .car-info {
279 + .car-name {
280 + color: #f9fafb;
281 + }
282 +
283 + .car-details {
284 + color: #d1d5db;
285 + }
286 +
287 + .car-school {
288 + color: #9ca3af;
289 + }
290 + }
291 +
292 + .loading-container .loading-text {
293 + color: #6b7280;
294 + }
295 +
296 + .no-more-container text {
297 + color: #4b5563;
298 + }
299 +}
This diff is collapsed. Click to expand it.