@vtj/materials 0.13.16 → 0.13.18
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/dist/assets/antdv/index.umd.js +2 -2
- package/dist/assets/charts/index.umd.js +2 -2
- package/dist/assets/element/index.umd.js +3 -3
- package/dist/assets/icons/index.umd.js +2 -2
- package/dist/assets/ui/index.umd.js +2 -2
- package/dist/assets/uni-h5/index.umd.js +2 -2
- package/dist/assets/uni-ui/index.umd.js +2 -2
- package/dist/assets/vant/index.umd.js +2 -2
- package/dist/deps/@vtj/charts/index.umd.js +2 -2
- package/dist/deps/@vtj/icons/index.umd.js +2 -2
- package/dist/deps/@vtj/ui/index.umd.js +4 -4
- package/dist/deps/@vtj/ui/style.css +1 -1
- package/dist/deps/@vtj/utils/index.umd.js +28 -33
- package/dist/deps/@vueuse/core/index.iife.min.js +1 -1
- package/dist/deps/element-plus/index.css +1 -1
- package/dist/deps/element-plus/index.full.min.js +14 -14
- package/dist/deps/element-plus/zh-cn.js +1 -1
- package/dist/deps/uni-app/index.umd.js +1 -1
- package/dist/deps/uni-h5/index.umd.js +8 -8
- package/dist/deps/uni-h5/style.css +1 -1
- package/dist/deps/uni-h5-vue/index.umd.js +1 -1
- package/dist/deps/uni-ui/index.umd.js +1 -1
- package/dist/deps/uni-ui/style.css +1 -1
- package/dist/deps/vue/vue.global.js +88 -53
- package/dist/deps/vue/vue.global.prod.js +9 -9
- package/package.json +12 -12
- package/src/antdv/image.ts +1 -1
- package/src/element/image.ts +1 -1
- package/src/element/virtualizedTable.ts +6 -6
- package/src/manifest.json +69 -0
- package/src/pages/index.vue +2 -0
- package/src/pages.json +19 -0
- package/src/uni-ui/index.ts +88 -58
- package/src/{uni-ui/lib/uni.scss → uni.scss} +4 -0
- package/src/version.ts +2 -2
- package/src/uni-ui/lib/uni-col/uni-col.vue +0 -324
- package/src/uni-ui/lib/uni-collapse/uni-collapse.vue +0 -153
- package/src/uni-ui/lib/uni-collapse-item/uni-collapse-item.vue +0 -425
- package/src/uni-ui/lib/uni-data-picker/keypress.js +0 -45
- package/src/uni-ui/lib/uni-data-picker/uni-data-picker.vue +0 -604
- package/src/uni-ui/lib/uni-data-pickerview/uni-data-picker.js +0 -622
- package/src/uni-ui/lib/uni-data-pickerview/uni-data-pickerview.css +0 -76
- package/src/uni-ui/lib/uni-data-pickerview/uni-data-pickerview.vue +0 -335
- package/src/uni-ui/lib/uni-data-select/uni-data-select.vue +0 -590
- package/src/uni-ui/lib/uni-datetime-picker/calendar-item.vue +0 -188
- package/src/uni-ui/lib/uni-datetime-picker/calendar.vue +0 -985
- package/src/uni-ui/lib/uni-datetime-picker/i18n/en.json +0 -22
- package/src/uni-ui/lib/uni-datetime-picker/i18n/index.js +0 -8
- package/src/uni-ui/lib/uni-datetime-picker/i18n/zh-Hans.json +0 -22
- package/src/uni-ui/lib/uni-datetime-picker/i18n/zh-Hant.json +0 -22
- package/src/uni-ui/lib/uni-datetime-picker/time-picker.vue +0 -1032
- package/src/uni-ui/lib/uni-datetime-picker/uni-datetime-picker.vue +0 -1230
- package/src/uni-ui/lib/uni-datetime-picker/util.js +0 -448
- package/src/uni-ui/lib/uni-easyinput/common.js +0 -54
- package/src/uni-ui/lib/uni-easyinput/uni-easyinput.vue +0 -790
- package/src/uni-ui/lib/uni-fav/i18n/en.json +0 -4
- package/src/uni-ui/lib/uni-fav/i18n/index.js +0 -8
- package/src/uni-ui/lib/uni-fav/i18n/zh-Hans.json +0 -4
- package/src/uni-ui/lib/uni-fav/i18n/zh-Hant.json +0 -4
- package/src/uni-ui/lib/uni-fav/uni-fav.vue +0 -170
- package/src/uni-ui/lib/uni-file-picker/choose-and-upload-file.js +0 -280
- package/src/uni-ui/lib/uni-file-picker/uni-file-picker.vue +0 -668
- package/src/uni-ui/lib/uni-file-picker/upload-file.vue +0 -325
- package/src/uni-ui/lib/uni-file-picker/upload-image.vue +0 -292
- package/src/uni-ui/lib/uni-file-picker/utils.js +0 -110
- package/src/uni-ui/lib/uni-forms/uni-forms.vue +0 -416
- package/src/uni-ui/lib/uni-forms/utils.js +0 -293
- package/src/uni-ui/lib/uni-forms/validate.js +0 -486
- package/src/uni-ui/lib/uni-forms-item/uni-forms-item.vue +0 -630
- package/src/uni-ui/lib/uni-goods-nav/i18n/en.json +0 -6
- package/src/uni-ui/lib/uni-goods-nav/i18n/index.js +0 -8
- package/src/uni-ui/lib/uni-goods-nav/i18n/zh-Hans.json +0 -6
- package/src/uni-ui/lib/uni-goods-nav/i18n/zh-Hant.json +0 -6
- package/src/uni-ui/lib/uni-goods-nav/uni-goods-nav.vue +0 -231
- package/src/uni-ui/lib/uni-grid/uni-grid.vue +0 -148
- package/src/uni-ui/lib/uni-icons/uni-icons.uvue +0 -91
- package/src/uni-ui/lib/uni-icons/uni-icons.vue +0 -114
- package/src/uni-ui/lib/uni-icons/uniicons.css +0 -664
- package/src/uni-ui/lib/uni-icons/uniicons.ttf +0 -0
- package/src/uni-ui/lib/uni-icons/uniicons_file.ts +0 -664
- package/src/uni-ui/lib/uni-icons/uniicons_file_vue.js +0 -649
- package/src/uni-ui/lib/uni-indexed-list/uni-indexed-list-item.vue +0 -168
- package/src/uni-ui/lib/uni-indexed-list/uni-indexed-list.vue +0 -404
- package/src/uni-ui/lib/uni-list/uni-list.vue +0 -123
- package/src/uni-ui/lib/uni-list/uni-refresh.vue +0 -65
- package/src/uni-ui/lib/uni-list/uni-refresh.wxs +0 -87
- package/src/uni-ui/lib/uni-load-more/i18n/en.json +0 -5
- package/src/uni-ui/lib/uni-load-more/i18n/index.js +0 -8
- package/src/uni-ui/lib/uni-load-more/i18n/zh-Hans.json +0 -5
- package/src/uni-ui/lib/uni-load-more/i18n/zh-Hant.json +0 -5
- package/src/uni-ui/lib/uni-load-more/uni-load-more.vue +0 -456
- package/src/uni-ui/lib/uni-notice-bar/uni-notice-bar.vue +0 -484
- package/src/uni-ui/lib/uni-popup/i18n/en.json +0 -7
- package/src/uni-ui/lib/uni-popup/i18n/index.js +0 -8
- package/src/uni-ui/lib/uni-popup/i18n/zh-Hans.json +0 -7
- package/src/uni-ui/lib/uni-popup/i18n/zh-Hant.json +0 -7
- package/src/uni-ui/lib/uni-popup/keypress.js +0 -45
- package/src/uni-ui/lib/uni-popup/popup.js +0 -26
- package/src/uni-ui/lib/uni-popup/uni-popup.uvue +0 -90
- package/src/uni-ui/lib/uni-popup/uni-popup.vue +0 -552
- package/src/uni-ui/lib/uni-popup-dialog/keypress.js +0 -45
- package/src/uni-ui/lib/uni-popup-dialog/uni-popup-dialog.vue +0 -324
- package/src/uni-ui/lib/uni-popup-message/uni-popup-message.vue +0 -149
- package/src/uni-ui/lib/uni-rate/uni-rate.vue +0 -380
- package/src/uni-ui/lib/uni-row/uni-row.vue +0 -193
- package/src/uni-ui/lib/uni-search-bar/i18n/en.json +0 -4
- package/src/uni-ui/lib/uni-search-bar/i18n/index.js +0 -8
- package/src/uni-ui/lib/uni-search-bar/i18n/zh-Hans.json +0 -4
- package/src/uni-ui/lib/uni-search-bar/i18n/zh-Hant.json +0 -4
- package/src/uni-ui/lib/uni-search-bar/uni-search-bar.vue +0 -339
- package/src/uni-ui/lib/uni-swipe-action-item/bindingx.js +0 -311
- package/src/uni-ui/lib/uni-swipe-action-item/isPC.js +0 -12
- package/src/uni-ui/lib/uni-swipe-action-item/mpalipay.js +0 -195
- package/src/uni-ui/lib/uni-swipe-action-item/mpother.js +0 -260
- package/src/uni-ui/lib/uni-swipe-action-item/mpwxs.js +0 -84
- package/src/uni-ui/lib/uni-swipe-action-item/render.js +0 -270
- package/src/uni-ui/lib/uni-swipe-action-item/uni-swipe-action-item.vue +0 -493
- package/src/uni-ui/lib/uni-swipe-action-item/wx.wxs +0 -341
- package/src/uni-ui/lib/uni-table/uni-table.vue +0 -496
- package/src/uni-ui/lib/uni-td/uni-td.vue +0 -99
- package/src/uni-ui/lib/uni-th/filter-dropdown.vue +0 -559
- package/src/uni-ui/lib/uni-th/uni-th.vue +0 -322
- package/src/uni-ui/lib/uni-tr/table-checkbox.vue +0 -181
- package/src/uni-ui/lib/uni-tr/uni-tr.vue +0 -208
- package/src/uni-ui/lib/uni-transition/createAnimation.js +0 -131
- package/src/uni-ui/lib/uni-transition/uni-transition.vue +0 -310
- package/src/uni-ui/polyfill.ts +0 -41
@@ -1,325 +0,0 @@
|
|
1
|
-
<template>
|
2
|
-
<view class="uni-file-picker__files">
|
3
|
-
<view v-if="!readonly" class="files-button" @click="choose">
|
4
|
-
<slot></slot>
|
5
|
-
</view>
|
6
|
-
<!-- :class="{'is-text-box':showType === 'list'}" -->
|
7
|
-
<view v-if="list.length > 0" class="uni-file-picker__lists is-text-box" :style="borderStyle">
|
8
|
-
<!-- ,'is-list-card':showType === 'list-card' -->
|
9
|
-
|
10
|
-
<view class="uni-file-picker__lists-box" v-for="(item ,index) in list" :key="index" :class="{
|
11
|
-
'files-border':index !== 0 && styles.dividline}"
|
12
|
-
:style="index !== 0 && styles.dividline &&borderLineStyle">
|
13
|
-
<view class="uni-file-picker__item">
|
14
|
-
<!-- :class="{'is-text-image':showType === 'list'}" -->
|
15
|
-
<!-- <view class="files__image is-text-image">
|
16
|
-
<image class="header-image" :src="item.logo" mode="aspectFit"></image>
|
17
|
-
</view> -->
|
18
|
-
<view class="files__name">{{item.name}}</view>
|
19
|
-
<view v-if="delIcon&&!readonly" class="icon-del-box icon-files" @click="delFile(index)">
|
20
|
-
<view class="icon-del icon-files"></view>
|
21
|
-
<view class="icon-del rotate"></view>
|
22
|
-
</view>
|
23
|
-
</view>
|
24
|
-
<view v-if="(item.progress && item.progress !== 100) ||item.progress===0 " class="file-picker__progress">
|
25
|
-
<progress class="file-picker__progress-item" :percent="item.progress === -1?0:item.progress" stroke-width="4"
|
26
|
-
:backgroundColor="item.errMsg?'#ff5a5f':'#EBEBEB'" />
|
27
|
-
</view>
|
28
|
-
<view v-if="item.status === 'error'" class="file-picker__mask" @click.stop="uploadFiles(item,index)">
|
29
|
-
点击重试
|
30
|
-
</view>
|
31
|
-
</view>
|
32
|
-
|
33
|
-
</view>
|
34
|
-
</view>
|
35
|
-
</template>
|
36
|
-
|
37
|
-
<script>
|
38
|
-
export default {
|
39
|
-
name: "uploadFile",
|
40
|
-
emits:['uploadFiles','choose','delFile'],
|
41
|
-
props: {
|
42
|
-
filesList: {
|
43
|
-
type: Array,
|
44
|
-
default () {
|
45
|
-
return []
|
46
|
-
}
|
47
|
-
},
|
48
|
-
delIcon: {
|
49
|
-
type: Boolean,
|
50
|
-
default: true
|
51
|
-
},
|
52
|
-
limit: {
|
53
|
-
type: [Number, String],
|
54
|
-
default: 9
|
55
|
-
},
|
56
|
-
showType: {
|
57
|
-
type: String,
|
58
|
-
default: ''
|
59
|
-
},
|
60
|
-
listStyles: {
|
61
|
-
type: Object,
|
62
|
-
default () {
|
63
|
-
return {
|
64
|
-
// 是否显示边框
|
65
|
-
border: true,
|
66
|
-
// 是否显示分隔线
|
67
|
-
dividline: true,
|
68
|
-
// 线条样式
|
69
|
-
borderStyle: {}
|
70
|
-
}
|
71
|
-
}
|
72
|
-
},
|
73
|
-
readonly:{
|
74
|
-
type:Boolean,
|
75
|
-
default:false
|
76
|
-
}
|
77
|
-
},
|
78
|
-
computed: {
|
79
|
-
list() {
|
80
|
-
let files = []
|
81
|
-
this.filesList.forEach(v => {
|
82
|
-
files.push(v)
|
83
|
-
})
|
84
|
-
return files
|
85
|
-
},
|
86
|
-
styles() {
|
87
|
-
let styles = {
|
88
|
-
border: true,
|
89
|
-
dividline: true,
|
90
|
-
'border-style': {}
|
91
|
-
}
|
92
|
-
return Object.assign(styles, this.listStyles)
|
93
|
-
},
|
94
|
-
borderStyle() {
|
95
|
-
let {
|
96
|
-
borderStyle,
|
97
|
-
border
|
98
|
-
} = this.styles
|
99
|
-
let obj = {}
|
100
|
-
if (!border) {
|
101
|
-
obj.border = 'none'
|
102
|
-
} else {
|
103
|
-
let width = (borderStyle && borderStyle.width) || 1
|
104
|
-
width = this.value2px(width)
|
105
|
-
let radius = (borderStyle && borderStyle.radius) || 5
|
106
|
-
radius = this.value2px(radius)
|
107
|
-
obj = {
|
108
|
-
'border-width': width,
|
109
|
-
'border-style': (borderStyle && borderStyle.style) || 'solid',
|
110
|
-
'border-color': (borderStyle && borderStyle.color) || '#eee',
|
111
|
-
'border-radius': radius
|
112
|
-
}
|
113
|
-
}
|
114
|
-
let classles = ''
|
115
|
-
for (let i in obj) {
|
116
|
-
classles += `${i}:${obj[i]};`
|
117
|
-
}
|
118
|
-
return classles
|
119
|
-
},
|
120
|
-
borderLineStyle() {
|
121
|
-
let obj = {}
|
122
|
-
let {
|
123
|
-
borderStyle
|
124
|
-
} = this.styles
|
125
|
-
if (borderStyle && borderStyle.color) {
|
126
|
-
obj['border-color'] = borderStyle.color
|
127
|
-
}
|
128
|
-
if (borderStyle && borderStyle.width) {
|
129
|
-
let width = borderStyle && borderStyle.width || 1
|
130
|
-
let style = borderStyle && borderStyle.style || 0
|
131
|
-
if (typeof width === 'number') {
|
132
|
-
width += 'px'
|
133
|
-
} else {
|
134
|
-
width = width.indexOf('px') ? width : width + 'px'
|
135
|
-
}
|
136
|
-
obj['border-width'] = width
|
137
|
-
|
138
|
-
if (typeof style === 'number') {
|
139
|
-
style += 'px'
|
140
|
-
} else {
|
141
|
-
style = style.indexOf('px') ? style : style + 'px'
|
142
|
-
}
|
143
|
-
obj['border-top-style'] = style
|
144
|
-
}
|
145
|
-
let classles = ''
|
146
|
-
for (let i in obj) {
|
147
|
-
classles += `${i}:${obj[i]};`
|
148
|
-
}
|
149
|
-
return classles
|
150
|
-
}
|
151
|
-
},
|
152
|
-
|
153
|
-
methods: {
|
154
|
-
uploadFiles(item, index) {
|
155
|
-
this.$emit("uploadFiles", {
|
156
|
-
item,
|
157
|
-
index
|
158
|
-
})
|
159
|
-
},
|
160
|
-
choose() {
|
161
|
-
this.$emit("choose")
|
162
|
-
},
|
163
|
-
delFile(index) {
|
164
|
-
this.$emit('delFile', index)
|
165
|
-
},
|
166
|
-
value2px(value) {
|
167
|
-
if (typeof value === 'number') {
|
168
|
-
value += 'px'
|
169
|
-
} else {
|
170
|
-
value = value.indexOf('px') !== -1 ? value : value + 'px'
|
171
|
-
}
|
172
|
-
return value
|
173
|
-
}
|
174
|
-
}
|
175
|
-
}
|
176
|
-
</script>
|
177
|
-
|
178
|
-
<style lang="scss">
|
179
|
-
.uni-file-picker__files {
|
180
|
-
/* #ifndef APP-NVUE */
|
181
|
-
display: flex;
|
182
|
-
/* #endif */
|
183
|
-
flex-direction: column;
|
184
|
-
justify-content: flex-start;
|
185
|
-
}
|
186
|
-
|
187
|
-
.files-button {
|
188
|
-
// border: 1px red solid;
|
189
|
-
}
|
190
|
-
|
191
|
-
.uni-file-picker__lists {
|
192
|
-
position: relative;
|
193
|
-
margin-top: 5px;
|
194
|
-
overflow: hidden;
|
195
|
-
}
|
196
|
-
|
197
|
-
.file-picker__mask {
|
198
|
-
/* #ifndef APP-NVUE */
|
199
|
-
display: flex;
|
200
|
-
/* #endif */
|
201
|
-
justify-content: center;
|
202
|
-
align-items: center;
|
203
|
-
position: absolute;
|
204
|
-
right: 0;
|
205
|
-
top: 0;
|
206
|
-
bottom: 0;
|
207
|
-
left: 0;
|
208
|
-
color: #fff;
|
209
|
-
font-size: 14px;
|
210
|
-
background-color: rgba(0, 0, 0, 0.4);
|
211
|
-
}
|
212
|
-
|
213
|
-
.uni-file-picker__lists-box {
|
214
|
-
position: relative;
|
215
|
-
}
|
216
|
-
|
217
|
-
.uni-file-picker__item {
|
218
|
-
/* #ifndef APP-NVUE */
|
219
|
-
display: flex;
|
220
|
-
/* #endif */
|
221
|
-
align-items: center;
|
222
|
-
padding: 8px 10px;
|
223
|
-
padding-right: 5px;
|
224
|
-
padding-left: 10px;
|
225
|
-
}
|
226
|
-
|
227
|
-
.files-border {
|
228
|
-
border-top: 1px #eee solid;
|
229
|
-
}
|
230
|
-
|
231
|
-
.files__name {
|
232
|
-
flex: 1;
|
233
|
-
font-size: 14px;
|
234
|
-
color: #666;
|
235
|
-
margin-right: 25px;
|
236
|
-
/* #ifndef APP-NVUE */
|
237
|
-
word-break: break-all;
|
238
|
-
word-wrap: break-word;
|
239
|
-
/* #endif */
|
240
|
-
}
|
241
|
-
|
242
|
-
.icon-files {
|
243
|
-
/* #ifndef APP-NVUE */
|
244
|
-
position: static;
|
245
|
-
background-color: initial;
|
246
|
-
/* #endif */
|
247
|
-
}
|
248
|
-
|
249
|
-
// .icon-files .icon-del {
|
250
|
-
// background-color: #333;
|
251
|
-
// width: 12px;
|
252
|
-
// height: 1px;
|
253
|
-
// }
|
254
|
-
|
255
|
-
|
256
|
-
.is-list-card {
|
257
|
-
border: 1px #eee solid;
|
258
|
-
margin-bottom: 5px;
|
259
|
-
border-radius: 5px;
|
260
|
-
box-shadow: 0 0 2px 0px rgba(0, 0, 0, 0.1);
|
261
|
-
padding: 5px;
|
262
|
-
}
|
263
|
-
|
264
|
-
.files__image {
|
265
|
-
width: 40px;
|
266
|
-
height: 40px;
|
267
|
-
margin-right: 10px;
|
268
|
-
}
|
269
|
-
|
270
|
-
.header-image {
|
271
|
-
width: 100%;
|
272
|
-
height: 100%;
|
273
|
-
}
|
274
|
-
|
275
|
-
.is-text-box {
|
276
|
-
border: 1px #eee solid;
|
277
|
-
border-radius: 5px;
|
278
|
-
}
|
279
|
-
|
280
|
-
.is-text-image {
|
281
|
-
width: 25px;
|
282
|
-
height: 25px;
|
283
|
-
margin-left: 5px;
|
284
|
-
}
|
285
|
-
|
286
|
-
.rotate {
|
287
|
-
position: absolute;
|
288
|
-
transform: rotate(90deg);
|
289
|
-
}
|
290
|
-
|
291
|
-
.icon-del-box {
|
292
|
-
/* #ifndef APP-NVUE */
|
293
|
-
display: flex;
|
294
|
-
margin: auto 0;
|
295
|
-
/* #endif */
|
296
|
-
align-items: center;
|
297
|
-
justify-content: center;
|
298
|
-
position: absolute;
|
299
|
-
top: 0px;
|
300
|
-
bottom: 0;
|
301
|
-
right: 5px;
|
302
|
-
height: 26px;
|
303
|
-
width: 26px;
|
304
|
-
// border-radius: 50%;
|
305
|
-
// background-color: rgba(0, 0, 0, 0.5);
|
306
|
-
z-index: 2;
|
307
|
-
transform: rotate(-45deg);
|
308
|
-
}
|
309
|
-
|
310
|
-
.icon-del {
|
311
|
-
width: 15px;
|
312
|
-
height: 1px;
|
313
|
-
background-color: #333;
|
314
|
-
// border-radius: 1px;
|
315
|
-
}
|
316
|
-
|
317
|
-
/* #ifdef H5 */
|
318
|
-
@media all and (min-width: 768px) {
|
319
|
-
.uni-file-picker__files {
|
320
|
-
max-width: 375px;
|
321
|
-
}
|
322
|
-
}
|
323
|
-
|
324
|
-
/* #endif */
|
325
|
-
</style>
|
@@ -1,292 +0,0 @@
|
|
1
|
-
<template>
|
2
|
-
<view class="uni-file-picker__container">
|
3
|
-
<view class="file-picker__box" v-for="(item,index) in filesList" :key="index" :style="boxStyle">
|
4
|
-
<view class="file-picker__box-content" :style="borderStyle">
|
5
|
-
<image class="file-image" :src="item.url" mode="aspectFill" @click.stop="prviewImage(item,index)"></image>
|
6
|
-
<view v-if="delIcon && !readonly" class="icon-del-box" @click.stop="delFile(index)">
|
7
|
-
<view class="icon-del"></view>
|
8
|
-
<view class="icon-del rotate"></view>
|
9
|
-
</view>
|
10
|
-
<view v-if="(item.progress && item.progress !== 100) ||item.progress===0 " class="file-picker__progress">
|
11
|
-
<progress class="file-picker__progress-item" :percent="item.progress === -1?0:item.progress" stroke-width="4"
|
12
|
-
:backgroundColor="item.errMsg?'#ff5a5f':'#EBEBEB'" />
|
13
|
-
</view>
|
14
|
-
<view v-if="item.errMsg" class="file-picker__mask" @click.stop="uploadFiles(item,index)">
|
15
|
-
点击重试
|
16
|
-
</view>
|
17
|
-
</view>
|
18
|
-
</view>
|
19
|
-
<view v-if="filesList.length < limit && !readonly" class="file-picker__box" :style="boxStyle">
|
20
|
-
<view class="file-picker__box-content is-add" :style="borderStyle" @click="choose">
|
21
|
-
<slot>
|
22
|
-
<view class="icon-add"></view>
|
23
|
-
<view class="icon-add rotate"></view>
|
24
|
-
</slot>
|
25
|
-
</view>
|
26
|
-
</view>
|
27
|
-
</view>
|
28
|
-
</template>
|
29
|
-
|
30
|
-
<script>
|
31
|
-
export default {
|
32
|
-
name: "uploadImage",
|
33
|
-
emits:['uploadFiles','choose','delFile'],
|
34
|
-
props: {
|
35
|
-
filesList: {
|
36
|
-
type: Array,
|
37
|
-
default () {
|
38
|
-
return []
|
39
|
-
}
|
40
|
-
},
|
41
|
-
disabled:{
|
42
|
-
type: Boolean,
|
43
|
-
default: false
|
44
|
-
},
|
45
|
-
disablePreview: {
|
46
|
-
type: Boolean,
|
47
|
-
default: false
|
48
|
-
},
|
49
|
-
limit: {
|
50
|
-
type: [Number, String],
|
51
|
-
default: 9
|
52
|
-
},
|
53
|
-
imageStyles: {
|
54
|
-
type: Object,
|
55
|
-
default () {
|
56
|
-
return {
|
57
|
-
width: 'auto',
|
58
|
-
height: 'auto',
|
59
|
-
border: {}
|
60
|
-
}
|
61
|
-
}
|
62
|
-
},
|
63
|
-
delIcon: {
|
64
|
-
type: Boolean,
|
65
|
-
default: true
|
66
|
-
},
|
67
|
-
readonly:{
|
68
|
-
type:Boolean,
|
69
|
-
default:false
|
70
|
-
}
|
71
|
-
},
|
72
|
-
computed: {
|
73
|
-
styles() {
|
74
|
-
let styles = {
|
75
|
-
width: 'auto',
|
76
|
-
height: 'auto',
|
77
|
-
border: {}
|
78
|
-
}
|
79
|
-
return Object.assign(styles, this.imageStyles)
|
80
|
-
},
|
81
|
-
boxStyle() {
|
82
|
-
const {
|
83
|
-
width = 'auto',
|
84
|
-
height = 'auto'
|
85
|
-
} = this.styles
|
86
|
-
let obj = {}
|
87
|
-
if (height === 'auto') {
|
88
|
-
if (width !== 'auto') {
|
89
|
-
obj.height = this.value2px(width)
|
90
|
-
obj['padding-top'] = 0
|
91
|
-
} else {
|
92
|
-
obj.height = 0
|
93
|
-
}
|
94
|
-
} else {
|
95
|
-
obj.height = this.value2px(height)
|
96
|
-
obj['padding-top'] = 0
|
97
|
-
}
|
98
|
-
|
99
|
-
if (width === 'auto') {
|
100
|
-
if (height !== 'auto') {
|
101
|
-
obj.width = this.value2px(height)
|
102
|
-
} else {
|
103
|
-
obj.width = '33.3%'
|
104
|
-
}
|
105
|
-
} else {
|
106
|
-
obj.width = this.value2px(width)
|
107
|
-
}
|
108
|
-
|
109
|
-
let classles = ''
|
110
|
-
for(let i in obj){
|
111
|
-
classles+= `${i}:${obj[i]};`
|
112
|
-
}
|
113
|
-
return classles
|
114
|
-
},
|
115
|
-
borderStyle() {
|
116
|
-
let {
|
117
|
-
border
|
118
|
-
} = this.styles
|
119
|
-
let obj = {}
|
120
|
-
const widthDefaultValue = 1
|
121
|
-
const radiusDefaultValue = 3
|
122
|
-
if (typeof border === 'boolean') {
|
123
|
-
obj.border = border ? '1px #eee solid' : 'none'
|
124
|
-
} else {
|
125
|
-
let width = (border && border.width) || widthDefaultValue
|
126
|
-
width = this.value2px(width)
|
127
|
-
let radius = (border && border.radius) || radiusDefaultValue
|
128
|
-
radius = this.value2px(radius)
|
129
|
-
obj = {
|
130
|
-
'border-width': width,
|
131
|
-
'border-style': (border && border.style) || 'solid',
|
132
|
-
'border-color': (border && border.color) || '#eee',
|
133
|
-
'border-radius': radius
|
134
|
-
}
|
135
|
-
}
|
136
|
-
let classles = ''
|
137
|
-
for(let i in obj){
|
138
|
-
classles+= `${i}:${obj[i]};`
|
139
|
-
}
|
140
|
-
return classles
|
141
|
-
}
|
142
|
-
},
|
143
|
-
methods: {
|
144
|
-
uploadFiles(item, index) {
|
145
|
-
this.$emit("uploadFiles", item)
|
146
|
-
},
|
147
|
-
choose() {
|
148
|
-
this.$emit("choose")
|
149
|
-
},
|
150
|
-
delFile(index) {
|
151
|
-
this.$emit('delFile', index)
|
152
|
-
},
|
153
|
-
prviewImage(img, index) {
|
154
|
-
let urls = []
|
155
|
-
if(Number(this.limit) === 1&&this.disablePreview&&!this.disabled){
|
156
|
-
this.$emit("choose")
|
157
|
-
}
|
158
|
-
if(this.disablePreview) return
|
159
|
-
this.filesList.forEach(i => {
|
160
|
-
urls.push(i.url)
|
161
|
-
})
|
162
|
-
|
163
|
-
uni.previewImage({
|
164
|
-
urls: urls,
|
165
|
-
current: index
|
166
|
-
});
|
167
|
-
},
|
168
|
-
value2px(value) {
|
169
|
-
if (typeof value === 'number') {
|
170
|
-
value += 'px'
|
171
|
-
} else {
|
172
|
-
if (value.indexOf('%') === -1) {
|
173
|
-
value = value.indexOf('px') !== -1 ? value : value + 'px'
|
174
|
-
}
|
175
|
-
}
|
176
|
-
return value
|
177
|
-
}
|
178
|
-
}
|
179
|
-
}
|
180
|
-
</script>
|
181
|
-
|
182
|
-
<style lang="scss">
|
183
|
-
.uni-file-picker__container {
|
184
|
-
/* #ifndef APP-NVUE */
|
185
|
-
display: flex;
|
186
|
-
box-sizing: border-box;
|
187
|
-
/* #endif */
|
188
|
-
flex-wrap: wrap;
|
189
|
-
margin: -5px;
|
190
|
-
}
|
191
|
-
|
192
|
-
.file-picker__box {
|
193
|
-
position: relative;
|
194
|
-
// flex: 0 0 33.3%;
|
195
|
-
width: 33.3%;
|
196
|
-
height: 0;
|
197
|
-
padding-top: 33.33%;
|
198
|
-
/* #ifndef APP-NVUE */
|
199
|
-
box-sizing: border-box;
|
200
|
-
/* #endif */
|
201
|
-
}
|
202
|
-
|
203
|
-
.file-picker__box-content {
|
204
|
-
position: absolute;
|
205
|
-
top: 0;
|
206
|
-
right: 0;
|
207
|
-
bottom: 0;
|
208
|
-
left: 0;
|
209
|
-
margin: 5px;
|
210
|
-
border: 1px #eee solid;
|
211
|
-
border-radius: 5px;
|
212
|
-
overflow: hidden;
|
213
|
-
}
|
214
|
-
|
215
|
-
.file-picker__progress {
|
216
|
-
position: absolute;
|
217
|
-
bottom: 0;
|
218
|
-
left: 0;
|
219
|
-
right: 0;
|
220
|
-
/* border: 1px red solid; */
|
221
|
-
z-index: 2;
|
222
|
-
}
|
223
|
-
|
224
|
-
.file-picker__progress-item {
|
225
|
-
width: 100%;
|
226
|
-
}
|
227
|
-
|
228
|
-
.file-picker__mask {
|
229
|
-
/* #ifndef APP-NVUE */
|
230
|
-
display: flex;
|
231
|
-
/* #endif */
|
232
|
-
justify-content: center;
|
233
|
-
align-items: center;
|
234
|
-
position: absolute;
|
235
|
-
right: 0;
|
236
|
-
top: 0;
|
237
|
-
bottom: 0;
|
238
|
-
left: 0;
|
239
|
-
color: #fff;
|
240
|
-
font-size: 12px;
|
241
|
-
background-color: rgba(0, 0, 0, 0.4);
|
242
|
-
}
|
243
|
-
|
244
|
-
.file-image {
|
245
|
-
width: 100%;
|
246
|
-
height: 100%;
|
247
|
-
}
|
248
|
-
|
249
|
-
.is-add {
|
250
|
-
/* #ifndef APP-NVUE */
|
251
|
-
display: flex;
|
252
|
-
/* #endif */
|
253
|
-
align-items: center;
|
254
|
-
justify-content: center;
|
255
|
-
}
|
256
|
-
|
257
|
-
.icon-add {
|
258
|
-
width: 50px;
|
259
|
-
height: 5px;
|
260
|
-
background-color: #f1f1f1;
|
261
|
-
border-radius: 2px;
|
262
|
-
}
|
263
|
-
|
264
|
-
.rotate {
|
265
|
-
position: absolute;
|
266
|
-
transform: rotate(90deg);
|
267
|
-
}
|
268
|
-
|
269
|
-
.icon-del-box {
|
270
|
-
/* #ifndef APP-NVUE */
|
271
|
-
display: flex;
|
272
|
-
/* #endif */
|
273
|
-
align-items: center;
|
274
|
-
justify-content: center;
|
275
|
-
position: absolute;
|
276
|
-
top: 3px;
|
277
|
-
right: 3px;
|
278
|
-
height: 26px;
|
279
|
-
width: 26px;
|
280
|
-
border-radius: 50%;
|
281
|
-
background-color: rgba(0, 0, 0, 0.5);
|
282
|
-
z-index: 2;
|
283
|
-
transform: rotate(-45deg);
|
284
|
-
}
|
285
|
-
|
286
|
-
.icon-del {
|
287
|
-
width: 15px;
|
288
|
-
height: 2px;
|
289
|
-
background-color: #fff;
|
290
|
-
border-radius: 2px;
|
291
|
-
}
|
292
|
-
</style>
|
@@ -1,110 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* 获取文件名和后缀
|
3
|
-
* @param {String} name
|
4
|
-
*/
|
5
|
-
export const get_file_ext = (name) => {
|
6
|
-
const last_len = name.lastIndexOf('.')
|
7
|
-
const len = name.length
|
8
|
-
return {
|
9
|
-
name: name.substring(0, last_len),
|
10
|
-
ext: name.substring(last_len + 1, len)
|
11
|
-
}
|
12
|
-
}
|
13
|
-
|
14
|
-
/**
|
15
|
-
* 获取扩展名
|
16
|
-
* @param {Array} fileExtname
|
17
|
-
*/
|
18
|
-
export const get_extname = (fileExtname) => {
|
19
|
-
if (!Array.isArray(fileExtname)) {
|
20
|
-
let extname = fileExtname.replace(/(\[|\])/g, '')
|
21
|
-
return extname.split(',')
|
22
|
-
} else {
|
23
|
-
return fileExtname
|
24
|
-
}
|
25
|
-
return []
|
26
|
-
}
|
27
|
-
|
28
|
-
/**
|
29
|
-
* 获取文件和检测是否可选
|
30
|
-
*/
|
31
|
-
export const get_files_and_is_max = (res, _extname) => {
|
32
|
-
let filePaths = []
|
33
|
-
let files = []
|
34
|
-
if(!_extname || _extname.length === 0){
|
35
|
-
return {
|
36
|
-
filePaths,
|
37
|
-
files
|
38
|
-
}
|
39
|
-
}
|
40
|
-
res.tempFiles.forEach(v => {
|
41
|
-
let fileFullName = get_file_ext(v.name)
|
42
|
-
const extname = fileFullName.ext.toLowerCase()
|
43
|
-
if (_extname.indexOf(extname) !== -1) {
|
44
|
-
files.push(v)
|
45
|
-
filePaths.push(v.path)
|
46
|
-
}
|
47
|
-
})
|
48
|
-
if (files.length !== res.tempFiles.length) {
|
49
|
-
uni.showToast({
|
50
|
-
title: `当前选择了${res.tempFiles.length}个文件 ,${res.tempFiles.length - files.length} 个文件格式不正确`,
|
51
|
-
icon: 'none',
|
52
|
-
duration: 5000
|
53
|
-
})
|
54
|
-
}
|
55
|
-
|
56
|
-
return {
|
57
|
-
filePaths,
|
58
|
-
files
|
59
|
-
}
|
60
|
-
}
|
61
|
-
|
62
|
-
|
63
|
-
/**
|
64
|
-
* 获取图片信息
|
65
|
-
* @param {Object} filepath
|
66
|
-
*/
|
67
|
-
export const get_file_info = (filepath) => {
|
68
|
-
return new Promise((resolve, reject) => {
|
69
|
-
uni.getImageInfo({
|
70
|
-
src: filepath,
|
71
|
-
success(res) {
|
72
|
-
resolve(res)
|
73
|
-
},
|
74
|
-
fail(err) {
|
75
|
-
reject(err)
|
76
|
-
}
|
77
|
-
})
|
78
|
-
})
|
79
|
-
}
|
80
|
-
/**
|
81
|
-
* 获取封装数据
|
82
|
-
*/
|
83
|
-
export const get_file_data = async (files, type = 'image') => {
|
84
|
-
// 最终需要上传数据库的数据
|
85
|
-
let fileFullName = get_file_ext(files.name)
|
86
|
-
const extname = fileFullName.ext.toLowerCase()
|
87
|
-
let filedata = {
|
88
|
-
name: files.name,
|
89
|
-
uuid: files.uuid,
|
90
|
-
extname: extname || '',
|
91
|
-
cloudPath: files.cloudPath,
|
92
|
-
fileType: files.fileType,
|
93
|
-
thumbTempFilePath: files.thumbTempFilePath,
|
94
|
-
url: files.path || files.path,
|
95
|
-
size: files.size, //单位是字节
|
96
|
-
image: {},
|
97
|
-
path: files.path,
|
98
|
-
video: {}
|
99
|
-
}
|
100
|
-
if (type === 'image') {
|
101
|
-
const imageinfo = await get_file_info(files.path)
|
102
|
-
delete filedata.video
|
103
|
-
filedata.image.width = imageinfo.width
|
104
|
-
filedata.image.height = imageinfo.height
|
105
|
-
filedata.image.location = imageinfo.path
|
106
|
-
} else {
|
107
|
-
delete filedata.image
|
108
|
-
}
|
109
|
-
return filedata
|
110
|
-
}
|