mali-applet-ui 0.2.5 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/utils/applet.js +38 -0
package/package.json
CHANGED
package/utils/applet.js
CHANGED
|
@@ -1,3 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 获取当前平台信息
|
|
3
|
+
*/
|
|
4
|
+
export function getPlatformInfo () {
|
|
5
|
+
const sysRes = uni.getSystemInfoSync()
|
|
6
|
+
const hostName = sysRes.hostName
|
|
7
|
+
const platform = {
|
|
8
|
+
// H5
|
|
9
|
+
isH5: false,
|
|
10
|
+
isQWH5: false,
|
|
11
|
+
isDDH5: false,
|
|
12
|
+
// 微信
|
|
13
|
+
isWX: false,
|
|
14
|
+
// 企业微信
|
|
15
|
+
isQW: false,
|
|
16
|
+
// 钉钉
|
|
17
|
+
isDD: false,
|
|
18
|
+
// 支付宝
|
|
19
|
+
isZFB: false
|
|
20
|
+
}
|
|
21
|
+
if (/web/.test(sysRes.uniPlatform)) {
|
|
22
|
+
platform.isH5 = true
|
|
23
|
+
platform.isQWH5 = true
|
|
24
|
+
platform.isDDH5 = true
|
|
25
|
+
} else {
|
|
26
|
+
if (/WeChat/i.test(hostName)) {
|
|
27
|
+
platform.isWX = true
|
|
28
|
+
} else if (/wxwork/i.test(hostName)) {
|
|
29
|
+
platform.isQW = true
|
|
30
|
+
} else if (/DingTalk/i.test(hostName)) {
|
|
31
|
+
platform.isDD = true
|
|
32
|
+
} else if (/alipay/i.test(hostName)) {
|
|
33
|
+
platform.isZFB = true
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return platform
|
|
37
|
+
}
|
|
38
|
+
|
|
1
39
|
/**
|
|
2
40
|
* 获取 AppId
|
|
3
41
|
*/
|