Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MuGuiLin
uni-app
提交
347c3825
U
uni-app
项目概览
MuGuiLin
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
347c3825
编写于
5月 27, 2022
作者:
D
DCloud_LXH
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore: lint
上级
0bb4e07d
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
16 addition
and
16 deletion
+16
-16
src/platforms/mp-weixin/helpers/enhance-system-info.js
src/platforms/mp-weixin/helpers/enhance-system-info.js
+9
-9
src/platforms/mp-weixin/helpers/get-app-base-info.js
src/platforms/mp-weixin/helpers/get-app-base-info.js
+1
-1
src/platforms/mp-weixin/helpers/get-device-info.js
src/platforms/mp-weixin/helpers/get-device-info.js
+4
-4
src/platforms/mp-weixin/helpers/get-window-info.js
src/platforms/mp-weixin/helpers/get-window-info.js
+2
-2
未找到文件。
src/platforms/mp-weixin/helpers/enhance-system-info.js
浏览文件 @
347c3825
function
_getDeviceBrand
(
model
)
{
function
_getDeviceBrand
(
model
)
{
if
(
/iphone/gi
.
test
(
model
)
||
/ipad/gi
.
test
(
model
)
||
/mac/gi
.
test
(
model
))
{
return
'
apple
'
}
if
(
/windows/gi
.
test
(
model
))
{
return
'
microsoft
'
}
return
''
...
...
@@ -6,7 +6,7 @@ function _getDeviceBrand(model) {
const
UUID_KEY
=
'
__DC_STAT_UUID
'
let
deviceId
export
function
useDeviceId
(
result
)
{
export
function
useDeviceId
(
result
)
{
deviceId
=
deviceId
||
__GLOBAL__
.
getStorageSync
(
UUID_KEY
)
if
(
!
deviceId
)
{
deviceId
=
Date
.
now
()
+
''
+
Math
.
floor
(
Math
.
random
()
*
1
e7
)
...
...
@@ -18,7 +18,7 @@ export function useDeviceId(result) {
result
.
deviceId
=
deviceId
}
export
function
addSafeAreaInsets
(
result
)
{
export
function
addSafeAreaInsets
(
result
)
{
if
(
result
.
safeArea
)
{
const
safeArea
=
result
.
safeArea
result
.
safeAreaInsets
=
{
...
...
@@ -30,7 +30,7 @@ export function addSafeAreaInsets(result) {
}
}
export
function
populateParameters
(
result
)
{
export
function
populateParameters
(
result
)
{
const
{
brand
=
''
,
model
=
''
,
system
=
''
,
language
=
''
,
theme
,
version
,
...
...
@@ -60,10 +60,10 @@ export function populateParameters(result) {
}
// deviceType
le
t
deviceType
=
getGetDeviceType
(
result
,
model
)
cons
t
deviceType
=
getGetDeviceType
(
result
,
model
)
// deviceModel
le
t
deviceBrand
=
getDeviceBrand
(
brand
,
model
,
isQuickApp
)
cons
t
deviceBrand
=
getDeviceBrand
(
brand
,
model
,
isQuickApp
)
// hostName
let
_hostName
=
hostName
||
__PLATFORM__
.
split
(
'
-
'
)[
1
]
// mp-jd
...
...
@@ -128,7 +128,7 @@ export function populateParameters(result) {
Object
.
assign
(
result
,
parameters
)
}
export
function
getGetDeviceType
(
result
,
model
)
{
export
function
getGetDeviceType
(
result
,
model
)
{
let
deviceType
=
result
.
deviceType
||
'
phone
'
if
(
__PLATFORM__
!==
'
mp-baidu
'
)
{
const
deviceTypeMaps
=
{
...
...
@@ -149,7 +149,7 @@ export function getGetDeviceType(result, model) {
return
deviceType
}
export
function
getDeviceBrand
(
export
function
getDeviceBrand
(
brand
,
model
,
isQuickApp
=
false
...
...
@@ -165,4 +165,4 @@ export function getDeviceBrand(
deviceBrand
=
_getDeviceBrand
(
deviceBrand
)
}
return
deviceBrand
}
\ No newline at end of file
}
src/platforms/mp-weixin/helpers/get-app-base-info.js
浏览文件 @
347c3825
...
...
@@ -18,7 +18,7 @@ export default {
appId
:
process
.
env
.
UNI_APP_ID
,
appName
:
process
.
env
.
UNI_APP_NAME
,
appVersion
:
process
.
env
.
UNI_APP_VERSION_NAME
,
appVersionCode
:
process
.
env
.
UNI_APP_VERSION_CODE
,
appVersionCode
:
process
.
env
.
UNI_APP_VERSION_CODE
})
}
}
src/platforms/mp-weixin/helpers/get-device-info.js
浏览文件 @
347c3825
import
{
useDeviceId
,
getGetDeviceType
,
getDeviceBrand
}
from
'
./enhance-system-info
'
;
import
{
useDeviceId
,
getGetDeviceType
,
getDeviceBrand
}
from
'
./enhance-system-info
'
export
default
{
returnValue
:
function
(
result
)
{
const
{
brand
,
model
}
=
result
le
t
deviceType
=
getGetDeviceType
(
result
,
model
)
le
t
deviceBrand
=
getDeviceBrand
(
brand
,
model
)
cons
t
deviceType
=
getGetDeviceType
(
result
,
model
)
cons
t
deviceBrand
=
getDeviceBrand
(
brand
,
model
)
useDeviceId
(
result
)
Object
.
assign
(
result
,
{
deviceType
,
deviceBrand
,
deviceModel
:
model
,
deviceModel
:
model
})
}
}
src/platforms/mp-weixin/helpers/get-window-info.js
浏览文件 @
347c3825
import
{
addSafeAreaInsets
}
from
'
./enhance-system-info
'
;
import
{
addSafeAreaInsets
}
from
'
./enhance-system-info
'
export
default
{
returnValue
:
function
(
result
)
{
...
...
@@ -6,7 +6,7 @@ export default {
Object
.
assign
(
result
,
{
windowTop
:
0
,
windowBottom
:
0
,
windowBottom
:
0
})
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录