@mpxjs/api-proxy 2.9.53 → 2.9.59

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.
Files changed (58) hide show
  1. package/@types/index.d.ts +7 -7
  2. package/package.json +20 -4
  3. package/src/common/js/promisify.js +3 -1
  4. package/src/common/js/utils.js +13 -1
  5. package/src/common/js/web.js +0 -12
  6. package/src/platform/api/action-sheet/ActionSheet.js +3 -7
  7. package/src/platform/api/action-sheet/index.android.js +1 -0
  8. package/src/platform/api/action-sheet/index.ios.js +1 -0
  9. package/src/platform/api/action-sheet/rnActionSheet.jsx +127 -0
  10. package/src/platform/api/app/index.android.js +1 -0
  11. package/src/platform/api/app/index.ios.js +1 -0
  12. package/src/platform/api/app/index.web.js +5 -4
  13. package/src/platform/api/clipboard-data/rnClipboard.js +5 -5
  14. package/src/platform/api/create-intersection-observer/IntersectionObserver.js +5 -5
  15. package/src/platform/api/create-selector-query/index.android.js +1 -0
  16. package/src/platform/api/create-selector-query/index.ios.js +9 -0
  17. package/src/platform/api/create-selector-query/rnNodesRef.js +262 -0
  18. package/src/platform/api/create-selector-query/rnSelectQuery.js +43 -0
  19. package/src/platform/api/device/network/getNetworkType.js +4 -4
  20. package/src/platform/api/device/network/rnNetwork.js +3 -3
  21. package/src/platform/api/image/Preview.js +3 -3
  22. package/src/platform/api/location/index.ali.js +31 -0
  23. package/src/platform/api/location/index.android.js +1 -0
  24. package/src/platform/api/location/index.ios.js +31 -0
  25. package/src/platform/api/location/index.js +13 -0
  26. package/src/platform/api/location/index.web.js +36 -0
  27. package/src/platform/api/make-phone-call/rnMakePhone.js +3 -3
  28. package/src/platform/api/modal/Modal.js +12 -15
  29. package/src/platform/api/modal/index.android.js +1 -0
  30. package/src/platform/api/modal/index.ios.js +1 -0
  31. package/src/platform/api/modal/rnModal.jsx +149 -0
  32. package/src/platform/api/next-tick/index.android.js +1 -0
  33. package/src/platform/api/next-tick/index.ios.js +1 -0
  34. package/src/platform/api/page-scroll-to/index.web.js +3 -3
  35. package/src/platform/api/pull-down/index.web.js +5 -5
  36. package/src/platform/api/request/index.web.js +3 -6
  37. package/src/platform/api/route/index.ios.js +9 -9
  38. package/src/platform/api/route/index.web.js +15 -18
  39. package/src/platform/api/screen-brightness/index.android.js +1 -0
  40. package/src/platform/api/screen-brightness/index.ios.js +1 -0
  41. package/src/platform/api/screen-brightness/rnScreenBrightness.js +53 -0
  42. package/src/platform/api/set-navigation-bar/index.android.js +1 -0
  43. package/src/platform/api/set-navigation-bar/index.ios.js +41 -0
  44. package/src/platform/api/set-navigation-bar/index.web.js +3 -3
  45. package/src/platform/api/socket/SocketTask.js +7 -17
  46. package/src/platform/api/socket/index.web.js +3 -3
  47. package/src/platform/api/storage/index.web.js +11 -12
  48. package/src/platform/api/storage/rnStorage.js +12 -12
  49. package/src/platform/api/system/index.web.js +2 -2
  50. package/src/platform/api/system/rnSystem.js +3 -3
  51. package/src/platform/api/tab-bar/index.web.js +9 -9
  52. package/src/platform/api/toast/Toast.js +3 -3
  53. package/src/platform/api/toast/error.png +0 -0
  54. package/src/platform/api/toast/index.android.js +1 -0
  55. package/src/platform/api/toast/index.ios.js +1 -0
  56. package/src/platform/api/toast/rnToast.jsx +189 -0
  57. package/src/platform/api/toast/success.png +0 -0
  58. package/src/platform/index.js +3 -0
