@dcloudio/uni-h5 2.0.0 → 2.0.1-32920211122002

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 (157) hide show
  1. package/dist/automator.js +1 -1
  2. package/dist/index.css +1 -1
  3. package/dist/index.umd.min.js +1 -1
  4. package/lib/apis.js +14 -4
  5. package/lib/h5/uni.automator.js +1 -1
  6. package/lib/modules.json +4 -1
  7. package/manifest.json +49 -0
  8. package/package.json +2 -3
  9. package/src/core/helpers/api.js +1 -1
  10. package/src/core/helpers/constants.js +1 -0
  11. package/src/core/helpers/i18n/en.json +4 -2
  12. package/src/core/helpers/i18n/es.json +4 -1
  13. package/src/core/helpers/i18n/fr.json +4 -1
  14. package/src/core/helpers/i18n/index.js +155 -4
  15. package/src/core/helpers/i18n/zh-Hans.json +4 -1
  16. package/src/core/helpers/i18n/zh-Hant.json +4 -1
  17. package/src/core/helpers/index.js +1 -1
  18. package/src/core/helpers/interceptor.js +19 -15
  19. package/src/core/helpers/promise.js +1 -1
  20. package/src/core/helpers/protocol/device/set-clipboard-data.js +11 -2
  21. package/src/core/helpers/protocol/network/request.js +14 -1
  22. package/src/core/helpers/protocol/network/upload-file.js +1 -1
  23. package/src/core/helpers/protocol/ui/popup.js +2 -2
  24. package/src/core/runtime/base.js +2 -0
  25. package/src/core/runtime/locale.js +37 -0
  26. package/src/core/runtime/web-view/index.js +4 -0
  27. package/src/core/runtime/wrapper/create-subpackage-app.js +7 -6
  28. package/src/core/runtime/wrapper/util.js +6 -1
  29. package/src/core/service/api/base/interceptor.js +1 -1
  30. package/src/core/service/api/context/canvas.js +3 -2
  31. package/src/core/service/api/context/create-map-context.js +8 -1
  32. package/src/core/service/api/ui/locale.js +50 -0
  33. package/src/core/service/plugins/app/create-app.js +8 -3
  34. package/src/core/service/plugins/app/index.js +2 -2
  35. package/src/core/service/plugins/index.js +8 -2
  36. package/src/core/view/bridge/subscribe/api/request-component-observer.js +16 -1
  37. package/src/core/view/components/canvas/index.vue +3 -1
  38. package/src/core/view/components/editor/formats/image.js +3 -1
  39. package/src/core/view/components/editor/formats/index.js +3 -1
  40. package/src/core/view/components/editor/formats/link.js +9 -0
  41. package/src/core/view/components/editor/index.vue +33 -3
  42. package/src/core/view/components/image/index.vue +4 -5
  43. package/src/core/view/components/input/index.vue +53 -25
  44. package/src/core/view/components/picker-view-column/index.vue +1 -0
  45. package/src/core/view/components/progress/index.vue +20 -13
  46. package/src/core/view/components/rich-text/index.vue +13 -1
  47. package/src/core/view/components/rich-text/nodes-parser.js +23 -4
  48. package/src/core/view/components/scroll-view/index.vue +253 -122
  49. package/src/core/view/components/slider/index.vue +1 -1
  50. package/src/core/view/components/swiper/index.vue +3 -0
  51. package/src/core/view/components/textarea/index.vue +7 -3
  52. package/src/core/view/index.css +4 -0
  53. package/src/core/view/mixins/field.js +27 -9
  54. package/src/core/view/mixins/interact.js +13 -11
  55. package/src/core/view/mixins/keyboard.js +42 -26
  56. package/src/core/view/mixins/touchtrack.js +2 -2
  57. package/src/core/view/plugins/index.js +1 -1
  58. package/src/platforms/app-plus/constants.js +1 -0
  59. package/src/platforms/app-plus/helpers/get-real-path.js +7 -4
  60. package/src/platforms/app-plus/helpers/uuid.js +1 -1
  61. package/src/platforms/app-plus/service/api/ad/ad-base.js +159 -0
  62. package/src/platforms/app-plus/service/api/ad/ad.js +4 -8
  63. package/src/platforms/app-plus/service/api/ad/full-screen-video-ad.js +5 -98
  64. package/src/platforms/app-plus/service/api/ad/interactive-ad.js +257 -0
  65. package/src/platforms/app-plus/service/api/ad/interstitial-ad.js +15 -0
  66. package/src/platforms/app-plus/service/api/ad/rewarded-video-ad.js +15 -2
  67. package/src/platforms/app-plus/service/api/device/system.js +3 -2
  68. package/src/platforms/app-plus/service/api/file/open-document.js +7 -15
  69. package/src/platforms/app-plus/service/api/index.js +2 -0
  70. package/src/platforms/app-plus/service/api/location/get-location.js +8 -7
  71. package/src/platforms/app-plus/service/api/media/choose-image.js +22 -51
  72. package/src/platforms/app-plus/service/api/media/choose-video.js +19 -36
  73. package/src/platforms/app-plus/service/api/media/compress-video.js +2 -2
  74. package/src/platforms/app-plus/service/api/media/get-video-info.js +5 -2
  75. package/src/platforms/app-plus/service/api/network/request.js +27 -1
  76. package/src/platforms/app-plus/service/api/network/upload-file.js +1 -1
  77. package/src/platforms/app-plus/service/api/plugin/oauth.js +140 -8
  78. package/src/platforms/app-plus/service/api/storage/storage.js +1 -1
  79. package/src/platforms/app-plus/service/api/ui/popup.js +21 -11
  80. package/src/platforms/app-plus/service/api/ui/tab-bar.js +3 -2
  81. package/src/platforms/app-plus/service/api/util.js +5 -1
  82. package/src/platforms/app-plus/service/framework/app.js +21 -5
  83. package/src/platforms/app-plus/service/framework/config.js +1 -0
  84. package/src/platforms/app-plus/service/framework/plugins/index.js +8 -2
  85. package/src/platforms/app-plus/service/framework/plugins/lifecycle.js +2 -2
  86. package/src/platforms/app-plus/service/framework/subscribe-handlers/index.js +1 -1
  87. package/src/platforms/app-plus/service/framework/tab-bar.js +12 -2
  88. package/src/platforms/app-plus/service/framework/webview/index.js +2 -2
  89. package/src/platforms/app-plus/service/framework/webview/parser/title-nview-parser.js +73 -30
  90. package/src/platforms/app-plus/service/framework/webview/parser/webview-style-parser.js +16 -16
  91. package/src/platforms/app-plus/service/index.js +10 -3
  92. package/src/platforms/app-plus/service/publish-handler.js +3 -0
  93. package/src/platforms/app-plus/view/bridge/subscribe/index.js +5 -3
  94. package/src/platforms/app-plus/view/components/ad/index.vue +53 -44
  95. package/src/platforms/app-plus/view/components/cover-view/index.vue +13 -7
  96. package/src/platforms/app-plus/view/components/map/index.vue +29 -27
  97. package/src/platforms/app-plus/view/components/video/index.vue +40 -24
  98. package/src/platforms/app-plus/view/framework/plugins/gesture.js +17 -0
  99. package/src/platforms/app-plus/view/framework/plugins/index.js +3 -1
  100. package/src/platforms/app-plus/view/index.css +4 -0
  101. package/src/platforms/app-plus/view/mixins/cover.js +10 -15
  102. package/src/platforms/app-plus/view/mixins/native.js +45 -3
  103. package/src/platforms/app-plus-nvue/service/api/context/operate-map-player.js +3 -0
  104. package/src/platforms/h5/components/app/observable.js +3 -2
  105. package/src/platforms/h5/components/app/popup/mixins/modal.js +3 -3
  106. package/src/platforms/h5/components/app/popup/modal.vue +38 -2
  107. package/src/platforms/h5/components/app/popup/toast.vue +9 -1
  108. package/src/platforms/h5/components/app/tabBar.vue +39 -17
  109. package/src/platforms/h5/components/page/index.vue +5 -3
  110. package/src/platforms/h5/components/page/pageHead.vue +94 -75
  111. package/src/platforms/h5/components/system-routes/choose-location/index.vue +127 -66
  112. package/src/platforms/h5/components/system-routes/open-location/index.vue +193 -38
  113. package/src/platforms/h5/helpers/location.js +26 -0
  114. package/src/platforms/h5/helpers/todo-api.js +2 -2
  115. package/src/platforms/h5/service/api/device/clipboard.js +41 -0
  116. package/src/platforms/h5/service/api/device/get-system-info.js +75 -0
  117. package/src/platforms/h5/service/api/location/get-location.js +47 -18
  118. package/src/platforms/h5/service/api/media/MIMEType.js +53 -0
  119. package/src/platforms/h5/service/api/media/choose-file.js +9 -1
  120. package/src/platforms/h5/service/api/media/choose-image.js +9 -2
  121. package/src/platforms/h5/service/api/media/choose-video.js +9 -1
  122. package/src/platforms/h5/service/api/media/create_input.js +12 -3
  123. package/src/platforms/h5/service/api/ui/popup.js +3 -5
  124. package/src/platforms/h5/service/api/ui/tab-bar.js +1 -1
  125. package/src/platforms/h5/service/index.js +5 -0
  126. package/src/platforms/h5/view/bridge/subscribe/index.js +3 -2
  127. package/src/platforms/h5/view/components/ad/index.vue +112 -69
  128. package/src/platforms/h5/view/components/map/index.vue +96 -349
  129. package/src/platforms/h5/view/components/map/map-marker.js +287 -0
  130. package/src/platforms/h5/view/components/map/maps/callout.js +117 -0
  131. package/src/platforms/h5/view/components/map/maps/index.js +55 -0
  132. package/src/platforms/h5/view/components/video/index.vue +1 -1
  133. package/src/platforms/h5/view/index.css +4 -0
  134. package/src/platforms/mp-alipay/runtime/api/protocols.js +30 -3
  135. package/src/platforms/mp-baidu/runtime/api/protocols.js +5 -0
  136. package/src/platforms/mp-baidu/runtime/wrapper/component-parser.js +20 -18
  137. package/src/platforms/mp-baidu/runtime/wrapper/util.js +2 -1
  138. package/src/platforms/mp-kuaishou/runtime/api/protocols.js +3 -1
  139. package/src/platforms/mp-kuaishou/runtime/wrapper/component-parser.js +21 -1
  140. package/src/platforms/mp-lark/runtime/api/index.js +0 -0
  141. package/src/platforms/mp-lark/runtime/api/protocols.js +68 -0
  142. package/src/platforms/mp-lark/runtime/api/providers.js +6 -0
  143. package/src/platforms/mp-lark/runtime/index.js +1 -0
  144. package/src/platforms/mp-lark/runtime/web-view.js +11 -0
  145. package/src/platforms/mp-lark/runtime/wrapper/app-parser.js +33 -0
  146. package/src/platforms/mp-lark/runtime/wrapper/component-parser.js +50 -0
  147. package/src/platforms/mp-lark/runtime/wrapper/page-parser.js +39 -0
  148. package/src/platforms/mp-lark/runtime/wrapper/util.js +64 -0
  149. package/src/platforms/mp-qq/runtime/api/protocols.js +3 -1
  150. package/src/platforms/mp-toutiao/runtime/api/protocols.js +2 -0
  151. package/src/platforms/mp-toutiao/runtime/wrapper/component-parser.js +35 -19
  152. package/src/platforms/mp-weixin/helpers/get-user-profile.js +6 -0
  153. package/src/platforms/mp-weixin/runtime/index.js +6 -7
  154. package/src/platforms/mp-weixin/runtime/wrapper/app-base-parser.js +197 -126
  155. package/src/platforms/mp-weixin/runtime/wrapper/fix-set-data.js +37 -0
  156. package/src/shared/uni-id-mixin.js +77 -0
  157. package/src/shared/util.js +2 -0
