@zscreate/zhxy-app-component 1.0.362 → 1.0.364

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.
@@ -1507,7 +1507,7 @@ export default {
1507
1507
  columnName: widget.columnName,
1508
1508
  columnCode: widget.columnCode,
1509
1509
  apiUrl: widget.apiUrl,
1510
- selectedCode: widget.labels
1510
+ selectedCode: widget.SQLKey || 'IDIndex'
1511
1511
  }
1512
1512
  if (widget.defaultSQL && widget.defaultSQL.dataSourceId) params.datasourceId = widget.defaultSQL.dataSourceId
1513
1513
  if (widget.defaultSQL && widget.defaultSQL.serverId) params.serverId = widget.defaultSQL.serverId
@@ -262,7 +262,20 @@ export default {
262
262
  }
263
263
  })
264
264
  } else {
265
- window.open( process.uniEnv.imgUrl+ res.message + '?download=0')
265
+ // #ifdef H5
266
+ // H5环境下使用a标签打开,避免window.open被阻止
267
+ const url = process.uniEnv.imgUrl + res.message + '?download=0'
268
+ const link = document.createElement('a')
269
+ link.href = url
270
+ link.target = '_blank'
271
+ link.rel = 'noopener noreferrer'
272
+ document.body.appendChild(link)
273
+ link.click()
274
+ document.body.removeChild(link)
275
+ // #endif
276
+ // #ifndef H5
277
+ window.open(process.uniEnv.imgUrl + res.message + '?download=0')
278
+ // #endif
266
279
  }
267
280
  } else {
268
281
  uni.showToast({
@@ -275,7 +288,38 @@ export default {
275
288
  })
276
289
  return
277
290
  }
278
- window.open(process.uniEnv.imgUrl + file.url + '?download=0')
291
+
292
+ // 处理图片和其他文件类型
293
+ const imageTypes = ['jpg', 'jpeg', 'png', 'gif']
294
+ const previewUrl = process.uniEnv.imgUrl + file.url + '?download=0'
295
+
296
+ // #ifdef H5
297
+ if (imageTypes.includes(ext)) {
298
+ // 图片类型使用uni.previewImage
299
+ uni.previewImage({
300
+ urls: [previewUrl],
301
+ fail() {
302
+ uni.showToast({
303
+ icon: 'none',
304
+ title: '图片预览失败',
305
+ duration: 2000
306
+ })
307
+ }
308
+ })
309
+ } else {
310
+ // 其他文件类型使用a标签打开
311
+ const link = document.createElement('a')
312
+ link.href = previewUrl
313
+ link.target = '_blank'
314
+ link.rel = 'noopener noreferrer'
315
+ document.body.appendChild(link)
316
+ link.click()
317
+ document.body.removeChild(link)
318
+ }
319
+ // #endif
320
+ // #ifndef H5
321
+ window.open(previewUrl)
322
+ // #endif
279
323
  },
280
324
  getFileExt(filename) {
281
325
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zscreate/zhxy-app-component",
3
- "version": "1.0.362",
3
+ "version": "1.0.364",
4
4
  "private": false,
5
5
  "description": "zhxy-app-component",
6
6
  "main": "index.js",