From 2087470a5145709781706daf108eed7ff6708013 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=A8=E7=9B=BC-=E6=B7=B1=E8=93=9D-=E9=B8=BF=E8=92=99?= Date: Mon, 1 Jul 2024 14:11:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=86=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E7=9A=84=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/ets/utils/DeviceUtil.ets | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/harmony_utils/src/main/ets/utils/DeviceUtil.ets b/harmony_utils/src/main/ets/utils/DeviceUtil.ets index 3112f12..b3980f0 100644 --- a/harmony_utils/src/main/ets/utils/DeviceUtil.ets +++ b/harmony_utils/src/main/ets/utils/DeviceUtil.ets @@ -5,6 +5,7 @@ import { StrUtil } from './StrUtil'; import { AssetStore } from './other/AssetStore'; import { PreferencesUtil } from './PreferencesUtil'; import { RandomUtil } from './RandomUtil'; +import deviceinfo from '@ohos.deviceInfo'; /** * 设备相关工具类 @@ -172,4 +173,27 @@ export class DeviceUtil { } + /** + * 获取当前鸿蒙os版本号 + * @returns + */ + static getDeviceOsVersion() { + return deviceinfo.osFullName + } + + /** + * 设备品牌名称 + * @returns + */ + static getDeviceBrand() { + return deviceinfo.brand + } + + /** + * 设备认证型号 + * @returns + */ + static getDeviceProductModel() { + return deviceinfo.productModel + } } \ No newline at end of file -- Gitee