Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
middleLayer_for_debug
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
template admin
middleLayer_for_debug
Commits
da6369ab
Commit
da6369ab
authored
Apr 19, 2022
by
范雪寒
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 扫码
parent
c9af7628
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
505 additions
and
115 deletions
+505
-115
middleLayer_for_debug.fire
...ts/middleLayer_for_debug/scene/middleLayer_for_debug.fire
+480
-106
air.js
assets/middleLayer_for_debug/script/air.js
+19
-9
middleLayer.js
assets/middleLayer_for_debug/script/middleLayer.js
+6
-0
No files found.
assets/middleLayer_for_debug/scene/middleLayer_for_debug.fire
View file @
da6369ab
This diff is collapsed.
Click to expand it.
assets/middleLayer_for_debug/script/air.js
View file @
da6369ab
const
testMockData
=
{
"
eof
"
:
1
,
"
file
"
:
"
/storage/emulated/0/Android/data/com.example.oxford/cache/shengtong/gradeVoice.mp3
"
,
"
audioUrl
"
:
"
https://staging-teach.cdn.ireadabc.com/db48d49e122ba65aa7c5ee56963418a6.mp3
"
,
"
result
"
:{
"
duration
"
:
"
2.470
"
,
"
fluency
"
:
100
,
"
integrity
"
:
100
,
"
kernel_version
"
:
"
3.6.7
"
,
"
overall
"
:
99
,
"
pronunciation
"
:
99
,
"
resource_version
"
:
"
2.3.6
"
,
"
rhythm
"
:
0
,
"
speed
"
:
78
},
"
tokenId
"
:
"
621c32543327932cfc000002
"
};
const
recordMockData
=
{
"
text
"
:
"
what can i do for you
"
,
"
audioUrl
"
:
"
https://staging-teach.cdn.ireadabc.com/368ad56174f85e2ff1f39f12bac5c693.mp3
"
};
const
testMockData
=
{
"
eof
"
:
1
,
"
file
"
:
"
/storage/emulated/0/Android/data/com.example.oxford/cache/shengtong/gradeVoice.mp3
"
,
"
audioUrl
"
:
"
https://staging-teach.cdn.ireadabc.com/db48d49e122ba65aa7c5ee56963418a6.mp3
"
,
"
result
"
:
{
"
duration
"
:
"
2.470
"
,
"
fluency
"
:
100
,
"
integrity
"
:
100
,
"
kernel_version
"
:
"
3.6.7
"
,
"
overall
"
:
99
,
"
pronunciation
"
:
99
,
"
resource_version
"
:
"
2.3.6
"
,
"
rhythm
"
:
0
,
"
speed
"
:
78
},
"
tokenId
"
:
"
621c32543327932cfc000002
"
};
const
recordMockData
=
{
"
text
"
:
"
what can i do for you
"
,
"
audioUrl
"
:
"
https://staging-teach.cdn.ireadabc.com/368ad56174f85e2ff1f39f12bac5c693.mp3
"
};
export
function
initAir
(
_this
)
{
const
realAir
=
{
...
...
@@ -25,6 +25,7 @@ export function initAir(_this) {
osmoFingerReadCallback
:
function
(
res
)
{
_this
.
log
(
`***成功调用osmoFingerReadCallback***参数==
${
res
}
`
);
},
startScanCodeCallback
:
null
,
getEngineInfoCallback
:
null
,
recognitionCameraCallBack
:
null
,
testCallBack
:
null
,
...
...
@@ -38,7 +39,7 @@ export function initAir(_this) {
if
(
key
==
"
osmoCallback
"
||
key
==
"
osmoHandwritingCallback
"
||
key
==
"
osmoHandwritingMlkitCallback
"
||
key
==
"
osmoFingerReadCallback
"
)
{
newValue
=
function
(
res
)
{
_this
.
log
(
`||==成功调用
${
key
}
==||参数==
${
JSON
.
stringify
(
res
)}
`
);
if
(
typeof
(
res
)
==
'
string
'
)
{
if
(
typeof
(
res
)
==
'
string
'
)
{
value
(
res
);
}
else
{
value
(
JSON
.
stringify
(
res
));
...
...
@@ -119,7 +120,7 @@ export function initAir(_this) {
}
// 结束录音
window
.
air
.
recordCallBack
=
(
res
)
=>
{
res
=
typeof
(
res
)
==
'
string
'
?
res
:
JSON
.
stringify
(
res
);
res
=
typeof
(
res
)
==
'
string
'
?
res
:
JSON
.
stringify
(
res
);
_this
.
log
(
`===成功调用recordCallBack=== res ==
${
res
}
`
);
callback
&&
callback
(
res
);
window
.
air
.
recordCallBack
=
null
;
...
...
@@ -142,7 +143,7 @@ export function initAir(_this) {
}
// 结束录音
window
.
air
.
testCallBack
=
(
res
)
=>
{
res
=
typeof
(
res
)
==
'
string
'
?
res
:
JSON
.
stringify
(
res
);
res
=
typeof
(
res
)
==
'
string
'
?
res
:
JSON
.
stringify
(
res
);
_this
.
log
(
`===成功调用testCallBack=== res ==
${
res
}
`
);
callback
&&
callback
(
res
);
window
.
air
.
testCallBack
=
null
;
...
...
@@ -167,7 +168,7 @@ export function initAir(_this) {
_this
.
log
(
`===成功调用getEngineInfo===`
);
// 调用原生获取机器信息
window
.
air
.
getEngineInfoCallback
=
(
res
)
=>
{
if
(
typeof
(
res
)
==
'
string
'
)
{
if
(
typeof
(
res
)
==
'
string
'
)
{
window
.
air
.
engineInfo
=
res
;
callback
&&
callback
(
res
);
}
else
{
...
...
@@ -178,6 +179,15 @@ export function initAir(_this) {
};
window
.
courseware
.
callOcMethod
(
"
getEngineInfo
"
,
{});
},
startScanCode
(
callback
)
{
_this
.
log
(
`===成功调用startScanCode===`
);
// 调用原生开始扫码
window
.
air
.
startScanCodeCallback
=
(
res
)
=>
{
callback
&&
callback
(
res
);
window
.
air
.
startScanCodeCallback
=
null
;
};
window
.
courseware
.
callOcMethod
(
"
startScanCode
"
,
{});
},
openOsmo
(
params
=
{})
{
window
.
courseware
.
hasCalledOpenOsmo
=
true
;
_this
.
log
(
`===成功调用openOsmo===
${
JSON
.
stringify
(
params
)}
`
);
...
...
@@ -229,15 +239,15 @@ export function initAir(_this) {
console
.
log
(
'
汪汪汪
'
)
}
else
{
console
.
error
(
`非源生环境,网页版不支持
${
method
}
方法,将返回此方法的Mock数据以便于网页版调试使用`
);
if
(
method
==
'
getEngineInfo
'
)
{
window
.
air
.
getEngineInfoCallback
({
isDev
:
1
,
uuid
:
'
debug-xxxxxx-xxxxxx
'
});
if
(
method
==
'
getEngineInfo
'
)
{
window
.
air
.
getEngineInfoCallback
({
isDev
:
1
,
uuid
:
'
debug-xxxxxx-xxxxxx
'
});
}
else
if
(
method
==
'
startTest
'
)
{
}
else
if
(
method
==
'
stopTest
'
)
{
window
.
air
.
testCallBack
(
testMockData
);
}
else
if
(
method
==
'
startRecord
'
)
{
}
else
if
(
method
==
'
stopRecord
'
)
{
window
.
air
.
recordCallBack
(
recordMockData
);
}
else
{
}
else
{
console
.
error
(
`
${
method
}
方法还没有Mock数据,请联系技术支持人员添加`
);
}
}
...
...
assets/middleLayer_for_debug/script/middleLayer.js
View file @
da6369ab
...
...
@@ -541,6 +541,12 @@ cc.Class({
});
});
cc
.
find
(
'
middleLayer/ui/BtnScanCode
'
).
on
(
'
click
'
,
()
=>
{
window
.
courseware
.
startScanCode
((
res
)
=>
{
this
.
showLog
(
res
);
});
});
cc
.
find
(
'
middleLayer/ui/BtnOpenTest
'
).
on
(
'
click
'
,
()
=>
{
window
.
courseware
.
startTest
(
'
apple
'
);
});
...
...
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