feat(特价好车): 实现特价好车页面数据对接API
- 移除模拟数据,改为从API获取真实车辆数据 - 实现品牌、年份、学校的筛选功能 - 添加分页加载更多功能 - 更新车辆卡片显示字段以匹配API返回数据
Showing
3 changed files
with
12 additions
and
5 deletions
| 1 | /* | 1 | /* |
| 2 | * @Date: 2025-07-09 14:58:51 | 2 | * @Date: 2025-07-09 14:58:51 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2025-07-10 14:45:49 | 4 | + * @LastEditTime: 2025-07-11 10:18:35 |
| 5 | * @FilePath: /jgdl/src/api/car.js | 5 | * @FilePath: /jgdl/src/api/car.js |
| 6 | * @Description: 车辆相关API接口 | 6 | * @Description: 车辆相关API接口 |
| 7 | */ | 7 | */ |
| ... | @@ -66,6 +66,13 @@ export const editVehicleAPI = (params) => fn(fetch.post(Api.EDIT_VEHICLE, params | ... | @@ -66,6 +66,13 @@ export const editVehicleAPI = (params) => fn(fetch.post(Api.EDIT_VEHICLE, params |
| 66 | /** | 66 | /** |
| 67 | * @description: 首页轮播/最新上架/特价好车 | 67 | * @description: 首页轮播/最新上架/特价好车 |
| 68 | * @param section 推荐的位置,1=首页轮播, 2=特价好车, 3=精品推荐 | 68 | * @param section 推荐的位置,1=首页轮播, 2=特价好车, 3=精品推荐 |
| 69 | + * @param school_id 学校ID | ||
| 70 | + * @param brand 品牌 | ||
| 71 | + * @param manufacture_year 出厂年份 | ||
| 72 | + * @param verification_status 认证状态(1=不认证, 3=认证待审核, 5=已认证, 7=认证失败) | ||
| 73 | + * @param keyword 搜索关键字(品牌/型号/描述) | ||
| 74 | + * @param page 页码 | ||
| 75 | + * @param limit 每页数量 | ||
| 69 | * @returns data[{ id, seller_id, school_id, school_name, title, brand, model, manufacture_year, new_level, range_km, total_mileage_km, max_speed_kmh, battery_capacity_ah, brake_wear_level, tire_wear_level, price, market_price, verification_status, rejection_reason, note, photos, is_favorite }] | 76 | * @returns data[{ id, seller_id, school_id, school_name, title, brand, model, manufacture_year, new_level, range_km, total_mileage_km, max_speed_kmh, battery_capacity_ah, brake_wear_level, tire_wear_level, price, market_price, verification_status, rejection_reason, note, photos, is_favorite }] |
| 70 | */ | 77 | */ |
| 71 | 78 | ... | ... |
This diff is collapsed. Click to expand it.
| 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-11 10:09:02 | 4 | + * @LastEditTime: 2025-07-11 10:58:14 |
| 5 | * @FilePath: /jgdl/src/pages/index/index.vue | 5 | * @FilePath: /jgdl/src/pages/index/index.vue |
| 6 | * @Description: 捡个电驴首页 | 6 | * @Description: 捡个电驴首页 |
| 7 | --> | 7 | --> |
| ... | @@ -290,14 +290,14 @@ onMounted(async () => { | ... | @@ -290,14 +290,14 @@ onMounted(async () => { |
| 290 | // 获取首页轮播 | 290 | // 获取首页轮播 |
| 291 | const res1 = await getRecommendVehicleAPI({ section: 1 }) | 291 | const res1 = await getRecommendVehicleAPI({ section: 1 }) |
| 292 | if (res1.code) { | 292 | if (res1.code) { |
| 293 | - bannerImages.value = res1.data.map(item => item.front_photo); | 293 | + bannerImages.value = res1.data.list.map(item => item.front_photo); |
| 294 | } | 294 | } |
| 295 | // 获取精品推荐 | 295 | // 获取精品推荐 |
| 296 | const res2 = await getRecommendVehicleAPI({ section: 3 }) | 296 | const res2 = await getRecommendVehicleAPI({ section: 3 }) |
| 297 | if (res2.code) { | 297 | if (res2.code) { |
| 298 | - featuredScooters.value = res2.data | 298 | + featuredScooters.value = res2.data.list |
| 299 | // 处理图片数据 | 299 | // 处理图片数据 |
| 300 | - const processedData = res2.data.map(item => ({ | 300 | + const processedData = res2.data.list.map(item => ({ |
| 301 | ...item, | 301 | ...item, |
| 302 | front_photo: item.front_photo || DEFAULT_COVER_IMG, | 302 | front_photo: item.front_photo || DEFAULT_COVER_IMG, |
| 303 | // 确保价格为数字类型 | 303 | // 确保价格为数字类型 | ... | ... |
-
Please register or login to post a comment