@@ -0,0 +1,41 @@
1
+
2
+ export function getClipboardData () {
3
+ const pasteText = document.getElementById('#clipboard')
4
+ const data = pasteText ? pasteText.value : undefined
5
+ if (data) {
6
+ return {
7
+ data,
8
+ errMsg: 'getClipboardData:ok'
9
+ }
10
+ } else {
11
+ return {
12
+ errMsg: 'getClipboardData:fail'
13
+ }
14
+ }
15
+ }
16
+
17
+ export function setClipboardData ({
18
+ data
19
+ }) {
20
+ const pasteText = document.getElementById('#clipboard')
21
+ pasteText && pasteText.remove()
22
+ const textarea = document.createElement('textarea')
23
+ textarea.id = '#clipboard'
24
+ textarea.style.position = 'absolute'
25
+ textarea.style.top = '-9999px'
26
+ textarea.style.zIndex = '-9999'
27
+ document.body.appendChild(textarea)
28
+ textarea.value = data
29
+ textarea.focus()
30
+ textarea.select()
31
+ const result = document.execCommand('Copy', false, null)
32
+ if (result) {
33
+ return {
34
+ errMsg: 'setClipboardData:ok'
35
+ }
36
+ } else {
37
+ return {
38
+ errMsg: 'setClipboardData:fail'
39
+ }
40
+ }
41
+ }
@@ -11,6 +11,22 @@ const isAndroid = /android/i.test(ua)
11
11
  * 是否iOS设备
