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