110 lines
4.1 KiB
TypeScript
Raw Normal View History

2024-01-05 11:11:15 +08:00
import UIAbility from '@ohos.app.ability.UIAbility';
import hilog from '@ohos.hilog';
import window from '@ohos.window';
import relationalStore from '@ohos.data.relationalStore'
import abilityAccessCtrl, { Permissions } from '@ohos.abilityAccessCtrl';
// import featureAbility from '@ohos.ability.featureAbility'
import { makedir } from '../common/service/fileService'
import {Array2Byte} from '../common/utils/tools'
export default class EntryAbility extends UIAbility {
onCreate(want, launchParam) {
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
}
onDestroy() {
const arrClose = [0x55, 0xaa, 0x01, 0x00, 0x02, 0x00, 0x03, 0x00]
const arrCloseBuffer= Array2Byte(arrClose).buffer
globalThis?.lightLineUdp?.send(arrCloseBuffer);
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy');
}
async onWindowStageCreate(windowStage: window.WindowStage) {
// this.context
// Main window is created, set main page for this ability
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
globalThis.carInfo = {}
globalThis.examinerInfo = {}
globalThis.deviceNo = '';
globalThis.hasAuth = false
2024-09-05 08:59:37 +08:00
// globalThis.version = '2022.08.13.01'//洛阳
// globalThis.judgeVersion = '2022.12.05.1'
2024-09-13 11:17:58 +08:00
// globalThis.version = '2022.06.29.01'//洛阳科目二
// globalThis.judgeVersion = '2022.12.18.1'
2024-09-19 18:46:35 +08:00
/***************** 黑龙江科目二 ******************/
// globalThis.version = '2024.03.19.01'
// globalThis.judgeVersion = '2024.01.05.1'
/***************** 黑龙江科目三 ******************/
// globalThis.version = '2023.09.23.01'
// globalThis.judgeVersion = '2023.07.10.1'
/***************** 杭州科目二 ******************/
2024-09-27 09:50:29 +08:00
globalThis.version = '2022 03 14 01'
globalThis.judgeVersion = '2022 03 17 1'
2024-09-19 18:46:35 +08:00
2024-09-27 09:50:29 +08:00
/****************** 济南科目三 *****************/
// globalThis.version = '2023.12.13.01'//济南科目三
2024-06-27 20:53:36 +08:00
// globalThis.judgeVersion = '2023.09.30.1'
2024-09-19 18:46:35 +08:00
globalThis.videoVersion= '1.0'
2024-06-27 20:53:36 +08:00
// globalThis.videoVersion= '1.0'
2024-01-31 14:42:14 +08:00
// globalThis.version = '2022.03.14.01'
2024-09-19 18:46:35 +08:00
//视频遮挡
2024-06-04 14:18:44 +08:00
globalThis.spzd={
spzd1:false,
spzd2:false,
spzd3:false,
spzd4:false,
}
globalThis.signNum=0//心跳指令编号
globalThis.lsh='0000000000000'//学员流水号
2024-06-27 20:53:36 +08:00
globalThis.ratio= 1700 / 960 //适配比例
2024-06-04 14:18:44 +08:00
globalThis.statue=1//考试状态
2024-01-05 11:11:15 +08:00
globalThis.pathDir = this.context.filesDir;
2024-06-27 20:53:36 +08:00
globalThis.context = this.context;
globalThis.isJudgeInitBool=false
2024-01-05 11:11:15 +08:00
console.info('jiangsong globalThis.pathDir = ' + globalThis.pathDir);
// this.requestPermission(this.context)
// this.featureAbilityAuth()
const windowClass = await windowStage.getMainWindow();
globalThis.windowClass = windowClass
2024-09-13 11:17:58 +08:00
await windowClass.setWindowLayoutFullScreen(true)
2024-09-05 08:56:01 +08:00
// await windowClass.setWindowSystemBarEnable([]) //全屏
2024-07-31 13:47:40 +08:00
// await windowClass.setWindowSystemBarEnable(['navigation'])
2024-01-05 11:11:15 +08:00
windowStage.loadContent('pages/Index', (err, data) => {
if (err.code) {
hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
return;
}
hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? '');
});
this.creatFiles();
}
onWindowStageDestroy() {
// Main window is destroyed, release UI related resources
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');
}
onForeground() {
// Ability has brought to foreground
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground');
}
onBackground() {
// Ability has back to background
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground');
}
creatFiles() {
makedir('/testFile');
}
2024-09-27 09:50:29 +08:00
}