@@ -0,0 +1,43 @@
1
+ import NodeRef from './rnNodesRef'
2
+ import { warn, noop } from '@mpxjs/utils'
3
+
4
+ export default class SelectorQuery {
5
+ constructor () {
6
+ this._component = null
7
+ this._queue = []
8
+ this._queueCb = []
9
+ }
10
+
11
+ // wx 目前 exec 方法返回 undefined,文档上标注的是 NodeRef 类型,按实际的返回值来实现
12
+ exec (cb = noop) {
13
+ Promise.all(this._queueCb.map((cb) => cb())).then((res) => cb(res))
14
+ }
15
+
16
+ in (component) {
17
+ this._component = component
18
+ return this
19
+ }
20
+
21
+ /**
22
+ * 目前支持的 selector
23
+ *
24
+ * 1. id 选择器:#the-id
25
+ * 2. class 选择器(可以连续指定多个):.a-class.another-class
26
+ */
27
+ select (selector = '', all) {
28
+ if (!this._component) {
29
+ warn('Please use SelectorQuery.in method to set context')
30
+ }
31
+ const refs = this._component && this._component.__selectRef(selector, 'node', all)
32
+ return new NodeRef(refs, this, !all)
33
+ }
34
+
35
+ selectAll (selector) {
36
+ return this.select(selector, true)
37
+ }
38
+
39
+ selectViewport () {
40
+ // todo rn 这块实现不了
41
+ return this.select('')
42
+ }
43
+ }
@@ -1,4 +1,4 @@
1
- import { webHandleSuccess, webHandleFail, isBrowser, throwSSRWarning } from '../../../../common/js'
1
+ import { successHandle, failHandle, isBrowser, throwSSRWarning } from '../../../../common/js'
2
2
 
3
3
  export function getNetworkType ({ success, fail = () => {}, complete = () => {} } = {}) {
4
4
  if (!isBrowser) {
@@ -7,11 +7,11 @@ export function getNetworkType ({ success, fail = () => {}, complete = () => {}
7
7
  }
8
8
  try {
9
9
  if (navigator.connection) {
10
- webHandleSuccess({ networkType: navigator.connection.effectiveType }, success, complete)
10
+ successHandle({ networkType: navigator.connection.effectiveType }, success, complete)
11
11
  } else {
12
- webHandleSuccess({ networkType: 'unknown' }, success, complete)
12
+ successHandle({ networkType: 'unknown' }, success, complete)
13
13
  }
14
14
  } catch (err) {
15
- webHandleFail(err, fail, complete)
15
+ failHandle(err, fail, complete)
16
16
  }
17
17
  }
@@ -1,4 +1,4 @@
1
- import { webHandleSuccess, webHandleFail, defineUnsupportedProps } from '../../../../common/js'
1
+ import { successHandle, failHandle, defineUnsupportedProps } from '../../../../common/js'
2
2
  import NetInfo, { NetInfoStateType } from '@react-native-community/netinfo'
3
3
 
4
4
  let _unsubscribe = null
@@ -21,12 +21,12 @@ const getNetworkType = function (options) {
21
21
  errMsg: 'getNetworkType:ok'
22
22
  }
23
23
  defineUnsupportedProps(result, ['signalStrength', 'hasSystemProxy'])
24
- webHandleSuccess(result, success, complete)
24
+ successHandle(result, success, complete)
25
25
  }).catch((err) => {
26
26
  const result = {
27
27
  errMsg: err.message
28
28
  }
29
- webHandleFail(result, fail, complete)
29
+ failHandle(result, fail, complete)
30
30
  })
31
31
  }
32
32
 
@@ -1,4 +1,4 @@
1
- import { webHandleSuccess, webHandleFail, createDom, warn, bindTap, getRootElement } from '../../../common/js'
1
+ import { successHandle, failHandle, createDom, warn, bindTap, getRootElement } from '../../../common/js'
2
2
  import '../../../common/stylus/Preview.styl'
