@mpxjs/api-proxy 2.9.11-test.0 → 2.9.13
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/ToPromise.js +25 -0
- package/src/common/js/index.js +1 -0
- package/src/common/js/utils.js +1 -32
- package/src/index.js +75 -4
- package/src/index.web.js +24 -0
- package/src/mini/platform/wxToAli.js +667 -0
- package/src/mini/platform/wxToQq.js +20 -0
- package/src/mini/platform/wxToTt.js +9 -0
- package/src/{common/js → mini}/promisify.js +3 -4
- package/src/mini/transform.js +71 -0
- package/src/{platform → web}/api/action-sheet/ActionSheet.js +6 -6
- package/src/web/api/index.js +68 -0
- package/src/{platform → web}/api/modal/Modal.js +7 -2
- package/src/{platform/api/pull-down/index.web.js → web/api/pull-down/index.js} +22 -14
- package/src/{platform/api/request/index.web.js → web/api/request/index.js} +5 -2
- package/src/{platform/api/route/index.web.js → web/api/route/index.js} +80 -59
- package/src/{platform/api/set-navigation-bar/index.web.js → web/api/set-navigation-bar/index.js} +1 -0
- package/src/{platform → web}/api/socket/SocketTask.js +1 -1
- package/src/{platform/api/storage/index.web.js → web/api/storage/index.js} +10 -0
- package/src/{platform/api/system/index.web.js → web/api/system/index.js} +1 -0
- package/src/{platform/api/tab-bar/index.web.js → web/api/tab-bar/index.js} +8 -0
- package/src/{platform → web}/api/toast/Toast.js +3 -1
- package/src/install.js +0 -62
- package/src/platform/api/action-sheet/index.ali.js +0 -28
- package/src/platform/api/action-sheet/index.js +0 -9
- package/src/platform/api/add-phone-contact/index.ali.js +0 -13
- package/src/platform/api/add-phone-contact/index.js +0 -9
- package/src/platform/api/animation/index.js +0 -9
- package/src/platform/api/app/index.js +0 -24
- package/src/platform/api/audio/index.js +0 -9
- package/src/platform/api/base/index.js +0 -12
- package/src/platform/api/ble-connection/index.ali.js +0 -17
- package/src/platform/api/ble-connection/index.js +0 -15
- package/src/platform/api/canvas/index.ali.js +0 -16
- package/src/platform/api/canvas/index.js +0 -15
- package/src/platform/api/check-session/index.js +0 -9
- package/src/platform/api/clipboard-data/index.ali.js +0 -30
- package/src/platform/api/clipboard-data/index.js +0 -12
- package/src/platform/api/create-intersection-observer/index.ali.js +0 -7
- package/src/platform/api/create-intersection-observer/index.js +0 -9
- package/src/platform/api/create-selector-query/index.ali.js +0 -35
- package/src/platform/api/create-selector-query/index.js +0 -9
- package/src/platform/api/device/network/index.js +0 -15
- package/src/platform/api/file/index.ali.js +0 -35
- package/src/platform/api/file/index.js +0 -12
- package/src/platform/api/get-user-info/index.ali.js +0 -18
- package/src/platform/api/get-user-info/index.js +0 -9
- package/src/platform/api/image/index.ali.js +0 -36
- package/src/platform/api/image/index.js +0 -12
- package/src/platform/api/login/index.ali.js +0 -15
- package/src/platform/api/login/index.js +0 -9
- package/src/platform/api/make-phone-call/index.ali.js +0 -12
- package/src/platform/api/make-phone-call/index.js +0 -9
- package/src/platform/api/modal/index.ali.js +0 -32
- package/src/platform/api/modal/index.js +0 -9
- package/src/platform/api/next-tick/index.ali.js +0 -7
- package/src/platform/api/next-tick/index.js +0 -9
- package/src/platform/api/next-tick/index.tt.js +0 -7
- package/src/platform/api/page-scroll-to/index.js +0 -9
- package/src/platform/api/pull-down/index.js +0 -12
- package/src/platform/api/request/index.ali.js +0 -26
- package/src/platform/api/request/index.js +0 -9
- package/src/platform/api/request-payment/index.ali.js +0 -45
- package/src/platform/api/request-payment/index.js +0 -9
- package/src/platform/api/route/index.js +0 -21
- package/src/platform/api/scan-code/index.ali.js +0 -17
- package/src/platform/api/scan-code/index.js +0 -9
- package/src/platform/api/screen-brightness/index.ali.js +0 -26
- package/src/platform/api/screen-brightness/index.js +0 -12
- package/src/platform/api/set-navigation-bar/index.ali.js +0 -25
- package/src/platform/api/set-navigation-bar/index.js +0 -12
- package/src/platform/api/socket/index.js +0 -9
- package/src/platform/api/storage/index.ali.js +0 -59
- package/src/platform/api/storage/index.js +0 -36
- package/src/platform/api/system/index.ali.js +0 -38
- package/src/platform/api/system/index.js +0 -12
- package/src/platform/api/tab-bar/index.js +0 -18
- package/src/platform/api/toast/index.ali.js +0 -39
- package/src/platform/api/toast/index.js +0 -18
- package/src/platform/api/video/index.js +0 -9
- package/src/platform/api/window/index.js +0 -12
- package/src/platform/index.js +0 -106
- /package/src/{platform/api/action-sheet/index.web.js → web/api/action-sheet/index.js} +0 -0
- /package/src/{platform → web}/api/animation/animation.js +0 -0
- /package/src/{platform/api/animation/index.web.js → web/api/animation/index.js} +0 -0
- /package/src/{platform/api/app/index.web.js → web/api/app/index.js} +0 -0
- /package/src/{platform/api/audio/index.web.js → web/api/audio/index.js} +0 -0
- /package/src/{platform → web}/api/base/base64.js +0 -0
- /package/src/{platform/api/base/index.web.js → web/api/base/index.js} +0 -0
- /package/src/{platform → web}/api/create-intersection-observer/IntersectionObserver.js +0 -0
- /package/src/{platform/api/create-intersection-observer/index.web.js → web/api/create-intersection-observer/index.js} +0 -0
- /package/src/{platform → web}/api/create-selector-query/NodesRef.js +0 -0
- /package/src/{platform → web}/api/create-selector-query/SelectQuery.js +0 -0
- /package/src/{platform/api/create-selector-query/index.web.js → web/api/create-selector-query/index.js} +0 -0
- /package/src/{platform → web}/api/device/network/getNetworkType.js +0 -0
- /package/src/{platform/api/device/network/index.web.js → web/api/device/network/index.js} +0 -0
- /package/src/{platform → web}/api/device/network/onNetworkStatusChange.js +0 -0
- /package/src/{platform/api/event-channel/index.web.js → web/api/event-channel/index.js} +0 -0
- /package/src/{platform/api/modal/index.web.js → web/api/modal/index.js} +0 -0
- /package/src/{platform/api/next-tick/index.web.js → web/api/next-tick/index.js} +0 -0
- /package/src/{platform/api/page-scroll-to/index.web.js → web/api/page-scroll-to/index.js} +0 -0
- /package/src/{platform/api/image → web/api/preview-image}/Preview.js +0 -0
- /package/src/{platform/api/image/index.web.js → web/api/preview-image/index.js} +0 -0
- /package/src/{platform → web}/api/request/RequestTask.js +0 -0
- /package/src/{platform/api/socket/index.web.js → web/api/socket/index.js} +0 -0
- /package/src/{platform/api/toast/index.web.js → web/api/toast/index.js} +0 -0
- /package/src/{platform/api/video/index.web.js → web/api/video/index.js} +0 -0
- /package/src/{platform/api/window/index.web.js → web/api/window/index.js} +0 -0
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { changeOpts, noop } from '../../../common/js'
|
|
2
|
-
function showActionSheet (options = {}) {
|
|
3
|
-
const opts = changeOpts(options, {
|
|
4
|
-
itemList: 'items'
|
|
5
|
-
})
|
|
6
|
-
|
|
7
|
-
const cacheSuc = opts.success || noop
|
|
8
|
-
const cacheFail = opts.fail || noop
|
|
9
|
-
|
|
10
|
-
opts.success = function (res) {
|
|
11
|
-
const sucRes = changeOpts(res, {
|
|
12
|
-
index: 'tapIndex'
|
|
13
|
-
})
|
|
14
|
-
if (sucRes.tapIndex === -1) {
|
|
15
|
-
cacheFail.call(this, {
|
|
16
|
-
errMsg: 'showActionSheet:fail cancel'
|
|
17
|
-
})
|
|
18
|
-
} else {
|
|
19
|
-
cacheSuc.call(this, sucRes)
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
my.showActionSheet(opts)
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export {
|
|
27
|
-
showActionSheet
|
|
28
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { getEnvObj, envError } from '../../../common/js'
|
|
2
|
-
|
|
3
|
-
const ENV_OBJ = getEnvObj()
|
|
4
|
-
|
|
5
|
-
const onError = ENV_OBJ.onError || envError('onError')
|
|
6
|
-
|
|
7
|
-
const offError = ENV_OBJ.offError || envError('offError')
|
|
8
|
-
|
|
9
|
-
const onAppShow = ENV_OBJ.onAppShow || envError('onAppShow')
|
|
10
|
-
|
|
11
|
-
const offAppShow = ENV_OBJ.offAppShow || envError('offAppShow')
|
|
12
|
-
|
|
13
|
-
const onAppHide = ENV_OBJ.onAppHide || envError('onAppHide')
|
|
14
|
-
|
|
15
|
-
const offAppHide = ENV_OBJ.offAppHide || envError('offAppHide')
|
|
16
|
-
|
|
17
|
-
export {
|
|
18
|
-
onAppShow,
|
|
19
|
-
onAppHide,
|
|
20
|
-
offAppShow,
|
|
21
|
-
offAppHide,
|
|
22
|
-
onError,
|
|
23
|
-
offError
|
|
24
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { getEnvObj, envError } from '../../../common/js'
|
|
2
|
-
|
|
3
|
-
const ENV_OBJ = getEnvObj()
|
|
4
|
-
|
|
5
|
-
const base64ToArrayBuffer = ENV_OBJ.base64ToArrayBuffer || envError('base64ToArrayBuffer')
|
|
6
|
-
|
|
7
|
-
const arrayBufferToBase64 = ENV_OBJ.arrayBufferToBase64 || envError('arrayBufferToBase64')
|
|
8
|
-
|
|
9
|
-
export {
|
|
10
|
-
base64ToArrayBuffer,
|
|
11
|
-
arrayBufferToBase64
|
|
12
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
function closeBLEConnection (options = {}) {
|
|
2
|
-
my.disconnectBLEDevice(options)
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
function createBLEConnection (options = {}) {
|
|
6
|
-
my.connectBLEDevice(options)
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
function onBLEConnectionStateChange (callback) {
|
|
10
|
-
my.onBLEConnectionStateChanged(callback)
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export {
|
|
14
|
-
closeBLEConnection,
|
|
15
|
-
createBLEConnection,
|
|
16
|
-
onBLEConnectionStateChange
|
|
17
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { getEnvObj, envError } from '../../../common/js'
|
|
2
|
-
|
|
3
|
-
const ENV_OBJ = getEnvObj()
|
|
4
|
-
|
|
5
|
-
const closeBLEConnection = ENV_OBJ.closeBLEConnection || envError('closeBLEConnection')
|
|
6
|
-
|
|
7
|
-
const createBLEConnection = ENV_OBJ.createBLEConnection || envError('createBLEConnection')
|
|
8
|
-
|
|
9
|
-
const onBLEConnectionStateChange = ENV_OBJ.onBLEConnectionStateChange || envError('onBLEConnectionStateChange')
|
|
10
|
-
|
|
11
|
-
export {
|
|
12
|
-
closeBLEConnection,
|
|
13
|
-
createBLEConnection,
|
|
14
|
-
onBLEConnectionStateChange
|
|
15
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { changeOpts, handleSuccess } from '../../../common/js'
|
|
2
|
-
|
|
3
|
-
function canvasToTempFilePath (options = {}) {
|
|
4
|
-
handleSuccess(options, res => {
|
|
5
|
-
return changeOpts(
|
|
6
|
-
res,
|
|
7
|
-
{ errMsg: 'canvasToTempFilePath:ok' }
|
|
8
|
-
)
|
|
9
|
-
})
|
|
10
|
-
|
|
11
|
-
my.canvasToTempFilePath(options)
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export {
|
|
15
|
-
canvasToTempFilePath
|
|
16
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { getEnvObj, envError } from '../../../common/js'
|
|
2
|
-
|
|
3
|
-
const ENV_OBJ = getEnvObj()
|
|
4
|
-
|
|
5
|
-
const createCanvasContext = ENV_OBJ.createCanvasContext || envError('createCanvasContext')
|
|
6
|
-
|
|
7
|
-
const canvasToTempFilePath = ENV_OBJ.canvasToTempFilePath || envError('canvasToTempFilePath')
|
|
8
|
-
|
|
9
|
-
const canvasGetImageData = ENV_OBJ.canvasGetImageData || envError('canvasGetImageData')
|
|
10
|
-
|
|
11
|
-
export {
|
|
12
|
-
createCanvasContext,
|
|
13
|
-
canvasToTempFilePath,
|
|
14
|
-
canvasGetImageData
|
|
15
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { changeOpts, handleSuccess } from '../../../common/js'
|
|
2
|
-
|
|
3
|
-
function setClipboardData (options = {}) {
|
|
4
|
-
const opts = changeOpts(options, {
|
|
5
|
-
data: 'text'
|
|
6
|
-
})
|
|
7
|
-
handleSuccess(opts, res => {
|
|
8
|
-
return changeOpts(res, {
|
|
9
|
-
success: ''
|
|
10
|
-
}, {
|
|
11
|
-
errMsg: 'setClipboardData:ok'
|
|
12
|
-
})
|
|
13
|
-
})
|
|
14
|
-
my.setClipboard(opts)
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function getClipboardData (options = {}) {
|
|
18
|
-
const opts = changeOpts(options)
|
|
19
|
-
|
|
20
|
-
handleSuccess(opts, res => {
|
|
21
|
-
return changeOpts(res, { text: 'data' })
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
my.getClipboard(opts)
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export {
|
|
28
|
-
setClipboardData,
|
|
29
|
-
getClipboardData
|
|
30
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { getEnvObj, envError } from '../../../common/js'
|
|
2
|
-
|
|
3
|
-
const ENV_OBJ = getEnvObj()
|
|
4
|
-
|
|
5
|
-
const setClipboardData = ENV_OBJ.setClipboardData || envError('setClipboardData')
|
|
6
|
-
|
|
7
|
-
const getClipboardData = ENV_OBJ.getClipboardData || envError('getClipboardData')
|
|
8
|
-
|
|
9
|
-
export {
|
|
10
|
-
setClipboardData,
|
|
11
|
-
getClipboardData
|
|
12
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { noop } from '../../../common/js'
|
|
2
|
-
|
|
3
|
-
function createSelectorQuery (options = {}) {
|
|
4
|
-
const selectorQuery = my.createSelectorQuery(options)
|
|
5
|
-
const proxyMethods = ['boundingClientRect', 'scrollOffset']
|
|
6
|
-
const cbs = []
|
|
7
|
-
proxyMethods.forEach((name) => {
|
|
8
|
-
const originalMethod = selectorQuery[name]
|
|
9
|
-
selectorQuery[name] = function (cb = noop) {
|
|
10
|
-
cbs.push(cb)
|
|
11
|
-
return originalMethod.call(this)
|
|
12
|
-
}
|
|
13
|
-
})
|
|
14
|
-
|
|
15
|
-
const originalExec = selectorQuery.exec
|
|
16
|
-
selectorQuery.exec = function (originalCb = noop) {
|
|
17
|
-
const cb = function (results) {
|
|
18
|
-
results.forEach((item, index) => {
|
|
19
|
-
cbs[index] && cbs[index](item)
|
|
20
|
-
})
|
|
21
|
-
originalCb(results)
|
|
22
|
-
}
|
|
23
|
-
return originalExec.call(this, cb)
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
selectorQuery.in = function () {
|
|
27
|
-
return this
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
return selectorQuery
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export {
|
|
34
|
-
createSelectorQuery
|
|
35
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { getEnvObj, envError } from '../../../../common/js'
|
|
2
|
-
|
|
3
|
-
const ENV_OBJ = getEnvObj()
|
|
4
|
-
|
|
5
|
-
const getNetworkType = ENV_OBJ.getNetworkType || envError('getNetworkType')
|
|
6
|
-
|
|
7
|
-
const onNetworkStatusChange = ENV_OBJ.onNetworkStatusChange || envError('onNetworkStatusChange')
|
|
8
|
-
|
|
9
|
-
const offNetworkStatusChange = ENV_OBJ.offNetworkStatusChange || envError('offNetworkStatusChange')
|
|
10
|
-
|
|
11
|
-
export {
|
|
12
|
-
getNetworkType,
|
|
13
|
-
onNetworkStatusChange,
|
|
14
|
-
offNetworkStatusChange
|
|
15
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { changeOpts, handleSuccess } from '../../../common/js'
|
|
2
|
-
|
|
3
|
-
function downloadFile (options = {}) {
|
|
4
|
-
const opts = changeOpts(options)
|
|
5
|
-
|
|
6
|
-
handleSuccess(opts, res => {
|
|
7
|
-
return changeOpts(res, { apFilePath: 'tempFilePath' })
|
|
8
|
-
})
|
|
9
|
-
|
|
10
|
-
return my.downloadFile(opts)
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
function uploadFile (options = {}) {
|
|
14
|
-
const opts = changeOpts(options, { name: 'fileName' })
|
|
15
|
-
|
|
16
|
-
return my.uploadFile(opts)
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function saveFile (options = {}) {
|
|
20
|
-
const opts = changeOpts(options, {
|
|
21
|
-
tempFilePath: 'apFilePath'
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
handleSuccess(opts, res => {
|
|
25
|
-
return changeOpts(res, { apFilePath: 'savedFilePath' })
|
|
26
|
-
})
|
|
27
|
-
|
|
28
|
-
my.saveFile(opts)
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export {
|
|
32
|
-
downloadFile,
|
|
33
|
-
uploadFile,
|
|
34
|
-
saveFile
|
|
35
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { getEnvObj, envError } from '../../../common/js'
|
|
2
|
-
|
|
3
|
-
const ENV_OBJ = getEnvObj()
|
|
4
|
-
|
|
5
|
-
const downloadFile = ENV_OBJ.downloadFile || envError('downloadFile')
|
|
6
|
-
|
|
7
|
-
const uploadFile = ENV_OBJ.uploadFile || envError('uploadFile')
|
|
8
|
-
|
|
9
|
-
export {
|
|
10
|
-
downloadFile,
|
|
11
|
-
uploadFile
|
|
12
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { warn } from '../../../common/js'
|
|
2
|
-
|
|
3
|
-
const TIPS_NAME = '支付宝环境 mpx'
|
|
4
|
-
|
|
5
|
-
function getUserInfo (options = {}) {
|
|
6
|
-
if (options.withCredentials === true) {
|
|
7
|
-
warn(`支付宝不支持在 ${TIPS_NAME}.getUserInfo 使用 withCredentials 参数中获取等敏感信息`)
|
|
8
|
-
}
|
|
9
|
-
if (options.lang) {
|
|
10
|
-
warn(`支付宝不支持在 ${TIPS_NAME}.getUserInfo 中使用 lang 参数`)
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
my.getOpenUserInfo(options)
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export {
|
|
17
|
-
getUserInfo
|
|
18
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { changeOpts, handleSuccess } from '../../../common/js'
|
|
2
|
-
|
|
3
|
-
function previewImage (options = {}) {
|
|
4
|
-
const opts = changeOpts(options)
|
|
5
|
-
|
|
6
|
-
if (opts.current) {
|
|
7
|
-
const idx = options.urls.indexOf(opts.current)
|
|
8
|
-
opts.current = idx !== -1 ? idx : 0
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
my.previewImage(opts)
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
function compressImage (options = {}) {
|
|
15
|
-
const opts = changeOpts(options, {
|
|
16
|
-
quality: ''
|
|
17
|
-
}, {
|
|
18
|
-
compressLevel: Math.round(options.quality / 100 * 4), // 支付宝图片压缩质量为 0 ~ 4,微信是 0 ~ 100
|
|
19
|
-
apFilePaths: [options.src]
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
handleSuccess(opts, res => {
|
|
23
|
-
return changeOpts(
|
|
24
|
-
res,
|
|
25
|
-
{ apFilePaths: '' },
|
|
26
|
-
{ tempFilePath: res.apFilePaths[0] }
|
|
27
|
-
)
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
my.compressImage(opts)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export {
|
|
34
|
-
previewImage,
|
|
35
|
-
compressImage
|
|
36
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { getEnvObj, envError } from '../../../common/js'
|
|
2
|
-
|
|
3
|
-
const ENV_OBJ = getEnvObj()
|
|
4
|
-
|
|
5
|
-
const previewImage = ENV_OBJ.previewImage || envError('previewImage')
|
|
6
|
-
|
|
7
|
-
const compressImage = ENV_OBJ.compressImage || envError('compressImage')
|
|
8
|
-
|
|
9
|
-
export {
|
|
10
|
-
previewImage,
|
|
11
|
-
compressImage
|
|
12
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { changeOpts, handleSuccess } from '../../../common/js'
|
|
2
|
-
|
|
3
|
-
function login (options = {}) {
|
|
4
|
-
const opts = changeOpts(options)
|
|
5
|
-
|
|
6
|
-
handleSuccess(opts, res => {
|
|
7
|
-
return changeOpts(res, { authCode: 'code' }, { errMsg: 'login:ok' })
|
|
8
|
-
})
|
|
9
|
-
|
|
10
|
-
my.getAuthCode(opts)
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export {
|
|
14
|
-
login
|
|
15
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { changeOpts, handleSuccess } from '../../../common/js'
|
|
2
|
-
|
|
3
|
-
function showModal (options = {}) {
|
|
4
|
-
let opts
|
|
5
|
-
|
|
6
|
-
if (options.showCancel === undefined || options.showCancel) {
|
|
7
|
-
opts = changeOpts(options, {
|
|
8
|
-
confirmText: 'confirmButtonText',
|
|
9
|
-
cancelText: 'cancelButtonText'
|
|
10
|
-
})
|
|
11
|
-
|
|
12
|
-
handleSuccess(opts, res => {
|
|
13
|
-
return changeOpts(res, undefined, { cancel: !res.confirm })
|
|
14
|
-
})
|
|
15
|
-
|
|
16
|
-
my.confirm(opts)
|
|
17
|
-
} else {
|
|
18
|
-
opts = changeOpts(options, {
|
|
19
|
-
confirmText: 'buttonText'
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
handleSuccess(opts, res => {
|
|
23
|
-
return changeOpts(res, undefined, { cancel: false, confirm: true })
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
my.alert(opts)
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export {
|
|
31
|
-
showModal
|
|
32
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { getEnvObj, envError } from '../../../common/js'
|
|
2
|
-
|
|
3
|
-
const ENV_OBJ = getEnvObj()
|
|
4
|
-
|
|
5
|
-
const stopPullDownRefresh = ENV_OBJ.stopPullDownRefresh || envError('stopPullDownRefresh')
|
|
6
|
-
|
|
7
|
-
const startPullDownRefresh = ENV_OBJ.startPullDownRefresh || envError('startPullDownRefresh')
|
|
8
|
-
|
|
9
|
-
export {
|
|
10
|
-
stopPullDownRefresh,
|
|
11
|
-
startPullDownRefresh
|
|
12
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { changeOpts, handleSuccess } from '../../../common/js'
|
|
2
|
-
|
|
3
|
-
function request (options = {}) {
|
|
4
|
-
const opts = changeOpts(options, {
|
|
5
|
-
header: 'headers'
|
|
6
|
-
})
|
|
7
|
-
|
|
8
|
-
handleSuccess(opts, res => {
|
|
9
|
-
return changeOpts(res, {
|
|
10
|
-
headers: 'header',
|
|
11
|
-
status: 'statusCode'
|
|
12
|
-
})
|
|
13
|
-
})
|
|
14
|
-
|
|
15
|
-
// request 在 1.11.0 以上版本才支持
|
|
16
|
-
// httpRequest 即将被废弃,钉钉端仍需要使用
|
|
17
|
-
if (my.canIUse('request')) {
|
|
18
|
-
return my.request(opts)
|
|
19
|
-
} else {
|
|
20
|
-
return my.httpRequest(opts)
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export {
|
|
25
|
-
request
|
|
26
|
-
}
|