fix: 优化类型
This commit is contained in:
parent
f7156afd7a
commit
00ed6c8d02
@ -0,0 +1,5 @@
|
||||
export interface DeviceParamType {
|
||||
time: string;
|
||||
deviceName: string;
|
||||
type: string;
|
||||
}
|
||||
@ -4,4 +4,6 @@ export * from "./Table"
|
||||
|
||||
export * from "./Common"
|
||||
|
||||
export * from "./Judge"
|
||||
export * from "./Judge"
|
||||
|
||||
export * from "./Register"
|
||||
@ -5,6 +5,7 @@ import deviceManager from '@ohos.distributedHardware.deviceManager'
|
||||
import promptAction from '@ohos.promptAction'
|
||||
import FileUtil from '../common/utils/File'
|
||||
import common from '@ohos.app.ability.common'
|
||||
import { DeviceParamType } from '../model'
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
@ -14,7 +15,6 @@ struct Index {
|
||||
@State deviceNo: string = ''
|
||||
@State deviceName: string = ''
|
||||
@State checked: string = '0'
|
||||
@State net: any = ''
|
||||
@State plateNo: string = ''
|
||||
@State @Watch('outClick') outFlag: boolean = false;
|
||||
@State subType: string = '2';
|
||||
@ -24,14 +24,13 @@ struct Index {
|
||||
// this.plateNo=globalThis.carInfo.plateNo
|
||||
console.log('createDeviceManagerstart')
|
||||
try {
|
||||
deviceManager.createDeviceManager('com.oh.dts', (error, value) => {
|
||||
deviceManager.createDeviceManager('com.oh.dts', (error: string, value: deviceManager.DeviceManager) => {
|
||||
if (error) {
|
||||
console.error('createDeviceManager failed.');
|
||||
return;
|
||||
}
|
||||
let dvMgrObj = value;
|
||||
this.deviceName = dvMgrObj.getLocalDeviceInfoSync().deviceName
|
||||
this.deviceNo = dvMgrObj.getLocalDeviceInfoSync().deviceId.substring(0, 10).toUpperCase()
|
||||
this.deviceName = value.getLocalDeviceInfoSync().deviceName
|
||||
this.deviceNo = value.getLocalDeviceInfoSync().deviceId.substring(0, 10).toUpperCase()
|
||||
this.ip = 'MAC-' + this.deviceNo
|
||||
globalThis.deviceNo = 'MAC-' + this.deviceNo
|
||||
});
|
||||
@ -117,7 +116,7 @@ struct Index {
|
||||
|
||||
async registrationDeviceNoFn() {
|
||||
const date = new Date()
|
||||
const param = {
|
||||
const param: DeviceParamType = {
|
||||
time: dateFormat(date),
|
||||
deviceName: this.ip,
|
||||
type: '1'
|
||||
@ -128,11 +127,9 @@ struct Index {
|
||||
globalThis.deviceNo = this.ip
|
||||
console.log('globalThis.deviceNo', globalThis.deviceNo)
|
||||
// upDateTableByArray('DeviceInfoTable', [{ deviceId: this.ip }])
|
||||
registrationDeviceNo(param).then(res => {
|
||||
// @ts-ignore
|
||||
registrationDeviceNo(param).then((res: ESObject) => {
|
||||
if (res.registrationDeviceNoRsp.head.resultCode == '0') {
|
||||
promptAction.showToast({
|
||||
// @ts-ignore
|
||||
message: decodeURIComponent(res.registrationDeviceNoRsp.head.resultMessage),
|
||||
duration: 3000
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user