sadais-piui 1.2.7-beta126 → 1.2.7-beta127
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<!--
|
|
2
2
|
* @Author: zhangzhenfei
|
|
3
3
|
* @Date: 2021-08-13 11:31:57
|
|
4
|
-
* @LastEditTime: 2024-10-
|
|
4
|
+
* @LastEditTime: 2024-10-22 10:42:41
|
|
5
5
|
* @LastEditors: zhangzhenfei
|
|
6
6
|
* @Description: 图片上传组件
|
|
7
7
|
* @FilePath: /piui-awesome/src/piui/components/pi-upload-img/index.vue
|
|
@@ -35,8 +35,10 @@
|
|
|
35
35
|
class="pi-rela pi-of-hidden pi-radius-8"
|
|
36
36
|
:style="[getItemStyle]"
|
|
37
37
|
>
|
|
38
|
-
<view class="file-mask">
|
|
39
|
-
|
|
38
|
+
<view class="file-mask" :class="[{'no-bg': fileIconMap[getFileType(imgField ? img[imgField] : img)]}]">
|
|
39
|
+
<image v-if="fileIconMap[getFileType(imgField ? img[imgField] : img)]" :src="fileIconMap[getFileType(imgField ? img[imgField] : img)]" mode="widthFix" style="width: 100%;"/>
|
|
40
|
+
<template v-else>
|
|
41
|
+
<pi-icon
|
|
40
42
|
:name="
|
|
41
43
|
isVideoFilename(imgField ? img[imgField] : img)
|
|
42
44
|
? 'videofill'
|
|
@@ -48,6 +50,7 @@
|
|
|
48
50
|
<view class="pi-mg-top-12 pi-fz-22">
|
|
49
51
|
{{ getFileType(imgField ? img[imgField] : img) }}
|
|
50
52
|
</view>
|
|
53
|
+
</template>
|
|
51
54
|
</view>
|
|
52
55
|
</view>
|
|
53
56
|
</view>
|
|
@@ -382,6 +385,13 @@ export default {
|
|
|
382
385
|
default() {
|
|
383
386
|
return uploadImg.chooseVideoOpts
|
|
384
387
|
}
|
|
388
|
+
},
|
|
389
|
+
// 文件类型和图标映射关系,对象形式({PDF: 'https://xxx'})
|
|
390
|
+
fileIconMap: {
|
|
391
|
+
type: Object,
|
|
392
|
+
default() {
|
|
393
|
+
return uploadImg.fileIconMap
|
|
394
|
+
}
|
|
385
395
|
}
|
|
386
396
|
},
|
|
387
397
|
data() {
|
|
@@ -985,6 +995,9 @@ export default {
|
|
|
985
995
|
align-items: center;
|
|
986
996
|
justify-content: center;
|
|
987
997
|
background: rgba(0, 0, 0, 0.3);
|
|
998
|
+
&.no-bg {
|
|
999
|
+
background: transparent;
|
|
1000
|
+
}
|
|
988
1001
|
}
|
|
989
1002
|
}
|
|
990
1003
|
</style>
|
package/config/uploadImg.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* @Author: zhangzhenfei
|
|
3
3
|
* @Date: 2021-08-13 11:29:02
|
|
4
|
-
* @LastEditTime: 2024-
|
|
4
|
+
* @LastEditTime: 2024-10-22 10:43:21
|
|
5
5
|
* @LastEditors: zhangzhenfei
|
|
6
6
|
* @Description: 图片上传
|
|
7
|
-
* @FilePath: /
|
|
7
|
+
* @FilePath: /piui-awesome/src/piui/config/uploadImg.js
|
|
8
8
|
*/
|
|
9
9
|
import icon from './icon.js'
|
|
10
10
|
import cropOption from './imgCropper.js'
|
|
@@ -77,5 +77,6 @@ export default {
|
|
|
77
77
|
},
|
|
78
78
|
beforeUpload: null, // 上传之前的钩子
|
|
79
79
|
onProgress: null, // 文件上传时的钩子
|
|
80
|
-
beforeRemove: null // 删除之前的钩子
|
|
80
|
+
beforeRemove: null, // 删除之前的钩子
|
|
81
|
+
fileIconMap: {} // 文件类型和图标映射关系,对象形式({PDF: 'https://xxx'})
|
|
81
82
|
}
|