首页
This commit is contained in:
parent
2c2b7085de
commit
fd997829d1
@ -2,7 +2,7 @@
|
||||
"string": [
|
||||
{
|
||||
"name": "app_name",
|
||||
"value": "car_next"
|
||||
"value": "鸿蒙车载"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@ -4,13 +4,13 @@
|
||||
{
|
||||
"name": "default",
|
||||
"material": {
|
||||
"certpath": "/Users/wangzhongjie/.ohos/config/openharmony/default_car_next_xIuD6UMCLxZgyeiH-w2XdDck6DewIfdHAvOk_FUbNZo=.cer",
|
||||
"storePassword": "0000001B00F51DADDF4103D94A7D4FD6C4F54D73E1DE0B0AB4E51D9F7B3B63CAD636CB8B7AFECA0C817A28",
|
||||
"certpath": "C:/Users/93218/.ohos/config/openharmony/default_harmony_vehicle_terminal_Ja3OiX9fkBwGKa0NNRbcXszAt35lPCdUakY4mTtjFwU=.cer",
|
||||
"storePassword": "0000001B8DAD42641E5F7218D3617E25253F6E8B9D3E209D83F6E7D7A50EEA33CC9F3672C35C8893FE7C05",
|
||||
"keyAlias": "debugKey",
|
||||
"keyPassword": "0000001BDCCBD8F284944B997A693592E7D77D62AEB605DD45A1935057816E45287006BA7BADF2C90CD9E7",
|
||||
"profile": "/Users/wangzhongjie/.ohos/config/openharmony/default_car_next_xIuD6UMCLxZgyeiH-w2XdDck6DewIfdHAvOk_FUbNZo=.p7b",
|
||||
"keyPassword": "0000001B8689E02F5E83BE0C395F8A4DC367C1B2C222600352DC5D93C9B8251DAA9B059371E119BEA7DFB1",
|
||||
"profile": "C:/Users/93218/.ohos/config/openharmony/default_harmony_vehicle_terminal_Ja3OiX9fkBwGKa0NNRbcXszAt35lPCdUakY4mTtjFwU=.p7b",
|
||||
"signAlg": "SHA256withECDSA",
|
||||
"storeFile": "/Users/wangzhongjie/.ohos/config/openharmony/default_car_next_xIuD6UMCLxZgyeiH-w2XdDck6DewIfdHAvOk_FUbNZo=.p12"
|
||||
"storeFile": "C:/Users/93218/.ohos/config/openharmony/default_harmony_vehicle_terminal_Ja3OiX9fkBwGKa0NNRbcXszAt35lPCdUakY4mTtjFwU=.p12"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
{
|
||||
"lockfileVersion": 2,
|
||||
"lockfileVersion": 1,
|
||||
"ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",
|
||||
"specifiers": {},
|
||||
"packages": {}
|
||||
|
||||
@ -9,7 +9,7 @@ import { GlobalConfigType } from '../model';
|
||||
* @Email: shutdown0630@163.com
|
||||
*/
|
||||
export const GlobalConfig: GlobalConfigType = {
|
||||
comoonfileWriteAddress: '/mnt/hmdfs/100/account/device_view/local/files/duolun',
|
||||
commonFileWriteAddress: '/mnt/hmdfs/100/account/device_view/local/files/duolun',
|
||||
picSavePath: '/storage/cloud/100/files/Photo/',
|
||||
videoSavePath: '/storage/cloud/100/files/Videos/',
|
||||
host: 'http://172.37.55.192:8082',
|
||||
|
||||
@ -13,12 +13,10 @@ import FileUtils from '../utils/FileUtils';
|
||||
export default class EntryAbility extends UIAbility {
|
||||
async onCreate(want: Want, launchParam: AbilityConstant.LaunchParam) {
|
||||
try {
|
||||
console.log("sql first")
|
||||
await DB.init(this.context)
|
||||
await InitTable()
|
||||
console.log("sql first success")
|
||||
let fileUtil = new FileUtils(this.context)
|
||||
const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/ipConfig.txt');
|
||||
const data = await fileUtil.readFile(GlobalConfig.commonFileWriteAddress + '/config/ipConfig.txt');
|
||||
if (data !== '' && data !== undefined) {
|
||||
const result: EnvironmentConfigurationType = JSON.parse(data)
|
||||
AppStorage.setOrCreate<EnvironmentConfigurationType>("EnvironmentConfiguration", result)
|
||||
@ -38,7 +36,6 @@ export default class EntryAbility extends UIAbility {
|
||||
}
|
||||
|
||||
async onWindowStageCreate(windowStage: window.WindowStage) {
|
||||
// Main window is created, set main page for this ability
|
||||
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
|
||||
const windowClass = await windowStage.getMainWindow();
|
||||
let rect = windowClass.getWindowProperties().windowRect
|
||||
@ -63,8 +60,8 @@ export default class EntryAbility extends UIAbility {
|
||||
isJudgeInitBool: false,
|
||||
})
|
||||
|
||||
|
||||
AppStorage.setOrCreate('windowClass', windowClass)
|
||||
await windowClass.setWindowLayoutFullScreen(true)
|
||||
await windowClass.setWindowSystemBarEnable([]) //全屏
|
||||
windowStage.loadContent('pages/Index', (err, data) => {
|
||||
if (err.code) {
|
||||
@ -74,7 +71,7 @@ export default class EntryAbility extends UIAbility {
|
||||
hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? '');
|
||||
});
|
||||
|
||||
this.creatFiles();
|
||||
this.createFiles();
|
||||
}
|
||||
|
||||
onWindowStageDestroy() {
|
||||
@ -92,6 +89,6 @@ export default class EntryAbility extends UIAbility {
|
||||
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground');
|
||||
}
|
||||
|
||||
creatFiles() {
|
||||
createFiles() {
|
||||
}
|
||||
}
|
||||
@ -147,7 +147,7 @@ export interface EnvironmentConfigurationType {
|
||||
|
||||
//全局配置
|
||||
export interface GlobalConfigType {
|
||||
comoonfileWriteAddress?: string
|
||||
commonFileWriteAddress?: string
|
||||
picSavePath?: string
|
||||
videoSavePath?: string
|
||||
host?: string
|
||||
|
||||
@ -82,7 +82,7 @@ struct Index {
|
||||
}) {
|
||||
ForEach(this.imgArr1, (item: Resource, index: number) => {
|
||||
if (index === this.imgArr1.length - 1) {
|
||||
imageBtn({ btnWidth: '38%', btnHeight: '24%', imgSrc: item })
|
||||
imageBtn({ btnWidth: '38%', imgSrc: item })
|
||||
.onClick(() => {
|
||||
if (this.inputTextArr[0].trim() == '' || this.inputTextArr[1].trim() == '') {
|
||||
promptAction.showToast({
|
||||
|
||||
@ -13,7 +13,7 @@ import {
|
||||
MASYSSETTableType,
|
||||
TimeSynchronizationRspBody
|
||||
} from '../model';
|
||||
import { GetCarInfo, GetDeviceInfo, SetCurrentTime, SetSerialNumber, UseAuth } from './Index/utils';
|
||||
import { GetCarInfo, GetDeviceInfo, SetCurrentTime, UseAuth } from './Index/utils';
|
||||
import { GetSyncData, InitializeTheCentralTable } from '../utils/table/Operation';
|
||||
import { BusinessError } from '@ohos.base';
|
||||
import { delPic } from '../utils/Video';
|
||||
@ -25,6 +25,7 @@ import { DrivingDataStorage } from '../utils/business/DrivingDataStorage';
|
||||
import { JudgeUdpBusinessInstance } from '../utils/business/JudgeUdpBusiness';
|
||||
import { JudgeEmitterInstance } from '../utils/business/UdpEvent';
|
||||
import { LoadingDialog } from './Index/Loading';
|
||||
import { ExitDialog } from './Index/ExitDialog'
|
||||
|
||||
|
||||
@Entry
|
||||
@ -46,7 +47,6 @@ struct Index {
|
||||
@State num: number = 0;
|
||||
private context = getContext(this) as common.UIAbilityContext;
|
||||
private fileHelper: FileHelper = new FileHelper(this.context)
|
||||
private interval = -1;
|
||||
private avPlayer: VoiceAnnounce = new VoiceAnnounce(this.context)
|
||||
private timeInfo: TimeSynchronizationRspBody = {}
|
||||
private loadingDialog: CustomDialogController = new CustomDialogController({
|
||||
@ -55,6 +55,20 @@ struct Index {
|
||||
alignment: DialogAlignment.Center,
|
||||
autoCancel: false
|
||||
})
|
||||
private delDialog: CustomDialogController = new CustomDialogController({
|
||||
builder: LoadingDialog({
|
||||
text: "正在清理本地数据,请稍候……"
|
||||
}),
|
||||
customStyle: true,
|
||||
alignment: DialogAlignment.Center,
|
||||
autoCancel: false
|
||||
})
|
||||
private exitDialog: CustomDialogController = new CustomDialogController({
|
||||
builder: ExitDialog(),
|
||||
customStyle: true,
|
||||
alignment: DialogAlignment.Center,
|
||||
autoCancel: false
|
||||
})
|
||||
private errorDialog: CustomDialogController = new CustomDialogController({
|
||||
builder: errorMsgDialog({
|
||||
title: AppStorage.get('title'),
|
||||
@ -74,15 +88,13 @@ struct Index {
|
||||
.height(69 * this.ratio * this.dialogRatio)
|
||||
.backgroundImage($r('app.media.button_nor'))
|
||||
.backgroundImageSize({ width: '100%', height: '100%' })
|
||||
// .margin({ bottom: 12 * this.ratio })
|
||||
}
|
||||
|
||||
async aboutToAppear() {
|
||||
await UseAuth(this.context)
|
||||
this.ratio = AppStorage.get<BaseInfoType>('baseInfo')?.ratio || 1.4
|
||||
this.angle = 0
|
||||
AppStorage.set('lsh', '1111111111111')
|
||||
// TODO 未改
|
||||
// globalThis.errorDialog = this.errorDialog
|
||||
JudgeEmitterInstance.init()
|
||||
GetSyncData<MASYSSETTableType>("MA_SYSSET").then((res: MASYSSETTableType[]) => {
|
||||
res.forEach((element) => {
|
||||
@ -110,6 +122,52 @@ struct Index {
|
||||
AppStorage.setOrCreate('lsh', '1111111111111')
|
||||
}
|
||||
|
||||
exam() {
|
||||
this.loadingDialog.open()
|
||||
if (!this.timeInfo) {
|
||||
AppStorage.setOrCreate('type', 1)
|
||||
AppStorage.setOrCreate('title', '时间同步接口连接失败')
|
||||
this.errorDialog.open()
|
||||
promptAction.showToast({
|
||||
message: `时间同步接口连接失败`,
|
||||
duration: 3000
|
||||
});
|
||||
this.loadingDialog.close()
|
||||
return
|
||||
}
|
||||
if (!this.carInfo) {
|
||||
promptAction.showToast({
|
||||
message: `车辆信息接口获取失败`,
|
||||
duration: 3000
|
||||
});
|
||||
AppStorage.setOrCreate('type', 1)
|
||||
AppStorage.setOrCreate('title', '车辆信息接口获取失败')
|
||||
this.errorDialog.open()
|
||||
this.loadingDialog.close()
|
||||
return
|
||||
}
|
||||
this.testXMLToJSONInWorker()
|
||||
}
|
||||
|
||||
practice() {
|
||||
if (JudgeConfig.isTrajectoryOpen) {
|
||||
router.pushUrl({
|
||||
url: 'pages/UserInfo',
|
||||
}, router.RouterMode.Single)
|
||||
return
|
||||
}
|
||||
//判断数据库是否有表数据,有则直接跳转,没有则读取本地数据
|
||||
GetSyncData<MASYSSETTableType>('MA_SYSSET').then((data: Array<MASYSSETTableType>) => {
|
||||
if (data?.[0]) {
|
||||
router.pushUrl({
|
||||
url: 'pages/UserInfo',
|
||||
}, router.RouterMode.Single)
|
||||
} else {
|
||||
this.testXMLToJSONInWorker()
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async testXMLToJSONInWorker() {
|
||||
const param: InitializeTheCentralTableType = {
|
||||
carId: this.carInfo?.carId,
|
||||
@ -151,31 +209,6 @@ struct Index {
|
||||
})
|
||||
}
|
||||
|
||||
async heartMsg() {
|
||||
// const signNum = AppStorage.get<number>('signNum')
|
||||
// const statue = AppStorage.get<string>('statue')
|
||||
// const lsh = AppStorage.get<string>('lsh')
|
||||
// const arr = [signNum || 0, statue || 1]
|
||||
// let tmpList: number[] = [];
|
||||
// tmpList.push(NumberToByteArray(Number(arr[0]), 1 * 8)[0])
|
||||
// tmpList.push(NumberToByteArray(Number(arr[1]), 1 * 8)[0])
|
||||
// const str = lsh || '0000000000000'
|
||||
// for (let i = 0; i < str.length; i++) {
|
||||
// tmpList.push(NumberToByteArray(str.charCodeAt(i), 1 * 8)[0])
|
||||
// }
|
||||
// TODO 未改
|
||||
// const param = {
|
||||
// id: 31,
|
||||
// list: tmpList,
|
||||
// carNo: this.carInfo.carNo,
|
||||
// placeId: this.carInfo.examinationRoomId
|
||||
// }
|
||||
// globalThis.udpClient2.initHeartSendMsg(param,this.context)
|
||||
// if (globalThis.udpClient2.getStatus()) {
|
||||
// globalThis.udpClient2.sendMsgExt(param, this.context)
|
||||
// }
|
||||
}
|
||||
|
||||
async createAlbum() {
|
||||
const time = GetCurrentTime()
|
||||
const date = time.split(' ')[0]
|
||||
@ -188,7 +221,6 @@ struct Index {
|
||||
console.log("test1111")
|
||||
ObtainUdpBusinessInstance.init();
|
||||
CenterUDPBusinessInstance.init();
|
||||
CenterUDPBusinessInstance.startHeartBeat()
|
||||
CenterUDPBusinessInstance.onMsg((data: centerCallBackMsgType) => {
|
||||
if (data.id == 32) {
|
||||
AppStorage.setOrCreate('signNum', data.body[1])
|
||||
@ -206,145 +238,70 @@ struct Index {
|
||||
JudgeUdpBusinessInstance.init()
|
||||
// TODO 摄像头遮挡
|
||||
// takePhotoFn(this.context)
|
||||
clearInterval(this.interval)
|
||||
this.interval = setInterval(() => {
|
||||
this.num++
|
||||
SetSerialNumber()
|
||||
if (this.num >= 3) {
|
||||
this.heartMsg()
|
||||
}
|
||||
}, 1000)
|
||||
// TODO
|
||||
// CenterUDPBusinessInstance.startHeartBeat()
|
||||
this.createAlbum()
|
||||
}
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
Column() {
|
||||
Row() {
|
||||
Image($r('app.media.logo')).width('30%').height('5.5%').margin({ left: 24 })
|
||||
Image($r('app.media.logo')).width('30%').margin({ left: 24 })
|
||||
Row() {
|
||||
Image($r('app.media.btn_setting')).width('16.7%').height('12.2%')
|
||||
Image($r('app.media.btn_setting')).width('16.7%')
|
||||
.onClick(async () => {
|
||||
// this.vocObj.playAudio({
|
||||
// type: 1,
|
||||
// name: 'button_media.wav'
|
||||
// })
|
||||
// deleteAllPicturesFn()
|
||||
router.pushUrl({
|
||||
url: 'pages/Settings',
|
||||
}, router.RouterMode.Single);
|
||||
})
|
||||
Image($r('app.media.btn_back')).width('14.4%').height('12.2%')
|
||||
Image($r('app.media.btn_back')).width('14.4%')
|
||||
.onClick(() => {
|
||||
// this.vocObj.playAudio({
|
||||
// type: 1,
|
||||
// name: 'button_media.wav'
|
||||
// })
|
||||
this.dialogVisible = true
|
||||
this.exitDialog.open()
|
||||
})
|
||||
}
|
||||
}
|
||||
.width('100%')
|
||||
.justifyContent(FlexAlign.SpaceBetween)
|
||||
}
|
||||
|
||||
Column() {
|
||||
Row() {
|
||||
if (!this.singlePlay) {
|
||||
imageBtn({ btnWidth: '28%', btnHeight: '71%', imgSrc: $r('app.media.index_lw') })
|
||||
.margin({ left: 80 * this.ratio })
|
||||
.onClick(async () => {
|
||||
this.loadingDialog.open()
|
||||
// this.vocObj.playAudio({
|
||||
// type: 1,
|
||||
// name: 'button_media.wav'
|
||||
// })
|
||||
// ||!this.initParamFlag
|
||||
if (!this.timeInfo) {
|
||||
AppStorage.setOrCreate('type', 1)
|
||||
AppStorage.setOrCreate('title', '时间同步接口连接失败')
|
||||
this.errorDialog.open()
|
||||
promptAction.showToast({
|
||||
message: `时间同步接口连接失败`,
|
||||
duration: 3000
|
||||
});
|
||||
this.loadingDialog.close()
|
||||
return
|
||||
}
|
||||
if (!this.carInfo) {
|
||||
promptAction.showToast({
|
||||
message: `车辆信息接口获取失败`,
|
||||
duration: 3000
|
||||
});
|
||||
AppStorage.setOrCreate('type', 1)
|
||||
AppStorage.setOrCreate('title', '车辆信息接口获取失败')
|
||||
this.errorDialog.open()
|
||||
this.loadingDialog.close()
|
||||
return
|
||||
}
|
||||
this.testXMLToJSONInWorker()
|
||||
})
|
||||
}
|
||||
if (this.singlePlay) {
|
||||
imageBtn({ btnWidth: '28%', btnHeight: '71%', imgSrc: $r('app.media.index_dj') })
|
||||
imageBtn({ btnWidth: '28%', imgSrc: this.singlePlay ? $r('app.media.index_dj') : $r('app.media.index_lw') })
|
||||
.margin({ left: 80 * this.ratio })
|
||||
.onClick(() => {
|
||||
// this.vocObj.playAudio({
|
||||
// type: 1,
|
||||
// name: 'button_media.wav'
|
||||
// })
|
||||
if (JudgeConfig.isTrajectoryOpen) {
|
||||
router.pushUrl({
|
||||
url: 'pages/UserInfo',
|
||||
}, router.RouterMode.Single)
|
||||
return
|
||||
}
|
||||
//判断数据库是否有表数据,有则直接跳转,没有则读取本地数据
|
||||
GetSyncData<MASYSSETTableType>('MA_SYSSET').then((data: Array<MASYSSETTableType>) => {
|
||||
console.log('datadata', JSON.stringify(data))
|
||||
if (data?.[0]) {
|
||||
router.pushUrl({
|
||||
url: 'pages/UserInfo',
|
||||
}, router.RouterMode.Single)
|
||||
if (this.singlePlay) {
|
||||
this.practice()
|
||||
} else {
|
||||
this.testXMLToJSONInWorker()
|
||||
this.exam()
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
imageBtn({ btnWidth: '28%', btnHeight: '71%', imgSrc: $r('app.media.index_zj') })
|
||||
imageBtn({ btnWidth: '28%', imgSrc: $r('app.media.index_zj') })
|
||||
.margin({ right: 80 * this.ratio })
|
||||
.onClick(() => {
|
||||
// this.vocObj.playAudio({
|
||||
// type: 1,
|
||||
// name: 'button_media.wav'
|
||||
// })
|
||||
router.pushUrl({
|
||||
url: 'pages/CarCheck'
|
||||
}, router.RouterMode.Single);
|
||||
})
|
||||
}
|
||||
.padding({ top: 30, bottom: 30 })
|
||||
.layoutWeight(1)
|
||||
.width('100%')
|
||||
.justifyContent(FlexAlign.SpaceAround)
|
||||
}
|
||||
|
||||
Column() {
|
||||
Row() {
|
||||
Column() {
|
||||
Text('V外壳:' + this.baseInfo?.version)
|
||||
.fontColor('#CCAE7A')
|
||||
.fontSize(18 * this.ratio)
|
||||
.fontSize(28)
|
||||
.width('30%')
|
||||
.margin({ bottom: 10 })
|
||||
Text('V评判:' + this.baseInfo.judgeVersion)
|
||||
.fontColor('#CCAE7A')
|
||||
.fontSize(18 * this.ratio)
|
||||
.fontSize(28)
|
||||
.width('30%')
|
||||
.margin({ bottom: 10 })
|
||||
|
||||
Text('授权信息:' + (this.baseInfo.hasAuth ? '已授权' : '未授权'))
|
||||
.fontColor('#CCAE7A')
|
||||
.fontSize(18 * this.ratio)
|
||||
.fontSize(28)
|
||||
.width('30%')
|
||||
}
|
||||
.margin({ left: 24 })
|
||||
@ -352,101 +309,24 @@ struct Index {
|
||||
GestureGroup(GestureMode.Exclusive,
|
||||
TapGesture({ count: 2 })
|
||||
.onAction(() => {
|
||||
// takePhotoFn(this.context)
|
||||
this.singlePlay = !this.singlePlay
|
||||
AppStorage.setOrCreate('singlePlay', this.singlePlay)
|
||||
|
||||
})
|
||||
)
|
||||
)
|
||||
|
||||
Text('考车号:' + this.deviceId)
|
||||
.fontColor('#CCAE7A')
|
||||
.fontSize(22 * this.ratio)
|
||||
.fontSize(36)
|
||||
.margin({ right: 24 })
|
||||
}
|
||||
.padding({ top: 10, bottom: 10 })
|
||||
.width('100%')
|
||||
.justifyContent(FlexAlign.SpaceBetween)
|
||||
.margin({ bottom: 10 })
|
||||
}.height(100)
|
||||
|
||||
|
||||
if (this.dialogVisible) {
|
||||
Flex({ justifyContent: FlexAlign.Center }) {
|
||||
Text('确认是否退出应用')
|
||||
.fontSize(28 * this.ratio * this.dialogRatio)
|
||||
.margin({ top: 100 * this.ratio * this.dialogRatio })
|
||||
Row() {
|
||||
Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
|
||||
Text(' 取 消 ')
|
||||
.fontSize(24 * this.ratio * this.dialogRatio)
|
||||
.fontColor('#fff')
|
||||
.width(100 * this.ratio * this.dialogRatio)
|
||||
}
|
||||
.commStyle()
|
||||
.onClick(() => {
|
||||
this.dialogVisible = false
|
||||
// this.vocObj.playAudio({
|
||||
// type: 1,
|
||||
// name: 'button_media.wav'
|
||||
// })
|
||||
}).margin({ right: 10 * this.ratio })
|
||||
|
||||
Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
|
||||
Text(' 确 定 ')
|
||||
.fontSize(24 * this.ratio * this.dialogRatio)
|
||||
.fontColor('#fff')
|
||||
.width(100 * this.ratio * this.dialogRatio)
|
||||
}
|
||||
.commStyle()
|
||||
.onClick(() => {
|
||||
// this.vocObj.playAudio({
|
||||
// type: 1,
|
||||
// name: 'button_media.wav'
|
||||
// })
|
||||
router.back()
|
||||
})
|
||||
}.position({ y: 265 * this.ratio * this.dialogRatio, x: 115 * this.ratio * this.dialogRatio })
|
||||
|
||||
}
|
||||
.width(660 * this.ratio * this.dialogRatio)
|
||||
.height(360 * this.ratio * this.dialogRatio)
|
||||
.position({ x: 220 * this.ratio, y: 98 * this.ratio - 265 / 2 * (1 - this.ratio * this.dialogRatio) })
|
||||
.backgroundColor('#E6E3DF')
|
||||
.borderRadius(19 * this.ratio * this.dialogRatio)
|
||||
}
|
||||
if (this.delLoading) {
|
||||
Column() {
|
||||
Image($r('app.media.open_loading'))
|
||||
.width(200 * this.ratio)
|
||||
.rotate({ angle: this.angle })
|
||||
.height(200 * this.ratio)
|
||||
.animation({
|
||||
duration: 5000, // 动画时长
|
||||
curve: Curve.EaseOut, // 动画曲线
|
||||
delay: 500, // 动画延迟
|
||||
iterations: -1, // 播放次数
|
||||
playMode: PlayMode.Normal, // 动画模式
|
||||
})
|
||||
.margin({ top: 30 * this.ratio })
|
||||
|
||||
Text('正在清理本地数据,请稍候……')
|
||||
.fontSize(24 * this.ratio)
|
||||
.margin({ top: 20 * this.ratio })
|
||||
.fontWeight(400)
|
||||
}
|
||||
.visibility(this.delLoading ? Visibility.Visible : Visibility.Hidden)
|
||||
.width(660 * this.ratio)
|
||||
.height(360 * this.ratio)
|
||||
.position({ x: 150 * this.ratio, y: 98 * this.ratio })
|
||||
.backgroundColor('#E6E3DF')
|
||||
.borderRadius(19 * this.ratio)
|
||||
}
|
||||
}
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
.justifyContent(FlexAlign.SpaceBetween)
|
||||
.backgroundImage($r('app.media.index_bg'))
|
||||
.backgroundImageSize({ width: '100%', height: '100%' })
|
||||
}
|
||||
}
|
||||
52
entry/src/main/ets/pages/Index/ExitDialog.ets
Normal file
52
entry/src/main/ets/pages/Index/ExitDialog.ets
Normal file
@ -0,0 +1,52 @@
|
||||
import common from '@ohos.app.ability.common'
|
||||
|
||||
@CustomDialog
|
||||
export struct ExitDialog {
|
||||
private controller: CustomDialogController
|
||||
|
||||
@Styles
|
||||
commStyle(){
|
||||
.width(220)
|
||||
.height(69)
|
||||
.backgroundImage($r('app.media.button_nor'))
|
||||
.backgroundImageSize({ width: '100%', height: '100%' })
|
||||
}
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
Row() {
|
||||
Text('确认是否退出应用')
|
||||
.fontSize(36)
|
||||
}.margin({ bottom: 80 })
|
||||
|
||||
Flex({ justifyContent: FlexAlign.Center }) {
|
||||
Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
|
||||
Text(' 取 消 ')
|
||||
.fontSize(24)
|
||||
.fontColor('#fff')
|
||||
.width(100)
|
||||
}
|
||||
.commStyle()
|
||||
.onClick(() => {
|
||||
this.controller.close()
|
||||
}).margin({ right: 10 })
|
||||
|
||||
Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
|
||||
Text(' 确 定 ')
|
||||
.fontSize(24)
|
||||
.fontColor('#fff')
|
||||
.width(100)
|
||||
}
|
||||
.commStyle()
|
||||
.margin({ left: 10 })
|
||||
.onClick(() => {
|
||||
(getContext(this) as common.UIAbilityContext).terminateSelf()
|
||||
})
|
||||
}
|
||||
}
|
||||
.width("45%")
|
||||
.padding({ left: 80, top: 60, right: 80, bottom: 60 })
|
||||
.backgroundColor('#E6E3DF')
|
||||
.borderRadius(20)
|
||||
}
|
||||
}
|
||||
@ -1,15 +1,15 @@
|
||||
@CustomDialog
|
||||
export struct LoadingDialog {
|
||||
@State
|
||||
private angle: number = 0
|
||||
@Prop private text: string = "获取考车信息,请稍候……"
|
||||
@State private angle: number = 0
|
||||
private controller: CustomDialogController
|
||||
|
||||
aboutToAppear(): void {
|
||||
animateTo({
|
||||
duration: 5000, // 动画时长
|
||||
curve: Curve.EaseOut, // 动画曲线
|
||||
iterations: -1, // 播放次数
|
||||
playMode: PlayMode.Normal, // 动画模式
|
||||
duration: 5000,
|
||||
curve: Curve.EaseOut,
|
||||
iterations: -1,
|
||||
playMode: PlayMode.Normal,
|
||||
}, () => {
|
||||
this.angle += 360
|
||||
})
|
||||
@ -26,7 +26,7 @@ export struct LoadingDialog {
|
||||
.width(80)
|
||||
.height(80)
|
||||
.position({ x: 288, y: 89 })
|
||||
Text('获取考车信息,请稍候……')
|
||||
Text(this.text)
|
||||
.fontSize(24)
|
||||
.margin({ top: 20 })
|
||||
.fontWeight(400)
|
||||
|
||||
@ -23,7 +23,7 @@ import FileUtils from '../../utils/FileUtils';
|
||||
export async function GetDeviceInfo(context: common.UIAbilityContext): Promise<string> {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
const fileUtil = new FileUtils(context)
|
||||
const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/deviceNo.txt');
|
||||
const data = await fileUtil.readFile(GlobalConfig.commonFileWriteAddress + '/config/deviceNo.txt');
|
||||
if (data === '' || data === undefined) {
|
||||
Prompt.showToast({
|
||||
message: "请先进行设备注册!",
|
||||
@ -63,16 +63,13 @@ export async function UseAuth(context: common.UIAbilityContext): Promise<boolean
|
||||
abilityAccessCtrl.createAtManager().requestPermissionsFromUser(context, permissions).then(res => {
|
||||
let grantStatus: Array<number> = res.authResults;
|
||||
let length: number = grantStatus.length;
|
||||
resolve(true)
|
||||
for (let i = 0; i < length; i++) {
|
||||
if (grantStatus[i] === 0) {
|
||||
// 用户授权,可以继续访问目标操作
|
||||
} else {
|
||||
if (grantStatus[i] !== 0) {
|
||||
reject(false)
|
||||
// 用户拒绝授权,提示用户必须授权才能访问当前页面的功能,并引导用户到系统设置中打开相应的权限
|
||||
return;
|
||||
}
|
||||
}
|
||||
resolve(true)
|
||||
}).catch((err: BusinessError) => {
|
||||
console.log("获取权限失败", JSON.stringify(err))
|
||||
reject(false)
|
||||
@ -119,7 +116,7 @@ export async function TakePhoto(context: common.UIAbilityContext) {
|
||||
spzd4: false,
|
||||
}
|
||||
const fileUtil = new FileUtils(context)
|
||||
const fileData = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/config3.txt');
|
||||
const fileData = await fileUtil.readFile(GlobalConfig.commonFileWriteAddress + '/config/config3.txt');
|
||||
param = JSON.parse(fileData)
|
||||
clearInterval(interval)
|
||||
interval = setTimeout(async () => {
|
||||
|
||||
@ -141,7 +141,7 @@ struct Index {
|
||||
|
||||
async aboutToAppear() {
|
||||
this.fileUtil = new FileUtils(this.context)
|
||||
const data = await this.fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/ipConfig.txt');
|
||||
const data = await this.fileUtil.readFile(GlobalConfig.commonFileWriteAddress + '/config/ipConfig.txt');
|
||||
if (data === '' || data === undefined) {
|
||||
} else {
|
||||
const result: EnvironmentConfigurationType = JSON.parse(data)
|
||||
|
||||
@ -616,7 +616,7 @@ struct Index {
|
||||
}
|
||||
|
||||
async getVideoConfig() {
|
||||
const data = await this.fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/config3.txt');
|
||||
const data = await this.fileUtil.readFile(GlobalConfig.commonFileWriteAddress + '/config/config3.txt');
|
||||
this.oldParam = JSON.parse(data)
|
||||
this.param = JSON.parse(data)
|
||||
}
|
||||
|
||||
@ -317,7 +317,7 @@ export default struct FaceCompare {
|
||||
}
|
||||
}, this.context);
|
||||
|
||||
const data = await this.fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/config3.txt');
|
||||
const data = await this.fileUtil.readFile(GlobalConfig.commonFileWriteAddress + '/config/config3.txt');
|
||||
console.log('faceEnterIn,data', data)
|
||||
|
||||
setTimeout(() => {
|
||||
|
||||
@ -19,26 +19,22 @@ export default struct TopLogo {
|
||||
}
|
||||
.backgroundColor('#333230')
|
||||
.width('100%')
|
||||
.height('10%')
|
||||
.height('100%')
|
||||
|
||||
Row() {
|
||||
Row() {
|
||||
Image($r('app.media.shortLogo'))
|
||||
.width('10.2%')
|
||||
.height('5.7%')
|
||||
.height('75%')
|
||||
.margin({ left: 30 * this.ratio, top: -15 * this.ratio })
|
||||
Text(this.timeText)
|
||||
.fontSize(30 * this.ratio)
|
||||
.fontColor('#CCB48F')
|
||||
.margin({ top: -15 * this.ratio, left: 14 * this.ratio }) //fontsize40
|
||||
.margin({ top: -15 * this.ratio, left: 14 * this.ratio })
|
||||
}
|
||||
|
||||
imageBtn({ btnWidth: '16.7%', btnHeight: '12.2%', imgSrc: $r('app.media.topB_back') })
|
||||
imageBtn({ btnWidth: '13.5%', imgSrc: $r('app.media.topB_back') })
|
||||
.onClick(() => {
|
||||
// this.vocObj.playAudio({
|
||||
// type: 1,
|
||||
// name: 'button_media.wav'
|
||||
// })
|
||||
this.outFlag = true
|
||||
router.back()
|
||||
})
|
||||
@ -48,6 +44,7 @@ export default struct TopLogo {
|
||||
.justifyContent(FlexAlign.SpaceBetween)
|
||||
}
|
||||
.width('100%')
|
||||
.height('8%')
|
||||
}
|
||||
|
||||
async aboutToAppear() {
|
||||
@ -55,11 +52,6 @@ export default struct TopLogo {
|
||||
this.timer = setInterval(async () => {
|
||||
this.timeText = GetCurrentTime();
|
||||
}, 1000)
|
||||
// this.vocObj = new voiceService(async (status,val) => {
|
||||
// if (status == 'idle') {
|
||||
// router.back()
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
aboutToDisappear() {
|
||||
|
||||
@ -1,10 +1,9 @@
|
||||
@Component
|
||||
export default struct imageBtn {
|
||||
//状态变量unPressed,用于控制按钮的状态
|
||||
@State unPressed: boolean = true
|
||||
@Prop imgSrc: Resource
|
||||
btnWidth?: string | number
|
||||
btnHeight?: string | number
|
||||
imgSrc?: Resource
|
||||
opacityNum: number = 1
|
||||
|
||||
@Styles
|
||||
@ -17,27 +16,19 @@ export default struct imageBtn {
|
||||
Column() {
|
||||
Column() {
|
||||
Stack() {
|
||||
// Image($r('app.media.topB_back'))
|
||||
Row() {
|
||||
// 判断当前组件为放开状态
|
||||
if (this.unPressed) {
|
||||
// 插入Row组件,配置过渡效果
|
||||
Image(this.imgSrc)// 水波纹扩散动画:Row组件backgroundColor属性变更(#fff -> #ccc),系统插入动画过渡效果,从组建的中心点开始放大,scale{0,0}变更scale{1,1}
|
||||
.transition({
|
||||
type: TransitionType.Insert,
|
||||
opacity: 0,
|
||||
})
|
||||
}
|
||||
// 判断当前组件为按下状态
|
||||
else if (!this.unPressed) {
|
||||
// 插入Row组件,配置过渡效果
|
||||
} else {
|
||||
Image(this.imgSrc)
|
||||
.opacity(this.opacityNum)
|
||||
.onAppear(() => {
|
||||
// 水波纹聚拢动画:Row组件backgroundColor属性变更(#ccc -> #fff),插入动画过渡效果,scale{1,1}变化为scale{0,0}
|
||||
animateTo({
|
||||
duration: 500,
|
||||
// 聚拢动画播放完成后,需要衔接扩散动画,此时Row组件backgroundColor属性变更(#fff -> #ccc),插入动画过渡效果,scale{0,0}变化为scale{1,1}
|
||||
onFinish: () => {
|
||||
this.opacityNum = 1
|
||||
}
|
||||
@ -56,17 +47,14 @@ export default struct imageBtn {
|
||||
.customStyle()
|
||||
}
|
||||
.width(this.btnWidth)
|
||||
.height(this.btnHeight)
|
||||
.height(this.btnHeight || "100%")
|
||||
}
|
||||
// onTouch事件,监听状态
|
||||
.onTouch((event: TouchEvent) => {
|
||||
// 当按钮按下时,更新按钮的状态(unPressed:true -> false)
|
||||
if (event.type == TouchType.Down) {
|
||||
animateTo({ duration: 400 }, () => {
|
||||
this.unPressed = !this.unPressed
|
||||
})
|
||||
}
|
||||
// 当按钮放开时,更新按钮的状态(unPressed:false -> true)
|
||||
if (event.type == TouchType.Up) {
|
||||
animateTo({ duration: 400 }, () => {
|
||||
this.unPressed = !this.unPressed
|
||||
|
||||
@ -14,7 +14,7 @@ interface RequestOption {
|
||||
timeout?: number
|
||||
}
|
||||
|
||||
const base: string = ""
|
||||
const base: string = AppStorage.get("host") || "http://127.0.0.1"
|
||||
|
||||
function xmlToJSON(target: string): object {
|
||||
let conv = new convertxml.ConvertXML()
|
||||
|
||||
@ -86,7 +86,7 @@ export async function saveStartRecordVideo(path: string, context: common.UIAbili
|
||||
const date = dayTs().format('YYYY-MM-DD HH:mm:ss').split(' ')[0]
|
||||
fileHelper.createAlbum(date);
|
||||
// const folderPath = await fileUtil.initFolder(`/${path}/${date}`);
|
||||
const data: string = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/config3.txt');
|
||||
const data: string = await fileUtil.readFile(GlobalConfig.commonFileWriteAddress + '/config/config3.txt');
|
||||
const param: VideoConfig = JSON.parse(data)
|
||||
const record_handle: RecordHandleType = {
|
||||
rocord_handle1: 0,
|
||||
|
||||
@ -4,6 +4,7 @@ import { fillZero, string2Bytes } from '../../pages/judgeSDK/utils/Common';
|
||||
import { NumberToByteArray } from '../Common';
|
||||
import UdpClient from '../UdpUtils';
|
||||
import { UDPTag } from '../../config';
|
||||
import { SetSerialNumber } from '../../pages/Index/utils';
|
||||
|
||||
// 中心UDP业务逻辑
|
||||
class CenterUDPBusiness {
|
||||
@ -91,6 +92,7 @@ class CenterUDPBusiness {
|
||||
startHeartBeat() {
|
||||
// 组装消息,一秒发送一次
|
||||
this.timer = setInterval(() => {
|
||||
SetSerialNumber()
|
||||
const signNum = AppStorage.get<number>('signNum')
|
||||
const statue = AppStorage.get<string>('statue')
|
||||
const lsh = AppStorage.get<string>('lsh')
|
||||
@ -128,6 +130,7 @@ class CenterUDPBusiness {
|
||||
let result: EnvironmentConfigurationType =
|
||||
AppStorage.get<EnvironmentConfigurationType>("EnvironmentConfiguration")!
|
||||
const carInfo: CarInfoType = AppStorage.get<CarInfoType>('carInfo')!
|
||||
AppStorage.setOrCreate("host", `http://${result.centerIp}:${result.centerPort}`)
|
||||
this.udp.create(result.udplocalIp!, '8800', carInfo.udpAddress!, carInfo.messagePort!)
|
||||
.then(resolve)
|
||||
.catch(reject)
|
||||
|
||||
@ -103,7 +103,7 @@ export async function InitializeTheCentralTable(params: InitializeTheCentralTabl
|
||||
'MAP_SUBITEM', 'MA_T_CARPARMSET', 'MA_MAP_ITEMCLASS', 'MA_MAP_POINT', 'MA_MAP_POINT_ITEM'];
|
||||
for (let i = 0; i <= tableList.length - 1; i++) {
|
||||
const data =
|
||||
await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + `/config/tableList/${tableList[i]}.txt`);
|
||||
await fileUtil.readFile(GlobalConfig.commonFileWriteAddress + `/config/tableList/${tableList[i]}.txt`);
|
||||
flag = await SqlInsertTable(tableList[i], JSON.parse(data) || [])
|
||||
}
|
||||
if (!flag) {
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
"name": "EntryAbility",
|
||||
"srcEntry": "./ets/entryability/EntryAbility.ets",
|
||||
"description": "$string:EntryAbility_desc",
|
||||
"icon": "$media:layered_image",
|
||||
"icon": "$media:logo_app",
|
||||
"label": "$string:EntryAbility_label",
|
||||
"startWindowIcon": "$media:startIcon",
|
||||
"startWindowBackground": "$color:start_window_background",
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
},
|
||||
{
|
||||
"name": "EntryAbility_label",
|
||||
"value": "label"
|
||||
"value": "多伦科技驾驶人考试系统"
|
||||
},
|
||||
{
|
||||
"name": "Permission_application",
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
},
|
||||
{
|
||||
"name": "EntryAbility_label",
|
||||
"value": "label"
|
||||
"value": "鸿蒙车载"
|
||||
},
|
||||
{
|
||||
"name": "Permission_application",
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
{
|
||||
"lockfileVersion": 2,
|
||||
"lockfileVersion": 1,
|
||||
"ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",
|
||||
"specifiers": {
|
||||
"@ohos/hypium@1.0.19": "@ohos/hypium@1.0.19",
|
||||
@ -8,13 +8,11 @@
|
||||
"packages": {
|
||||
"@ohos/hypium@1.0.19": {
|
||||
"resolved": "https://ohpm.openharmony.cn/ohpm/@ohos/hypium/-/hypium-1.0.19.har",
|
||||
"integrity": "sha512-cEjDgLFCm3cWZDeRXk7agBUkPqjWxUo6AQeiu0gEkb3J8ESqlduQLSIXeo3cCsm8U/asL7iKjF85ZyOuufAGSQ==",
|
||||
"registryType": "ohpm"
|
||||
"integrity": "sha512-cEjDgLFCm3cWZDeRXk7agBUkPqjWxUo6AQeiu0gEkb3J8ESqlduQLSIXeo3cCsm8U/asL7iKjF85ZyOuufAGSQ=="
|
||||
},
|
||||
"@ohos/crypto-js@2.0.3": {
|
||||
"resolved": "https://ohpm.openharmony.cn/ohpm/@ohos/crypto-js/-/crypto-js-2.0.3.har",
|
||||
"integrity": "sha512-LuHaR1kD5PxnOXnuR1fWvPwGtbed9Q/QGzk6JOh8y5Wdzvi8brPesODZiaWf9scOVRHsbTPOtZw91vWB35p1vQ==",
|
||||
"registryType": "ohpm"
|
||||
"integrity": "sha512-LuHaR1kD5PxnOXnuR1fWvPwGtbed9Q/QGzk6JOh8y5Wdzvi8brPesODZiaWf9scOVRHsbTPOtZw91vWB35p1vQ=="
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user