ljc hai 6 días
pai
achega
d2301addcd

+ 51 - 43
components/cwg-file-picker-wrapper.vue

@@ -1,7 +1,7 @@
 <template>
   <view class="file-picker-wrapper">
     <!-- 只读模式:仅展示 -->
-    <view v-if="readonly" class="file-list readonly-list">
+    <view v-if="readonly && !noFileList" class="file-list readonly-list">
       <view v-for="(file, index) in innerFileList" :key="index" class="file-item readonly-item"
         @click="previewFile(file, index)">
         <image v-if="isImage(file)" :src="file.url || file.path" mode="aspectFill" class="file-thumb"
@@ -16,52 +16,55 @@
 
     <!-- 正常模式:宫格上传(完全对齐官方 upload-image 样式) -->
     <view v-else class="uni-file-picker__container">
-      <view class="file-picker__box" v-for="(item, index) in innerFileList" :key="index"
-        :style="typeof boxStyle === 'object' ? boxStyle : { cssText: boxStyle }" >
-        <view class="file-picker__box-content " :style="borderStyle" >
-          <!-- 图片 -->
-          <image v-if="isImage(item)" class="file-image cursor-pointer" :data-tooltip="tooltipText(item)" :src="item.url || item.path" mode="aspectFill"
-            :style="imgStyle" @click.stop="previewFile(item, index)" />
-
-          <!-- 视频 → 显示第一帧 + 播放图标 -->
-          <view v-else-if="isVideo(item)" class="file-cover video-box cursor-pointer" :data-tooltip="tooltipText(item)" @click.stop="previewFile(item, index)">
-            <image :src="item.url || item.path" class="file-image" mode="aspectFill" :style="imgStyle" />
-            <view class="video-play-icon">▶</view>
-          </view>
-
-          <!-- 其他文件(PDF/Word/Excel) -->
-          <view v-else class="file-cover file-box cursor-pointer" :data-tooltip="tooltipText(item)" :class="getFileClass(item.name)"
-            @click.stop="previewFile(item, index)">
-            <text class="file-big-icon">{{ getFileIcon(item.name) }}</text>
-            <text class="file-ext-name">{{ getFileExt(item.name) }}</text>
-          </view>
-
-          <!-- 删除 -->
-          <view v-if="delIcon" class="icon-del-box cursor-pointer" :data-tooltip="t('vu.tooltip.t17')" @click.stop="deleteFile(index)">
-            <view class="icon-del"></view>
-            <view class="icon-del rotate"></view>
-          </view>
-
-          <!-- 进度 -->
-          <view v-if="item.status === 'uploading'" class="file-picker__progress">
-            <progress class="file-picker__progress-item" :percent="item.progress" stroke-width="4"
-              backgroundColor="#EBEBEB" />
-          </view>
-
-          <!-- 失败重试 -->
-          <view v-if="item.status === 'error'" class="file-picker__mask" @click.stop="reUploadFile(index)">
-            点击重试
+      <template v-if="!noFileList">
+        <view class="file-picker__box" v-for="(item, index) in innerFileList" :key="index"
+              :style="typeof boxStyle === 'object' ? boxStyle : { cssText: boxStyle }" >
+          <view class="file-picker__box-content " :style="borderStyle" >
+            <!-- 图片 -->
+            <image v-if="isImage(item)" class="file-image cursor-pointer" :data-tooltip="tooltipText(item)" :src="item.url || item.path" mode="aspectFill"
+                   :style="imgStyle" @click.stop="previewFile(item, index)" />
+
+            <!-- 视频 → 显示第一帧 + 播放图标 -->
+            <view v-else-if="isVideo(item)" class="file-cover video-box cursor-pointer" :data-tooltip="tooltipText(item)" @click.stop="previewFile(item, index)">
+              <image :src="item.url || item.path" class="file-image" mode="aspectFill" :style="imgStyle" />
+              <view class="video-play-icon">▶</view>
+            </view>
+
+            <!-- 其他文件(PDF/Word/Excel) -->
+            <view v-else class="file-cover file-box cursor-pointer" :data-tooltip="tooltipText(item)" :class="getFileClass(item.name)"
+                  @click.stop="previewFile(item, index)">
+              <text class="file-big-icon">{{ getFileIcon(item.name) }}</text>
+              <text class="file-ext-name">{{ getFileExt(item.name) }}</text>
+            </view>
+
+            <!-- 删除 -->
+            <view v-if="delIcon" class="icon-del-box cursor-pointer" :data-tooltip="t('vu.tooltip.t17')" @click.stop="deleteFile(index)">
+              <view class="icon-del"></view>
+              <view class="icon-del rotate"></view>
+            </view>
+
+            <!-- 进度 -->
+            <view v-if="item.status === 'uploading'" class="file-picker__progress">
+              <progress class="file-picker__progress-item" :percent="item.progress" stroke-width="4"
+                        backgroundColor="#EBEBEB" />
+            </view>
+
+            <!-- 失败重试 -->
+            <view v-if="item.status === 'error'" class="file-picker__mask" @click.stop="reUploadFile(index)">
+              点击重试
+            </view>
           </view>
         </view>
-      </view>
-
+      </template>
       <!-- 添加按钮 -->
