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