提交 b6780df2 编写于 作者: D DCloud_LXH

fix(app): 兼容 osName

上级 b171bd37
...@@ -26,6 +26,7 @@ export const getDeviceInfo = defineSyncApi<typeof uni.getDeviceInfo>( ...@@ -26,6 +26,7 @@ export const getDeviceInfo = defineSyncApi<typeof uni.getDeviceInfo>(
} = systemInfo } = systemInfo
const brand = deviceBrand.toLowerCase() const brand = deviceBrand.toLowerCase()
const _osName = osName.toLowerCase()
return { return {
deviceBrand: brand, deviceBrand: brand,
...@@ -36,8 +37,8 @@ export const getDeviceInfo = defineSyncApi<typeof uni.getDeviceInfo>( ...@@ -36,8 +37,8 @@ export const getDeviceInfo = defineSyncApi<typeof uni.getDeviceInfo>(
deviceType, deviceType,
brand, brand,
model: deviceModel, model: deviceModel,
system: `${osName === 'ios' ? 'iOS' : 'Android'} ${osVersion}`, system: `${_osName === 'ios' ? 'iOS' : 'Android'} ${osVersion}`,
platform: osName, platform: _osName,
} }
} }
) )
...@@ -92,6 +93,7 @@ export const getSystemInfoSync = defineSyncApi<typeof uni.getSystemInfoSync>( ...@@ -92,6 +93,7 @@ export const getSystemInfoSync = defineSyncApi<typeof uni.getSystemInfoSync>(
_initSystemInfo = true _initSystemInfo = true
const { osName, osLanguage, osVersion } = systemInfo const { osName, osLanguage, osVersion } = systemInfo
const _osName = osName.toLowerCase()
const osLanguageSplit = osLanguage.split('-') const osLanguageSplit = osLanguage.split('-')
const osLanguageSplitLast = osLanguageSplit[osLanguageSplit.length - 1] const osLanguageSplitLast = osLanguageSplit[osLanguageSplit.length - 1]
let _osLanguage = `${osLanguageSplit[0]}${ let _osLanguage = `${osLanguageSplit[0]}${
...@@ -104,10 +106,11 @@ export const getSystemInfoSync = defineSyncApi<typeof uni.getSystemInfoSync>( ...@@ -104,10 +106,11 @@ export const getSystemInfoSync = defineSyncApi<typeof uni.getSystemInfoSync>(
uniCompileVersion: __uniConfig.compilerVersion, uniCompileVersion: __uniConfig.compilerVersion,
uniRuntimeVersion: __uniConfig.compilerVersion, uniRuntimeVersion: __uniConfig.compilerVersion,
osLanguage: _osLanguage, osLanguage: _osLanguage,
osName: _osName,
} }
if (osName === 'ios') { if (_osName === 'ios') {
;(extraData as any).romName = osName ;(extraData as any).romName = _osName
;(extraData as any).romVersion = osVersion ;(extraData as any).romVersion = osVersion
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册