Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
ripplebb
uni-app
提交
682673ee
U
uni-app
项目概览
ripplebb
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
682673ee
编写于
5月 12, 2022
作者:
Q
qiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore: build
上级
6d7321a5
变更
17
展开全部
隐藏空白更改
内联
并排
Showing
17 changed file
with
1030 addition
and
133 deletion
+1030
-133
packages/uni-app-plus/dist/index.v3.js
packages/uni-app-plus/dist/index.v3.js
+108
-85
packages/uni-app-plus/dist/view.css
packages/uni-app-plus/dist/view.css
+1
-1
packages/uni-app-plus/dist/view.umd.min.js
packages/uni-app-plus/dist/view.umd.min.js
+2
-2
packages/uni-h5/dist/index.css
packages/uni-h5/dist/index.css
+1
-1
packages/uni-h5/dist/index.umd.min.js
packages/uni-h5/dist/index.umd.min.js
+1
-1
packages/uni-mp-alipay/dist/index.js
packages/uni-mp-alipay/dist/index.js
+93
-12
packages/uni-mp-baidu/dist/index.js
packages/uni-mp-baidu/dist/index.js
+72
-3
packages/uni-mp-jd/dist/index.js
packages/uni-mp-jd/dist/index.js
+115
-5
packages/uni-mp-kuaishou/dist/index.js
packages/uni-mp-kuaishou/dist/index.js
+84
-3
packages/uni-mp-lark/dist/index.js
packages/uni-mp-lark/dist/index.js
+76
-3
packages/uni-mp-qq/dist/index.js
packages/uni-mp-qq/dist/index.js
+84
-3
packages/uni-mp-toutiao/dist/index.js
packages/uni-mp-toutiao/dist/index.js
+76
-3
packages/uni-mp-weixin/dist/index.js
packages/uni-mp-weixin/dist/index.js
+84
-3
packages/uni-mp-xhs/dist/index.js
packages/uni-mp-xhs/dist/index.js
+115
-5
packages/uni-quickapp-native/dist/vue.dev.js
packages/uni-quickapp-native/dist/vue.dev.js
+1
-1
packages/uni-quickapp-native/dist/vue.prod.js
packages/uni-quickapp-native/dist/vue.prod.js
+1
-1
packages/uni-quickapp-webview/dist/index.js
packages/uni-quickapp-webview/dist/index.js
+116
-1
未找到文件。
packages/uni-app-plus/dist/index.v3.js
浏览文件 @
682673ee
...
...
@@ -259,7 +259,9 @@ var serviceContext = (function () {
'unPreloadPage',
'loadSubPackage',
'sendHostEvent',
'navigateToMiniProgram'
'navigateToMiniProgram',
'getLaunchOptionsSync',
'getEnterOptionsSync'
];
const ad = [
...
...
@@ -6390,9 +6392,12 @@ var serviceContext = (function () {
}
function getSystemInfo () {
const platform = plus.os.name.toLowerCase();
const ios = platform === 'ios';
const isAndroid = platform === 'android';
const { getSystemInfoSync } = weex.requireModule('plus');
const info = getSystemInfoSync();
const { deviceBrand, deviceModel, osName, osVersion, osLanguage } = info;
const brand = deviceBrand.toLowerCase();
const _osName = osName.toLowerCase();
const ios = _osName === 'ios';
const {
screenWidth,
screenHeight
...
...
@@ -6448,21 +6453,21 @@ var serviceContext = (function () {
height: windowHeightReal - safeAreaInsets.top - safeAreaInsets.bottom
};
return {
return
Object.assign(
{
errMsg: 'getSystemInfo:ok',
brand:
plus.device.vendor
,
model:
plus.device.m
odel,
brand:
brand
,
model:
deviceM
odel,
pixelRatio: plus.screen.scale,
screenWidth,
screenHeight,
windowWidth,
windowHeight,
statusBarHeight,
language:
plus.os.l
anguage,
system: `${
ios ? 'iOS' : isAndroid ? 'Android' : ''} ${plus.os.v
ersion}`,
language:
osL
anguage,
system: `${
osName} ${osV
ersion}`,
version: plus.runtime.innerVersion,
fontSizeSetting: '',
platform,
platform
: _osName
,
SDKVersion: '',
windowTop,
windowBottom,
...
...
@@ -6474,7 +6479,10 @@ var serviceContext = (function () {
left: safeAreaInsets.left
},
deviceId: deviceId$1()
}
}, info, {
deviceBrand: brand,
osName: _osName
})
}
function vibrateLong () {
...
...
@@ -8831,6 +8839,93 @@ var serviceContext = (function () {
);
}
const extend = Object.assign;
function createLaunchOptions () {
return {
path: '',
query: {},
scene: 1001,
referrerInfo: {
appId: '',
extraData: {}
}
}
}
const enterOptions = createLaunchOptions();
const launchOptions = createLaunchOptions();
function getLaunchOptions () {
return launchOptions
}
function getEnterOptions () {
return enterOptions
}
function initEnterOptions ({
path,
query,
referrerInfo
}) {
extend(enterOptions, {
path,
query: query ? parseQuery(query) : {},
referrerInfo: referrerInfo || {}
});
}
function initLaunchOptions ({
path,
query,
referrerInfo
}) {
extend(launchOptions, {
path,
query: query ? parseQuery(query) : {},
referrerInfo: referrerInfo || {},
channel: plus.runtime.channel,
launcher: plus.runtime.launcher
});
extend(enterOptions, launchOptions);
return launchOptions
}
function parseRedirectInfo () {
const weexPlus = weex.requireModule('plus');
if (weexPlus.getRedirectInfo) {
const {
path,
query,
extraData,
userAction,
fromAppid
} =
weexPlus.getRedirectInfo() || {};
const referrerInfo = {
appId: fromAppid,
extraData: {}
};
if (extraData) {
referrerInfo.extraData = extraData;
}
return {
path: path || '',
query: query ? '?' + query : '',
referrerInfo,
userAction
}
}
}
function getLaunchOptionsSync () {
return getLaunchOptions()
}
function getEnterOptionsSync () {
return getEnterOptions()
}
const VD_SYNC_VERSION = 2;
const PAGE_CREATE = 2;
...
...
@@ -9886,80 +9981,6 @@ var serviceContext = (function () {
return pageVm
}
const extend = Object.assign;
function createLaunchOptions () {
return {
path: '',
query: {},
scene: 1001,
referrerInfo: {
appId: '',
extraData: {}
}
}
}
const enterOptions = createLaunchOptions();
const launchOptions = createLaunchOptions();
function getEnterOptions () {
return enterOptions
}
function initEnterOptions ({
path,
query,
referrerInfo
}) {
extend(enterOptions, {
path,
query: query ? parseQuery(query) : {},
referrerInfo: referrerInfo || {}
});
}
function initLaunchOptions ({
path,
query,
referrerInfo
}) {
extend(launchOptions, {
path,
query: query ? parseQuery(query) : {},
referrerInfo: referrerInfo || {}
});
extend(enterOptions, launchOptions);
return launchOptions
}
function parseRedirectInfo () {
const weexPlus = weex.requireModule('plus');
if (weexPlus.getRedirectInfo) {
const {
path,
query,
extraData,
userAction,
fromAppid
} =
weexPlus.getRedirectInfo() || {};
const referrerInfo = {
appId: fromAppid,
extraData: {}
};
if (extraData) {
referrerInfo.extraData = extraData;
}
return {
path: path || '',
query: query ? '?' + query : '',
referrerInfo,
userAction
}
}
}
let isInitEntryPage = false;
function initEntryPage () {
...
...
@@ -12060,6 +12081,8 @@ var serviceContext = (function () {
loadSubPackage: loadSubPackage$2,
sendHostEvent: sendHostEvent,
navigateToMiniProgram: navigateToMiniProgram,
getLaunchOptionsSync: getLaunchOptionsSync,
getEnterOptionsSync: getEnterOptionsSync,
navigateBack: navigateBack$1,
navigateTo: navigateTo$1,
reLaunch: reLaunch$1,
...
...
packages/uni-app-plus/dist/view.css
浏览文件 @
682673ee
此差异已折叠。
点击以展开。
packages/uni-app-plus/dist/view.umd.min.js
浏览文件 @
682673ee
此差异已折叠。
点击以展开。
packages/uni-h5/dist/index.css
浏览文件 @
682673ee
此差异已折叠。
点击以展开。
packages/uni-h5/dist/index.umd.min.js
浏览文件 @
682673ee
此差异已折叠。
点击以展开。
packages/uni-mp-alipay/dist/index.js
浏览文件 @
682673ee
...
...
@@ -636,6 +636,98 @@ function removeStorageSync (key) {
})
}
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
'
}
}
function
addSafeAreaInsets
(
result
)
{
if
(
result
.
safeArea
)
{
const
safeArea
=
result
.
safeArea
;
result
.
safeAreaInsets
=
{
top
:
safeArea
.
top
,
left
:
safeArea
.
left
,
right
:
result
.
windowWidth
-
safeArea
.
right
,
bottom
:
result
.
screenHeight
-
safeArea
.
bottom
};
}
}
function
populateParameters
(
result
)
{
const
{
brand
,
model
,
system
,
language
,
theme
,
version
,
hostName
=
''
,
platform
}
=
result
;
const
isQuickApp
=
"
mp-alipay
"
.
indexOf
(
'
quickapp-webview
'
)
!==
-
1
;
// osName osVersion
let
osName
=
''
;
let
osVersion
=
''
;
{
osName
=
platform
;
osVersion
=
system
;
}
let
hostVersion
=
version
;
// deviceType
let
deviceType
=
result
.
deviceType
||
'
phone
'
;
{
const
deviceTypeMaps
=
{
ipad
:
'
pad
'
,
windows
:
'
pc
'
,
mac
:
'
pc
'
};
const
deviceTypeMapsKeys
=
Object
.
keys
(
deviceTypeMaps
);
const
_model
=
model
.
toLocaleLowerCase
();
for
(
let
index
=
0
;
index
<
deviceTypeMapsKeys
.
length
;
index
++
)
{
const
_m
=
deviceTypeMapsKeys
[
index
];
if
(
_model
.
indexOf
(
_m
)
!==
-
1
)
{
deviceType
=
deviceTypeMaps
[
_m
];
break
}
}
}
// deviceModel
let
deviceBrand
=
model
.
split
(
'
'
)[
0
].
toLocaleLowerCase
();
if
(
isQuickApp
)
{
deviceBrand
=
brand
.
toLocaleLowerCase
();
}
else
{
deviceBrand
=
getDeviceBrand
(
deviceBrand
);
}
// hostName
let
_hostName
=
hostName
;
// mp-jd
_hostName
=
result
.
app
;
// wx.getAccountInfoSync
const
parameters
=
{
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
,
uniCompileVersion
:
process
.
env
.
UNI_COMPILER_VERSION
,
uniRuntimeVersion
:
process
.
env
.
UNI_COMPILER_VERSION
,
uniPlatform
:
process
.
env
.
UNI_SUB_PLATFORM
||
process
.
env
.
UNI_PLATFORM
,
deviceBrand
,
deviceModel
:
model
,
deviceType
,
osName
:
osName
.
toLocaleLowerCase
(),
osVersion
,
osLanguage
:
language
,
osTheme
:
theme
,
hostTheme
:
theme
,
hostVersion
,
hostLanguage
:
language
,
hostName
:
_hostName
,
// TODO
ua
:
''
,
hostPackageName
:
''
,
browserName
:
''
,
browseVersion
:
''
};
Object
.
assign
(
result
,
parameters
);
}
const
UUID_KEY
=
'
__DC_STAT_UUID
'
;
let
deviceId
;
function
addUuid
(
result
)
{
...
...
@@ -650,18 +742,6 @@ function addUuid (result) {
result
.
deviceId
=
deviceId
;
}
function
addSafeAreaInsets
(
result
)
{
if
(
result
.
safeArea
)
{
const
safeArea
=
result
.
safeArea
;
result
.
safeAreaInsets
=
{
top
:
safeArea
.
top
,
left
:
safeArea
.
left
,
right
:
result
.
windowWidth
-
safeArea
.
right
,
bottom
:
result
.
windowHeight
-
safeArea
.
bottom
};
}
}
function
normalizePlatform
(
result
)
{
let
platform
=
result
.
platform
?
result
.
platform
.
toLowerCase
()
:
'
devtools
'
;
if
(
!~
[
'
android
'
,
'
ios
'
].
indexOf
(
platform
))
{
...
...
@@ -675,6 +755,7 @@ var getSystemInfo = {
addUuid
(
result
);
addSafeAreaInsets
(
result
);
normalizePlatform
(
result
);
populateParameters
(
result
);
}
};
...
...
packages/uni-mp-baidu/dist/index.js
浏览文件 @
682673ee
...
...
@@ -651,9 +651,14 @@ var previewImage = {
}
};
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
'
}
}
const
UUID_KEY
=
'
__DC_STAT_UUID
'
;
let
deviceId
;
function
addUui
d
(
result
)
{
function
useDeviceI
d
(
result
)
{
deviceId
=
deviceId
||
swan
.
getStorageSync
(
UUID_KEY
);
if
(
!
deviceId
)
{
deviceId
=
Date
.
now
()
+
''
+
Math
.
floor
(
Math
.
random
()
*
1
e7
);
...
...
@@ -672,15 +677,79 @@ function addSafeAreaInsets (result) {
top
:
safeArea
.
top
,
left
:
safeArea
.
left
,
right
:
result
.
windowWidth
-
safeArea
.
right
,
bottom
:
Math
.
abs
(
result
.
screenHeight
-
safeArea
.
bottom
)
bottom
:
result
.
screenHeight
-
safeArea
.
bottom
};
}
}
function
populateParameters
(
result
)
{
const
{
brand
,
model
,
system
,
language
,
theme
,
version
,
hostName
=
''
,
platform
}
=
result
;
const
isQuickApp
=
"
mp-baidu
"
.
indexOf
(
'
quickapp-webview
'
)
!==
-
1
;
// osName osVersion
let
osName
=
''
;
let
osVersion
=
''
;
{
osName
=
system
.
split
(
'
'
)[
0
]
||
''
;
osVersion
=
system
.
split
(
'
'
)[
1
]
||
''
;
}
let
hostVersion
=
version
;
// host 枚举值 https://smartprogram.baidu.com/docs/develop/api/device_sys/hostlist/
{
hostVersion
=
result
.
swanNativeVersion
||
version
;
}
// deviceType
let
deviceType
=
result
.
deviceType
||
'
phone
'
;
// deviceModel
let
deviceBrand
=
model
.
split
(
'
'
)[
0
].
toLocaleLowerCase
();
if
(
isQuickApp
)
{
deviceBrand
=
brand
.
toLocaleLowerCase
();
}
else
{
deviceBrand
=
getDeviceBrand
(
deviceBrand
);
}
// hostName
let
_hostName
=
hostName
;
// mp-jd
{
_hostName
=
result
.
host
;
}
// wx.getAccountInfoSync
const
parameters
=
{
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
,
uniCompileVersion
:
process
.
env
.
UNI_COMPILER_VERSION
,
uniRuntimeVersion
:
process
.
env
.
UNI_COMPILER_VERSION
,
uniPlatform
:
process
.
env
.
UNI_SUB_PLATFORM
||
process
.
env
.
UNI_PLATFORM
,
deviceBrand
,
deviceModel
:
model
,
deviceType
,
osName
:
osName
.
toLocaleLowerCase
(),
osVersion
,
osLanguage
:
language
,
osTheme
:
theme
,
hostTheme
:
theme
,
hostVersion
,
hostLanguage
:
language
,
hostName
:
_hostName
,
// TODO
ua
:
''
,
hostPackageName
:
''
,
browserName
:
''
,
browseVersion
:
''
};
Object
.
assign
(
result
,
parameters
);
}
var
getSystemInfo
=
{
returnValue
:
function
(
result
)
{
addUui
d
(
result
);
useDeviceI
d
(
result
);
addSafeAreaInsets
(
result
);
populateParameters
(
result
);
}
};
...
...
packages/uni-mp-jd/dist/index.js
浏览文件 @
682673ee
...
...
@@ -480,10 +480,120 @@ var baseApi = /*#__PURE__*/Object.freeze({
interceptors
:
interceptors
});
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
'
}
}
const
UUID_KEY
=
'
__DC_STAT_UUID
'
;
let
deviceId
;
function
useDeviceId
(
result
)
{
deviceId
=
deviceId
||
jd
.
getStorageSync
(
UUID_KEY
);
if
(
!
deviceId
)
{
deviceId
=
Date
.
now
()
+
''
+
Math
.
floor
(
Math
.
random
()
*
1
e7
);
jd
.
setStorage
({
key
:
UUID_KEY
,
data
:
deviceId
});
}
result
.
deviceId
=
deviceId
;
}
function
addSafeAreaInsets
(
result
)
{
if
(
result
.
safeArea
)
{
const
safeArea
=
result
.
safeArea
;
result
.
safeAreaInsets
=
{
top
:
safeArea
.
top
,
left
:
safeArea
.
left
,
right
:
result
.
windowWidth
-
safeArea
.
right
,
bottom
:
result
.
screenHeight
-
safeArea
.
bottom
};
}
}
function
populateParameters
(
result
)
{
const
{
brand
,
model
,
system
,
language
,
theme
,
version
,
hostName
=
''
,
platform
}
=
result
;
const
isQuickApp
=
"
mp-jd
"
.
indexOf
(
'
quickapp-webview
'
)
!==
-
1
;
// osName osVersion
let
osName
=
''
;
let
osVersion
=
''
;
{
osName
=
system
.
split
(
'
'
)[
0
]
||
''
;
osVersion
=
system
.
split
(
'
'
)[
1
]
||
''
;
}
let
hostVersion
=
version
;
// deviceType
let
deviceType
=
result
.
deviceType
||
'
phone
'
;
{
const
deviceTypeMaps
=
{
ipad
:
'
pad
'
,
windows
:
'
pc
'
,
mac
:
'
pc
'
};
const
deviceTypeMapsKeys
=
Object
.
keys
(
deviceTypeMaps
);
const
_model
=
model
.
toLocaleLowerCase
();
for
(
let
index
=
0
;
index
<
deviceTypeMapsKeys
.
length
;
index
++
)
{
const
_m
=
deviceTypeMapsKeys
[
index
];
if
(
_model
.
indexOf
(
_m
)
!==
-
1
)
{
deviceType
=
deviceTypeMaps
[
_m
];
break
}
}
}
// deviceModel
let
deviceBrand
=
model
.
split
(
'
'
)[
0
].
toLocaleLowerCase
();
if
(
isQuickApp
)
{
deviceBrand
=
brand
.
toLocaleLowerCase
();
}
else
{
deviceBrand
=
getDeviceBrand
(
deviceBrand
);
}
// hostName
let
_hostName
=
hostName
;
// mp-jd
// wx.getAccountInfoSync
const
parameters
=
{
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
,
uniCompileVersion
:
process
.
env
.
UNI_COMPILER_VERSION
,
uniRuntimeVersion
:
process
.
env
.
UNI_COMPILER_VERSION
,
uniPlatform
:
process
.
env
.
UNI_SUB_PLATFORM
||
process
.
env
.
UNI_PLATFORM
,
deviceBrand
,
deviceModel
:
model
,
deviceType
,
osName
:
osName
.
toLocaleLowerCase
(),
osVersion
,
osLanguage
:
language
,
osTheme
:
theme
,
hostTheme
:
theme
,
hostVersion
,
hostLanguage
:
language
,
hostName
:
_hostName
,
// TODO
ua
:
''
,
hostPackageName
:
''
,
browserName
:
''
,
browseVersion
:
''
};
Object
.
assign
(
result
,
parameters
);
}
var
getSystemInfo
=
{
returnValue
:
function
(
result
)
{
useDeviceId
(
result
);
addSafeAreaInsets
(
result
);
populateParameters
(
result
);
}
};
// import navigateTo from 'uni-helpers/navigate-to'
// import redirectTo from '../../../mp-weixin/helpers/redirect-to'
// import previewImage from '../../../mp-weixin/helpers/normalize-preview-image'
// import getSystemInfo from '../../../mp-weixin/helpers/system-info'
// import getUserProfile from '../../../mp-weixin/helpers/get-user-profile'
// 需要做转换的 API 列表
...
...
@@ -491,8 +601,8 @@ const protocols = {
// navigateTo,
// redirectTo,
// previewImage,
//
getSystemInfo,
// getSystemInfoSync: getSystemInfo,
getSystemInfo
,
getSystemInfoSync
:
getSystemInfo
// getUserProfile
};
...
...
packages/uni-mp-kuaishou/dist/index.js
浏览文件 @
682673ee
...
...
@@ -651,9 +651,14 @@ var previewImage = {
}
};
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
'
}
}
const
UUID_KEY
=
'
__DC_STAT_UUID
'
;
let
deviceId
;
function
addUui
d
(
result
)
{
function
useDeviceI
d
(
result
)
{
deviceId
=
deviceId
||
ks
.
getStorageSync
(
UUID_KEY
);
if
(
!
deviceId
)
{
deviceId
=
Date
.
now
()
+
''
+
Math
.
floor
(
Math
.
random
()
*
1
e7
);
...
...
@@ -672,15 +677,91 @@ function addSafeAreaInsets (result) {
top
:
safeArea
.
top
,
left
:
safeArea
.
left
,
right
:
result
.
windowWidth
-
safeArea
.
right
,
bottom
:
Math
.
abs
(
result
.
screenHeight
-
safeArea
.
bottom
)
bottom
:
result
.
screenHeight
-
safeArea
.
bottom
};
}
}
function
populateParameters
(
result
)
{
const
{
brand
,
model
,
system
,
language
,
theme
,
version
,
hostName
=
''
,
platform
}
=
result
;
const
isQuickApp
=
"
mp-kuaishou
"
.
indexOf
(
'
quickapp-webview
'
)
!==
-
1
;
// osName osVersion
let
osName
=
''
;
let
osVersion
=
''
;
{
osName
=
system
.
split
(
'
'
)[
0
]
||
''
;
osVersion
=
system
.
split
(
'
'
)[
1
]
||
''
;
}
let
hostVersion
=
version
;
// deviceType
let
deviceType
=
result
.
deviceType
||
'
phone
'
;
{
const
deviceTypeMaps
=
{
ipad
:
'
pad
'
,
windows
:
'
pc
'
,
mac
:
'
pc
'
};
const
deviceTypeMapsKeys
=
Object
.
keys
(
deviceTypeMaps
);
const
_model
=
model
.
toLocaleLowerCase
();
for
(
let
index
=
0
;
index
<
deviceTypeMapsKeys
.
length
;
index
++
)
{
const
_m
=
deviceTypeMapsKeys
[
index
];
if
(
_model
.
indexOf
(
_m
)
!==
-
1
)
{
deviceType
=
deviceTypeMaps
[
_m
];
break
}
}
}
// deviceModel
let
deviceBrand
=
model
.
split
(
'
'
)[
0
].
toLocaleLowerCase
();
if
(
isQuickApp
)
{
deviceBrand
=
brand
.
toLocaleLowerCase
();
}
else
{
deviceBrand
=
getDeviceBrand
(
deviceBrand
);
}
// hostName
let
_hostName
=
hostName
;
// mp-jd
{
_hostName
=
result
.
host
;
}
// wx.getAccountInfoSync
const
parameters
=
{
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
,
uniCompileVersion
:
process
.
env
.
UNI_COMPILER_VERSION
,
uniRuntimeVersion
:
process
.
env
.
UNI_COMPILER_VERSION
,
uniPlatform
:
process
.
env
.
UNI_SUB_PLATFORM
||
process
.
env
.
UNI_PLATFORM
,
deviceBrand
,
deviceModel
:
model
,
deviceType
,
osName
:
osName
.
toLocaleLowerCase
(),
osVersion
,
osLanguage
:
language
,
osTheme
:
theme
,
hostTheme
:
theme
,
hostVersion
,
hostLanguage
:
language
,
hostName
:
_hostName
,
// TODO
ua
:
''
,
hostPackageName
:
''
,
browserName
:
''
,
browseVersion
:
''
};
Object
.
assign
(
result
,
parameters
);
}
var
getSystemInfo
=
{
returnValue
:
function
(
result
)
{
addUui
d
(
result
);
useDeviceI
d
(
result
);
addSafeAreaInsets
(
result
);
populateParameters
(
result
);
}
};
...
...
packages/uni-mp-lark/dist/index.js
浏览文件 @
682673ee
...
...
@@ -653,7 +653,7 @@ var previewImage = {
const
UUID_KEY
=
'
__DC_STAT_UUID
'
;
let
deviceId
;
function
addUui
d
(
result
)
{
function
useDeviceI
d
(
result
)
{
deviceId
=
deviceId
||
tt
.
getStorageSync
(
UUID_KEY
);
if
(
!
deviceId
)
{
deviceId
=
Date
.
now
()
+
''
+
Math
.
floor
(
Math
.
random
()
*
1
e7
);
...
...
@@ -672,15 +672,88 @@ function addSafeAreaInsets (result) {
top
:
safeArea
.
top
,
left
:
safeArea
.
left
,
right
:
result
.
windowWidth
-
safeArea
.
right
,
bottom
:
Math
.
abs
(
result
.
screenHeight
-
safeArea
.
bottom
)
bottom
:
result
.
screenHeight
-
safeArea
.
bottom
};
}
}
function
populateParameters
(
result
)
{
const
{
brand
,
model
,
system
,
language
,
theme
,
version
,
hostName
=
''
,
platform
}
=
result
;
// osName osVersion
let
osName
=
''
;
let
osVersion
=
''
;
{
osName
=
system
.
split
(
'
'
)[
0
]
||
''
;
osVersion
=
system
.
split
(
'
'
)[
1
]
||
''
;
}
let
hostVersion
=
version
;
// deviceType
let
deviceType
=
result
.
deviceType
||
'
phone
'
;
{
const
deviceTypeMaps
=
{
ipad
:
'
pad
'
,
windows
:
'
pc
'
,
mac
:
'
pc
'
};
const
deviceTypeMapsKeys
=
Object
.
keys
(
deviceTypeMaps
);
const
_model
=
model
.
toLocaleLowerCase
();
for
(
let
index
=
0
;
index
<
deviceTypeMapsKeys
.
length
;
index
++
)
{
const
_m
=
deviceTypeMapsKeys
[
index
];
if
(
_model
.
indexOf
(
_m
)
!==
-
1
)
{
deviceType
=
deviceTypeMaps
[
_m
];
break
}
}
}
// deviceModel
let
deviceBrand
=
model
.
split
(
'
'
)[
0
].
toLocaleLowerCase
();
{
deviceBrand
=
brand
.
toLocaleLowerCase
();
}
// hostName
let
_hostName
=
hostName
;
// mp-jd
{
_hostName
=
result
.
appName
;
}
// wx.getAccountInfoSync
const
parameters
=
{
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
,
uniCompileVersion
:
process
.
env
.
UNI_COMPILER_VERSION
,
uniRuntimeVersion
:
process
.
env
.
UNI_COMPILER_VERSION
,
uniPlatform
:
process
.
env
.
UNI_SUB_PLATFORM
||
process
.
env
.
UNI_PLATFORM
,
deviceBrand
,
deviceModel
:
model
,
deviceType
,
osName
:
osName
.
toLocaleLowerCase
(),
osVersion
,
osLanguage
:
language
,
osTheme
:
theme
,
hostTheme
:
theme
,
hostVersion
,
hostLanguage
:
language
,
hostName
:
_hostName
,
// TODO
ua
:
''
,
hostPackageName
:
''
,
browserName
:
''
,
browseVersion
:
''
};
Object
.
assign
(
result
,
parameters
);
}
var
getSystemInfo
=
{
returnValue
:
function
(
result
)
{
addUui
d
(
result
);
useDeviceI
d
(
result
);
addSafeAreaInsets
(
result
);
populateParameters
(
result
);
}
};
...
...
packages/uni-mp-qq/dist/index.js
浏览文件 @
682673ee
...
...
@@ -651,9 +651,14 @@ var previewImage = {
}
};
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
'
}
}
const
UUID_KEY
=
'
__DC_STAT_UUID
'
;
let
deviceId
;
function
addUui
d
(
result
)
{
function
useDeviceI
d
(
result
)
{
deviceId
=
deviceId
||
wx
.
getStorageSync
(
UUID_KEY
);
if
(
!
deviceId
)
{
deviceId
=
Date
.
now
()
+
''
+
Math
.
floor
(
Math
.
random
()
*
1
e7
);
...
...
@@ -672,15 +677,91 @@ function addSafeAreaInsets (result) {
top
:
safeArea
.
top
,
left
:
safeArea
.
left
,
right
:
result
.
windowWidth
-
safeArea
.
right
,
bottom
:
Math
.
abs
(
result
.
screenHeight
-
safeArea
.
bottom
)
bottom
:
result
.
screenHeight
-
safeArea
.
bottom
};
}
}
function
populateParameters
(
result
)
{
const
{
brand
,
model
,
system
,
language
,
theme
,
version
,
hostName
=
''
,
platform
}
=
result
;
const
isQuickApp
=
"
mp-qq
"
.
indexOf
(
'
quickapp-webview
'
)
!==
-
1
;
// osName osVersion
let
osName
=
''
;
let
osVersion
=
''
;
{
osName
=
system
.
split
(
'
'
)[
0
]
||
''
;
osVersion
=
system
.
split
(
'
'
)[
1
]
||
''
;
}
let
hostVersion
=
version
;
// deviceType
let
deviceType
=
result
.
deviceType
||
'
phone
'
;
{
const
deviceTypeMaps
=
{
ipad
:
'
pad
'
,
windows
:
'
pc
'
,
mac
:
'
pc
'
};
const
deviceTypeMapsKeys
=
Object
.
keys
(
deviceTypeMaps
);
const
_model
=
model
.
toLocaleLowerCase
();
for
(
let
index
=
0
;
index
<
deviceTypeMapsKeys
.
length
;
index
++
)
{
const
_m
=
deviceTypeMapsKeys
[
index
];
if
(
_model
.
indexOf
(
_m
)
!==
-
1
)
{
deviceType
=
deviceTypeMaps
[
_m
];
break
}
}
}
// deviceModel
let
deviceBrand
=
model
.
split
(
'
'
)[
0
].
toLocaleLowerCase
();
if
(
isQuickApp
)
{
deviceBrand
=
brand
.
toLocaleLowerCase
();
}
else
{
deviceBrand
=
getDeviceBrand
(
deviceBrand
);
}
// hostName
let
_hostName
=
hostName
;
// mp-jd
_hostName
=
result
.
AppPlatform
;
// wx.getAccountInfoSync
const
parameters
=
{
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
,
uniCompileVersion
:
process
.
env
.
UNI_COMPILER_VERSION
,
uniRuntimeVersion
:
process
.
env
.
UNI_COMPILER_VERSION
,
uniPlatform
:
process
.
env
.
UNI_SUB_PLATFORM
||
process
.
env
.
UNI_PLATFORM
,
deviceBrand
,
deviceModel
:
model
,
deviceType
,
osName
:
osName
.
toLocaleLowerCase
(),
osVersion
,
osLanguage
:
language
,
osTheme
:
theme
,
hostTheme
:
theme
,
hostVersion
,
hostLanguage
:
language
,
hostName
:
_hostName
,
// TODO
ua
:
''
,
hostPackageName
:
''
,
browserName
:
''
,
browseVersion
:
''
};
Object
.
assign
(
result
,
parameters
);
}
var
getSystemInfo
=
{
returnValue
:
function
(
result
)
{
addUui
d
(
result
);
useDeviceI
d
(
result
);
addSafeAreaInsets
(
result
);
populateParameters
(
result
);
}
};
...
...
packages/uni-mp-toutiao/dist/index.js
浏览文件 @
682673ee
...
...
@@ -653,7 +653,7 @@ var previewImage = {
const
UUID_KEY
=
'
__DC_STAT_UUID
'
;
let
deviceId
;
function
addUui
d
(
result
)
{
function
useDeviceI
d
(
result
)
{
deviceId
=
deviceId
||
tt
.
getStorageSync
(
UUID_KEY
);
if
(
!
deviceId
)
{
deviceId
=
Date
.
now
()
+
''
+
Math
.
floor
(
Math
.
random
()
*
1
e7
);
...
...
@@ -672,15 +672,88 @@ function addSafeAreaInsets (result) {
top
:
safeArea
.
top
,
left
:
safeArea
.
left
,
right
:
result
.
windowWidth
-
safeArea
.
right
,
bottom
:
Math
.
abs
(
result
.
screenHeight
-
safeArea
.
bottom
)
bottom
:
result
.
screenHeight
-
safeArea
.
bottom
};
}
}
function
populateParameters
(
result
)
{
const
{
brand
,
model
,
system
,
language
,
theme
,
version
,
hostName
=
''
,
platform
}
=
result
;
// osName osVersion
let
osName
=
''
;
let
osVersion
=
''
;
{
osName
=
system
.
split
(
'
'
)[
0
]
||
''
;
osVersion
=
system
.
split
(
'
'
)[
1
]
||
''
;
}
let
hostVersion
=
version
;
// deviceType
let
deviceType
=
result
.
deviceType
||
'
phone
'
;
{
const
deviceTypeMaps
=
{
ipad
:
'
pad
'
,
windows
:
'
pc
'
,
mac
:
'
pc
'
};
const
deviceTypeMapsKeys
=
Object
.
keys
(
deviceTypeMaps
);
const
_model
=
model
.
toLocaleLowerCase
();
for
(
let
index
=
0
;
index
<
deviceTypeMapsKeys
.
length
;
index
++
)
{
const
_m
=
deviceTypeMapsKeys
[
index
];
if
(
_model
.
indexOf
(
_m
)
!==
-
1
)
{
deviceType
=
deviceTypeMaps
[
_m
];
break
}
}
}
// deviceModel
let
deviceBrand
=
model
.
split
(
'
'
)[
0
].
toLocaleLowerCase
();
{
deviceBrand
=
brand
.
toLocaleLowerCase
();
}
// hostName
let
_hostName
=
hostName
;
// mp-jd
{
_hostName
=
result
.
appName
;
}
// wx.getAccountInfoSync
const
parameters
=
{
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
,
uniCompileVersion
:
process
.
env
.
UNI_COMPILER_VERSION
,
uniRuntimeVersion
:
process
.
env
.
UNI_COMPILER_VERSION
,
uniPlatform
:
process
.
env
.
UNI_SUB_PLATFORM
||
process
.
env
.
UNI_PLATFORM
,
deviceBrand
,
deviceModel
:
model
,
deviceType
,
osName
:
osName
.
toLocaleLowerCase
(),
osVersion
,
osLanguage
:
language
,
osTheme
:
theme
,
hostTheme
:
theme
,
hostVersion
,
hostLanguage
:
language
,
hostName
:
_hostName
,
// TODO
ua
:
''
,
hostPackageName
:
''
,
browserName
:
''
,
browseVersion
:
''
};
Object
.
assign
(
result
,
parameters
);
}
var
getSystemInfo
=
{
returnValue
:
function
(
result
)
{
addUui
d
(
result
);
useDeviceI
d
(
result
);
addSafeAreaInsets
(
result
);
populateParameters
(
result
);
}
};
...
...
packages/uni-mp-weixin/dist/index.js
浏览文件 @
682673ee
...
...
@@ -546,9 +546,14 @@ var previewImage = {
}
};
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
'
}
}
const
UUID_KEY
=
'
__DC_STAT_UUID
'
;
let
deviceId
;
function
addUui
d
(
result
)
{
function
useDeviceI
d
(
result
)
{
deviceId
=
deviceId
||
wx
.
getStorageSync
(
UUID_KEY
);
if
(
!
deviceId
)
{
deviceId
=
Date
.
now
()
+
''
+
Math
.
floor
(
Math
.
random
()
*
1
e7
);
...
...
@@ -567,15 +572,91 @@ function addSafeAreaInsets (result) {
top
:
safeArea
.
top
,
left
:
safeArea
.
left
,
right
:
result
.
windowWidth
-
safeArea
.
right
,
bottom
:
Math
.
abs
(
result
.
screenHeight
-
safeArea
.
bottom
)
bottom
:
result
.
screenHeight
-
safeArea
.
bottom
};
}
}
function
populateParameters
(
result
)
{
const
{
brand
,
model
,
system
,
language
,
theme
,
version
,
hostName
=
''
,
platform
}
=
result
;
const
isQuickApp
=
"
mp-weixin
"
.
indexOf
(
'
quickapp-webview
'
)
!==
-
1
;
// osName osVersion
let
osName
=
''
;
let
osVersion
=
''
;
{
osName
=
system
.
split
(
'
'
)[
0
]
||
''
;
osVersion
=
system
.
split
(
'
'
)[
1
]
||
''
;
}
let
hostVersion
=
version
;
// deviceType
let
deviceType
=
result
.
deviceType
||
'
phone
'
;
{
const
deviceTypeMaps
=
{
ipad
:
'
pad
'
,
windows
:
'
pc
'
,
mac
:
'
pc
'
};
const
deviceTypeMapsKeys
=
Object
.
keys
(
deviceTypeMaps
);
const
_model
=
model
.
toLocaleLowerCase
();
for
(
let
index
=
0
;
index
<
deviceTypeMapsKeys
.
length
;
index
++
)
{
const
_m
=
deviceTypeMapsKeys
[
index
];
if
(
_model
.
indexOf
(
_m
)
!==
-
1
)
{
deviceType
=
deviceTypeMaps
[
_m
];
break
}
}
}
// deviceModel
let
deviceBrand
=
model
.
split
(
'
'
)[
0
].
toLocaleLowerCase
();
if
(
isQuickApp
)
{
deviceBrand
=
brand
.
toLocaleLowerCase
();
}
else
{
deviceBrand
=
getDeviceBrand
(
deviceBrand
);
}
// hostName
let
_hostName
=
hostName
;
// mp-jd
_hostName
=
(
result
.
host
||
{}).
env
;
// wx.getAccountInfoSync
const
parameters
=
{
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
,
uniCompileVersion
:
process
.
env
.
UNI_COMPILER_VERSION
,
uniRuntimeVersion
:
process
.
env
.
UNI_COMPILER_VERSION
,
uniPlatform
:
process
.
env
.
UNI_SUB_PLATFORM
||
process
.
env
.
UNI_PLATFORM
,
deviceBrand
,
deviceModel
:
model
,
deviceType
,
osName
:
osName
.
toLocaleLowerCase
(),
osVersion
,
osLanguage
:
language
,
osTheme
:
theme
,
hostTheme
:
theme
,
hostVersion
,
hostLanguage
:
language
,
hostName
:
_hostName
,
// TODO
ua
:
''
,
hostPackageName
:
''
,
browserName
:
''
,
browseVersion
:
''
};
Object
.
assign
(
result
,
parameters
);
}
var
getSystemInfo
=
{
returnValue
:
function
(
result
)
{
addUui
d
(
result
);
useDeviceI
d
(
result
);
addSafeAreaInsets
(
result
);
populateParameters
(
result
);
}
};
...
...
packages/uni-mp-xhs/dist/index.js
浏览文件 @
682673ee
...
...
@@ -480,10 +480,120 @@ var baseApi = /*#__PURE__*/Object.freeze({
interceptors
:
interceptors
});
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
'
}
}
const
UUID_KEY
=
'
__DC_STAT_UUID
'
;
let
deviceId
;
function
useDeviceId
(
result
)
{
deviceId
=
deviceId
||
xhs
.
getStorageSync
(
UUID_KEY
);
if
(
!
deviceId
)
{
deviceId
=
Date
.
now
()
+
''
+
Math
.
floor
(
Math
.
random
()
*
1
e7
);
xhs
.
setStorage
({
key
:
UUID_KEY
,
data
:
deviceId
});
}
result
.
deviceId
=
deviceId
;
}
function
addSafeAreaInsets
(
result
)
{
if
(
result
.
safeArea
)
{
const
safeArea
=
result
.
safeArea
;
result
.
safeAreaInsets
=
{
top
:
safeArea
.
top
,
left
:
safeArea
.
left
,
right
:
result
.
windowWidth
-
safeArea
.
right
,
bottom
:
result
.
screenHeight
-
safeArea
.
bottom
};
}
}
function
populateParameters
(
result
)
{
const
{
brand
,
model
,
system
,
language
,
theme
,
version
,
hostName
=
''
,
platform
}
=
result
;
const
isQuickApp
=
"
mp-xhs
"
.
indexOf
(
'
quickapp-webview
'
)
!==
-
1
;
// osName osVersion
let
osName
=
''
;
let
osVersion
=
''
;
{
osName
=
system
.
split
(
'
'
)[
0
]
||
''
;
osVersion
=
system
.
split
(
'
'
)[
1
]
||
''
;
}
let
hostVersion
=
version
;
// deviceType
let
deviceType
=
result
.
deviceType
||
'
phone
'
;
{
const
deviceTypeMaps
=
{
ipad
:
'
pad
'
,
windows
:
'
pc
'
,
mac
:
'
pc
'
};
const
deviceTypeMapsKeys
=
Object
.
keys
(
deviceTypeMaps
);
const
_model
=
model
.
toLocaleLowerCase
();
for
(
let
index
=
0
;
index
<
deviceTypeMapsKeys
.
length
;
index
++
)
{
const
_m
=
deviceTypeMapsKeys
[
index
];
if
(
_model
.
indexOf
(
_m
)
!==
-
1
)
{
deviceType
=
deviceTypeMaps
[
_m
];
break
}
}
}
// deviceModel
let
deviceBrand
=
model
.
split
(
'
'
)[
0
].
toLocaleLowerCase
();
if
(
isQuickApp
)
{
deviceBrand
=
brand
.
toLocaleLowerCase
();
}
else
{
deviceBrand
=
getDeviceBrand
(
deviceBrand
);
}
// hostName
let
_hostName
=
hostName
;
// mp-jd
// wx.getAccountInfoSync
const
parameters
=
{
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
,
uniCompileVersion
:
process
.
env
.
UNI_COMPILER_VERSION
,
uniRuntimeVersion
:
process
.
env
.
UNI_COMPILER_VERSION
,
uniPlatform
:
process
.
env
.
UNI_SUB_PLATFORM
||
process
.
env
.
UNI_PLATFORM
,
deviceBrand
,
deviceModel
:
model
,
deviceType
,
osName
:
osName
.
toLocaleLowerCase
(),
osVersion
,
osLanguage
:
language
,
osTheme
:
theme
,
hostTheme
:
theme
,
hostVersion
,
hostLanguage
:
language
,
hostName
:
_hostName
,
// TODO
ua
:
''
,
hostPackageName
:
''
,
browserName
:
''
,
browseVersion
:
''
};
Object
.
assign
(
result
,
parameters
);
}
var
getSystemInfo
=
{
returnValue
:
function
(
result
)
{
useDeviceId
(
result
);
addSafeAreaInsets
(
result
);
populateParameters
(
result
);
}
};
// import navigateTo from 'uni-helpers/navigate-to'
// import redirectTo from '../../../mp-weixin/helpers/redirect-to'
// import previewImage from '../../../mp-weixin/helpers/normalize-preview-image'
// import getSystemInfo from '../../../mp-weixin/helpers/system-info'
// import getUserProfile from '../../../mp-weixin/helpers/get-user-profile'
// 需要做转换的 API 列表
...
...
@@ -491,8 +601,8 @@ const protocols = {
// navigateTo,
// redirectTo,
// previewImage,
//
getSystemInfo,
// getSystemInfoSync: getSystemInfo,
getSystemInfo
,
getSystemInfoSync
:
getSystemInfo
// getUserProfile
};
...
...
packages/uni-quickapp-native/dist/vue.dev.js
浏览文件 @
682673ee
此差异已折叠。
点击以展开。
packages/uni-quickapp-native/dist/vue.prod.js
浏览文件 @
682673ee
此差异已折叠。
点击以展开。
packages/uni-quickapp-webview/dist/index.js
浏览文件 @
682673ee
...
...
@@ -651,10 +651,125 @@ var previewImage = {
}
};
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
'
}
}
const
UUID_KEY
=
'
__DC_STAT_UUID
'
;
let
deviceId
;
function
useDeviceId
(
result
)
{
deviceId
=
deviceId
||
qa
.
getStorageSync
(
UUID_KEY
);
if
(
!
deviceId
)
{
deviceId
=
Date
.
now
()
+
''
+
Math
.
floor
(
Math
.
random
()
*
1
e7
);
qa
.
setStorage
({
key
:
UUID_KEY
,
data
:
deviceId
});
}
result
.
deviceId
=
deviceId
;
}
function
addSafeAreaInsets
(
result
)
{
if
(
result
.
safeArea
)
{
const
safeArea
=
result
.
safeArea
;
result
.
safeAreaInsets
=
{
top
:
safeArea
.
top
,
left
:
safeArea
.
left
,
right
:
result
.
windowWidth
-
safeArea
.
right
,
bottom
:
result
.
screenHeight
-
safeArea
.
bottom
};
}
}
function
populateParameters
(
result
)
{
const
{
brand
,
model
,
system
,
language
,
theme
,
version
,
hostName
=
''
,
platform
}
=
result
;
const
isQuickApp
=
"
quickapp-webview
"
.
indexOf
(
'
quickapp-webview
'
)
!==
-
1
;
// osName osVersion
let
osName
=
''
;
let
osVersion
=
''
;
{
osName
=
system
.
split
(
'
'
)[
0
]
||
''
;
osVersion
=
system
.
split
(
'
'
)[
1
]
||
''
;
}
let
hostVersion
=
version
;
// deviceType
let
deviceType
=
result
.
deviceType
||
'
phone
'
;
{
const
deviceTypeMaps
=
{
ipad
:
'
pad
'
,
windows
:
'
pc
'
,
mac
:
'
pc
'
};
const
deviceTypeMapsKeys
=
Object
.
keys
(
deviceTypeMaps
);
const
_model
=
model
.
toLocaleLowerCase
();
for
(
let
index
=
0
;
index
<
deviceTypeMapsKeys
.
length
;
index
++
)
{
const
_m
=
deviceTypeMapsKeys
[
index
];
if
(
_model
.
indexOf
(
_m
)
!==
-
1
)
{
deviceType
=
deviceTypeMaps
[
_m
];
break
}
}
}
// deviceModel
let
deviceBrand
=
model
.
split
(
'
'
)[
0
].
toLocaleLowerCase
();
if
(
isQuickApp
)
{
deviceBrand
=
brand
.
toLocaleLowerCase
();
}
else
{
deviceBrand
=
getDeviceBrand
(
deviceBrand
);
}
// hostName
let
_hostName
=
hostName
;
// mp-jd
// wx.getAccountInfoSync
const
parameters
=
{
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
,
uniCompileVersion
:
process
.
env
.
UNI_COMPILER_VERSION
,
uniRuntimeVersion
:
process
.
env
.
UNI_COMPILER_VERSION
,
uniPlatform
:
process
.
env
.
UNI_SUB_PLATFORM
||
process
.
env
.
UNI_PLATFORM
,
deviceBrand
,
deviceModel
:
model
,
deviceType
,
osName
:
osName
.
toLocaleLowerCase
(),
osVersion
,
osLanguage
:
language
,
osTheme
:
theme
,
hostTheme
:
theme
,
hostVersion
,
hostLanguage
:
language
,
hostName
:
_hostName
,
// TODO
ua
:
''
,
hostPackageName
:
''
,
browserName
:
''
,
browseVersion
:
''
};
Object
.
assign
(
result
,
parameters
);
}
var
getSystemInfo
=
{
returnValue
:
function
(
result
)
{
useDeviceId
(
result
);
addSafeAreaInsets
(
result
);
populateParameters
(
result
);
}
};
const
protocols
=
{
navigateTo
,
redirectTo
,
previewImage
previewImage
,
getSystemInfo
,
getSystemInfoSync
:
getSystemInfo
};
const
todos
=
[
'
preloadPage
'
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录