@zscreate/zhxy-app-component 1.0.120 → 1.0.121

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.
@@ -85,9 +85,13 @@ import {downloadFile, getOpenId, toAwait} from "../../utils/util";
85
85
  handleDelete(idx) {
86
86
  this.$emit('fileDelete', idx)
87
87
  },
88
- downLoadFile(path, name, item) {
88
+ async downLoadFile(path, name, item) {
89
89
  let baseUrl = this.downLoadUrl
90
90
  if (this.widget.options.uploadEncrypt) {
91
+ const [err, res = {} ] = await toAwait(this.$u.get('/sys/common/checkDownloadZip', {fileId: item.fileId}))
92
+ if (err || !res.success) {
93
+ return uni.showToast({title: res.message || '文件检查状态失败', icon: 'none'})
94
+ }
91
95
  path = `/sys/common/downloadZip?fileId=${item.fileId}&openId=${this.openId}`
92
96
  baseUrl = process.uniEnv.BASE_API || process.uniEnv.apiUrl
93
97
  }
@@ -154,11 +158,18 @@ import {downloadFile, getOpenId, toAwait} from "../../utils/util";
154
158
  'X-Access-Token': uni.getStorageSync('token') || this.$store.state.token || this.$store.getters.token
155
159
  },
156
160
  success: function(res) {
157
- res = JSON.parse(res.data)
158
- if (!res.success) return uni.showToast({
159
- title: res.message || '文件上传失败',
160
- icon: 'none'
161
- })
161
+ try {
162
+ res = JSON.parse(res.data)
163
+ if (!res.success) throw new Error(res.message)
164
+ } catch (e) {
165
+ if (e.toString().includes('JSON')) e = undefined
166
+ that.show = false
167
+ that.percent = 0
168
+ return uni.showToast({
169
+ title: (e && e.toString()) || '文件上传失败',
170
+ icon: 'none'
171
+ })
172
+ }
162
173
  let uid = String(Math.random()).substr(2) - 0
163
174
  let imgObj = {
164
175
  uid,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zscreate/zhxy-app-component",
3
- "version": "1.0.120",
3
+ "version": "1.0.121",
4
4
  "private": false,
5
5
  "description": "zhxy-app-component",
6
6
  "main": "index.js",