71 lines
2.0 KiB
Plaintext
Raw Normal View History

2024-01-05 11:11:15 +08:00
import apiJudgeSdk from 'libJudgeSdk.so';
2024-07-02 11:10:33 +08:00
import Judge from '../../judgeSDK/utils/judge-real';
import { MarkRule, Project, ProjectObj } from '../../judgeSDK/api/judgeSDK.d';
2024-01-05 11:11:15 +08:00
import common from '@ohos.app.ability.common';
@Component
2024-07-02 11:10:33 +08:00
export default struct RealTime {
2024-01-05 11:11:15 +08:00
@State message: string = '开始绘制'
// 控制XComponent组件的创建和销毁
@State draw: boolean = false
//监管接口序列号
2024-07-02 11:10:33 +08:00
@State serialNumber: number = 0
2024-01-05 11:11:15 +08:00
//模拟考试项目
2024-07-02 11:10:33 +08:00
@State projects: Project[] = []
@State projectsObj: ProjectObj = {}
@State markRuleListObj: MarkRule = {}
private widthNumber: string | number | Resource = 0
private heightNumber: string | number | Resource = 0
2024-01-05 11:11:15 +08:00
private context = getContext(this) as common.UIAbilityContext;
2024-07-02 11:10:33 +08:00
constructor() {
super()
}
2024-01-05 11:11:15 +08:00
// xcomponentController: XComponentController = new XComponentController()
build() {
Row() {
Column() {
if (this.draw) {
XComponent({
id: 'duolun_plugin_id_draw', //显示轨迹窗口id名称注意这个ID要和C++侧一致,不能变
type: 'surface',
libraryname: 'JudgeSdk'
2024-02-23 16:08:37 +08:00
// libraryname: 'judgesdk'
2024-01-05 11:11:15 +08:00
})
2024-07-02 11:10:33 +08:00
.width(this.widthNumber)
.height(this.heightNumber)
2024-01-05 11:11:15 +08:00
.onLoad(() => {
apiJudgeSdk.examJudgeMapSetDrawing(true); //停止绘制地图轨迹false:表示结束绘制
})
.onDestroy(() => {
apiJudgeSdk.examJudgeMapSetDrawing(false); //停止绘制地图轨迹false:表示结束绘制
this.draw = false;
clearInterval(globalThis.realTimer)
})
} else {
2024-07-02 11:10:33 +08:00
Column() {
}
.width(this.widthNumber)
.height(this.heightNumber)
2024-01-05 11:11:15 +08:00
}
}
.width('100%')
.backgroundColor('#fff')
}
.height('100%')
}
async aboutToAppear() {
const judge = new Judge(this)
}
aboutToDisappear() {
//apiJudgeSdk.stopRender();
}
}