fix: 修改调试模式重启app问题

This commit is contained in:
wangzhongjie 2025-08-22 10:11:02 +08:00
parent e6a75028c5
commit d64d951f1e
3 changed files with 25 additions and 6 deletions

View File

@ -169,6 +169,8 @@ export interface EnvironmentConfigurationType {
version?: string
// 评判版本
judgeVersion?: string
// 是否使用网络摄像头
isUseNetworkCamera?: string
}
//全局配置

View File

@ -7,14 +7,15 @@ import ethernet from '@ohos.net.ethernet';
import { BusinessError } from '@ohos.base';
import Prompt from '@system.prompt';
import { dConsole } from '../utils/LogWorker';
import window from '@ohos.window';
@Entry
@Component
struct TerminalInfoPage {
@State config: EnvironmentConfigurationType = {}
@State isProcessing: boolean = false;
private fileUtil!: FileUtils
private context = getContext(this) as common.UIAbilityContext;
@State isProcessing: boolean = false;
async aboutToAppear() {
this.fileUtil = new FileUtils(this.context)
@ -186,6 +187,14 @@ struct TerminalInfoPage {
this.config.isOpenFiniteDifference = value;
}
})
blockComponent({
label: "开启网络摄像头",
type: 7,
value: this.config.isUseNetworkCamera,
change: (value: string) => {
this.config.isUseNetworkCamera = value;
}
})
blockComponent({
label: "是否开启日志",
type: 2,
@ -203,15 +212,20 @@ struct TerminalInfoPage {
}
})
blockComponent({
label: "开启调试(重启APP)",
label: "开启调试",
type: 6,
value: this.config.isOpenDebugger,
change: (value: string) => {
change: async (value: string) => {
this.config.isOpenDebugger = value;
const win = await window.getLastWindow(this.context);
if (value === "1") {
win.setWindowSystemBarEnable(['status', 'navigation'])
} else {
win.setWindowSystemBarEnable([])
}
}
})
}.margin(20)
}
.height(650)
.width("100%")
@ -222,7 +236,6 @@ struct TerminalInfoPage {
top: 10
})
Row() {
Image($r('app.media.bc')).height(80).objectFit(ImageFit.Contain).onClick(() => {
if (this.isProcessing) {
@ -396,7 +409,7 @@ struct blockComponent {
})
} else {
ForEach(this.type === 1 ? this.rearMachineModelList :
this.type === 2 || this.type === 5 || this.type === 6 ? this.logList :
this.type === 2 || this.type === 5 || this.type === 6 || this.type === 7 ? this.logList :
this.type === 3 ? this.boardList : this.carTypeList, (item: CommonListType, index) => {
Radio({ value: item.label, group: 'terRadioGroup' + this.type })
.borderColor('#E5CBA1')

View File

@ -72,6 +72,10 @@ class serialPortService {
}
}
offMsg() {
this.events = [];
}
async closed() {
const res = await CancelReceiveSerialPortData(this.fd);
this.events = [];