@mpxjs/api-proxy 2.9.27 → 2.9.38
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 +2 -2
- package/src/common/js/utils.js +16 -1
- package/src/platform/api/action-sheet/index.ali.js +3 -2
- package/src/platform/api/action-sheet/index.js +1 -3
- package/src/platform/api/add-phone-contact/index.ali.js +2 -2
- package/src/platform/api/add-phone-contact/index.js +1 -3
- package/src/platform/api/animation/index.js +1 -3
- package/src/platform/api/app/index.js +1 -3
- package/src/platform/api/audio/index.js +1 -3
- package/src/platform/api/base/index.js +1 -3
- package/src/platform/api/base/index.web.js +1 -1
- package/src/platform/api/ble-connection/index.ali.js +5 -3
- package/src/platform/api/ble-connection/index.js +1 -3
- package/src/platform/api/canvas/index.ali.js +2 -4
- package/src/platform/api/canvas/index.js +1 -6
- package/src/platform/api/check-session/index.js +1 -3
- package/src/platform/api/clipboard-data/index.ali.js +3 -3
- package/src/platform/api/clipboard-data/index.js +1 -3
- package/src/platform/api/create-intersection-observer/IntersectionObserver.js +7 -4
- package/src/platform/api/create-intersection-observer/index.ali.js +3 -1
- package/src/platform/api/create-intersection-observer/index.js +1 -3
- package/src/platform/api/create-selector-query/SelectQuery.js +2 -1
- package/src/platform/api/create-selector-query/index.ali.js +2 -2
- package/src/platform/api/create-selector-query/index.js +1 -3
- package/src/platform/api/device/network/index.js +1 -3
- package/src/platform/api/device/network/onNetworkStatusChange.js +1 -1
- package/src/platform/api/file/index.ali.js +4 -4
- package/src/platform/api/file/index.js +1 -3
- package/src/platform/api/get-user-info/index.ali.js +2 -2
- package/src/platform/api/get-user-info/index.js +1 -3
- package/src/platform/api/image/index.ali.js +3 -3
- package/src/platform/api/image/index.js +1 -3
- package/src/platform/api/lifecycle/index.ali.js +3 -1
- package/src/platform/api/lifecycle/index.js +1 -3
- package/src/platform/api/login/index.ali.js +2 -2
- package/src/platform/api/login/index.js +1 -3
- package/src/platform/api/make-phone-call/index.ali.js +2 -2
- package/src/platform/api/make-phone-call/index.js +1 -3
- package/src/platform/api/modal/index.ali.js +3 -3
- package/src/platform/api/modal/index.js +1 -3
- package/src/platform/api/next-tick/index.js +1 -3
- package/src/platform/api/page-scroll-to/index.js +1 -3
- package/src/platform/api/pull-down/index.js +1 -3
- package/src/platform/api/request/index.ali.js +4 -4
- package/src/platform/api/request/index.js +1 -3
- package/src/platform/api/request-payment/index.ali.js +2 -2
- package/src/platform/api/request-payment/index.js +1 -3
- package/src/platform/api/route/index.js +1 -3
- package/src/platform/api/scan-code/index.ali.js +2 -2
- package/src/platform/api/scan-code/index.js +1 -3
- package/src/platform/api/screen-brightness/index.ali.js +3 -3
- package/src/platform/api/screen-brightness/index.js +1 -3
- package/src/platform/api/set-navigation-bar/index.ali.js +7 -9
- package/src/platform/api/set-navigation-bar/index.js +1 -3
- package/src/platform/api/socket/index.js +1 -3
- package/src/platform/api/storage/index.ali.js +12 -10
- package/src/platform/api/storage/index.js +1 -3
- package/src/platform/api/system/index.ali.js +5 -5
- package/src/platform/api/system/index.js +1 -3
- package/src/platform/api/tab-bar/index.js +1 -3
- package/src/platform/api/toast/index.ali.js +5 -5
- package/src/platform/api/toast/index.js +1 -3
- package/src/platform/api/video/index.js +1 -3
- package/src/platform/api/window/index.js +1 -3
- package/src/platform/api/window/index.web.js +1 -1
- package/src/platform/index.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mpxjs/api-proxy",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.38",
|
|
4
4
|
"description": "convert miniprogram API at each end",
|
|
5
5
|
"module": "src/index.js",
|
|
6
6
|
"types": "@types/index.d.ts",
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"axios": "^1.6.7"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "5e2740e2091edda91eda9ffe775989c7fd9838df"
|
|
43
43
|
}
|
package/src/common/js/utils.js
CHANGED
|
@@ -95,11 +95,24 @@ function makeMap (arr) {
|
|
|
95
95
|
}, {})
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
+
function parseDataset (dataset) {
|
|
99
|
+
const parsed = {}
|
|
100
|
+
for (const key in dataset) {
|
|
101
|
+
if (hasOwn(dataset, key)) {
|
|
102
|
+
parsed[key] = JSON.parse(dataset[key])
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return parsed
|
|
106
|
+
}
|
|
107
|
+
|
|
98
108
|
const isBrowser = typeof window !== 'undefined'
|
|
99
109
|
|
|
100
110
|
function throwSSRWarning (info) {
|
|
101
111
|
console.error(`[Mpx runtime error]: Dangerous API! ${info}, It may cause some problems, please use this method with caution`)
|
|
102
112
|
}
|
|
113
|
+
|
|
114
|
+
const ENV_OBJ = getEnvObj()
|
|
115
|
+
|
|
103
116
|
export {
|
|
104
117
|
changeOpts,
|
|
105
118
|
handleSuccess,
|
|
@@ -111,5 +124,7 @@ export {
|
|
|
111
124
|
makeMap,
|
|
112
125
|
isBrowser,
|
|
113
126
|
hasOwn,
|
|
114
|
-
throwSSRWarning
|
|
127
|
+
throwSSRWarning,
|
|
128
|
+
ENV_OBJ,
|
|
129
|
+
parseDataset
|
|
115
130
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { changeOpts, noop } from '../../../common/js'
|
|
1
|
+
import { ENV_OBJ, changeOpts, noop } from '../../../common/js'
|
|
2
|
+
|
|
2
3
|
function showActionSheet (options = {}) {
|
|
3
4
|
const opts = changeOpts(options, {
|
|
4
5
|
itemList: 'items'
|
|
@@ -20,7 +21,7 @@ function showActionSheet (options = {}) {
|
|
|
20
21
|
}
|
|
21
22
|
}
|
|
22
23
|
|
|
23
|
-
|
|
24
|
+
return ENV_OBJ.showActionSheet(opts)
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
export {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { changeOpts } from '../../../common/js'
|
|
1
|
+
import { ENV_OBJ, changeOpts } from '../../../common/js'
|
|
2
2
|
|
|
3
3
|
function addPhoneContact (options = {}) {
|
|
4
4
|
const opts = changeOpts(options, {
|
|
5
5
|
weChatNumber: 'alipayAccount'
|
|
6
6
|
})
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
return ENV_OBJ.addPhoneContact(opts)
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export {
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
+
import { ENV_OBJ } from '../../../common/js'
|
|
2
|
+
|
|
1
3
|
function closeBLEConnection (options = {}) {
|
|
2
|
-
|
|
4
|
+
return ENV_OBJ.disconnectBLEDevice(options)
|
|
3
5
|
}
|
|
4
6
|
|
|
5
7
|
function createBLEConnection (options = {}) {
|
|
6
|
-
|
|
8
|
+
return ENV_OBJ.connectBLEDevice(options)
|
|
7
9
|
}
|
|
8
10
|
|
|
9
11
|
function onBLEConnectionStateChange (callback) {
|
|
10
|
-
|
|
12
|
+
return ENV_OBJ.onBLEConnectionStateChanged(callback)
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
export {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { changeOpts, envError, handleSuccess } from '../../../common/js'
|
|
1
|
+
import { ENV_OBJ, changeOpts, envError, handleSuccess } from '../../../common/js'
|
|
2
2
|
|
|
3
3
|
function canvasToTempFilePath (options = {}) {
|
|
4
4
|
handleSuccess(options, res => {
|
|
@@ -8,13 +8,11 @@ function canvasToTempFilePath (options = {}) {
|
|
|
8
8
|
)
|
|
9
9
|
})
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
return ENV_OBJ.canvasToTempFilePath(options)
|
|
12
12
|
}
|
|
13
|
-
const createCanvasContext = envError('createCanvasContext')
|
|
14
13
|
const canvasGetImageData = envError('canvasGetImageData')
|
|
15
14
|
|
|
16
15
|
export {
|
|
17
|
-
createCanvasContext,
|
|
18
16
|
canvasToTempFilePath,
|
|
19
17
|
canvasGetImageData
|
|
20
18
|
}
|
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
const ENV_OBJ = getEnvObj()
|
|
4
|
-
|
|
5
|
-
const createCanvasContext = ENV_OBJ.createCanvasContext || envError('createCanvasContext')
|
|
1
|
+
import { ENV_OBJ, envError } from '../../../common/js'
|
|
6
2
|
|
|
7
3
|
const canvasToTempFilePath = ENV_OBJ.canvasToTempFilePath || envError('canvasToTempFilePath')
|
|
8
4
|
|
|
9
5
|
const canvasGetImageData = ENV_OBJ.canvasGetImageData || envError('canvasGetImageData')
|
|
10
6
|
|
|
11
7
|
export {
|
|
12
|
-
createCanvasContext,
|
|
13
8
|
canvasToTempFilePath,
|
|
14
9
|
canvasGetImageData
|
|
15
10
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { changeOpts, handleSuccess } from '../../../common/js'
|
|
1
|
+
import { ENV_OBJ, changeOpts, handleSuccess } from '../../../common/js'
|
|
2
2
|
|
|
3
3
|
function setClipboardData (options = {}) {
|
|
4
4
|
const opts = changeOpts(options, {
|
|
@@ -11,7 +11,7 @@ function setClipboardData (options = {}) {
|
|
|
11
11
|
errMsg: 'setClipboardData:ok'
|
|
12
12
|
})
|
|
13
13
|
})
|
|
14
|
-
|
|
14
|
+
return ENV_OBJ.setClipboard(opts)
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
function getClipboardData (options = {}) {
|
|
@@ -21,7 +21,7 @@ function getClipboardData (options = {}) {
|
|
|
21
21
|
return changeOpts(res, { text: 'data' })
|
|
22
22
|
})
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
return ENV_OBJ.getClipboard(opts)
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
export {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { nextTick } from '../next-tick'
|
|
2
|
+
import { parseDataset } from '../../../common/js'
|
|
2
3
|
|
|
3
4
|
let isInit = true
|
|
4
5
|
|
|
@@ -27,14 +28,16 @@ class WebIntersectionObserver {
|
|
|
27
28
|
if (!isInit || (isInit && (entry.intersectionRatio !== initialRatio && (this._minThreshold <= entry.intersectionRatio)))) {
|
|
28
29
|
Object.defineProperties(entry, {
|
|
29
30
|
id: {
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
get () {
|
|
32
|
+
return entry.target.id || ''
|
|
33
|
+
},
|
|
32
34
|
enumerable: true,
|
|
33
35
|
configurable: true
|
|
34
36
|
},
|
|
35
37
|
dataset: {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
+
get () {
|
|
39
|
+
return parseDataset(entry.target.dataset)
|
|
40
|
+
},
|
|
38
41
|
enumerable: true,
|
|
39
42
|
configurable: true
|
|
40
43
|
},
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import NodesRef from './NodesRef'
|
|
2
|
+
import { parseDataset } from '../../../common/js'
|
|
2
3
|
|
|
3
4
|
class SelectQuery {
|
|
4
5
|
constructor () {
|
|
@@ -82,7 +83,7 @@ class SelectQuery {
|
|
|
82
83
|
const res = {}
|
|
83
84
|
const isViewport = selector === 'html'
|
|
84
85
|
if (id) res.id = el.id
|
|
85
|
-
if (dataset) res.dataset =
|
|
86
|
+
if (dataset) res.dataset = parseDataset(el.dataset)
|
|
86
87
|
if (rect) {
|
|
87
88
|
if (isViewport) {
|
|
88
89
|
res.left = 0
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { noop } from '../../../common/js'
|
|
1
|
+
import { ENV_OBJ, noop } from '../../../common/js'
|
|
2
2
|
|
|
3
3
|
function createSelectorQuery (options = {}) {
|
|
4
|
-
const selectorQuery =
|
|
4
|
+
const selectorQuery = ENV_OBJ.createSelectorQuery(options)
|
|
5
5
|
const proxyMethods = ['boundingClientRect', 'scrollOffset']
|
|
6
6
|
const cbs = []
|
|
7
7
|
proxyMethods.forEach((name) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { changeOpts, handleSuccess } from '../../../common/js'
|
|
1
|
+
import { ENV_OBJ, changeOpts, handleSuccess } from '../../../common/js'
|
|
2
2
|
|
|
3
3
|
function downloadFile (options = {}) {
|
|
4
4
|
const opts = changeOpts(options)
|
|
@@ -7,13 +7,13 @@ function downloadFile (options = {}) {
|
|
|
7
7
|
return changeOpts(res, { apFilePath: 'tempFilePath' })
|
|
8
8
|
})
|
|
9
9
|
|
|
10
|
-
return
|
|
10
|
+
return ENV_OBJ.downloadFile(opts)
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
function uploadFile (options = {}) {
|
|
14
14
|
const opts = changeOpts(options, { name: 'fileName' })
|
|
15
15
|
|
|
16
|
-
return
|
|
16
|
+
return ENV_OBJ.uploadFile(opts)
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
function saveFile (options = {}) {
|
|
@@ -25,7 +25,7 @@ function saveFile (options = {}) {
|
|
|
25
25
|
return changeOpts(res, { apFilePath: 'savedFilePath' })
|
|
26
26
|
})
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
return ENV_OBJ.saveFile(opts)
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
export {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { warn } from '../../../common/js'
|
|
1
|
+
import { ENV_OBJ, warn } from '../../../common/js'
|
|
2
2
|
|
|
3
3
|
const TIPS_NAME = '支付宝环境 mpx'
|
|
4
4
|
|
|
@@ -10,7 +10,7 @@ function getUserInfo (options = {}) {
|
|
|
10
10
|
warn(`支付宝不支持在 ${TIPS_NAME}.getUserInfo 中使用 lang 参数`)
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
return ENV_OBJ.getOpenUserInfo(options)
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { changeOpts, handleSuccess } from '../../../common/js'
|
|
1
|
+
import { ENV_OBJ, changeOpts, handleSuccess } from '../../../common/js'
|
|
2
2
|
|
|
3
3
|
function previewImage (options = {}) {
|
|
4
4
|
const opts = changeOpts(options)
|
|
@@ -8,7 +8,7 @@ function previewImage (options = {}) {
|
|
|
8
8
|
opts.current = idx !== -1 ? idx : 0
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
return ENV_OBJ.previewImage(opts)
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
function compressImage (options = {}) {
|
|
@@ -27,7 +27,7 @@ function compressImage (options = {}) {
|
|
|
27
27
|
)
|
|
28
28
|
})
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
return ENV_OBJ.compressImage(opts)
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
export {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { changeOpts, handleSuccess } from '../../../common/js'
|
|
1
|
+
import { ENV_OBJ, changeOpts, handleSuccess } from '../../../common/js'
|
|
2
2
|
|
|
3
3
|
function login (options = {}) {
|
|
4
4
|
const opts = changeOpts(options)
|
|
@@ -7,7 +7,7 @@ function login (options = {}) {
|
|
|
7
7
|
return changeOpts(res, { authCode: 'code' }, { errMsg: 'login:ok' })
|
|
8
8
|
})
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
return ENV_OBJ.getAuthCode(opts)
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { changeOpts } from '../../../common/js'
|
|
1
|
+
import { ENV_OBJ, changeOpts } from '../../../common/js'
|
|
2
2
|
|
|
3
3
|
function makePhoneCall (options = {}) {
|
|
4
4
|
const opts = changeOpts(options, {
|
|
5
5
|
phoneNumber: 'number'
|
|
6
6
|
})
|
|
7
|
-
|
|
7
|
+
return ENV_OBJ.makePhoneCall(opts)
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { changeOpts, handleSuccess } from '../../../common/js'
|
|
1
|
+
import { ENV_OBJ, changeOpts, handleSuccess } from '../../../common/js'
|
|
2
2
|
|
|
3
3
|
function showModal (options = {}) {
|
|
4
4
|
let opts
|
|
@@ -13,7 +13,7 @@ function showModal (options = {}) {
|
|
|
13
13
|
return changeOpts(res, undefined, { cancel: !res.confirm })
|
|
14
14
|
})
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
return ENV_OBJ.confirm(opts)
|
|
17
17
|
} else {
|
|
18
18
|
opts = changeOpts(options, {
|
|
19
19
|
confirmText: 'buttonText'
|
|
@@ -23,7 +23,7 @@ function showModal (options = {}) {
|
|
|
23
23
|
return changeOpts(res, undefined, { cancel: false, confirm: true })
|
|
24
24
|
})
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
return ENV_OBJ.alert(opts)
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { changeOpts, handleSuccess } from '../../../common/js'
|
|
1
|
+
import { ENV_OBJ, changeOpts, handleSuccess } from '../../../common/js'
|
|
2
2
|
|
|
3
3
|
function request (options = {}) {
|
|
4
4
|
const opts = changeOpts(options, {
|
|
@@ -14,10 +14,10 @@ function request (options = {}) {
|
|
|
14
14
|
|
|
15
15
|
// request 在 1.11.0 以上版本才支持
|
|
16
16
|
// httpRequest 即将被废弃,钉钉端仍需要使用
|
|
17
|
-
if (
|
|
18
|
-
return
|
|
17
|
+
if (ENV_OBJ.canIUse('request')) {
|
|
18
|
+
return ENV_OBJ.request(opts)
|
|
19
19
|
} else {
|
|
20
|
-
return
|
|
20
|
+
return ENV_OBJ.httpRequest(opts)
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { changeOpts, error, noop } from '../../../common/js'
|
|
1
|
+
import { ENV_OBJ, changeOpts, error, noop } from '../../../common/js'
|
|
2
2
|
|
|
3
3
|
const TIPS_NAME = '支付宝环境 mpx'
|
|
4
4
|
|
|
@@ -37,7 +37,7 @@ function requestPayment (options = {}) {
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
return ENV_OBJ.tradePay(opts)
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
export {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { changeOpts, handleSuccess } from '../../../common/js'
|
|
1
|
+
import { ENV_OBJ, changeOpts, handleSuccess } from '../../../common/js'
|
|
2
2
|
|
|
3
3
|
function scanCode (options = {}) {
|
|
4
4
|
const opts = changeOpts(options, {
|
|
@@ -9,7 +9,7 @@ function scanCode (options = {}) {
|
|
|
9
9
|
return changeOpts(res, { code: 'result' })
|
|
10
10
|
})
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
return ENV_OBJ.scan(opts)
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { changeOpts, handleSuccess } from '../../../common/js'
|
|
1
|
+
import { ENV_OBJ, changeOpts, handleSuccess } from '../../../common/js'
|
|
2
2
|
|
|
3
3
|
function setScreenBrightness (options = {}) {
|
|
4
4
|
const opts = changeOpts(options, {
|
|
@@ -7,7 +7,7 @@ function setScreenBrightness (options = {}) {
|
|
|
7
7
|
handleSuccess(opts, res => {
|
|
8
8
|
return changeOpts(res, {}, { errMsg: 'setScreenBrightness:ok' })
|
|
9
9
|
})
|
|
10
|
-
|
|
10
|
+
return ENV_OBJ.setScreenBrightness(opts)
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
function getScreenBrightness (options = {}) {
|
|
@@ -17,7 +17,7 @@ function getScreenBrightness (options = {}) {
|
|
|
17
17
|
return changeOpts(res, { brightness: 'value' }, { errMsg: 'getScreenBrightness:ok' })
|
|
18
18
|
})
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
return ENV_OBJ.getScreenBrightness(opts)
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
export {
|
|
@@ -1,22 +1,20 @@
|
|
|
1
|
-
import { changeOpts, handleSuccess } from '../../../common/js'
|
|
1
|
+
import { ENV_OBJ, changeOpts, handleSuccess } from '../../../common/js'
|
|
2
2
|
|
|
3
3
|
function setNavigationBarTitle (options = {}) {
|
|
4
4
|
handleSuccess(options, res => {
|
|
5
5
|
return changeOpts(res, {}, { errMsg: 'setScreenBrightness:ok' })
|
|
6
6
|
})
|
|
7
|
-
if (
|
|
8
|
-
|
|
9
|
-
return
|
|
7
|
+
if (ENV_OBJ.canIUse('setNavigationBarTitle')) {
|
|
8
|
+
return ENV_OBJ.setNavigationBarTitle(options)
|
|
10
9
|
}
|
|
11
|
-
|
|
10
|
+
return ENV_OBJ.setNavigationBar(options)
|
|
12
11
|
}
|
|
13
12
|
|
|
14
13
|
function setNavigationBarColor (options = {}) {
|
|
15
|
-
if (
|
|
16
|
-
|
|
17
|
-
return
|
|
14
|
+
if (ENV_OBJ.canIUse('setNavigationBarColor')) {
|
|
15
|
+
return ENV_OBJ.setNavigationBarColor(options)
|
|
18
16
|
}
|
|
19
|
-
|
|
17
|
+
return ENV_OBJ.setNavigationBar(options)
|
|
20
18
|
}
|
|
21
19
|
|
|
22
20
|
export {
|
|
@@ -1,48 +1,50 @@
|
|
|
1
|
+
import { ENV_OBJ } from '../../../common/js'
|
|
2
|
+
|
|
1
3
|
function setStorage (options) {
|
|
2
|
-
|
|
4
|
+
return ENV_OBJ.setStorage(options)
|
|
3
5
|
}
|
|
4
6
|
|
|
5
7
|
function setStorageSync (key, data) {
|
|
6
|
-
|
|
8
|
+
return ENV_OBJ.setStorageSync({
|
|
7
9
|
key,
|
|
8
10
|
data
|
|
9
11
|
})
|
|
10
12
|
}
|
|
11
13
|
|
|
12
14
|
function getStorage (options) {
|
|
13
|
-
|
|
15
|
+
return ENV_OBJ.getStorage(options)
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
function getStorageSync (key) {
|
|
17
|
-
return
|
|
19
|
+
return ENV_OBJ.getStorageSync({
|
|
18
20
|
key
|
|
19
21
|
}).data
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
function getStorageInfo (options) {
|
|
23
|
-
return
|
|
25
|
+
return ENV_OBJ.getStorageInfo(options)
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
function getStorageInfoSync () {
|
|
27
|
-
return
|
|
29
|
+
return ENV_OBJ.getStorageInfoSync()
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
function removeStorage (options) {
|
|
31
|
-
return
|
|
33
|
+
return ENV_OBJ.removeStorage(options)
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
function removeStorageSync (key) {
|
|
35
|
-
|
|
37
|
+
return ENV_OBJ.removeStorageSync({
|
|
36
38
|
key
|
|
37
39
|
})
|
|
38
40
|
}
|
|
39
41
|
|
|
40
42
|
function clearStorage (options) {
|
|
41
|
-
|
|
43
|
+
return ENV_OBJ.clearStorage(options)
|
|
42
44
|
}
|
|
43
45
|
|
|
44
46
|
function clearStorageSync (options) {
|
|
45
|
-
|
|
47
|
+
return ENV_OBJ.clearStorageSync(options)
|
|
46
48
|
}
|
|
47
49
|
|
|
48
50
|
export {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { changeOpts, handleSuccess } from '../../../common/js'
|
|
1
|
+
import { ENV_OBJ, changeOpts, handleSuccess } from '../../../common/js'
|
|
2
2
|
|
|
3
3
|
function getSystemInfo (options = {}) {
|
|
4
4
|
const opts = changeOpts(options)
|
|
5
5
|
|
|
6
6
|
handleSuccess(opts, res => {
|
|
7
7
|
res.system = `${res.platform} ${res.system}`
|
|
8
|
-
res.SDKVersion =
|
|
8
|
+
res.SDKVersion = ENV_OBJ.SDKVersion
|
|
9
9
|
|
|
10
10
|
// 支付宝 windowHeight 可能为 0
|
|
11
11
|
if (!res.windowHeight) {
|
|
@@ -15,14 +15,14 @@ function getSystemInfo (options = {}) {
|
|
|
15
15
|
return res
|
|
16
16
|
})
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
return ENV_OBJ.getSystemInfo(opts)
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
function getSystemInfoSync () {
|
|
22
|
-
const res =
|
|
22
|
+
const res = ENV_OBJ.getSystemInfoSync() || {}
|
|
23
23
|
|
|
24
24
|
res.system = `${res.platform} ${res.system}`
|
|
25
|
-
res.SDKVersion =
|
|
25
|
+
res.SDKVersion = ENV_OBJ.SDKVersion
|
|
26
26
|
|
|
27
27
|
// 支付宝 windowHeight 可能为 0
|
|
28
28
|
if (!res.windowHeight) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { changeOpts, warn } from '../../../common/js'
|
|
1
|
+
import { ENV_OBJ, changeOpts, warn } from '../../../common/js'
|
|
2
2
|
|
|
3
3
|
const TIPS_NAME = '支付宝环境 mpx'
|
|
4
4
|
|
|
@@ -7,28 +7,28 @@ function showToast (options = {}) {
|
|
|
7
7
|
title: 'content',
|
|
8
8
|
icon: 'type'
|
|
9
9
|
})
|
|
10
|
-
|
|
10
|
+
return ENV_OBJ.showToast(opts)
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
function hideToast (options = {}) {
|
|
14
14
|
if (options.success || options.fail || options.complete) {
|
|
15
15
|
warn(`${TIPS_NAME}.hideToast 不支持 success/fail/complete 参数`)
|
|
16
16
|
}
|
|
17
|
-
|
|
17
|
+
return ENV_OBJ.hideToast(options)
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
function showLoading (options = {}) {
|
|
21
21
|
const opts = changeOpts(options, {
|
|
22
22
|
title: 'content'
|
|
23
23
|
})
|
|
24
|
-
|
|
24
|
+
return ENV_OBJ.showLoading(opts)
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
function hideLoading (options = {}) {
|
|
28
28
|
if (options.success || options.fail || options.complete) {
|
|
29
29
|
warn(`${TIPS_NAME}.hideLoading 不支持 success/fail/complete 参数`)
|
|
30
30
|
}
|
|
31
|
-
|
|
31
|
+
return ENV_OBJ.hideLoading(options)
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
export {
|
package/src/platform/index.js
CHANGED
|
@@ -19,7 +19,7 @@ export * from './api/base'
|
|
|
19
19
|
// closeBLEConnection, createBLEConnection, onBLEConnectionStateChange
|
|
20
20
|
export * from './api/ble-connection'
|
|
21
21
|
|
|
22
|
-
//
|
|
22
|
+
// canvasToTempFilePath, canvasGetImageData
|
|
23
23
|
export * from './api/canvas'
|
|
24
24
|
|
|
25
25
|
// checkSession
|