fix: 修复学员端成长路径数据解析,兼容直接返回数据格式
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -490,8 +490,12 @@ const loadGrowthPath = async () => {
|
|||||||
growthPathLoading.value = true
|
growthPathLoading.value = true
|
||||||
try {
|
try {
|
||||||
const response = await getGrowthPath()
|
const response = await getGrowthPath()
|
||||||
|
// 兼容两种响应格式:直接返回数据 或 { code, data } 格式
|
||||||
if (response.code === 200 && response.data) {
|
if (response.code === 200 && response.data) {
|
||||||
growthPathData.value = response.data
|
growthPathData.value = response.data
|
||||||
|
} else if (response.id && response.stages) {
|
||||||
|
// API 直接返回数据对象
|
||||||
|
growthPathData.value = response
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('加载成长路径失败:', error)
|
console.error('加载成长路径失败:', error)
|
||||||
|
|||||||
Reference in New Issue
Block a user