Commit 19e7ac6e authored by liujiangnan's avatar liujiangnan

feat: 添加其他原生方法

parent 1ef49150
...@@ -19,6 +19,9 @@ export function initAir(_this) { ...@@ -19,6 +19,9 @@ export function initAir(_this) {
_this.log(`***成功调用osmoFingerReadCallback***参数==${res}`); _this.log(`***成功调用osmoFingerReadCallback***参数==${res}`);
}, },
getEngineInfoCallback: null, getEngineInfoCallback: null,
recognitionCameraCallBack: null,
testCallBack: null,
recordCallBack: null,
onCourseInScreen: null, onCourseInScreen: null,
} }
window.courseware = { window.courseware = {
...@@ -64,21 +67,55 @@ export function initAir(_this) { ...@@ -64,21 +67,55 @@ export function initAir(_this) {
}, },
startRecord(testText) { startRecord(testText) {
_this.log(`===成功调用startRecord=== testText == ${testText}`); _this.log(`===成功调用startRecord=== testText == ${testText}`);
this.callOcMethod("startRecord", {"params": testText});
}, },
stopRecord(_isgradepapers, _callback) { stopRecord(_isgradepapers, _callback) {
_this.log(`===成功调用stopRecord=== _isgradepapers == ${_isgradepapers}`); _this.log(`===成功调用stopRecord=== _isgradepapers == ${_isgradepapers}`);
_callback && _callback(null); let callback = _callback;
let isgradepapers;
if(_isgradepapers && typeof _isgradepapers === "function") {
callback = _isgradepapers;
isgradepapers = 1;
} else {
isgradepapers = _isgradepapers;
}
if(!callback){
// 不传回调函数就表示取消评测
this.callOcMethod("stopRecord", {isBreak: 1});
return;
}
// 结束录音
window.air.recordCallBack = (res) => {
callback && callback(res);
window.air.recordCallBack = null;
};
this.callOcMethod("stopRecord", {isBreak: 0, isGradePapers: isgradepapers});
}, },
startTest(testText) { startTest(testText) {
_this.log(`===成功调用startTest=== testText == ${testText}`); _this.log(`===成功调用startTest=== testText == ${testText}`);
this.callOcMethod("startTest", {"params": testText});
}, },
stopTest(callback) { stopTest(callback) {
_this.log(`===成功调用stopTest===`); _this.log(`===成功调用stopTest===`);
callback && callback(null); if(!callback){
// 不传回调函数就表示取消评测
this.callOcMethod("stopTest", {isBreak: 1});
return;
}
// 结束录音
window.air.testCallBack = (res) => {
callback && callback(res);
window.air.testCallBack = null;
};
this.callOcMethod("stopTest", {});
}, },
openRecognitionCamera(callback) { openRecognitionCamera(callback) {
_this.log(`===成功调用openRecognitionCamera===`); _this.log(`===成功调用openRecognitionCamera===`);
callback && callback(null); window.air.recognitionCameraCallBack = (res) => {
callback && callback(res);
window.air.recognitionCameraCallBack = null;
};
this.callOcMethod("openRecognitionCamera", {});
}, },
getEngineInfo(callback) { getEngineInfo(callback) {
_this.log(`===成功调用getEngineInfo===`); _this.log(`===成功调用getEngineInfo===`);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment