Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
addInsured-AIA-POC
Project
Project
Details
Activity
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liujianghai
addInsured-AIA-POC
Commits
cb5df2e7
Commit
cb5df2e7
authored
Mar 08, 2020
by
marsandheart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix issue 1,2
parent
5ddfb0f0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
11 deletions
+25
-11
DoubleRecord.jsx
src/pages/DoubleRecord.jsx
+25
-11
No files found.
src/pages/DoubleRecord.jsx
View file @
cb5df2e7
...
@@ -385,13 +385,16 @@ export default function(props) {
...
@@ -385,13 +385,16 @@ export default function(props) {
const
playQuestion
=
(
questionId
)
=>
{
const
playQuestion
=
(
questionId
)
=>
{
console
.
log
(
'407'
);
console
.
log
(
'407'
);
const
targetQuestion
=
currentStep
.
questions
.
find
((
q
)
=>
q
.
questionId
===
questionId
);
const
targetQuestion
=
currentStep
.
questions
.
find
((
q
)
=>
q
.
questionId
===
questionId
);
if
(
!
targetQuestion
||
targetQuestion
.
playStatus
===
'3'
)
{
if
(
!
targetQuestion
||
targetQuestion
.
playStatus
===
'3'
||
targetQuestion
.
playStatus
===
'2'
)
{
// 找不到问题,已经读完的,已经暂停的问题 不操作
return
;
return
;
}
else
if
(
!
targetQuestion
.
needPlay
)
{
}
else
if
(
!
targetQuestion
.
needPlay
)
{
// 不需要读的问题,直接置为已读完
setPlayStatus
(
questionId
,
'3'
);
setPlayStatus
(
questionId
,
'3'
);
}
else
if
(
targetQuestion
.
playStatus
!==
'2'
){
}
else
{
// 还未开始的问题状态为0的,置为1 开始读
setPlayStatus
(
questionId
,
'1'
);
setPlayStatus
(
questionId
,
'1'
);
voiceStart
(
targetQuestion
.
voice
);
voiceStart
(
targetQuestion
);
}
}
};
};
...
@@ -474,8 +477,8 @@ export default function(props) {
...
@@ -474,8 +477,8 @@ export default function(props) {
if
(
targetQuestion
.
needCheck
)
{
if
(
targetQuestion
.
needCheck
)
{
// stop and wait check
// stop and wait check
setPlayStatus
(
questionId
,
'3'
);
// console.log('need you check');
// console.log('need you check');
setPlayStatus
(
questionId
,
'3'
);
return
;
return
;
}
else
{
}
else
{
setPlayStatusAndChecked
(
questionId
,
'3'
,
true
);
setPlayStatusAndChecked
(
questionId
,
'3'
,
true
);
...
@@ -526,9 +529,9 @@ export default function(props) {
...
@@ -526,9 +529,9 @@ export default function(props) {
};
};
// 调用app的语音播报,监听语音结束,在刚进入页面时自动调用一次,每一个问题结束后判断是否自动调用
// 调用app的语音播报,监听语音结束,在刚进入页面时自动调用一次,每一个问题结束后判断是否自动调用
const
voiceStart
=
(
voiceContent
)
=>
{
const
voiceStart
=
(
targetQuestion
)
=>
{
setIsPlaying
(
'Y'
);
setIsPlaying
(
'Y'
);
console
.
log
(
`播放:
${
voiceContent
}
`
);
console
.
log
(
`播放:
${
targetQuestion
.
voice
}
`
);
// setTimeout(() => {
// setTimeout(() => {
// console.log('finish one voice');
// console.log('finish one voice');
...
@@ -539,11 +542,18 @@ export default function(props) {
...
@@ -539,11 +542,18 @@ export default function(props) {
alert
(
'window.webkit 未定义'
);
alert
(
'window.webkit 未定义'
);
return
;
return
;
}
}
window
.
webkit
.
messageHandlers
.
aiaVoiceBroadCastContent
.
postMessage
({
content
:
voiceContent
});
window
.
webkit
.
messageHandlers
.
aiaVoiceBroadCastContent
.
postMessage
({
content
:
targetQuestion
.
voice
});
window
.
aiaVoiceFinish
=
()
=>
{
window
.
aiaVoiceFinish
=
()
=>
{
console
.
log
(
'finish one step'
);
console
.
log
(
'finish one step'
);
setIsPlaying
(
'N'
);
// 如果当前问题需要手动勾选,则将isPlaying置为 N ,如果不需要手动勾选,则马上要读下一个问题,故不改变isPlaying
if
(
targetQuestion
.
needCheck
)
{
setIsPlaying
(
'N'
);
}
finishOneVoice
();
finishOneVoice
();
};
};
};
};
...
@@ -642,8 +652,13 @@ export default function(props) {
...
@@ -642,8 +652,13 @@ export default function(props) {
const
currentStepIdx
=
steps
.
findIndex
((
s
)
=>
s
.
id
===
stepId
);
const
currentStepIdx
=
steps
.
findIndex
((
s
)
=>
s
.
id
===
stepId
);
const
lastStepId
=
steps
[
currentStepIdx
-
1
].
id
;
const
lastStepId
=
steps
[
currentStepIdx
-
1
].
id
;
voicePause
();
const
currentQuestion
=
currentStep
.
questions
.
find
((
q
)
=>
q
.
questionId
===
questionId
);
setPlayStatus
(
questionId
,
'2'
);
if
(
currentQuestion
.
playStatus
===
'1'
)
{
// 1 正在读的-暂停; 2 已暂停的-不操作;3 已读完的-不操作
voicePause
();
setPlayStatus
(
questionId
,
'2'
);
}
setStepId
(
lastStepId
);
setStepId
(
lastStepId
);
setQuestionId
(
findLastUnreadQuestion
(
lastStepId
));
setQuestionId
(
findLastUnreadQuestion
(
lastStepId
));
}
}
...
@@ -715,7 +730,6 @@ export default function(props) {
...
@@ -715,7 +730,6 @@ export default function(props) {
question=
{
q
}
question=
{
q
}
setPlayStatus=
{
setPlayStatus
}
setPlayStatus=
{
setPlayStatus
}
setChecked=
{
setCheckThenNextQuestion
}
setChecked=
{
setCheckThenNextQuestion
}
voiceStart=
{
voiceStart
}
voicePause=
{
voicePause
}
voicePause=
{
voicePause
}
voiceContinue=
{
voiceContinue
}
voiceContinue=
{
voiceContinue
}
/>
/>
...
...
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