hookehuyr

fix(map_activity): 修复接口字段拼写错误和封面空值处理

- 修复 detail/list 接口字段拼写错误:tittle → title
- 修复 PosterCheckinDetail 页面 API 导入错误
- 添加 cover 字段空值处理,使用默认封面图
- 同步更新 API 文档和 Mock 数据

影响文件:
- src/pages/ActivitiesDetail/index.vue
- src/pages/CheckinMap/index.vue
- src/pages/PosterCheckinDetail/index.vue
- src/utils/mockData.js
- src/api/map_activity.js
- docs/api-specs/map_activity/detail.md
- docs/api-specs/map_activity/list.md

Co-Authored-By: Claude Code <noreply@anthropic.com>
......@@ -41,6 +41,7 @@ paths:
in: query
description: 活动ID
required: false
example: '834988'
schema:
type: string
responses:
......@@ -62,14 +63,11 @@ paths:
type: string
title: 地图网址
id:
type: string
type: integer
title: 活动ID
cover:
type: string
title: 封面图
tittle:
type: string
title: 标题
begin_date:
type: string
title: 开始时间
......@@ -94,10 +92,13 @@ paths:
discount_title:
type: string
title: 打卡点底部优惠标题
title:
type: string
title: 标题
x-apifox-orders:
- id
- cover
- tittle
- title
- begin_date
- end_date
- is_ended
......@@ -113,7 +114,7 @@ paths:
- begin_date
- id
- cover
- tittle
- title
- first_checkin_points
- required_checkin_count
- complete_points
......@@ -137,7 +138,9 @@ components:
schemas: {}
responses: {}
securitySchemes: {}
servers: []
servers:
- url: https://oa-dev.onwall.cn
description: 测试环境
security: []
```
......
......@@ -58,24 +58,24 @@ paths:
type: string
title: 地图网址
id:
type: string
type: integer
title: 活动ID
cover:
type: string
title: 封面图
tittle:
type: string
title: 标题
begin_date:
type: string
title: 开始时间
end_date:
type: string
title: 结束时间
title:
type: string
title: 标题
x-apifox-orders:
- id
- cover
- tittle
- title
- begin_date
- end_date
- url
......@@ -85,7 +85,7 @@ paths:
- begin_date
- id
- cover
- tittle
- title
x-apifox-orders:
- code
- msg
......@@ -105,7 +105,9 @@ components:
schemas: {}
responses: {}
securitySchemes: {}
servers: []
servers:
- url: https://oa-dev.onwall.cn
description: 测试环境
security: []
```
......
......@@ -34,9 +34,8 @@ export const checkinAPI = params => fn(fetch.post(Api.Checkin, params))
* msg: string; // 消息
* data: {
url: string; // 地图网址
id: string; // 活动ID
id: integer; // 活动ID
cover: string; // 封面图
tittle: string; // 标题
begin_date: string; // 开始时间
end_date: string; // 结束时间
is_ended: boolean; // 活动是否已经结束
......@@ -45,6 +44,7 @@ export const checkinAPI = params => fn(fetch.post(Api.Checkin, params))
required_checkin_count: integer; // 需要打卡几次,才能完成活动
complete_points: integer; // 完成活动获得多少积分
discount_title: string; // 打卡点底部优惠标题
title: string; // 标题
* };
* }>}
*/
......@@ -76,11 +76,11 @@ export const isCheckedAPI = params => fn(fetch.get(Api.IsChecked, params))
* msg: string; // 消息
* data: Array<{
url: string; // 地图网址
id: string; // 活动ID
id: integer; // 活动ID
cover: string; // 封面图
tittle: string; // 标题
begin_date: string; // 开始时间
end_date: string; // 结束时间
title: string; // 标题
* }>;
* }>}
*/
......@@ -118,7 +118,7 @@ export const listAPI = params => fn(fetch.get(Api.List, params))
* };
* }>}
*/
export const getPosterDetailAPI = params => fn(fetch.get(Api.Poster, params))
export const posterAPI = params => fn(fetch.get(Api.Poster, params))
/**
* @description 上传海报背景
......
......@@ -964,11 +964,11 @@ const transformApiDataToActivityData = apiData => {
]
return {
title: apiData.tittle || '活动标题',
title: apiData.title || '活动标题',
subtitle: '探索城市魅力,感受时尚脉搏',
dateRange: dateRange,
posterUrl: apiData.cover || defaultPoster.value,
description: `欢迎参加${apiData.tittle}活动!`,
description: `欢迎参加${apiData.title}活动!`,
rules: rules,
rewards: rewards,
}
......@@ -1000,9 +1000,12 @@ const fetchActivityDetail = async () => {
if (transformedData) {
activityData.value = transformedData
// 更新默认海报图
if (response.data.cover) {
// 更新默认海报图:如果 cover 为空,使用默认封面
if (response.data.cover && response.data.cover.trim() !== '') {
defaultPoster.value = response.data.cover
} else {
// cover 为空,保持默认封面不变
console.log('[ActivitiesCover] cover 为空,使用默认封面图')
}
// 更新活动状态
......
......@@ -44,6 +44,10 @@ import { useLoad } from '@tarojs/taro'
// ⚠️ MOCK 数据开关 - 开发环境使用 mock 数据,生产环境使用真实 API
const USE_MOCK_DATA = process.env.NODE_ENV === 'development'
// 默认封面图
const DEFAULT_COVER =
'https://cdn.ipadbiz.cn/lls_prog/images/welcome_8.jpg?imageMogr2/strip/quality/60'
/**
* 便民地图列表数据
*/
......@@ -58,10 +62,11 @@ const loading = ref(false)
const formatMapList = list => {
return list.map(item => ({
id: item.id,
title: item.tittle, // API 返回的是 tittle,映射为 title
cover: item.cover,
title: item.title,
// 如果 cover 为空,使用默认封面图
cover: item.cover && item.cover.trim() !== '' ? item.cover : DEFAULT_COVER,
timeRange: `${item.begin_date}~${item.end_date}`,
activityId: item.id, // 使用 id 作为 activityId
activityId: item.id,
}))
}
......
......@@ -167,7 +167,7 @@ import { Left, Right } from '@nutui/icons-vue-taro'
import PosterBuilder from '@/components/PosterBuilder/index.vue'
import BASE_URL from '@/utils/config'
// 导入获取海报详情的API
import { getPosterDetailAPI, savePosterBackgroundAPI } from '@/api/map_activity'
import { posterAPI, savePosterBackgroundAPI } from '@/api/map_activity'
// 默认背景图
const defaultBackground =
'https://cdn.ipadbiz.cn/lls_prog/images/%E6%B5%B7%E6%8A%A5%E9%BB%98%E8%AE%A4%E8%83%8C%E6%99%AF%E5%9B%BE1.png?imageMogr2/strip/quality/60'
......@@ -209,7 +209,7 @@ const fetchPosterDetail = async () => {
// 小程序版本。正式版为 "release",体验版为 "trial"。默认是正式版
const env_version = envVersion === 'release' ? 'release' : 'trial'
const response = await getPosterDetailAPI({ env_version })
const response = await posterAPI({ env_version })
if (response.code === 1) {
apiData.value = response.data
......
......@@ -73,7 +73,7 @@ function generateMapActivityItem(id) {
return {
id: String(id),
tittle: activityName,
title: activityName,
cover: randomImage(400, 300, id),
begin_date: formatDate(startDate),
end_date: formatDate(endDate),
......@@ -255,7 +255,7 @@ export const mockMapActivityDetail = () => {
url: 'https://example.com/map',
id: '1',
cover: randomImage(750, 500, 10),
tittle: '重阳登高打卡',
title: '重阳登高打卡',
begin_date: '2025.09.06',
end_date: '2025.10.31',
is_ended: false,
......