木星 1 month ago
parent
commit
7992e5c5ba
1 changed files with 10 additions and 8 deletions
  1. 10 8
      src/views/Template/TemplateManage.vue

+ 10 - 8
src/views/Template/TemplateManage.vue

@@ -157,15 +157,17 @@ const schema = reactive<FormSchema[]>([
157
         formData.thumbnail = _response.data
157
         formData.thumbnail = _response.data
158
       },
158
       },
159
       beforeUpload: (rawFile) => {
159
       beforeUpload: (rawFile) => {
160
-        console.log('kokokoko', rawFile)
161
-        if (
162
-          rawFile.type !== 'image/jpeg' &&
163
-          rawFile.type !== 'image/png' &&
164
-          rawFile.type !== 'image/jpg'
165
-        ) {
166
-          ElMessage.error('只能上传png、jpg格式')
160
+        console.log('sadghasgdaj', rawFile.name.includes('jpeg'))
161
+        console.log('kankangeshi', rawFile)
162
+        if (rawFile.name.includes('jpeg')) {
163
+          ElMessage.error('上传格式:png、jpg!')
164
+          return false
165
+        }
166
+        if (rawFile.type !== 'image/png' && rawFile.type !== 'image/jpeg') {
167
+          ElMessage.error('上传格式:png、jpg!')
167
           return false
168
           return false
168
         }
169
         }
170
+
169
         return true
171
         return true
170
       },
172
       },
171
       slots: {
173
       slots: {
@@ -216,7 +218,7 @@ const schema = reactive<FormSchema[]>([
216
       },
218
       },
217
       beforeUpload: (rawFile) => {
219
       beforeUpload: (rawFile) => {
218
         console.log('kokokoko', rawFile)
220
         console.log('kokokoko', rawFile)
219
-        if (rawFile.type !== 'application/x-zip-compressed' || rawFile.type !== 'application/zip') {
221
+        if (rawFile.type !== 'application/x-zip-compressed' && rawFile.type !== 'application/zip') {
220
           ElMessage.error('只能上传ZIP文件')
222
           ElMessage.error('只能上传ZIP文件')
221
           return false
223
           return false
222
         } else if (rawFile.size / 1024 / 1024 > 2048) {
224
         } else if (rawFile.size / 1024 / 1024 > 2048) {