فهرست منبع

限制文件上传大小为20MB

Xiao_123 6 ماه پیش
والد
کامیت
0dcaa480c3
3فایلهای تغییر یافته به همراه25 افزوده شده و 3 حذف شده
  1. 7 0
      pagesA/chart/index.vue
  2. 11 3
      pagesA/resume/index.vue
  3. 7 0
      pagesB/positionDetail/index.vue

+ 7 - 0
pagesA/chart/index.vue

@@ -497,6 +497,13 @@ function handleUploadResume () {
     count: 1,
     type: 'file',
     success (res) {
+      // 限制文件上传大小
+      const size = res.tempFiles[0].size
+      if (size / (1024*1024) > 20) {
+        uni.showToast({ icon: 'none', title: '文件大小不能超过20M' })
+        return
+      }
+      
       const title = res.tempFiles[0].name
       const path = res.tempFiles[0].path
       const test = /\.(pdf|docx|doc)$/.test(title)

+ 11 - 3
pagesA/resume/index.vue

@@ -1,7 +1,7 @@
 <template>
   <view class="ss-p-b-100" style="height: 100vh; background-color: #f2f4f7;">
     <uni-notice-bar show-close single text="最多可以上传5份附件简历" />
-    <view v-if="bioList.length > 0" class="ss-p-t-6">
+    <view v-if="bioList.length > 0">
 			<uni-card v-for="(item, index) in bioList" :key="index" :is-shadow="true" :border='false' shadow="0px 0px 3px 1px rgba(0,0,0,0.1)">
 				<view class="d-flex align-center">
           <view @click="preview(item.url)"  style="flex: 1;">
@@ -17,8 +17,9 @@
 		<view v-else class="nodata-img-parent">
 			<image src="https://minio.citupro.com/dev/static/nodata.png" mode="widthFix" style="width: 100vw;height: 100vh;"></image>
 		</view>
-    <view class="bottom-sticky">
-      <button class="recomm-button" @click="handleUpload">微信聊天文件上传</button>
+    <view class="bottom-sticky flex-column">
+      <button class="recomm-button" style="margin-bottom: 0;" @click="handleUpload">微信聊天文件上传</button>
+      <view class="color-primary font-size-14 ss-m-b-25 ss-m-t-10" style="text-align: center;">上传文件大小不能超过20MB</view>
     </view>
 
     <uni-popup ref="popup" type="bottom">
@@ -78,6 +79,13 @@ const handleUpload = () => {
     count: 1,
     type: 'file',
     success (res) {
+      // 限制文件上传大小
+      const size = res.tempFiles[0].size
+      if (size / (1024*1024) > 20) {
+        uni.showToast({ icon: 'none', title: '文件大小不能超过20M' })
+        return
+      }
+
       const title = res.tempFiles[0].name
       const path = res.tempFiles[0].path
       //效验是否为支持的文件格式

+ 7 - 0
pagesB/positionDetail/index.vue

@@ -558,6 +558,13 @@ const handleUpload = () => {
     count: 1,
     type: 'file',
     success (res) {
+      // 限制文件上传大小
+      const size = res.tempFiles[0].size
+      if (size / (1024*1024) > 20) {
+        uni.showToast({ icon: 'none', title: '文件大小不能超过20M' })
+        return
+      }
+
       const title = res.tempFiles[0].name
       const path = res.tempFiles[0].path
       //效验是否为支持的文件格式