Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
middleLayer_for_JJ_F
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_JJ_F
Commits
259b69f1
Commit
259b69f1
authored
Apr 01, 2024
by
limingzhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: debug
parent
9b2cbfec
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
144 deletions
+4
-144
air.js
assets/middleLayer_for_JJ_F/script/air.js
+4
-144
No files found.
assets/middleLayer_for_JJ_F/script/air.js
View file @
259b69f1
...
...
@@ -13,12 +13,6 @@ export function initAir(_this) {
_this
.
log
(
"
***成功调用onCourseInScreen***
"
);
});
},
recordRealtimeCallBack
:
function
(
res
)
{
_this
.
log
(
`***成功调用recordRealtimeCallBack***参数==
${
res
}
`
);
},
recordWordSpellCallBack
:
function
(
res
)
{
_this
.
log
(
`***成功调用recordWordSpellCallBack***参数==
${
res
}
`
);
},
osmoCallback
:
function
(
res
)
{
_this
.
log
(
`***成功调用osmoCallback***参数==
${
res
}
`
);
},
...
...
@@ -37,14 +31,11 @@ export function initAir(_this) {
startScanCodeCallback
:
null
,
needUpdateCallback
:
null
,
getEngineInfoCallback
:
null
,
logFileUploadCallback
:
null
,
takePictureCallBack
:
null
,
configurationPortraitCallback
:
null
,
configurationLandscapeCallback
:
null
,
startBuyToAppStoreCallBack
:
null
,
recognitionCameraCallBack
:
null
,
testCallBack
:
null
,
testConvertCallBack
:
null
,
recordCallBack
:
null
,
onCourseInScreen
:
null
,
};
...
...
@@ -52,7 +43,7 @@ export function initAir(_this) {
window
.
air
=
new
Proxy
(
realAir
,
{
set
:
function
(
target
,
key
,
value
,
receiver
)
{
let
newValue
=
value
;
if
(
key
==
"
recordWordSpellCallBack
"
||
key
==
"
recordRealtimeCallBack
"
||
key
==
"
osmoCallback
"
||
key
==
"
osmoHandwritingCallback
"
||
key
==
"
osmoHandwritingMlkitCallback
"
||
key
==
"
osmoFingerReadCallback
"
)
{
if
(
key
==
"
osmoCallback
"
||
key
==
"
osmoHandwritingCallback
"
||
key
==
"
osmoHandwritingMlkitCallback
"
||
key
==
"
osmoFingerReadCallback
"
)
{
newValue
=
function
(
res
)
{
_this
.
log
(
`||==成功调用
${
key
}
==||参数==
${
JSON
.
stringify
(
res
)}
`
);
if
(
typeof
(
res
)
==
'
string
'
)
{
...
...
@@ -161,98 +152,16 @@ export function initAir(_this) {
window
.
air
.
testCallBack
=
(
res
)
=>
{
res
=
typeof
(
res
)
==
'
string
'
?
res
:
JSON
.
stringify
(
res
);
_this
.
log
(
`===成功调用testCallBack=== res ==
${
res
}
`
);
// 录音异常兼容处理
const
resObj
=
JSON
.
parse
(
res
);
if
(
resObj
.
errCode
)
{
resObj
.
result
=
{
overall
:
0
};
resObj
.
audioUrl
=
""
;
res
=
JSON
.
stringify
(
resObj
);
_this
.
showTips
(
`评测服务信号弱,可能会造成评分不准确,请稍后再来录音评测吧~`
);
}
callback
&&
callback
(
res
);
window
.
air
.
testCallBack
=
null
;
};
window
.
courseware
.
callOcMethod
(
"
stopTest
"
,
{});
},
startTestConvert
(
testText
,
option
)
{
window
.
courseware
.
hasCalledStartTestConvert
=
true
;
_this
.
log
(
`===成功调用startTestConvert=== testText ==
${
testText
}
`
);
window
.
courseware
.
callOcMethod
(
"
startTestConvert
"
,
{
...
option
,
"
params
"
:
testText
});
},
stopTestConvert
(
testCallback
,
convertCallback
)
{
window
.
courseware
.
hasCalledStartTestConvert
=
false
;
_this
.
log
(
`===成功调用stopTestConvert===`
);
if
(
!
testCallback
)
{
// 不传回调函数就表示取消评测
_this
.
log
(
`===成功取消录音评测===`
);
window
.
courseware
.
callOcMethod
(
"
stopTestConvert
"
,
{
isBreak
:
1
});
return
;
}
// 结束录音
window
.
air
.
testCallBack
=
(
res
)
=>
{
res
=
typeof
(
res
)
==
'
string
'
?
res
:
JSON
.
stringify
(
res
);
_this
.
log
(
`===成功调用testCallBack=== res ==
${
res
}
`
);
// 录音异常兼容处理
const
resObj
=
JSON
.
parse
(
res
);
if
(
resObj
.
errCode
)
{
resObj
.
result
=
{
overall
:
0
};
resObj
.
audioUrl
=
""
;
res
=
JSON
.
stringify
(
resObj
);
_this
.
showTips
(
`评测服务信号弱,可能会造成评分不准确,请稍后再来录音评测吧~`
);
}
testCallback
&&
testCallback
(
res
);
window
.
air
.
testCallBack
=
null
;
};
// 结束变声
window
.
air
.
testConvertCallBack
=
(
res
)
=>
{
res
=
typeof
(
res
)
==
'
string
'
?
res
:
JSON
.
stringify
(
res
);
_this
.
log
(
`===成功调用testConvertCallBack=== res ==
${
res
}
`
);
// 录音异常兼容处理
const
resObj
=
JSON
.
parse
(
res
);
if
(
resObj
.
errCode
)
{
resObj
.
convertUrl
=
""
;
res
=
JSON
.
stringify
(
resObj
);
_this
.
showTips
(
`变声失败,请稍后再来尝试吧~`
);
}
convertCallback
&&
convertCallback
(
res
);
window
.
air
.
testConvertCallBack
=
null
;
};
window
.
courseware
.
callOcMethod
(
"
stopTestConvert
"
,
{});
},
startRealtimeRecord
(
params
=
{})
{
window
.
courseware
.
hasCalledRealtimeRecord
=
true
;
_this
.
log
(
`===成功调用startRealtimeRecord===
${
JSON
.
stringify
(
params
)}
`
);
window
.
courseware
.
callOcMethod
(
"
startRealtimeRecord
"
,
params
);
},
stopRealtimeRecord
(
params
=
{})
{
window
.
courseware
.
hasCalledRealtimeRecord
=
false
;
_this
.
log
(
`===成功调用stopRealtimeRecord===`
);
window
.
courseware
.
callOcMethod
(
"
stopRealtimeRecord
"
,
params
);
},
startWordSpell
(
params
=
{})
{
window
.
courseware
.
hasWordSpelling
=
true
;
_this
.
log
(
`===成功调用startWordSpell===
${
JSON
.
stringify
(
params
)}
`
);
window
.
courseware
.
callOcMethod
(
"
startWordSpell
"
,
params
);
},
stopWordSpell
(
params
=
{})
{
window
.
courseware
.
hasWordSpelling
=
false
;
_this
.
log
(
`===成功调用stopWordSpell===`
);
window
.
courseware
.
callOcMethod
(
"
stopWordSpell
"
,
params
);
},
// 拍照
takePicture
(
callback
)
{
_this
.
log
(
`===成功调用takePicture===`
);
window
.
air
.
takePictureCallBack
=
(
res
)
=>
{
if
(
typeof
(
res
)
==
'
string
'
)
{
callback
&&
callback
(
res
);
}
else
{
callback
&&
callback
(
JSON
.
stringify
(
res
));
}
callback
&&
callback
(
JSON
.
stringify
(
res
));
window
.
air
.
takePictureCallBack
=
null
;
};
window
.
courseware
.
callOcMethod
(
"
takePicture
"
,
{});
...
...
@@ -287,23 +196,6 @@ export function initAir(_this) {
};
window
.
courseware
.
callOcMethod
(
"
getEngineInfo
"
,
{});
},
logUpload
(
callback
)
{
_this
.
log
(
`===成功调用logUpload===`
);
// 调用原生获取机器信息
window
.
air
.
logFileUploadCallback
=
(
res
)
=>
{
if
(
typeof
(
res
)
==
'
string
'
)
{
callback
&&
callback
(
res
);
}
else
{
callback
&&
callback
(
JSON
.
stringify
(
res
));
}
window
.
air
.
logFileUploadCallback
=
null
;
};
window
.
courseware
.
callOcMethod
(
"
logUpload
"
,
{});
},
behaviorToCollectWithParam
(
event
,
type
=
""
)
{
// 埋点所需接口 levelPayForSuccess userRegistrationEvent
window
.
courseware
.
callOcMethod
(
"
behaviorToCollectWithParam
"
,
{
event
,
type
});
},
exitApp
()
{
_this
.
log
(
`===成功调用exitApp===`
);
window
.
courseware
.
callOcMethod
(
"
exitApp
"
,
{});
...
...
@@ -374,17 +266,6 @@ export function initAir(_this) {
_this
.
log
(
`===成功调用closeOsmoFingerRead===`
);
window
.
courseware
.
callOcMethod
(
"
closeOsmoFingerRead
"
,
{});
},
modifyVideoSpeed
(
params
=
{},
callback
)
{
_this
.
log
(
`===成功调用modifyVideoSpeed===`
);
window
.
air
.
modifyVideoSpeedCallback
=
(
res
)
=>
{
_this
.
log
(
`===modifyVideoSpeedCallback=== res ==
${
res
}
`
);
callback
&&
callback
(
res
);
window
.
air
.
modifyVideoSpeedCallback
=
null
;
};
window
.
courseware
.
callOcMethod
(
"
modifyVideoSpeed
"
,
params
);
},
onConfigurationPortrait
(
params
=
{},
callback
)
{
_this
.
log
(
`===成功调用onConfigurationPortrait||竖屏===`
);
window
.
air
.
configurationPortraitCallback
=
(
res
)
=>
{
...
...
@@ -401,19 +282,11 @@ export function initAir(_this) {
};
window
.
courseware
.
callOcMethod
(
"
onConfigurationLandscape
"
,
params
);
},
startBuyToAppStore
(
params
=
{},
callback
)
{
// 苹果支付
_this
.
log
(
`===成功调用startBuyToAppStore===`
);
window
.
air
.
startBuyToAppStoreCallBack
=
(
res
)
=>
{
callback
&&
callback
(
res
);
};
window
.
courseware
.
callOcMethod
(
"
startBuyToAppStore
"
,
params
);
},
callOcMethod
(
method
,
param
)
{
const
paramStr
=
JSON
.
stringify
(
param
);
_this
.
log
(
`===成功调用原生方法
${
method
}
===参数==
${
paramStr
}
`
);
if
(
cc
.
sys
.
isNative
&&
cc
.
sys
.
os
==
cc
.
sys
.
OS_IOS
)
{
return
jsb
.
reflection
.
callStaticMethod
(
'
RootViewController
'
,
`
${
method
}
:`
,
paramStr
);
return
jsb
.
reflection
.
callStaticMethod
(
'
CocosMng
'
,
`
${
method
}
:`
,
paramStr
);
}
else
if
(
cc
.
sys
.
isNative
&&
cc
.
sys
.
os
==
cc
.
sys
.
OS_ANDROID
)
{
return
jsb
.
reflection
.
callStaticMethod
(
'
com/iplayabc/cocos/AppActivity
'
,
method
,
'
(Ljava/lang/String;)Ljava/lang/String;
'
,
paramStr
);
}
else
if
(
cc
.
sys
.
isNative
&&
cc
.
sys
.
os
==
cc
.
sys
.
OS_WINDOWS
)
{
...
...
@@ -421,17 +294,13 @@ export function initAir(_this) {
}
else
{
console
.
error
(
`非源生环境,网页版不支持
${
method
}
方法,将返回此方法的Mock数据以便于网页版调试使用`
);
if
(
method
==
'
getEngineInfo
'
){
window
.
air
.
getEngineInfoCallback
({
isDev
:
1
,
uuid
:
'
debug-xxxxxx-xxxxxx
'
,
version
:
'
1.0.2
'
});
}
else
if
(
method
==
'
logUpload
'
){
window
.
air
.
logFileUploadCallback
({
"
fileUrl
"
:
"
abcedfgh
"
,
"
error
"
:
""
});
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
if
(
method
==
'
startBuyToAppStore
'
)
{
window
.
air
.
startBuyToAppStoreCallBack
({
productid
:
1
,
puid
:
22
,
receiptData
:
"
HelloWorld
"
,
error
:
""
});
}
else
{
console
.
error
(
`
${
method
}
方法还没有Mock数据,请联系技术支持人员添加`
);
}
...
...
@@ -444,15 +313,6 @@ export function initAir(_this) {
if
(
window
.
courseware
.
hasCalledStartTest
)
{
window
.
courseware
.
stopTest
();
}
if
(
window
.
courseware
.
hasCalledStartTestConvert
)
{
window
.
courseware
.
stopTestConvert
();
}
if
(
window
.
courseware
.
hasCalledRealtimeRecord
)
{
window
.
courseware
.
stopRealtimeRecord
();
}
if
(
window
.
courseware
.
hasWordSpelling
)
{
window
.
courseware
.
stopWordSpell
();
}
if
(
window
.
courseware
.
hasCalledOpenRecognitionCamera
)
{
window
.
courseware
.
closeRecognitionCamera
();
}
...
...
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