3
3
  /**
4
4
  * Preview class for displaying images in a slideshow format.
@@ -67,9 +67,9 @@ export default class Preview {
67
67
  }))))
68
68
  this.maxIndex = urls.length
69
69
  this.updateTextTip()
70
- webHandleSuccess({ errMsg: 'previewImage:ok' }, success, complete)
70
+ successHandle({ errMsg: 'previewImage:ok' }, success, complete)
71
71
  } catch (e) {
72
- webHandleFail({ errMsg: 'previewImage:fail', err: e }, fail, complete)
72
+ failHandle({ errMsg: 'previewImage:fail', err: e }, fail, complete)
73
73
  }
74
74
  }
75
75
 
@@ -0,0 +1,31 @@
1
+ import { ENV_OBJ, changeOpts, handleSuccess, defineUnsupportedProps } from '../../../common/js'
2
+
3
+ function getLocation (options = {}) {
4
+ const opts = Object.assign(options, {
5
+ type: 0 // 只获取经纬与微信拉齐
6
+ })
7
+ handleSuccess(opts, res => {
8
+ const result = changeOpts(
9
+ res,
10
+ { errMsg: 'getLocation:ok' }
11
+ )
12
+ defineUnsupportedProps(result, ['speed'])
13
+ return result
14
+ })
15
+ return ENV_OBJ.getLocation(opts)
16
+ }
17
+
18
+ function openLocation (options = {}) {
19
+ const opts = Object.assign({
20
+ scale: 15 // 地图缩放比例兜底值
21
+ }, options)
22
+ return ENV_OBJ.openLocation(opts)
23
+ }
24
+
25
+ const chooseLocation = ENV_OBJ.chooseLocation
26
+
27
+ export {
28
+ getLocation,
29
+ openLocation,
30
+ chooseLocation
31
+ }
@@ -0,0 +1 @@
1
+ export * from './index.ios'
@@ -0,0 +1,31 @@
1
+ import GetLocation from 'react-native-get-location'
2
+ import { envError, successHandle, failHandle, defineUnsupportedProps } from '../../../common/js'
3
+
4
+ const getLocation = function (options) {
5
+ const { isHighAccuracy = false, success, fail, complete } = options
6
+ GetLocation.getCurrentPosition({
7
+ enableHighAccuracy: isHighAccuracy
8
+ }).then(location => {
9
+ Object.assign(location, {
10
+ errMsg: 'getLocation:ok'
11
+ })
12
+ defineUnsupportedProps(location, ['horizontalAccuracy'])
13
+ successHandle(location, success, complete)
14
+ })
15
+ .catch(error => {
16
+ const result = {
17
+ errMsg: `getLocation:fail ${error}`
18
+ }
19
+ failHandle(result, fail, complete)
20
+ })
21
+ }
22
+
23
+ const openLocation = envError('openLocation')
24
+
25
+ const chooseLocation = envError('chooseLocation')
26
+
27
+ export {
28
+ getLocation,
29
+ openLocation,
30
+ chooseLocation
31
+ }
@@ -0,0 +1,13 @@
1
+ import { ENV_OBJ, envError } from '../../../common/js'
2
+
3
+ const getLocation = ENV_OBJ.getLocation || envError('getLocation')
4
+
5
+ const openLocation = ENV_OBJ.openLocation || envError('openLocation')
6
+
7
+ const chooseLocation = ENV_OBJ.chooseLocation || envError('chooseLocation')
8
+
9
+ export {
10
+ getLocation,
11
+ openLocation,
12
+ chooseLocation
13
+ }
@@ -0,0 +1,36 @@
1
+ import { envError, successHandle, failHandle, defineUnsupportedProps } from '../../../common/js'
2
+
3
+ const getLocation = function (options) {
4
+ const { isHighAccuracy = false, success, fail, complete } = options
5
+ if (navigator.geolocation.getCurrentPosition) {
6
+ navigator.geolocation.getCurrentPosition((res = {}) => {
7
+ const coords = res.coords || {}
8
+ const result = {
9
+ accuracy: coords.accuracy,
10
+ errMsg: 'getLocation:ok',
11
+ latitude: coords.latitude,
12
+ longitude: coords.longitude,
13
+ speed: coords.accuracy
14
+ }
15
+ defineUnsupportedProps(result, ['horizontalAccuracy', 'verticalAccuracy'])
16
+ successHandle(result, success, complete)
17
+ }, (err) => {
18
+ const result = {
19
+ errMsg: `getLocation:fail ${err}`
20
+ }
21
+ failHandle(result, fail, complete)
22
+ }, {
23
+ enableHighAccuracy: isHighAccuracy
24
+ })
25
+ }
26
+ }
27
+
28
+ const openLocation = envError('openLocation')
29
+
30
+ const chooseLocation = envError('chooseLocation')
31
+
32
+ export {
33
+ getLocation,
34
+ openLocation,
35
+ chooseLocation
36
+ }
@@ -1,4 +1,4 @@
1
- import { webHandleSuccess, webHandleFail } from '../../../common/js'
1
+ import { successHandle, failHandle } from '../../../common/js'
2
2
  import { Linking } from 'react-native'
3
3
 
4
4
  const makePhoneCall = function (options) {
@@ -13,12 +13,12 @@ const makePhoneCall = function (options) {
13
13
  const result = {
14
14
  errMsg: 'makePhoneCall:ok'
15
15
  }
16
- webHandleSuccess(result, success, complete)
16
+ successHandle(result, success, complete)
17
17
  }).catch(() => {
18
18
  const result = {
19
19
  errMsg: 'makePhoneCall:fail cancel'
20
20
  }
21
- webHandleFail(result, fail, complete)
21
+ failHandle(result, fail, complete)
22
22
  })
23
23
  }
24
24
 
@@ -1,4 +1,4 @@
1
- import { createDom, getRootElement, webHandleSuccess } from '../../../common/js'
1
+ import { createDom, getRootElement, successHandle, failHandle } from '../../../common/js'
2
2
  import '../../../common/stylus/Modal.styl'
3
3
  // import { forEach } from '@didi/mpx-fetch/src/util'
4
4
  // 汉字为两个字符,字母/数字为一个字符
@@ -23,9 +23,9 @@ export default class Modal {
23
23
  cancelColor: '#000000',
24
24
  confirmText: '确定',
25
25
  confirmColor: '#576B95',
26
- success: (...args) => {},
27
- fail: (...args) => {},
28
- complete: (...args) => {}
26
+ success: (...args) => { },
27
+ fail: (...args) => { },
28
+ complete: (...args) => { }
29
29
  }
30
30
 
31
31
  this.hideTimer = null
@@ -44,21 +44,18 @@ export default class Modal {
44
44
  }
45
45
 
46
46
  show (options = {}) {
47
- getRootElement().appendChild(this.modal)
48
- if (options.confirmText && _getLength(options.confirmText) > 8) {
49
- // eslint-disable-next-line
50
- return Promise.reject({errMsg: 'showModal:fail confirmText length should not larger than 4 Chinese characters'})
47
+ const opts = Object.assign({}, this.defaultOpts, options)
48
+ if (opts.confirmText && _getLength(opts.confirmText) > 8) {
49
+ return failHandle({ errMsg: 'showModal:fail confirmText length should not larger than 4 Chinese characters' }, opts.fail, opts.complete)
51
50
  }
52
- if (options.cancelText && _getLength(options.cancelText) > 8) {
53
- // eslint-disable-next-line
54
- return Promise.reject({errMsg: 'showModal:fail cancelText length should not larger than 4 Chinese characters'})
51
+ if (opts.cancelText && _getLength(opts.cancelText) > 8) {
52
+ return failHandle({ errMsg: 'showModal:fail cancelText length should not larger than 4 Chinese characters' }, opts.fail, opts.complete)
55
53
  }
54
+ getRootElement().appendChild(this.modal)
56
55
  if (this.hideTimer) {
57
56
  clearTimeout(this.hideTimer)
58
57
  this.hideTimer = null
59
58
  }
60
- const opts = Object.assign({}, this.defaultOpts, options)
61
-
62
59
  this.title.textContent = opts.title
63
60
  this.content.textContent = opts.content
64
61
 
@@ -80,7 +77,7 @@ export default class Modal {
80
77
  cancel: true,
81
78
  confirm: false
82
79
  }
83
- webHandleSuccess(result, opts.success, opts.complete)
80
+ successHandle(result, opts.success, opts.complete)
84
81
  }
85
82
  this.confirmBtn.onclick = () => {
86
83
  this.hide()
@@ -89,7 +86,7 @@ export default class Modal {
89
86
  cancel: false,
90
87
  confirm: true
91
88
  }
92
- webHandleSuccess(result, opts.success, opts.complete)
89
+ successHandle(result, opts.success, opts.complete)
93
90
  }
94
91
 
95
92
  this.modal.classList.add('show')
@@ -0,0 +1 @@
1
+ export * from './rnModal'
@@ -0,0 +1 @@
1
+ export * from './rnModal'
@@ -0,0 +1,149 @@
1
+ import { View, Dimensions, Text, StyleSheet, TouchableOpacity, ScrollView } from 'react-native'
2
+ import { successHandle, failHandle } from '../../../common/js'
3
+ import { Portal } from '@ant-design/react-native'
4
+ const { width, height } = Dimensions.get('window')
5
+ const showModal = function (options) {
6
+ const {
7
+ title,
8
+ content,
9
+ showCancel = true,
10
+ cancelText = '取消',
11
+ cancelColor = '#000000',
12
+ confirmText = '确定',
13
+ confirmColor = '#576B95',
14
+ editable = false,
15
+ placeholderText,
16
+ success,
17
+ fail,
18
+ complete
19
+ } = options
20
+ const modalWidth = width - 60
21
+ const styles = StyleSheet.create({
22
+ modalTask: {
23
+ width,
24
+ height,
25
+ justifyContent: 'center',
26
+ alignItems: 'center',
27
+ backgroundColor: 'rgba(0,0,0,0.6)',
28
+ position: 'absolute'
29
+ },
30
+ modalContent: {
31
+ paddingTop: 20,
32
+ width: modalWidth,
33
+ backgroundColor: '#ffffff',
34
+ borderRadius: 15,
35
+ justifyContent: 'center',
36
+ alignItems: 'center'
37
+ },
38
+ modalTitleText: {
39
+ fontSize: 18,
40
+ fontWeight: 'bold',
41
+ paddingLeft: 20,
42
+ paddingRight: 20
43
+ },
44
+ contentBox: {
45
+ maxHeight: height * 0.45,
46
+ marginTop: 10
47
+ },
48
+ modalContentText: {
49
+ fontSize: 16,
50
+ lineHeight: 26,
51
+ color: '#808080',
52
+ paddingLeft: 20,
53
+ paddingRight: 20
54
+ },
55
+ modalBtnBox: {
56
+ borderTopWidth: StyleSheet.hairlineWidth,
57
+ borderTopColor: 'rgba(0,0,0,0.2)',
58
+ borderStyle: 'solid',
59
+ marginTop: 25,
60
+ width: '100%',
61
+ display: 'flex',
62
+ flexDirection: 'row'
63
+ },
64
+ modalBtn: {
65
+ flex: 1,
66
+ textAlign: 'center',
67
+ paddingTop: 10,
68
+ paddingBottom: 10,
69
+ },
70
+ modalButton: {
71
+ width: '100%',
72
+ fontWeight: 'bold',
73
+ textAlign: 'center'
74
+ },
75
+ cancelStyle: {
76
+ borderRightWidth: StyleSheet.hairlineWidth,
77
+ borderRightColor: 'rgba(0,0,0,0.2)',
78
+ borderStyle: 'solid',
79
+ }
80
+ })
81
+ let modalKey
82
+ let ModalView
83
+ let modalTitle = []
84
+ let modalContent = []
85
+ let modalButton = [{
86
+ text: confirmText,
87
+ confirmColor,
88
+ type: 'confirm',
89
+ color: 'rgb(87, 107, 149)'
90
+ }]
91
+ const closeModal = function (buttonInfo) {
92
+ Portal.remove(modalKey)
93
+ modalKey = null
94
+ const result = {
95
+ errMsg: 'showModal:ok'
96
+ }
97
+ if (buttonInfo.type === 'confirm') {
98
+ Object.assign(result, {
99
+ confirm: true,
100
+ cancel: false,
101
+ content: null
102
+ })
103
+ } else {
104
+ Object.assign(result, {
105
+ confirm: false,
106
+ cancel: true
107
+ })
108
+ }
109
+ successHandle(result, success, complete)
110
+ }
111
+ if (title) {
112
+ modalTitle.push(title)
113
+ }
114
+ if (!editable && content) {
115
+ modalContent.push(content)
116
+ }
117
+ if (showCancel) {
118
+ modalButton.unshift({
119
+ text: cancelText,
120
+ cancelColor,
121
+ type: 'cancel',
122
+ style: styles.cancelStyle,
123
+ color: '#000000'
124
+ })
125
+ }
126
+ if (!editable) {
127
+ ModalView = <View style={styles.modalTask}>
128
+ <View style={styles.modalContent}>
129
+ {modalTitle.map((item, index) => <View key={index}><Text style={styles.modalTitleText}>{item}</Text></View>)}
130
+ {modalContent.map((item, index) => <ScrollView key={index} style={styles.contentBox}><Text style={styles.modalContentText}>{item}</Text></ScrollView>)}
131
+ <View style={styles.modalBtnBox}>
132
+ {modalButton.map((item, index) => <TouchableOpacity key={index} style={[ styles.modalBtn, item.style ]} onPress={() => closeModal(item)}><Text style={[styles.modalButton, { color: item.color }]}>{item.text}</Text></TouchableOpacity>)}
133
+ </View>
134
+ </View>
135
+ </View>
136
+ }
137
+ try {
138
+ modalKey = Portal.add(ModalView)
139
+ } catch (e) {
140
+ const result = {
141
+ errMsg: `showModal:fail invalid ${e}`
142
+ }
143
+ failHandle(result, fail, complete)
144
+ }
145
+ }
146
+
147
+ export {
148
+ showModal
149
+ }
@@ -0,0 +1 @@
1
+ export * from './index.ali'
@@ -0,0 +1 @@
1
+ export * from './index.ali'
@@ -1,4 +1,4 @@
1
- import { webHandleSuccess, webHandleFail, isBrowser, throwSSRWarning } from '../../../common/js'
1
+ import { successHandle, failHandle, isBrowser, throwSSRWarning } from '../../../common/js'
2
2
  import { nextTick } from '../next-tick'
3
3
 
4
4
  export function pageScrollTo (options) {
@@ -11,13 +11,13 @@ export function pageScrollTo (options) {
11
11
  const { success, fail, complete } = options
12
12
 
13
13
  if (!ms) {
14
- return webHandleFail({
14
+ return failHandle({
15
15
  errMsg: 'pageScrollTo:fail'
16
16
  }, fail, complete)
17
17
  }
18
18
 
19
19
  ms.pageScrollTo(options)
20
- webHandleSuccess({
20
+ successHandle({
21
21
  errMsg: 'pageScrollTo:ok'
22
22
  }, success, complete)
23
23
  })
@@ -1,4 +1,4 @@
1
- import { webHandleSuccess, webHandleFail, throwSSRWarning, isBrowser } from '../../../common/js'
1
+ import { successHandle, failHandle, throwSSRWarning, isBrowser } from '../../../common/js'
2
2
 
3
3
  function stopPullDownRefresh (options = {}) {
4
4
  if (!isBrowser) {
@@ -22,10 +22,10 @@ function stopPullDownRefresh (options = {}) {
22
22
  }
23
23
  if (err) {
24
24
  const res = { errMsg: `stopPullDownRefresh:fail ${err}` }
25
- webHandleFail(res, options.fail, options.complete)
25
+ failHandle(res, options.fail, options.complete)
26
26
  } else {
27
27
  const res = { errMsg: 'stopPullDownRefresh:ok' }
28
- webHandleSuccess(res, options.success, options.complete)
28
+ successHandle(res, options.success, options.complete)
29
29
  }
30
30
  }
31
31
  }
@@ -52,10 +52,10 @@ function startPullDownRefresh (options = {}) {
52
52
  }
53
53
  if (err) {
54
54
  const res = { errMsg: `startPullDownRefresh:fail ${err}` }
55
- webHandleFail(res, options.fail, options.complete)
55
+ failHandle(res, options.fail, options.complete)
56
56
  } else {
57
57
  const res = { errMsg: 'startPullDownRefresh:ok' }
58
- webHandleSuccess(res, options.success, options.complete)
58
+ successHandle(res, options.success, options.complete)
59
59
  }
60
60
  }
61
61
  }
@@ -1,5 +1,5 @@
1
1
  import axios from 'axios'
2
- import { webHandleSuccess, webHandleFail, defineUnsupportedProps } from '../../../common/js'
2
+ import { successHandle, failHandle, defineUnsupportedProps } from '../../../common/js'
3
3
  import RequestTask from './RequestTask'
4
4
 
5
5
  function request (options = { url: '' }) {
@@ -70,7 +70,7 @@ function request (options = { url: '' }) {
70
70
  header: res.headers
71
71
  }
72
72
  defineUnsupportedProps(result, ['cookies', 'profile', 'exception'])
73
- webHandleSuccess(result, success, complete)
73
+ successHandle(result, success, complete)
74
74
  return result
75
75
  }).catch(err => {
76
76
  const response = err?.response || {}
@@ -80,10 +80,7 @@ function request (options = { url: '' }) {
80
80
  header: response.headers,
81
81
  data: response.data
82
82
  }
83
- webHandleFail(res, fail, complete)
84
- if (!fail) {
85
- return Promise.reject(res)
86
- }
83
+ failHandle(res, fail, complete)
87
84
  })
88
85
 
89
86
  return requestTask
@@ -1,4 +1,4 @@
1
- import { webHandleSuccess, webHandleFail } from '../../../common/js'
1
+ import { successHandle, failHandle } from '../../../common/js'
2
2
  import { parseQuery } from '@mpxjs/utils'
3
3
 
4
4
  function parseUrl (url) {
@@ -58,11 +58,11 @@ function navigateTo (options = {}) {
58
58
  navigation.push(finalPath, queryObj)
59
59
  navigationHelper.lastSuccessCallback = () => {
60
60
  const res = { errMsg: 'navigateTo:ok' }
61
- webHandleSuccess(res, options.success, options.complete)
61
+ successHandle(res, options.success, options.complete)
62
62
  }
63
63
  navigationHelper.lastFailCallback = (msg) => {
64
64
  const res = { errMsg: `navigateTo:fail ${msg}` }
65
- webHandleFail(res, options.fail, options.complete)
65
+ failHandle(res, options.fail, options.complete)
66
66
  }
67
67
  }
68
68
  }
@@ -77,11 +77,11 @@ function redirectTo (options = {}) {
77
77
  navigation.replace(finalPath, queryObj)
78
78
  navigationHelper.lastSuccessCallback = () => {
79
79
  const res = { errMsg: 'redirectTo:ok' }
80
- webHandleSuccess(res, options.success, options.complete)
80
+ successHandle(res, options.success, options.complete)
81
81
  }
82
82
  navigationHelper.lastFailCallback = (msg) => {
83
83
  const res = { errMsg: `redirectTo:fail ${msg}` }
84
- webHandleFail(res, options.fail, options.complete)
84
+ failHandle(res, options.fail, options.complete)
85
85
  }
86
86
  }
87
87
  }
@@ -93,11 +93,11 @@ function navigateBack (options = {}) {
93
93
  navigation.pop(options.delta || 1)
94
94
  navigationHelper.lastSuccessCallback = () => {
95
95
  const res = { errMsg: 'navigateBack:ok' }
96
- webHandleSuccess(res, options.success, options.complete)
96
+ successHandle(res, options.success, options.complete)
97
97
  }
98
98
  navigationHelper.lastFailCallback = (msg) => {
99
99
  const res = { errMsg: `navigateBack:fail ${msg}` }
100
- webHandleFail(res, options.fail, options.complete)
100
+ failHandle(res, options.fail, options.complete)
101
101
  }
102
102
  }
103
103
  }
@@ -120,11 +120,11 @@ function reLaunch (options = {}) {
120
120
  })
121
121
  navigationHelper.lastSuccessCallback = () => {
122
122
  const res = { errMsg: 'redirectTo:ok' }
123
- webHandleSuccess(res, options.success, options.complete)
123
+ successHandle(res, options.success, options.complete)
124
124
  }
125
125
  navigationHelper.lastFailCallback = (msg) => {
126
126
  const res = { errMsg: `redirectTo:fail ${msg}` }
127
- webHandleFail(res, options.fail, options.complete)
127
+ failHandle(res, options.fail, options.complete)
128
128
  }
129
129
  }
130
130
  }