fix: 首页问题修复
This commit is contained in:
parent
b1dfddda46
commit
636ba1fb15
@ -53,8 +53,8 @@ export default class EntryAbility extends UIAbility {
|
||||
AppStorage.setOrCreate<string>('deviceNo', "") //设备号
|
||||
AppStorage.setOrCreate<BaseInfoType>('baseInfo', {
|
||||
hasAuth: false,
|
||||
version: GlobalConfig.version.jn.km3[0] || "",
|
||||
judgeVersion: GlobalConfig.version.jn.km3[1] || "",
|
||||
version: GlobalConfig.version.sz.km2[0] || "",
|
||||
judgeVersion: GlobalConfig.version.sz.km2[1] || "",
|
||||
tcpSendNum: 0,
|
||||
videoVersion: '1.0',
|
||||
ratio: width / height, //适配比例
|
||||
@ -65,7 +65,7 @@ export default class EntryAbility extends UIAbility {
|
||||
|
||||
AppStorage.setOrCreate('windowClass', windowClass)
|
||||
await windowClass.setWindowLayoutFullScreen(true)
|
||||
await windowClass.setWindowSystemBarEnable([]) //全屏
|
||||
// await windowClass.setWindowSystemBarEnable([]) //全屏
|
||||
windowStage.loadContent('pages/Index', (err, data) => {
|
||||
if (err.code) {
|
||||
hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { DrvexamType } from '.';
|
||||
import { CarInfoType, DrvexamType } from '.';
|
||||
|
||||
// -----new-----
|
||||
export interface ApiResponseType {
|
||||
@ -85,7 +85,7 @@ interface ObtainCarExamInfoRsp {
|
||||
body?: ObtainCarExamInfoRspBody
|
||||
}
|
||||
|
||||
export interface ObtainCarExamInfoRspBody {
|
||||
export interface ObtainCarExamInfoRspBody extends CarInfoType {
|
||||
carId: string;
|
||||
carIp: string;
|
||||
carNo: string;
|
||||
|
||||
@ -186,14 +186,14 @@ struct Index {
|
||||
async initParams() {
|
||||
console.log("test1111")
|
||||
ObtainUdpBusinessInstance.init();
|
||||
await GetCarInfo()
|
||||
await GetDeviceInfo(this.context)
|
||||
this.carInfo = await GetCarInfo()
|
||||
CenterUDPBusinessInstance.init();
|
||||
CenterUDPBusinessInstance.onMsg((data: centerCallBackMsgType) => {
|
||||
if (data.id == 32) {
|
||||
AppStorage.setOrCreate('signNum', data.body[1])
|
||||
}
|
||||
},)
|
||||
await GetDeviceInfo(this.context)
|
||||
this.carInfo = AppStorage.get<CarInfoType>('carInfo')!
|
||||
this.deviceId = this.carInfo.carNo || ""
|
||||
await SetCurrentTime()
|
||||
@ -225,11 +225,12 @@ struct Index {
|
||||
this.onlineExam()
|
||||
}
|
||||
})
|
||||
|
||||
BottomMessageComponent({
|
||||
version: this.baseInfo.version,
|
||||
judgeVersion: this.baseInfo.judgeVersion,
|
||||
hasAuth: this.baseInfo.hasAuth,
|
||||
examCarNumber: this.baseInfo.deviceNo,
|
||||
examCarNumber: this.deviceId,
|
||||
versionClick: () => {
|
||||
this.singlePlay = !this.singlePlay
|
||||
AppStorage.setOrCreate('singlePlay', this.singlePlay)
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
@Component
|
||||
export default struct BottomMessageComponent {
|
||||
@State version: string = ""
|
||||
@State judgeVersion: string = ""
|
||||
@State hasAuth: boolean = false
|
||||
@State examCarNumber: string = ""
|
||||
@Prop version: string = ""
|
||||
@Prop judgeVersion: string = ""
|
||||
@Prop hasAuth: boolean
|
||||
@Prop examCarNumber: string
|
||||
versionClick?: () => void
|
||||
|
||||
build() {
|
||||
@ -16,7 +16,7 @@ export default struct BottomMessageComponent {
|
||||
Column() {
|
||||
Text('V外壳:' + this.version).textCommonStyle()
|
||||
Text('V评判:' + this.judgeVersion).textCommonStyle()
|
||||
Text("授权信息:" + this.hasAuth ? "已授权" : "未授权").textCommonStyle()
|
||||
Text('授权信息:' + (this.hasAuth ? "已授权" : "未授权")).textCommonStyle()
|
||||
}.gesture(
|
||||
GestureGroup(GestureMode.Exclusive,
|
||||
TapGesture({ count: 2 })
|
||||
@ -27,7 +27,7 @@ export default struct BottomMessageComponent {
|
||||
)
|
||||
|
||||
Text("考车号: " + this.examCarNumber).textCommonStyle()
|
||||
}
|
||||
}.width("100%")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -5,6 +5,7 @@ import {
|
||||
ApiResponseType,
|
||||
BaseInfoType,
|
||||
CarConfigurationParamsType,
|
||||
CarInfoType,
|
||||
ObtainCarExamInfoParams,
|
||||
ObtainCarExamInfoRspBody,
|
||||
TimeSynchronizationParams,
|
||||
@ -24,23 +25,22 @@ export async function GetDeviceInfo(context: common.UIAbilityContext): Promise<s
|
||||
return new Promise(async (resolve, reject) => {
|
||||
const fileUtil = new FileUtils(context)
|
||||
const data = await fileUtil.readFile(GlobalConfig.commonFileWriteAddress + '/config/deviceNo.txt');
|
||||
if (data === '' || data === undefined) {
|
||||
if (!data) {
|
||||
Prompt.showToast({
|
||||
message: "请先进行设备注册!",
|
||||
duration: 3000
|
||||
})
|
||||
AppStorage.setOrCreate('type', 1)
|
||||
AppStorage.setOrCreate('title', '请先进行设备注册')
|
||||
resolve("")
|
||||
} else {
|
||||
const fileData: CarConfigurationParamsType = JSON.parse(data)
|
||||
console.log("获取设备号", fileData.deviceName)
|
||||
AppStorage.setOrCreate('deviceNo', fileData.deviceName)
|
||||
resolve(fileData.deviceName)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export async function GetCarInfo() {
|
||||
export async function GetCarInfo(): Promise<CarInfoType> {
|
||||
let date = new Date();
|
||||
let params: ObtainCarExamInfoParams = {
|
||||
time: dayTs(date).format("YYYY-MM-DD HH:mm:ss"),
|
||||
@ -52,7 +52,9 @@ export async function GetCarInfo() {
|
||||
const carInfo: ObtainCarExamInfoRspBody = res?.obtainCarExamInfoRsp?.body!
|
||||
carInfo.plateNo = decodeURIComponent(carInfo.plateNo)
|
||||
AppStorage.setOrCreate('carInfo', carInfo)
|
||||
return carInfo
|
||||
}
|
||||
return {}
|
||||
}
|
||||
|
||||
// 获取授权
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user