mali-applet-ui 1.1.95 → 1.1.96

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mali-applet-ui",
3
- "version": "1.1.95",
3
+ "version": "1.1.96",
4
4
  "description": "码里UI-小程序组件库(vue2)",
5
5
  "files": [
6
6
  "lib",
package/utils/applet.js CHANGED
@@ -102,3 +102,17 @@ export function getAppDpr () {
102
102
  ratio = info.pixelRatio || 2
103
103
  return ratio
104
104
  }
105
+
106
+ export function getUserDataPath () {
107
+ let udPath = ''
108
+
109
+ // #ifdef MP-WEIXIN
110
+ udPath = wx.env.USER_DATA_PATH
111
+ // #endif
112
+
113
+ // #ifdef MP-DINGTALK
114
+ udPath = dd.env.USER_DATA_PATH
115
+ // #endif
116
+
117
+ return udPath
118
+ }
package/utils/file.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import XEUtils from 'xe-utils'
2
+ import { getUserDataPath } from './applet'
2
3
 
3
4
  export function getFileSuffix (filename) {
4
5
  const pos = filename.lastIndexOf('.')
@@ -41,7 +42,7 @@ export function openFileByUrl (fileUrl, fileName, options) {
41
42
  const fileType = opts.type || getFileSuffix(name || getFileName(url)).toLowerCase()
42
43
  uni.downloadFile({
43
44
  url,
44
- filePath: name ? `${uni.env.USER_DATA_PATH}/${name.indexOf('.') === -1 ? `${name}.${fileType}` : name}` : '',
45
+ filePath: name ? `${getUserDataPath()}/${name.indexOf('.') === -1 ? `${name}.${fileType}` : name}` : '',
45
46
  success: (downRes) => {
46
47
  if (getFilePreviewTypes().includes(fileType)) {
47
48
  uni.openDocument({
@@ -98,7 +99,7 @@ export function saveFileByUrl (fileUrl, fileName, options) {
98
99
  const fileType = opts.type || getFileSuffix(name || getFileName(url)).toLowerCase()
99
100
  uni.downloadFile({
100
101
  url,
101
- filePath: name ? `${uni.env.USER_DATA_PATH}/${name.indexOf('.') === -1 ? `${name}.${fileType}` : name}` : '',
102
+ filePath: name ? `${getUserDataPath()}/${name.indexOf('.') === -1 ? `${name}.${fileType}` : name}` : '',
102
103
  success: (downRes) => {
103
104
  uni.saveFile({
104
105
  tempFilePath: downRes.filePath || downRes.tempFilePath,