af-mobile-client-vue3 1.3.69 → 1.3.71

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,7 +1,7 @@
1
1
  {
2
2
  "name": "af-mobile-client-vue3",
3
3
  "type": "module",
4
- "version": "1.3.69",
4
+ "version": "1.3.71",
5
5
  "packageManager": "pnpm@10.13.1",
6
6
  "description": "Vue + Vite component lib",
7
7
  "engines": {
@@ -1,9 +1,10 @@
1
1
  <script setup lang="ts">
2
- import cameraIcon from '@af-mobile-client-vue3/assets/img/component/camera.png'
2
+ // import cameraIcon from '@af-mobile-client-vue3/assets/img/component/camera.png'
3
3
  import { deleteFile, upload } from '@af-mobile-client-vue3/services/api/common'
4
4
  import { mobileUtil } from '@af-mobile-client-vue3/utils/mobileUtil'
5
5
  import {
6
6
  ActionSheet,
7
+ Icon as VanIcon,
7
8
  Uploader as vanUploader,
8
9
  } from 'vant'
9
10
  import { ref } from 'vue'
@@ -209,7 +210,7 @@ function handlePhotoUpload(photoData: any) {
209
210
  emit('updateAllFileList', imageList.value.filter(item => item.status === 'done').map(item => item)) // 新增
210
211
 
211
212
  const doneIds = Object.values(imageList.value)
212
- .filter(item => item.status === 'done')
213
+ .filter(item => !item.status || item.status === 'done')
213
214
  .map(item => item.photo_name)
214
215
 
215
216
  if (props.outerIndex !== undefined)
@@ -272,7 +273,7 @@ function deleteFileFunction(file: any) {
272
273
  const doneIds = ref(null)
273
274
  if (props.isAsyncUpload) {
274
275
  doneIds.value = Object.values(imageList.value)
275
- .filter(item => item.status === 'done')
276
+ .filter(item => !item.status || item.status === 'done')
276
277
  .map(item => item.photo_name)
277
278
  }
278
279
  else {
@@ -299,7 +300,7 @@ function deleteFileFunction(file: any) {
299
300
  const doneIds = ref(null)
300
301
  if (props.isAsyncUpload) {
301
302
  doneIds.value = Object.values(imageList.value)
302
- .filter(item => item.status === 'done')
303
+ .filter(item => !item.status || item.status === 'done')
303
304
  .map(item => item.photo_name)
304
305
  }
305
306
  else {
@@ -379,28 +380,30 @@ function handleActionSelect(option: any) {
379
380
  style="display:none"
380
381
  @change="(e:any) => handleBrowserFiles(e.target.files)"
381
382
  >
382
- <div
383
- v-if="!props.readonly && props.mode !== '预览' && (imageList.length < props.attr?.acceptCount && props.attr?.addOrEdit !== 'readonly')"
384
- class="custom-upload-area"
385
- @click="handleUploadAreaClick"
386
- >
387
- <img :src="cameraIcon" alt="camera" class="upload-camera-img">
388
- <div class="upload-title">
389
- 上传附件
390
- </div>
391
- <div v-if="props.attr?.acceptCount" class="upload-desc">
392
- 上传限制: {{ imageList.length }} / {{ props.attr?.acceptCount }}
393
- </div>
394
- </div>
395
383
  <van-uploader
396
384
  ref="uploaderRef"
397
385
  v-model="imageList"
398
- :show-upload="false"
386
+ class="custom-trigger-uploader"
387
+ :show-upload="true"
399
388
  :deletable="!props.readonly && (props.attr?.addOrEdit !== 'readonly' && props.authority === 'admin') && props.mode !== '预览'"
400
389
  :multiple="!props.readonly && props.authority === 'admin'"
401
390
  :preview-image="true"
402
391
  :before-delete="!props.readonly && props.attr?.addOrEdit !== 'readonly' && props.authority === 'admin' ? deleteFileFunction : undefined"
403
- />
392
+ :before-read="() => false"
393
+ >
394
+ <template #default>
395
+ <div
396
+ v-if="!props.readonly && props.mode !== '预览' && (imageList.length < props.attr?.acceptCount && props.attr?.addOrEdit !== 'readonly')"
397
+ class="custom-upload-area"
398
+ @click="handleUploadAreaClick"
399
+ >
400
+ <VanIcon name="plus" size="35" color="#d9d9d9" />
401
+ <div v-if="props.attr?.acceptCount" class="upload-desc">
402
+ {{ imageList.length }} / {{ props.attr?.acceptCount }}
403
+ </div>
404
+ </div>
405
+ </template>
406
+ </van-uploader>
404
407
  <ActionSheet
405
408
  v-model:show="showActionSheet"
406
409
  :actions="actionOptions"
@@ -420,10 +423,13 @@ function handleActionSelect(option: any) {
420
423
  // 该属性会影响表单布局
421
424
  // gap: 16px;
422
425
  }
426
+ /* 让自定义上传按钮可点击:关闭 Vant 覆盖在上方的透明 input 的事件捕获 */
427
+ :deep(.custom-trigger-uploader .van-uploader__input) {
428
+ pointer-events: none;
429
+ }
423
430
  .custom-upload-area {
424
- width: 100%;
425
- height: 100%;
426
- min-height: 80px;
431
+ width: 82px;
432
+ height: 82px;
427
433
  box-sizing: border-box;
428
434
  border: 1px dashed #d9d9d9;
429
435
  border-radius: 10px;