Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
飞
飞鹤小程序
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
FH
飞鹤小程序
Commits
eb2a5dea
Commit
eb2a5dea
authored
Oct 27, 2025
by
spc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed
parent
d9e87981
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
54 deletions
+48
-54
CanEatAnswerPopup.vue
components/CanEatAnswerPopup.vue
+33
-15
payResultPage.vue
v3/payResultPage/payResultPage.vue
+11
-11
Home.vue
views/Home.vue
+4
-28
No files found.
components/CanEatAnswerPopup.vue
View file @
eb2a5dea
...
...
@@ -93,27 +93,45 @@ export default {
computed
:
{
// 根据fallResult或allResult字符串生成显示用的选项分布数据
displayOptionDistribution
()
{
// 优先使用fallResult(后端返回的实际数据)
if
(
this
.
fallResult
&&
this
.
fallResult
.
trim
()
!==
''
&&
this
.
fallResult
.
includes
(
'|'
))
{
const
percentages
=
this
.
fallResult
.
split
(
'|'
);
const
labels
=
[
'能吃'
,
'少吃'
,
'慎吃'
,
'禁吃'
];
return
percentages
.
map
((
percent
,
index
)
=>
({
label
:
labels
[
index
]
||
''
,
percentage
:
`
${
percent
}
%`
}));
const
labels
=
[
'能吃'
,
'少吃'
,
'慎吃'
,
'禁吃'
];
// 确保所有数据都被正确记录
console
.
log
(
'AllResult数据:'
,
this
.
allResult
,
'类型:'
,
typeof
this
.
allResult
);
console
.
log
(
'FallResult数据:'
,
this
.
fallResult
,
'类型:'
,
typeof
this
.
fallResult
);
// 首先检查fallResult
if
(
this
.
fallResult
&&
this
.
fallResult
!==
null
&&
this
.
fallResult
.
trim
()
!==
''
&&
this
.
fallResult
.
includes
(
'|'
))
{
try
{
const
percentages
=
this
.
fallResult
.
split
(
'|'
);
console
.
log
(
'使用fallResult生成分布:'
,
percentages
);
return
percentages
.
map
((
percent
,
index
)
=>
({
label
:
labels
[
index
]
||
''
,
percentage
:
`
${
percent
}
%`
}));
}
catch
(
error
)
{
console
.
error
(
'处理fallResult时出错:'
,
error
);
}
}
// 如果没有fallResult,再使用allResult
else
if
(
this
.
allResult
&&
this
.
allResult
.
trim
()
!==
''
&&
this
.
allResult
.
includes
(
'|'
))
{
const
percentages
=
this
.
allResult
.
split
(
'|'
);
const
labels
=
[
'能吃'
,
'少吃'
,
'慎吃'
,
'禁吃'
];
// 然后检查allResult,使用更宽松的判断条件
if
(
this
.
allResult
&&
this
.
allResult
!==
null
&&
typeof
this
.
allResult
===
'string'
)
{
// 即使不包含|符号,也尝试处理
let
percentages
;
if
(
this
.
allResult
.
includes
(
'|'
))
{
percentages
=
this
.
allResult
.
split
(
'|'
);
}
else
{
// 尝试作为单个百分比处理
percentages
=
[
this
.
allResult
,
'0'
,
'0'
,
'0'
];
}
console
.
log
(
'使用allResult生成分布:'
,
percentages
);
return
percentages
.
map
((
percent
,
index
)
=>
({
label
:
labels
[
index
]
||
''
,
percentage
:
`
${
percent
}
%`
}));
}
// 否则使用传入的optionDistribution
// 最后使用默认的optionDistribution
console
.
log
(
'使用默认optionDistribution'
);
return
this
.
optionDistribution
;
}
},
...
...
v3/payResultPage/payResultPage.vue
View file @
eb2a5dea
...
...
@@ -224,17 +224,17 @@ export default {
// 处理活动banner点击
handleVipActiveClick
(
index
,
item
)
{
console
.
log
(
'活动banner点击:'
,
item
);
if
(
item
?.
linkType
===
'h5'
)
{
jump
({
type
:
JumpType
.
H5
,
url
:
item
?.
linkUrl
||
''
})
;
}
else
if
(
item
?.
linkType
===
'page'
)
{
jump
({
type
:
JumpType
.
PAGE
,
url
:
item
?.
linkUrl
||
''
});
}
// 只保留跳转功能,从item.link获取跳转参数
const
url
=
item
?.
link
?.
url
||
item
?.
linkUrl
||
''
;
const
type
=
item
?.
link
?.
type
||
(
item
?.
linkType
===
'h5'
?
JumpType
.
H5
:
JumpType
.
PAGE
);
const
extra
=
item
?.
link
?.
extra
;
jump
({
type
:
type
,
url
:
url
,
extra
:
extra
}
)
}
}
}
...
...
views/Home.vue
View file @
eb2a5dea
...
...
@@ -364,7 +364,7 @@
<!-- 答案解析弹窗 -->
<CanEatAnswerPopup
:visible=
"showAnswerPopup"
:isCorrect=
"isAnswerCorrect"
:rewardInfo=
"rewardInfo"
:question=
"currentQuestion"
:correctAnswer=
"correctAnswer"
:analysis=
"answerAnalysis"
:optionDistribution=
"optionDistribution"
:allResult=
"canEatData?.allResult"
:optionDistribution=
"optionDistribution"
:allResult=
"canEatData?.a
nalysis?.a
llResult"
@
close=
"showAnswerPopup = false"
/>
<!-- 金币动画模块 -->
...
...
@@ -467,12 +467,7 @@ export default {
currentQuestion
:
''
,
correctAnswer
:
''
,
answerAnalysis
:
''
,
optionDistribution
:
[
{
label
:
'能吃'
,
percentage
:
'25%'
,
color
:
'#B27C1E'
},
{
label
:
'少吃'
,
percentage
:
'25%'
,
color
:
'#B27C1E'
},
{
label
:
'慎吃'
,
percentage
:
'25%'
,
color
:
'#B27C1E'
},
{
label
:
'禁吃'
,
percentage
:
'25%'
,
color
:
'#B27C1E'
}
],
// 悬浮图片相关配置
floatIcon
:
{
// imageUrl: 'homepage/btnclose.png',
...
...
@@ -1225,7 +1220,7 @@ export default {
this
.
isAnswerCorrect
=
isCorrect
;
this
.
currentQuestion
=
this
.
canEatData
.
title
||
''
;
// 确保正确答案是文案而不是索引
this
.
correctAnswer
=
typeof
correctAnswer
===
'number'
?
this
.
correctAnswer
=
typeof
correctAnswer
===
'number'
?
[
'能吃'
,
'少吃'
,
'慎吃'
,
'禁吃'
][
correctAnswer
]
:
correctAnswer
;
// 设置奖励信息
...
...
@@ -1250,25 +1245,6 @@ export default {
this
.
rewardInfo
=
''
;
}
// 设置选项分布数据
if
(
responseData
.
allResult
&&
responseData
.
allResult
.
trim
()
!==
''
)
{
const
percentages
=
responseData
.
allResult
.
split
(
'|'
);
const
labels
=
[
'能吃'
,
'少吃'
,
'慎吃'
,
'禁吃'
];
this
.
optionDistribution
=
percentages
.
map
((
percent
,
index
)
=>
({
label
:
labels
[
index
]
||
''
,
percentage
:
`
${
percent
}
%`
,
color
:
'#B27C1E'
}));
}
else
{
// 如果allResult为空,使用默认的25%分布
this
.
optionDistribution
=
[
{
label
:
'能吃'
,
percentage
:
'25%'
,
color
:
'#B27C1E'
},
{
label
:
'少吃'
,
percentage
:
'25%'
,
color
:
'#B27C1E'
},
{
label
:
'慎吃'
,
percentage
:
'25%'
,
color
:
'#B27C1E'
},
{
label
:
'禁吃'
,
percentage
:
'25%'
,
color
:
'#B27C1E'
}
];
}
// 设置解析内容
this
.
answerAnalysis
=
responseData
.
analysis
||
'暂无解析内容'
;
...
...
@@ -1289,7 +1265,7 @@ export default {
// 显示解析弹窗
this
.
showAnswerResult
({
analysis
:
this
.
canEatData
.
analysis
?.
content
||
'暂无解析内容'
,
allResult
:
this
.
canEatData
.
analysis
?.
allResult
||
'
25|25|25|25
'
,
allResult
:
this
.
canEatData
.
analysis
?.
allResult
||
''
,
reward
:
this
.
canEatData
.
reward
||
null
},
isCorrect
,
this
.
canEatData
.
myAnswer
,
correctAnswerText
);
}
else
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment