Compare commits

...

6 Commits

Author SHA1 Message Date
18b31dfdd4 Merge branch '代理服务方案' of http://47.122.70.237:3000/harmony_car/subject-two into 代理服务方案 2025-03-25 16:55:16 +08:00
17a52af998 网络判断 2025-03-18 19:05:07 +08:00
23e115e89e 网络判断 2025-03-18 17:27:06 +08:00
37f135744f 优化首页逻辑 2025-03-14 09:28:20 +08:00
49e62fa685 优化首页逻辑 2025-03-13 10:09:12 +08:00
e8bd7a00ec 增驾参数 2025-03-12 09:30:24 +08:00
5 changed files with 53 additions and 115 deletions

View File

@ -5,9 +5,9 @@
"name": "default", "name": "default",
"material": { "material": {
"certpath": "C:\\Users\\93218\\.ohos\\config\\openharmony\\auto_ohos_default_subject-two_com.oh.dts.cer", "certpath": "C:\\Users\\93218\\.ohos\\config\\openharmony\\auto_ohos_default_subject-two_com.oh.dts.cer",
"storePassword": "0000001A1DDAA4ACBCE726491F94C3AF56A2540582DD64F1D58054FCE4F27EB1EA3AB9254BF5C318282B", "storePassword": "0000001B6B286329D0B89755E137765E5E3EC92AFE4D235E753CC849068623687DD2FB932E88F0E1176076",
"keyAlias": "debugKey", "keyAlias": "debugKey",
"keyPassword": "0000001AD378A9170F3E15A274CD444FCF00FAF0839F218288C28EC15366295413D9CB4926E710B7AEE8", "keyPassword": "0000001B82C966539FBC43A53702ADEAB4BC43B1A454A0645D48C22CC3BCDD977F0F98415E532D6094CF4C",
"profile": "C:\\Users\\93218\\.ohos\\config\\openharmony\\auto_ohos_default_subject-two_com.oh.dts.p7b", "profile": "C:\\Users\\93218\\.ohos\\config\\openharmony\\auto_ohos_default_subject-two_com.oh.dts.p7b",
"signAlg": "SHA256withECDSA", "signAlg": "SHA256withECDSA",
"storeFile": "C:\\Users\\93218\\.ohos\\config\\openharmony\\auto_ohos_default_subject-two_com.oh.dts.p12" "storeFile": "C:\\Users\\93218\\.ohos\\config\\openharmony\\auto_ohos_default_subject-two_com.oh.dts.p12"

View File

@ -1,21 +1,26 @@
import systemTime from '@ohos.systemTime'; import systemTime from '@ohos.systemTime';
import { timeSynchronization } from '../../api/index' import { timeSynchronization } from '../../api/index'
import { dateFormat,dateVersionFormat } from '../utils/tools'; import { dateFormat, dateVersionFormat } from '../utils/tools';
//同步时时间 //同步时时间
export async function timeSynchronize() { export async function timeSynchronize() {
let date = new Date(); let date = new Date();
console.info('jiangsong1:timeSynchronization begin ' ); console.info('jiangsong1:timeSynchronization begin ');
let params = { time: dateFormat(date), deviceNo: globalThis.deviceNo,version:globalThis.version,judgeVersion:globalThis.judgeVersion} let params = {
let res:any = await timeSynchronization(params) time: dateFormat(date),
deviceNo: globalThis.deviceNo,
version: globalThis.version,
judgeVersion: globalThis.judgeVersion
}
let res: any = await timeSynchronization(params)
res = res.timeSynchronizationRsp; res = res.timeSynchronizationRsp;
globalThis.timeInfo=res.body globalThis.timeInfo = res.body
console.log('timeInfo',JSON.stringify(res.body)) console.log('timeInfo', JSON.stringify(res.body))
return res; return res;
} }
export async function setCurrentTime():Promise<void> { export async function setCurrentTime(): Promise<void> {
let res = await timeSynchronize(); let res = await timeSynchronize();
let currentTime = res.head.time; let currentTime = res.head.time;
let times = new Date(currentTime).getTime(); let times = new Date(currentTime).getTime();
@ -27,13 +32,13 @@ export async function setCurrentTime():Promise<void> {
// }).catch((error) => { // }).catch((error) => {
// console.info(`Failed to set time. message: ${error.message}, code: ${error.code}`); // console.info(`Failed to set time. message: ${error.message}, code: ${error.code}`);
// }); // });
} catch(e) { } catch (e) {
console.info(`Failed to set time. message: ${e.message}, code: ${e.code}`); console.info(`Failed to set time. message: ${e.message}, code: ${e.code}`);
} }
} }
//获取当前时间并转化 //获取当前时间并转化
export async function getCurrentTime():Promise<string> { export async function getCurrentTime(): Promise<string> {
const date = await systemTime.getDate(); const date = await systemTime.getDate();
const year = date.getFullYear(); const year = date.getFullYear();
let month = date.getMonth() + 1; let month = date.getMonth() + 1;
@ -55,7 +60,7 @@ export async function getCurrentTime():Promise<string> {
} }
//时间戳转日期 //时间戳转日期
export function formatTime(time:number):string { export function formatTime(time: number): string {
//@ts-ignore //@ts-ignore
const h = parseInt(time / 3600) const h = parseInt(time / 3600)
//@ts-ignore //@ts-ignore

View File

@ -4,6 +4,7 @@ import prompt from '@ohos.prompt';
import { tcpUtil } from './TcpRequest'; import { tcpUtil } from './TcpRequest';
import Prompt from '@system.prompt'; import Prompt from '@system.prompt';
import tempRequest from './tempRequest'; import tempRequest from './tempRequest';
import connection from '@ohos.net.connection';
export function tcpRequest<T>(req: any): Promise<T> { export function tcpRequest<T>(req: any): Promise<T> {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
@ -89,6 +90,17 @@ export function tcpRequest<T>(req: any): Promise<T> {
}) })
} }
function getNetWorkStatus() {
connection.getDefaultNet().then(handle => {
console.log("[http request] network handle", JSON.stringify(handle))
connection.getNetCapabilities(handle).then(res => {
console.log("[http request] network result", JSON.stringify(res))
})
}).catch(err => {
console.log("[http request] network error", JSON.stringify(err))
})
}
export default async function request<T>(req: any): Promise<T> { export default async function request<T>(req: any): Promise<T> {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
tempRequest(req).then((response) => { tempRequest(req).then((response) => {
@ -97,6 +109,8 @@ export default async function request<T>(req: any): Promise<T> {
}).catch(err => { }).catch(err => {
console.log("[http request] only http request error") console.log("[http request] only http request error")
reject(err) reject(err)
}).finally(() => {
getNetWorkStatus()
}) })
}) })
} }

View File

@ -23,8 +23,6 @@ import IdlServiceExtProxy from '../IdlServiceExt/idl_service_ext_proxy';
import Want from '@ohos.app.ability.Want'; import Want from '@ohos.app.ability.Want';
import emitter from '@ohos.events.emitter'; import emitter from '@ohos.events.emitter';
// import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements';
@Entry @Entry
@Component @Component
struct Index { struct Index {
@ -55,13 +53,9 @@ struct Index {
}), }),
customStyle: true, customStyle: true,
alignment: DialogAlignment.Center, alignment: DialogAlignment.Center,
}, })
)
private fileUtil: FileUtil
private interval = null; private interval = null;
// private vocObj = null;
private avPlayer private avPlayer
private workerInstance = null;
private context = getContext(this) as common.UIAbilityContext; private context = getContext(this) as common.UIAbilityContext;
private serviceExtProxy: IdlServiceExtProxy private serviceExtProxy: IdlServiceExtProxy
@ -114,14 +108,7 @@ struct Index {
imageBtn({ btnWidth: '28%', btnHeight: '71%', imgSrc: $r('app.media.index_lw') }) imageBtn({ btnWidth: '28%', btnHeight: '71%', imgSrc: $r('app.media.index_lw') })
.margin({ left: 80 * globalThis.ratio }) .margin({ left: 80 * globalThis.ratio })
.onClick(async () => { .onClick(async () => {
// this.vocObj.playAudio({
// type: 1,
// name: 'button_media.wav'
// })
// ||!this.initParamFlag
if (this.loading) { if (this.loading) {
// globalThis.title = '正在初始化请等待5s后重试'
// this.errorDialog.open()
return return
} }
setTimeout(() => { setTimeout(() => {
@ -130,29 +117,29 @@ struct Index {
this.angle = 0 this.angle = 0
if (!globalThis.timeInfo) { if (!globalThis.timeInfo) {
globalThis.type = '1' globalThis.type = '1'
globalThis.title = '时间同步接口连接失败' globalThis.title = '时间同步接口连接失败,尝试重新同步,请稍后'
this.errorDialog.open() this.errorDialog.open()
promptAction.showToast({ promptAction.showToast({
message: `时间同步接口连接失败`, message: `时间同步接口连接失败,尝试重新同步,请稍后`,
duration: 3000 duration: 3000
}); });
this.loading = false this.loading = false
await this.initParams()
return return
} }
if (!globalThis.carInfo) { if (!globalThis.carInfo) {
globalThis.type = '1'
globalThis.title = '车辆信息接口获取失败,尝试重新获取,请稍后'
this.errorDialog.open()
promptAction.showToast({ promptAction.showToast({
message: `车辆信息接口获取失败`, message: `车辆信息接口获取失败,尝试重新获取,请稍后`,
duration: 3000 duration: 3000
}); });
globalThis.type = '1'
globalThis.title = '车辆信息接口获取失败'
this.errorDialog.open()
this.loading = false this.loading = false
await this.initParams()
return return
} }
this.testXMLToJSONInWorker() this.testXMLToJSONInWorker()
}) })
} }
if (this.isSingle) { if (this.isSingle) {
@ -413,20 +400,6 @@ struct Index {
} }
async aboutToAppear() { async aboutToAppear() {
// setInterval(() => {
// let date = new Date();
// console.info('jiangsong1:timeSynchronization begin ');
// uploadProgressData()
// let params = {
// time: dateFormat(date),
// deviceNo: globalThis.deviceNo,
// version: globalThis.version,
// judgeVersion: globalThis.judgeVersion
// }
// timeSynchronizationHTTP(params)
// }, 1000)
console.log('diyidiy')
emitter.on({ emitter.on({
eventId: 1 eventId: 1
}, async () => { }, async () => {
@ -544,47 +517,6 @@ struct Index {
} }
}) })
// workerInstance.postMessage(param);
// workerInstance.onmessage = (e: MessageEvents): void => {
// console.log("baoyihu after postMessage :", JSON.stringify(e.data));
// // @ts-ignore
// let workData: WorkData = e.data;
// this.loading = false
// if (workData.isComplete) {
// if(globalThis.singlePlay){
// router.pushUrl({
// url: 'pages/UserInfo',
// }, router.RouterMode.Single)
// return
// }
// getSyncData('MA_SYSSET').then(data => {
// console.log('datadata', JSON.stringify(data))
// // @ts-ignore
// data.forEach(sys => {
// //判断是否能点开始考试
// if(sys.v_no === '854'){
// globalThis.param854Str=sys.v_value
// }
// if (sys.v_no === '824'&&decodeURIComponent(sys.v_value)=='0') {
// // this.Param612Str= decodeURIComponent(sys.v_value)
// router.pushUrl({
// url:'pages/CarCheck',
// params: {
// 'fromIndex':true
// }
// }, router.RouterMode.Single)
// }else{
// router.pushUrl({
// url: 'pages/ExaminerLogin',
// }, router.RouterMode.Single)
// }
// })
// });
//
// }
// workerInstance.terminate();
//
// }
} }
async heartMsg() { async heartMsg() {
@ -610,7 +542,6 @@ struct Index {
} }
async onPageShow() { async onPageShow() {
console.log('ttttt', 1111)
await this.userAuth(); await this.userAuth();
console.log('globalThis.singlePlay', globalThis.singlePlay) console.log('globalThis.singlePlay', globalThis.singlePlay)
if (globalThis.singlePlay == undefined || globalThis.singlePlay == null) { if (globalThis.singlePlay == undefined || globalThis.singlePlay == null) {
@ -680,12 +611,9 @@ struct Index {
} }
async initParams() { async initParams() {
// deleteAllFIleLog(GlobalConfig.comoonfileWriteAddress + '/PLC/')
//设置plc udp 同步requesthost
await getUDP(this.context, false) await getUDP(this.context, false)
this.loading = false this.loading = false
await getDeviceInfo(this.context) await getDeviceInfo(this.context)
await getCarInfo() await getCarInfo()
await getUDP2(this.context, false) await getUDP2(this.context, false)
getTCP() getTCP()
@ -715,15 +643,6 @@ struct Index {
} }
}, 1000) }, 1000)
this.createAlbum() this.createAlbum()
// clearInterval(globalThis.demo)
// globalThis.demo= setInterval(()=>{
// const str= {"carId":"1062","examinationRoomId":"2","videoVersion":"1.0","judgeVersion":"2023.09.30.1","shellVersion":"2023.12.13.01","host":"http://172.37.55.191:8082"}
// initialization(str)
// },10000)
//下载模型
// await this.getModel()
// const arr = [0x55, 0xaa, 0x01, 0x00, 0x02, 0x01, 0x03, 0x00]
// globalThis.udpClientByTopLine.sendMsg(Array2Byte(arr).buffer)
} }
async getModel() { async getModel() {

View File

@ -1,15 +1,15 @@
-----BEGIN CERTIFICATE----- -----BEGIN CERTIFICATE-----
MIICFTCCAZugAwIBAgIIGq+f00ke04IwCgYIKoZIzj0EAwMwYzELMAkGA1UEBhMC MIICFTCCAZygAwIBAgIJAJsRE03JjrGjMAoGCCqGSM49BAMDMGMxCzAJBgNVBAYT
Q04xFDASBgNVBAoTC09wZW5IYXJtb255MRkwFwYDVQQLExBPcGVuSGFybW9ueSBU AkNOMRQwEgYDVQQKEwtPcGVuSGFybW9ueTEZMBcGA1UECxMQT3Blbkhhcm1vbnkg
ZWFtMSMwIQYDVQQDExpPcGVuSGFybW9ueSBBcHBsaWNhdGlvbiBDQTAeFw0yNTAz VGVhbTEjMCEGA1UEAxMaT3Blbkhhcm1vbnkgQXBwbGljYXRpb24gQ0EwHhcNMjUw
MDUwNjM2NTBaFw0zNTAzMDMwNjM2NTBaMEoxFTATBgNVBAMMDGlkZV9kZW1vX2Fw MzE4MDkyNzUwWhcNMzUwMzE2MDkyNzUwWjBKMRUwEwYDVQQDDAxpZGVfZGVtb19h
cDENMAsGA1UECxMEVW5pdDEVMBMGA1UEChMMT3JnYW5pemF0aW9uMQswCQYDVQQG cHAxDTALBgNVBAsTBFVuaXQxFTATBgNVBAoTDE9yZ2FuaXphdGlvbjELMAkGA1UE
EwJDTjBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABE7n4JhN2eaSkLl7n4xFpDJL BhMCQ04wWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAASjsgYkPrya0djVCUL+/VkM
ilA9I8KIfLH8SRDUkPrXf2wJMmMtuoVVF5GJeg1PEWCtO/MnyW9bWSVS7yfjNkyj xCkyWvQDx9RCh6+Ao0Wy5eqz8FRyf9U488Nr+cl7e6AZXtWAFIcyVaO7fiiH3SRR
UjBQMB0GA1UdDgQWBBRI3RnNQafzo9IPcVxr3ojATJSILTAOBgNVHQ8BAf8EBAMC o1IwUDAdBgNVHQ4EFgQUqvy4ps0Cxq1Vc0JJApd5bGCYuaAwDgYDVR0PAQH/BAQD
B4AwHwYDVR0jBBgwFoAU24a3IhbVC6FLt90le7nxBX2iLUcwCgYIKoZIzj0EAwMD AgeAMB8GA1UdIwQYMBaAFNuGtyIW1QuhS7fdJXu58QV9oi1HMAoGCCqGSM49BAMD
aAAwZQIxANvofcfVoWsL2NZJtI1wpWSIJDTcgZCo09raKGJKx2TlYgh3nJkBzBEh A2cAMGQCMDKcLnkiXSuvLjIQyhOq7wnWo9ObxlcqBajieyv4vZiCf90h58KQHfFN
IWwDsdUBZQIwI6ldAid/nCS8IcipHo8LmwJql8sIZ1BdRECQdkLK+yfzni/Kmy14 rvIdAFQfhwIwV3FJqf1/pNueUg5417N3Dm05QrzMtrnDOaf0gSGTuQSu9LHCaKhq
77svjX/mmH4f nGU1PJErkcGu
-----END CERTIFICATE----- -----END CERTIFICATE-----
843EBF354F774A955869BD3344B657552D16C547E46E1F6CEDCB79CEF80628A4 331EC6F78C0039676593BE2FBC4BBC6BD25651900D97CDA9DC5D16C896FC9614