@jr-public/jr-upload-ui 1.0.5 → 1.0.6

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": "@jr-public/jr-upload-ui",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "JR upload modal components for Vue2 and Vue3",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -257,8 +257,11 @@
257
257
  </div>
258
258
  </template>
259
259
 
260
- <script>
261
- export default {
260
+ <script>
261
+ // 组件统一允许的单文件最大值,maxSize 对外单位保持为 KB
262
+ const MAX_UPLOAD_SIZE_KB = 10 * 1024 * 1024
263
+
264
+ export default {
262
265
  name: 'JrUploadModal',
263
266
 
264
267
  props: {
@@ -304,7 +307,7 @@ export default {
304
307
 
305
308
  // 文件限制
306
309
  accept: { type: String, default: '' },
307
- maxSize: { type: Number, default: 50 * 1024 }, // KB
310
+ maxSize: { type: Number, default: MAX_UPLOAD_SIZE_KB }, // KB,默认最大10GB
308
311
  maxCount: { type: Number, default: 10 },
309
312
  multiple: { type: Boolean, default: true },
310
313
 
@@ -398,7 +401,8 @@ export default {
398
401
 
399
402
  return {
400
403
  allowedExtensions,
401
- maxSizeBytes: this.maxSize && this.maxSize > 0 ? this.maxSize * 1024 : null,
404
+ // 业务可以设置更小的限制,但不能突破组件统一的10GB单文件上限
405
+ maxSizeBytes: Math.min(this.maxSize && this.maxSize > 0 ? this.maxSize : MAX_UPLOAD_SIZE_KB, MAX_UPLOAD_SIZE_KB) * 1024,
402
406
  maxFileCount: this.maxCount && this.maxCount > 0 ? this.maxCount : null,
403
407
  multiple: this.multiple,
404
408
  showFileTypeInfo: this.showFileTypeInfo,
@@ -606,12 +610,12 @@ export default {
606
610
  const baseUrl = this.config.baseUrl
607
611
  const dependencies = [
608
612
  `${baseUrl}/js/aliyun-oss-sdk-6.18.0.min.js`,
609
- `${baseUrl}/js/jr-transfer-sdk.js?v=20260814-jmbs`,
613
+ `${baseUrl}/js/jr-transfer-sdk.js?v=20260814-10gb`,
610
614
  `${baseUrl}/js/jszip.min.js`
611
615
  ]
612
616
 
613
617
  // 检查是否已加载
614
- if (window.JrTransferSDK && window.JrTransferSDK.SDK_VERSION === '20260814-jmbs' && window.OSS && window.JSZip) {
618
+ if (window.JrTransferSDK && window.JrTransferSDK.SDK_VERSION === '20260814-10gb' && window.OSS && window.JSZip) {
615
619
  return Promise.resolve()
616
620
  }
617
621
 
@@ -257,10 +257,13 @@
257
257
  </div>
258
258
  </template>
259
259
 
260
- <script>
261
- import { ref, reactive, computed, watch, onMounted, onBeforeUnmount, defineEmits, defineProps, nextTick, getCurrentInstance } from 'vue'
262
-
263
- export default {
260
+ <script>
261
+ import { ref, reactive, computed, watch, onMounted, onBeforeUnmount, defineEmits, defineProps, nextTick, getCurrentInstance } from 'vue'
262
+
263
+ // 组件统一允许的单文件最大值,maxSize 对外单位保持为 KB
264
+ const MAX_UPLOAD_SIZE_KB = 10 * 1024 * 1024
265
+
266
+ export default {
264
267
  name: 'JrUploadModalVue3',
265
268
 
266
269
  props: {
@@ -306,7 +309,7 @@ export default {
306
309
 
307
310
  // 文件限制
308
311
  accept: { type: String, default: '' },
309
- maxSize: { type: Number, default: 50 * 1024 }, // KB
312
+ maxSize: { type: Number, default: MAX_UPLOAD_SIZE_KB }, // KB,默认最大10GB
310
313
  maxCount: { type: Number, default: 10 },
311
314
  multiple: { type: Boolean, default: true },
312
315
 
@@ -420,7 +423,8 @@ export default {
420
423
 
421
424
  return {
422
425
  allowedExtensions,
423
- maxSizeBytes: props.maxSize && props.maxSize > 0 ? props.maxSize * 1024 : null,
426
+ // 业务可以设置更小的限制,但不能突破组件统一的10GB单文件上限
427
+ maxSizeBytes: Math.min(props.maxSize && props.maxSize > 0 ? props.maxSize : MAX_UPLOAD_SIZE_KB, MAX_UPLOAD_SIZE_KB) * 1024,
424
428
  maxFileCount: props.maxCount && props.maxCount > 0 ? props.maxCount : null,
425
429
  multiple: props.multiple,
426
430
  showFileTypeInfo: props.showFileTypeInfo,
@@ -629,12 +633,12 @@ export default {
629
633
  const baseUrl = props.config.baseUrl
630
634
  const dependencies = [
631
635
  `${baseUrl}/js/aliyun-oss-sdk-6.18.0.min.js`,
632
- `${baseUrl}/js/jr-transfer-sdk.js?v=20260814-jmbs`,
636
+ `${baseUrl}/js/jr-transfer-sdk.js?v=20260814-10gb`,
633
637
  `${baseUrl}/js/jszip.min.js`
634
638
  ]
635
639
 
636
640
  // 检查是否已加载
637
- if (window.JrTransferSDK && window.JrTransferSDK.SDK_VERSION === '20260814-jmbs' && window.OSS && window.JSZip) {
641
+ if (window.JrTransferSDK && window.JrTransferSDK.SDK_VERSION === '20260814-10gb' && window.OSS && window.JSZip) {
638
642
  return Promise.resolve()
639
643
  }
640
644