hookehuyr

feat(特价好车): 实现特价好车页面数据对接API

- 移除模拟数据,改为从API获取真实车辆数据
- 实现品牌、年份、学校的筛选功能
- 添加分页加载更多功能
- 更新车辆卡片显示字段以匹配API返回数据
/*
* @Date: 2025-07-09 14:58:51
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-07-10 14:45:49
* @LastEditTime: 2025-07-11 10:18:35
* @FilePath: /jgdl/src/api/car.js
* @Description: 车辆相关API接口
*/
......@@ -66,6 +66,13 @@ export const editVehicleAPI = (params) => fn(fetch.post(Api.EDIT_VEHICLE, params
/**
* @description: 首页轮播/最新上架/特价好车
* @param section 推荐的位置,1=首页轮播, 2=特价好车, 3=精品推荐
* @param school_id 学校ID
* @param brand 品牌
* @param manufacture_year 出厂年份
* @param verification_status 认证状态(1=不认证, 3=认证待审核, 5=已认证, 7=认证失败)
* @param keyword 搜索关键字(品牌/型号/描述)
* @param page 页码
* @param limit 每页数量
* @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 }]
*/
......
This diff is collapsed. Click to expand it.
<!--
* @Date: 2025-06-28 10:33:00
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-07-11 10:09:02
* @LastEditTime: 2025-07-11 10:58:14
* @FilePath: /jgdl/src/pages/index/index.vue
* @Description: 捡个电驴首页
-->
......@@ -290,14 +290,14 @@ onMounted(async () => {
// 获取首页轮播
const res1 = await getRecommendVehicleAPI({ section: 1 })
if (res1.code) {
bannerImages.value = res1.data.map(item => item.front_photo);
bannerImages.value = res1.data.list.map(item => item.front_photo);
}
// 获取精品推荐
const res2 = await getRecommendVehicleAPI({ section: 3 })
if (res2.code) {
featuredScooters.value = res2.data
featuredScooters.value = res2.data.list
// 处理图片数据
const processedData = res2.data.map(item => ({
const processedData = res2.data.list.map(item => ({
...item,
front_photo: item.front_photo || DEFAULT_COVER_IMG,
// 确保价格为数字类型
......