12
12
  */
13
13
  const isIOS = /iphone|ipad|ipod/i.test(ua)
14
+ /**
15
+ * 是否是Windows设备
16
+ */
17
+ const isWindows = ua.match(/Windows NT ([\d|\d.\d]*)/i)
18
+ /**
19
+ * 是否是Mac设备
20
+ */
21
+ const isMac = /Macintosh|Mac/i.test(ua)
22
+ /**
23
+ * 是否是Linux设备
24
+ */
25
+ const isLinux = /Linux|X11/i.test(ua)
26
+ /**
27
+ * 是否是iPadOS
28
+ */
29
+ const isIPadOS = isMac && navigator.maxTouchPoints > 0
14
30
  /**
15
31
  * 获取系统信息-同步
16
32
  */
@@ -69,6 +85,65 @@ export function getSystemInfoSync () {
69
85
  break
70
86
  }
71
87
  }
88
+ } else if (isIPadOS) {
89
+ model = 'iPad'
90
+ osname = 'iOS'
91
+ osversion = typeof window.BigInt === 'function' ? '14.0' : '13.0'
92
+ } else if (isWindows || isMac || isLinux) {
93
+ model = 'PC'
94
+ const osversionFind = ua.match(/\((.+?)\)/)[1]
95
+
96
+ if (isWindows) {
97
+ osname = 'Windows'
98
+ osversion = ''
99
+ switch (isWindows[1]) {
100
+ case '5.1':
101
+ osversion = 'XP'
102
+ break
103
+ case '6.0':
104
+ osversion = 'Vista'
105
+ break
106
+ case '6.1':
107
+ osversion = '7'
108
+ break
109
+ case '6.2':
110
+ osversion = '8'
111
+ break
112
+ case '6.3':
113
+ osversion = '8.1'
114
+ break
115
+ case '10.0':
116
+ osversion = '10'
117
+ break
118
+ }
119
+
120
+ const framework = osversionFind.match(/[Win|WOW]([\d]+)/)
121
+ if (framework) {
122
+ osversion += ` x${framework[1]}`
123
+ }
124
+ } else if (isMac) {
125
+ osname = 'Mac'
126
+ osversion = osversionFind.match(/Mac OS X (.+)/) || ''
127
+
128
+ if (osversion) {
129
+ osversion = osversion[1].replace(/_/g, '.')
130
+ // '10_15_7' or '10.16; rv:86.0'
131
+ if (osversion.indexOf(';') !== -1) {
132
+ osversion = osversion.split(';')[0]
133
+ }
134
+ }
135
+ } else if (isLinux) {
136
+ osname = 'Linux'
137
+ osversion = osversionFind.match(/Linux (.*)/) || ''
138
+
139
+ if (osversion) {
140
+ osversion = osversion[1]
141
+ // 'x86_64' or 'x86_64; rv:79.0'
142
+ if (osversion.indexOf(';') !== -1) {
143
+ osversion = osversion.split(';')[0]
144
+ }
145
+ }
146
+ }
72
147
  } else {
73
148
  osname = 'Other'
74
149
  osversion = '0'
@@ -1,6 +1,10 @@
1
1
  import {
2
2
  getJSONP
3
3
  } from '../../../helpers/get-jsonp'
4
+ import {
5
+ MapType,
6
+ getMapInfo
7
+ } from '../../../helpers/location'
4
8
 
5
9
  /**
6
10
  * 获取定位信息
@@ -9,44 +13,69 @@ import {
9
13
  */
10
14
  export function getLocation ({
11
15
  type,
12
- altitude
16
+ altitude,
17
+ highAccuracyExpireTime
13
18
  }, callbackId) {
14
19
  const {
15
20
  invokeCallbackHandler: invoke
16
21
  } = UniServiceJSBridge
17
- const key = __uniConfig.qqMapKey
22
+ const mapInfo = getMapInfo()
18
23
 
19
24
  new Promise((resolve, reject) => {
20
25
  if (navigator.geolocation) {
21
26
  navigator.geolocation.getCurrentPosition(res => resolve(res.coords), reject, {
22
27
  enableHighAccuracy: altitude,
23
- timeout: 1000 * 100
28
+ timeout: highAccuracyExpireTime || 1000 * 100
24
29
  })
25
30
  } else {
26
31
  reject(new Error('device nonsupport geolocation'))
27
32
  }
28
33
  }).catch(() => {
29
34
  return new Promise((resolve, reject) => {
30
- getJSONP(`https://apis.map.qq.com/ws/location/v1/ip?output=jsonp&key=${key}`, {
31
- callback: 'callback'
32
- }, (res) => {
33
- if ('result' in res && res.result.location) {
34
- const location = res.result.location
35
- resolve({
36
- latitude: location.lat,
37
- longitude: location.lng
38
- }, true)
39
- } else {
40
- reject(new Error(res.message || JSON.stringify(res)))
41
- }
42
- }, () => reject(new Error('network error')))
35
+ if (mapInfo.type === MapType.QQ) {
36
+ getJSONP(`https://apis.map.qq.com/ws/location/v1/ip?output=jsonp&key=${mapInfo.key}`, {
37
+ callback: 'callback'
38
+ }, (res) => {
39
+ if ('result' in res && res.result.location) {
40
+ const location = res.result.location
41
+ resolve({
42
+ latitude: location.lat,
43
+ longitude: location.lng
44
+ }, true)
45
+ } else {
46
+ reject(new Error(res.message || JSON.stringify(res)))
47
+ }
48
+ }, () => reject(new Error('network error')))
49
+ } else if (mapInfo.type === MapType.GOOGLE) {
50
+ uni.request({
51
+ method: 'POST',
52
+ url: `https://www.googleapis.com/geolocation/v1/geolocate?key=${mapInfo.key}`,
53
+ success (res) {
54
+ const data = res.data
55
+ if ('location' in data) {
56
+ resolve({
57
+ latitude: data.location.lat,
58
+ longitude: data.location.lng,
59
+ accuracy: data.accuracy
60
+ })
61
+ } else {
62
+ reject(new Error((data.error && data.error.message) || JSON.stringify(res)))
63
+ }
64
+ },
65
+ fail () {
66
+ reject(new Error('network error'))
67
+ }
68
+ })
69
+ } else {
70
+ reject(new Error('network error'))
71
+ }
43
72
  })
44
73
  }).then((coords, skip) => {
45
- if (type.toUpperCase() === 'WGS84' || skip) {
74
+ if (type.toUpperCase() === 'WGS84' || mapInfo.type !== MapType.QQ || skip) {
46
75
  return coords
47
76
  }
48
77
  return new Promise((resolve, reject) => {
49
- getJSONP(`https://apis.map.qq.com/jsapi?qt=translate&type=1&points=${coords.longitude},${coords.latitude}&key=${key}&output=jsonp&pf=jsapi&ref=jsapi`, {
78
+ getJSONP(`https://apis.map.qq.com/jsapi?qt=translate&type=1&points=${coords.longitude},${coords.latitude}&key=${mapInfo.key}&output=jsonp&pf=jsapi&ref=jsapi`, {
50
79
  callback: 'cb'
51
80
  }, (res) => {
52
81
  if ('detail' in res && 'points' in res.detail && res.detail.points.length) {
@@ -0,0 +1,53 @@
1
+ export default {
2
+ /**
3
+ * 关于图片常见的MIME类型
4
+ */
5
+ image: {
6
+ jpg: 'jpeg',
7
+ jpe: 'jpeg',
8
+ pbm: 'x-portable-bitmap',
9
+ pgm: 'x-portable-graymap',
10
+ pnm: 'x-portable-anymap',
11
+ ppm: 'x-portable-pixmap',
12
+ psd: 'vnd.adobe.photoshop',
13
+ pic: 'x-pict',
14
+ rgb: 'x-rgb',
15
+ svg: 'svg+xml',
16
+ svgz: 'svg+xml',
17
+ tif: 'tiff',
18
+ xif: 'vnd.xiff',
19
+ wbmp: 'vnd.wap.wbmp',
20
+ wdp: 'vnd.ms-photo',
21
+ xbm: 'x-xbitmap',
22
+ ico: 'x-icon'
23
+ },
24
+ /**
25
+ * 关于视频常见的MIME类型
26
+ */
27
+ video: {
28
+ '3g2': '3gpp2',
29
+ '3gp': '3gpp',
30
+ avi: 'x-msvideo',
31
+ f4v: 'x-f4v',
32
+ flv: 'x-flv',
33
+ jpgm: 'jpm',
34
+ jpgv: 'jpeg',
35
+ m1v: 'mpeg',
36
+ m2v: 'mpeg',
37
+ mpe: 'mpeg',
38
+ mpg: 'mpeg',
39
+ mpg4: 'mpeg',
40
+ m4v: 'x-m4v',
41
+ mkv: 'x-matroska',
42
+ mov: 'quicktime',
43
+ qt: 'quicktime',
44
+ movie: 'x-sgi-movie',
45
+ mp4v: 'mp4',
46
+ ogv: 'ogg',
47
+ smv: 'x-smv',
48
+ wm: 'x-ms-wm',
49
+ wmv: 'x-ms-wmv',
50
+ wmx: 'x-ms-wmx',
51
+ wvx: 'x-ms-wvx'
52
+ }
53
+ }
@@ -1,5 +1,7 @@
1
1
  import { fileToUrl } from 'uni-platform/helpers/file'
2
+ import { t } from 'uni-core/helpers/i18n'
2
3
  import _createInput from './create_input'
4
+ import { interact } from 'uni-mixins'
3
5
 
4
6
  const {
5
7
  invokeCallbackHandler: invoke
@@ -55,5 +57,11 @@ export function chooseFile ({
55
57
  // TODO 用户取消选择时,触发 fail,目前尚未找到合适的方法。
56
58
  })
57
59
 
58
- fileInput.click()
60
+ if (interact.getStatus()) {
61
+ fileInput.click()
62
+ } else {
63
+ invoke(callbackId, {
64
+ errMsg: `chooseFile:fail ${t('uni.chooseFile.notUserActivation')}`
65
+ })
66
+ }
59
67
  }
@@ -1,5 +1,7 @@
1
1
  import { fileToUrl } from 'uni-platform/helpers/file'
2
+ import { t } from 'uni-core/helpers/i18n'
2
3
  import _createInput from './create_input'
4
+ import { interact } from 'uni-mixins'
3
5
 
4
6
  const {
5
7
  invokeCallbackHandler: invoke
@@ -27,7 +29,6 @@ export function chooseImage ({
27
29
  type: 'image'
28
30
  })
29
31
  document.body.appendChild(imageInput)
30
-
31
32
  imageInput.addEventListener('change', function (event) {
32
33
  const tempFiles = []
33
34
  const fileCount = event.target.files.length
@@ -54,5 +55,11 @@ export function chooseImage ({
54
55
  // TODO 用户取消选择时,触发 fail,目前尚未找到合适的方法。
55
56
  })
56
57
 
57
- imageInput.click()
58
+ if (interact.getStatus()) {
59
+ imageInput.click()
60
+ } else {
61
+ invoke(callbackId, {
62
+ errMsg: `chooseImage:fail ${t('uni.chooseFile.notUserActivation')}`
63
+ })
64
+ }
58
65
  }
@@ -1,5 +1,7 @@
1
1
  import { fileToUrl, revokeObjectURL } from 'uni-platform/helpers/file'
2
+ import { t } from 'uni-core/helpers/i18n'
2
3
  import _createInput from './create_input'
4
+ import { interact } from 'uni-mixins'
3
5
 
4
6
  const {
5
7
  invokeCallbackHandler: invoke
@@ -67,5 +69,11 @@ export function chooseVideo ({
67
69
  // TODO 用户取消选择时,触发 fail,目前尚未找到合适的方法。
68
70
  })
69
71
 
70
- videoInput.click()
72
+ if (interact.getStatus()) {
73
+ videoInput.click()
74
+ } else {
75
+ invoke(callbackId, {
76
+ errMsg: `chooseVideo:fail ${t('uni.chooseFile.notUserActivation')}`
77
+ })
78
+ }
71
79
  }
@@ -1,4 +1,9 @@
1
1
  import { updateElementStyle } from 'uni-shared'
2
+ import MIMEType from './MIMEType'
3
+ import { interact } from 'uni-mixins'
4
+
5
+ interact.addInteractListener()
6
+
2
7
  const ALL = '*'
3
8
 
4
9
  function isWXEnv () {
@@ -24,16 +29,20 @@ export default function ({ count, sourceType, type, extension }) {
24
29
  left: 0
25
30
  })
26
31
 
32
+ /**
33
+ * 选择文件
34
+ * chooseFile 使用后缀名
35
+ * chooseImage、chooseVideo 使用MIME类型
36
+ */
27
37
  inputEl.accept = extension.map(item => {
28
38
  if (type !== ALL) {
29
- // 剔除.拼接在type后
30
- return `${type}/${item.replace('.', '')}`
39
+ const MIMEKey = item.replace('.', '')
40
+ return `${type}/${MIMEType[type][MIMEKey] || MIMEKey}`
31
41
  } else {
32
42
  // 在微信环境里,'.jpeg,.png' 会提示没有应用可执行此操作
33
43
  if (isWXEnv()) {
34
44
  return '.'
35
45
  }
36
- // 在后缀前方加上.
37
46
  return item.indexOf('.') === 0 ? item : `.${item}`
38
47
  }
39
48
  }).join(',')
@@ -4,10 +4,8 @@ const {
4
4
  } = UniServiceJSBridge
5
5
 
6
6
  export function showModal (args, callbackId) {
7
- emit('onShowModal', args, function (type) {
8
- invoke(callbackId, {
9
- [type]: true
10
- })
7
+ emit('onShowModal', args, function (res) {
8
+ invoke(callbackId, res)
11
9
  })
12
10
  }
13
11
 
@@ -43,4 +41,4 @@ export function showActionSheet (args, callbackId) {
43
41
  })
44
42
  }
45
43
  })
46
- }
44
+ }
@@ -2,7 +2,7 @@ import {
2
2
  setProperties
3
3
  } from 'uni-shared'
4
4
 
5
- const setTabBarItemProps = ['text', 'iconPath', 'selectedIconPath']
5
+ const setTabBarItemProps = ['text', 'iconPath', 'selectedIconPath', 'visible']
6
6
 
7
7
  const setTabBarStyleProps = ['color', 'selectedColor', 'backgroundColor', 'borderStyle']
8
8
 
@@ -10,6 +10,11 @@ import {
10
10
  getCurrentPages
11
11
  }
12
12
  from 'uni-core/service/plugins/app'
13
+ import {
14
+ initI18n
15
+ } from 'uni-helpers/i18n'
16
+
17
+ initI18n()
13
18
 
14
19
  initOn(UniServiceJSBridge.on, {
15
20
  getApp,
@@ -23,10 +23,11 @@ const passiveOptions = supportsPassive ? {
23
23
 
24
24
  function updateCssVar (vm) {
25
25
  if (uni.canIUse('css.var')) {
26
+ const uniConfigTabbarHeight = parseFloat(__uniConfig.tabBar.height)
26
27
  const pageVm = vm.$parent.$parent
27
28
  const navigationBarType = pageVm.navigationBar.type
28
29
  const windowTopValue = navigationBarType === 'default' || navigationBarType === 'float' ? NAVBAR_HEIGHT : 0
29
- const windowBottomValue = getApp().$children[0].showTabBar ? TABBAR_HEIGHT : 0
30
+ const windowBottomValue = getApp().$children[0].showTabBar ? isNaN(uniConfigTabbarHeight) ? TABBAR_HEIGHT : uniConfigTabbarHeight : 0
30
31
  const envMethod = uni.canIUse('css.env') ? 'env' : (uni.canIUse('css.constant') ? 'constant' : '')
31
32
  const windowTop = windowTopValue && envMethod ? `calc(${windowTopValue}px + ${envMethod}(safe-area-inset-top))`
32
33
  : `${windowTopValue}px`
@@ -87,4 +88,4 @@ export default function initSubscribe (subscribe) {
87
88
  })
88
89
  }
89
90
  })
90
- }
91
+ }