-      <view v-if="innerFileList?.length < limit" class="file-picker__box cursor-pointer"
-        :style="typeof boxStyle === 'object' ? boxStyle : { cssText: boxStyle }" :data-tooltip="t('vu.tooltip.t10')" data-placement="top">
-        <view class="file-picker__box-content  is-add" :style="borderStyle" @click="handleChoose">
-          <cwg-icon name="icon_add" class="upload-icon" :size="24" />
+      <slot v-if="innerFileList?.length < limit" name="add-button" :handleChoose="handleChoose">
+        <view class="file-picker__box cursor-pointer"
+          :style="typeof boxStyle === 'object' ? boxStyle : { cssText: boxStyle }" :data-tooltip="t('vu.tooltip.t10')" data-placement="top">
+          <view class="file-picker__box-content is-add" :style="borderStyle" @click="handleChoose">
+            <cwg-icon name="icon_add" class="upload-icon" :size="24" />
+          </view>
         </view>
-      </view>
+      </slot>
     </view>
   </view>
   <cop-chooseFile :trigger="triggerFlag" accept="*" @receiveRenderFile="handleFile">
@@ -111,6 +114,11 @@ const props = defineProps({
     type: Boolean,
     default: true
   },
+  // 不展示文件列表
+  noFileList: {
+    type: Boolean,
+    default: false
+  },
   action: {
     type: String,
     default: ''

+ 1 - 2
composables/useFilters.ts

@@ -43,8 +43,7 @@ export function useFilters(): Filters {
         }
 
         // let value1 = Number(value).toFixed(2)
-      let value1 = numberDecimal(value,decimalPlaces);
-      console.log(value1)
+        let value1 = numberDecimal(value,decimalPlaces);
         if (value1.indexOf('-') > -1) {
             value1 = value1.split('-')[1];
             let num = value1.split('.');

+ 11 - 26
pages/mine/improveImmediately.vue

@@ -249,13 +249,6 @@
                     :showProgress="false" :canChoose="true" :showError="false" :show-progress="false" disablePreview
                     :image-styles="imageStyle" @update:modelValue="(val) => handleFileUpdate(val, '1')"
                     customClass="avatar-uploader">
-                    <view class="file-item">
-                      <image v-if="!isPdf(fileListID1.path)" class="avatar" :src="updateUrl + (fileListID1.path)">
-                      </image>
-                      <view v-else>
-                        <image class="icon" :src="icon_doc" />
-                      </view>
-                    </view>
                   </cwg-file-picker-wrapper>
                   <!--                  <view v-else>-->
                   <!--                    <view class="file-item">-->
@@ -278,13 +271,6 @@
                     :showProgress="false" :canChoose="true" :showError="false" :show-progress="false" disablePreview
                     :image-styles="imageStyle" @update:modelValue="(val) => handleFileUpdate(val, '2')"
                     customClass="avatar-uploader">
-                    <view class="file-item">
-                      <image v-if="!isPdf(fileListID2.path)" class="avatar" :src="updateUrl + (fileListID2.path)">
-                      </image>
-                      <view v-else>
-                        <image class="icon" :src="icon_doc" />
-                      </view>
-                    </view>
                   </cwg-file-picker-wrapper>
                 </uni-col>
                 <uni-col :xs="24" :sm="24" :md="4" :lg="4" :xl="4">
@@ -470,13 +456,16 @@
               </view>
               <uni-row class="demo-uni-row uni-row1" :gutter="20">
                 <uni-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
-                  <cwg-file-picker :limit="9" :multiple="true" :editable="true" :fileMediatype="'all'"
-                    uploadUrl="/custom/file/upload/10" :baseUrl="updateUrl" :imageWidth="100" :imageHeight="60"
+                  <cwg-file-picker-wrapper :limit="9" :multiple="true" :editable="true" :fileMediatype="'all'"
+                    uploadUrl="/custom/file/upload/10" :baseUrl="updateUrl" :imageWidth="100" :imageHeight="60" noFileList
                     :showPreviewDelete="false" :canDelete="false" :uploadError="false" :showProgress="false"
                     :image-styles="imageStyle" @update:modelValue="(val) => handleFileUpdate(val, '10')"
                     custom-class="fileOther" :showError="false">
-                    <button type="primary" class="btn btn-danger waves-effect waves-light">{{ t('Btn.Upload') }}</button>
-                  </cwg-file-picker>
+                    <template #add-button="{ handleChoose }">
+                      <button type="primary" class="btn btn-danger waves-effect waves-light btn-upload" @click="handleChoose">{{ t('Btn.Upload') }}</button>
+                    </template>
+
+                  </cwg-file-picker-wrapper>
                   <view class="fileList">
                     <view id="files" v-for="(item, index) in fileListOthers" :key="index">
 
@@ -486,13 +475,6 @@
                         :showProgress="false" :imageWidth="200" :imageHeight="150" :showPreviewDelete="true"
                         :disablePreview="true" :image-styles="imageStyle" :canChoose="true"
                         @update:modelValue="(val) => handleFileUpdate(val, '1')">
-                        <view class="file-item">
-                          <image v-if="!isPdf(item.path) || !isPdf(item.againPath)" class="avatar"
-                            :src="updateUrl + (item.againPath || item.path)"></image>
-                          <view v-else>
-                            <image class="icon" :src="icon_doc" />
-                          </view>
-                        </view>
                       </cwg-file-picker-wrapper>
                       <view class="options">
                         <u-button style="margin-right: 20px;" :disabled="item.status == 2" @click.stop="showFile(item)">
@@ -1041,7 +1023,7 @@ function changeCountry(value: any) {
 function handleFileUpdate(value, type) {
   console.log(value, type, 'uplaod')
   if (type == 10) {
-    uni.showToast({ title: t('card.New1.d5'), icon: 'none' })
+    // uni.showToast({ title: t('card.New1.d5'), icon: 'none' })
     getCustomFileList();
   }
 }
@@ -1859,4 +1841,7 @@ onUnmounted(() => {
     color: var(--bs-heading-color);
   }
 }
+.btn-upload{
+  width: px2rpx(120);
+}
 </style>