shijiplus-web-plugin 0.1.35 → 0.1.36
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/package.json +1 -1
- package/src/components/plus-comp/index.js +1 -1
- package/src/components/plus-comp/plus-input/plus-input.vue +76 -0
- package/src/components/upload-file/upload-file-file.vue +222 -0
- package/src/components/upload-file/upload-file-input.vue +203 -0
- package/src/components/upload-file/upload-file-single.vue +103 -0
- package/src/components/upload-file/upload-file-v2.vue +68 -0
- package/src/components/upload-file/upload-file.vue +402 -0
- package/src/index.js +6 -0
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const compFiles = ['plus-tag', 'plus-table-v2', 'plus-icon', 'plus-city-cascader', 'plus-count-down', 'plus-city-cascader', 'plus-common-header', 'plus-poptip', 'plus-qr-code', 'plus-drawer', 'plus-tabs', 'plus-remote-selector', 'plus-select', 'plus-form', 'plus-scrollview', 'plus-table', 'plus-modal', 'plus-card', 'permission-component']
|
|
1
|
+
const compFiles = ['plus-input', 'plus-tag', 'plus-table-v2', 'plus-icon', 'plus-city-cascader', 'plus-count-down', 'plus-city-cascader', 'plus-common-header', 'plus-poptip', 'plus-qr-code', 'plus-drawer', 'plus-tabs', 'plus-remote-selector', 'plus-select', 'plus-form', 'plus-scrollview', 'plus-table', 'plus-modal', 'plus-card', 'permission-component']
|
|
2
2
|
|
|
3
3
|
const install = (vue, opts = {}) => {
|
|
4
4
|
console.log('--------install---plus-comp----------')
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="`plus-input i-flex-wrap nowrap ${type}`">
|
|
3
|
+
<Input
|
|
4
|
+
v-model="mValue"
|
|
5
|
+
:type="type"
|
|
6
|
+
:rows="mRows"
|
|
7
|
+
:autosize="mAutosize"
|
|
8
|
+
:placeholder="placeholder"
|
|
9
|
+
:maxlength="maxlength"
|
|
10
|
+
/>
|
|
11
|
+
<span class="counter">{{ (mValue || '').length }}/{{ maxlength }}</span>
|
|
12
|
+
</div>
|
|
13
|
+
</template>
|
|
14
|
+
<script>
|
|
15
|
+
export default {
|
|
16
|
+
model: {
|
|
17
|
+
prop: 'value',
|
|
18
|
+
event: 'input'
|
|
19
|
+
},
|
|
20
|
+
props: {
|
|
21
|
+
value: [Number, String],
|
|
22
|
+
placeholder: String,
|
|
23
|
+
type: {
|
|
24
|
+
type: String,
|
|
25
|
+
default: 'text'
|
|
26
|
+
},
|
|
27
|
+
maxlength: {
|
|
28
|
+
type: Number,
|
|
29
|
+
default: null
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
watch: {
|
|
33
|
+
type: {
|
|
34
|
+
handler(val) {
|
|
35
|
+
if (val == 'textarea') {
|
|
36
|
+
this.mRows = 3
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
immediate: true
|
|
40
|
+
},
|
|
41
|
+
value: {
|
|
42
|
+
handler(val) {
|
|
43
|
+
this.mValue = val
|
|
44
|
+
},
|
|
45
|
+
immediate: true
|
|
46
|
+
},
|
|
47
|
+
mValue: {
|
|
48
|
+
handler(nVal) {
|
|
49
|
+
this.$emit('input', nVal)
|
|
50
|
+
},
|
|
51
|
+
immediate: true,
|
|
52
|
+
deep: true
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
data() {
|
|
56
|
+
return {
|
|
57
|
+
mValue: null,
|
|
58
|
+
mRows: 2,
|
|
59
|
+
mAutosize: { minRows: 2, maxRows: 6 }
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
methods: {}
|
|
63
|
+
}
|
|
64
|
+
</script>
|
|
65
|
+
<style lang="less" scoped>
|
|
66
|
+
.plus-input {
|
|
67
|
+
.counter {
|
|
68
|
+
font-size: 12px;
|
|
69
|
+
}
|
|
70
|
+
&.textarea {
|
|
71
|
+
.counter {
|
|
72
|
+
margin-top: auto;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
</style>
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<div
|
|
4
|
+
class="demo-upload-list"
|
|
5
|
+
:key="item.id"
|
|
6
|
+
v-show="item.type == showType"
|
|
7
|
+
v-for="(item, index) in uploadList"
|
|
8
|
+
>
|
|
9
|
+
<img v-show="item.type == 'pdf'" src="@/assets/images/pdf.jpeg" />
|
|
10
|
+
<img v-show="item.type == 'word'" src="@/assets/images/word.jpeg" />
|
|
11
|
+
<div class="demo-upload-list-cover">
|
|
12
|
+
<Icon
|
|
13
|
+
v-if="!disabled"
|
|
14
|
+
type="ios-trash-outline"
|
|
15
|
+
@click.native="handleRemove(item, index)"
|
|
16
|
+
></Icon>
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
<Upload
|
|
20
|
+
ref="upload"
|
|
21
|
+
:show-upload-list="false"
|
|
22
|
+
:default-file-list="defaultFiles"
|
|
23
|
+
:on-success="handleSuccess"
|
|
24
|
+
:format="['pdf', 'docx', 'doc']"
|
|
25
|
+
:headers="headers"
|
|
26
|
+
:max-size="fileMaxSize"
|
|
27
|
+
:on-format-error="handleFormatError"
|
|
28
|
+
:on-exceeded-size="handleMaxSize"
|
|
29
|
+
multiple
|
|
30
|
+
type="drag"
|
|
31
|
+
:before-upload="handleBeforeUpload"
|
|
32
|
+
:action="action || baseUrl + 'api/open/common/file/uploadFile'"
|
|
33
|
+
:class="{ hideUpload: remainderCount <= 0 }"
|
|
34
|
+
style="display: inline-block; width: 58px"
|
|
35
|
+
>
|
|
36
|
+
<div style="width: 58px; height: 58px; line-height: 58px">
|
|
37
|
+
<Icon :type="addIconType" size="20"></Icon>
|
|
38
|
+
</div>
|
|
39
|
+
</Upload>
|
|
40
|
+
</div>
|
|
41
|
+
</template>
|
|
42
|
+
<script>
|
|
43
|
+
import config from '@/config'
|
|
44
|
+
import store from '@/store'
|
|
45
|
+
const baseUrl = config.plusApiV5Domain()
|
|
46
|
+
let authHeader = {}
|
|
47
|
+
authHeader[config.tokenHeaderName] = store.state.user.token
|
|
48
|
+
authHeader['token'] = store.state.user.token
|
|
49
|
+
authHeader['app_name'] = 'op'
|
|
50
|
+
export default {
|
|
51
|
+
name: 'upload-file',
|
|
52
|
+
props: {
|
|
53
|
+
disabled: {
|
|
54
|
+
default: false
|
|
55
|
+
},
|
|
56
|
+
hintText: {
|
|
57
|
+
type: String,
|
|
58
|
+
default: ''
|
|
59
|
+
},
|
|
60
|
+
filePath: {
|
|
61
|
+
default: undefined
|
|
62
|
+
},
|
|
63
|
+
addIconType: {
|
|
64
|
+
default: 'md-cloud-upload'
|
|
65
|
+
},
|
|
66
|
+
maxUploadFiles: {
|
|
67
|
+
default: 1
|
|
68
|
+
},
|
|
69
|
+
maxSize: {
|
|
70
|
+
default: 20480
|
|
71
|
+
},
|
|
72
|
+
action: {
|
|
73
|
+
default: ''
|
|
74
|
+
},
|
|
75
|
+
fileName: {
|
|
76
|
+
de3fault: ''
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
data() {
|
|
80
|
+
return {
|
|
81
|
+
headers: authHeader,
|
|
82
|
+
baseUrl,
|
|
83
|
+
remainderCount: this.maxUploadFiles,
|
|
84
|
+
uploadList: [
|
|
85
|
+
{
|
|
86
|
+
type: 'pdf',
|
|
87
|
+
url: '@/assets/images/pdf.jpeg'
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
type: 'word',
|
|
91
|
+
url: '@/assets/images/word.jpeg'
|
|
92
|
+
}
|
|
93
|
+
],
|
|
94
|
+
showType: '',
|
|
95
|
+
localFileName: '',
|
|
96
|
+
defaultFiles: [],
|
|
97
|
+
fileMaxSize: this.maxSize
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
watch: {
|
|
101
|
+
filePath(value) {
|
|
102
|
+
this.showType = ''
|
|
103
|
+
this.$refs.upload.clearFiles()
|
|
104
|
+
this.remainderCount = this.maxUploadFiles
|
|
105
|
+
if (!this.$isEmpty(value)) {
|
|
106
|
+
this.showType =
|
|
107
|
+
value.slice(value.indexOf('.') + 1) == 'pdf' ? 'pdf' : 'word'
|
|
108
|
+
this.defaultFiles = []
|
|
109
|
+
this.remainderCount -= 1
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
|
|
113
|
+
fileName(value) {
|
|
114
|
+
this.localFileName = value
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
methods: {
|
|
118
|
+
handleRemove(file, index) {
|
|
119
|
+
this.showType = ''
|
|
120
|
+
this.remainderCount++
|
|
121
|
+
if (
|
|
122
|
+
!this.$isEmpty(this._events) &&
|
|
123
|
+
typeof this._events['on-remove'] === 'object'
|
|
124
|
+
) {
|
|
125
|
+
this.$emit('on-remove', { index: index, target: this })
|
|
126
|
+
} else {
|
|
127
|
+
if (
|
|
128
|
+
this.maxUploadFiles === 1 &&
|
|
129
|
+
this.$containKey(this.$options.propsData, 'imagePath')
|
|
130
|
+
) {
|
|
131
|
+
this.$emit('on-remove', { index: index, target: this })
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
handleSuccess(res, file) {
|
|
136
|
+
this.remainderCount--
|
|
137
|
+
file.url = res.data.path
|
|
138
|
+
file.name = res.data.path
|
|
139
|
+
res.data.fileName = this.localFileName
|
|
140
|
+
this.showType =
|
|
141
|
+
res.data.path.slice(res.data.path.indexOf('.') + 1) == 'pdf'
|
|
142
|
+
? 'pdf'
|
|
143
|
+
: 'word'
|
|
144
|
+
if (
|
|
145
|
+
!this.$isEmpty(this._events) &&
|
|
146
|
+
typeof this._events['on-upload-complete'] === 'object'
|
|
147
|
+
) {
|
|
148
|
+
this.$emit('on-upload-complete', { res: res, file: file, target: this })
|
|
149
|
+
} else {
|
|
150
|
+
if (this.maxUploadFiles === 1) {
|
|
151
|
+
if (this.$containKey(this.$options.propsData, 'imagePath')) {
|
|
152
|
+
this.$emit('on-upload-complete', {
|
|
153
|
+
res: res,
|
|
154
|
+
file: file,
|
|
155
|
+
target: this
|
|
156
|
+
})
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
handleFormatError(file) {
|
|
162
|
+
this.remainderCount++
|
|
163
|
+
this.$Notice.warning({
|
|
164
|
+
title: '文件格式错误',
|
|
165
|
+
desc: '只能上传 word 或 pdf格式的 文件.'
|
|
166
|
+
})
|
|
167
|
+
},
|
|
168
|
+
handleMaxSize(file) {
|
|
169
|
+
this.remainderCount++
|
|
170
|
+
this.$Notice.warning({
|
|
171
|
+
title: '文件超过20M',
|
|
172
|
+
desc: `文件不能大于20M`
|
|
173
|
+
})
|
|
174
|
+
},
|
|
175
|
+
handleBeforeUpload(data) {
|
|
176
|
+
this.localFileName = data.name
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
mounted() {}
|
|
180
|
+
}
|
|
181
|
+
</script>
|
|
182
|
+
<style>
|
|
183
|
+
.hideUpload {
|
|
184
|
+
display: none !important;
|
|
185
|
+
}
|
|
186
|
+
.demo-upload-list {
|
|
187
|
+
display: inline-block;
|
|
188
|
+
width: 60px;
|
|
189
|
+
height: 60px;
|
|
190
|
+
text-align: center;
|
|
191
|
+
line-height: 60px;
|
|
192
|
+
border: 1px solid transparent;
|
|
193
|
+
border-radius: 4px;
|
|
194
|
+
overflow: hidden;
|
|
195
|
+
background: #fff;
|
|
196
|
+
position: relative;
|
|
197
|
+
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
|
|
198
|
+
margin-right: 4px;
|
|
199
|
+
}
|
|
200
|
+
.demo-upload-list img {
|
|
201
|
+
width: 100%;
|
|
202
|
+
height: 100%;
|
|
203
|
+
}
|
|
204
|
+
.demo-upload-list-cover {
|
|
205
|
+
display: none;
|
|
206
|
+
position: absolute;
|
|
207
|
+
top: 0;
|
|
208
|
+
bottom: 0;
|
|
209
|
+
left: 0;
|
|
210
|
+
right: 0;
|
|
211
|
+
background: rgba(0, 0, 0, 0.6);
|
|
212
|
+
}
|
|
213
|
+
.demo-upload-list:hover .demo-upload-list-cover {
|
|
214
|
+
display: block;
|
|
215
|
+
}
|
|
216
|
+
.demo-upload-list-cover i {
|
|
217
|
+
color: #fff;
|
|
218
|
+
font-size: 20px;
|
|
219
|
+
cursor: pointer;
|
|
220
|
+
margin: 0 2px;
|
|
221
|
+
}
|
|
222
|
+
</style>
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div id="upload-input">
|
|
3
|
+
<Upload
|
|
4
|
+
ref="upload"
|
|
5
|
+
:show-upload-list="false"
|
|
6
|
+
:default-file-list="defaultFiles"
|
|
7
|
+
:on-success="handleSuccess"
|
|
8
|
+
:format="format"
|
|
9
|
+
:accept="accept"
|
|
10
|
+
:headers="headers"
|
|
11
|
+
:max-size="fileMaxSize"
|
|
12
|
+
:sizeUnit="sizeUnit"
|
|
13
|
+
:sizeUnitStr="sizeUnitStr"
|
|
14
|
+
:on-format-error="handleFormatError"
|
|
15
|
+
:on-exceeded-size="handleMaxSize"
|
|
16
|
+
:before-upload="handleBeforeUpload"
|
|
17
|
+
:multiple="maxUploadFiles > 1"
|
|
18
|
+
:action="baseUrl + 'api/open/common/file/uploadFile'"
|
|
19
|
+
>
|
|
20
|
+
<slot></slot>
|
|
21
|
+
</Upload>
|
|
22
|
+
</div>
|
|
23
|
+
</template>
|
|
24
|
+
<script>
|
|
25
|
+
import config from '@/config'
|
|
26
|
+
import store from '@/store'
|
|
27
|
+
const baseUrl = config.plusApiV5Domain()
|
|
28
|
+
let authHeader = {}
|
|
29
|
+
authHeader[config.tokenHeaderName] = store.state.user.token
|
|
30
|
+
authHeader['app_name'] = 'op'
|
|
31
|
+
export default {
|
|
32
|
+
name: 'UploadFileInput',
|
|
33
|
+
props: {
|
|
34
|
+
showImgList: {
|
|
35
|
+
default: () => {
|
|
36
|
+
return undefined
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
imagePath: {
|
|
40
|
+
default: undefined
|
|
41
|
+
},
|
|
42
|
+
addIconType: {
|
|
43
|
+
default: 'ios-camera'
|
|
44
|
+
},
|
|
45
|
+
accept: {
|
|
46
|
+
default: 'image/*'
|
|
47
|
+
},
|
|
48
|
+
format: {
|
|
49
|
+
default() {
|
|
50
|
+
return ['jpg', 'jpeg', 'png', 'gif']
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
maxUploadFiles: {
|
|
54
|
+
default: 1
|
|
55
|
+
},
|
|
56
|
+
maxSize: {
|
|
57
|
+
default: 2
|
|
58
|
+
},
|
|
59
|
+
sizeUnit: {
|
|
60
|
+
default: 1024
|
|
61
|
+
},
|
|
62
|
+
sizeUnitStr: {
|
|
63
|
+
default: 'MB'
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
data() {
|
|
67
|
+
return {
|
|
68
|
+
headers: authHeader,
|
|
69
|
+
baseUrl,
|
|
70
|
+
imgName: '',
|
|
71
|
+
visible: false,
|
|
72
|
+
remainderCount: this.maxUploadFiles,
|
|
73
|
+
uploadList: [],
|
|
74
|
+
defaultFiles: []
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
computed: {
|
|
78
|
+
fileMaxSize() {
|
|
79
|
+
return this.maxSize * this.sizeUnit
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
watch: {
|
|
83
|
+
imagePath(value) {
|
|
84
|
+
this.uploadList = []
|
|
85
|
+
this.$refs.upload.clearFiles()
|
|
86
|
+
this.remainderCount = this.maxUploadFiles
|
|
87
|
+
if (!this.$isEmpty(value)) {
|
|
88
|
+
if (!this.$isEmpty(this.uploadList)) {
|
|
89
|
+
this.uploadList.push({
|
|
90
|
+
name: value,
|
|
91
|
+
url: value,
|
|
92
|
+
status: 'finished'
|
|
93
|
+
})
|
|
94
|
+
} else {
|
|
95
|
+
this.uploadList = [{ name: value, url: value, status: 'finished' }]
|
|
96
|
+
}
|
|
97
|
+
this.defaultFiles = this.$deepCopy(this.uploadList)
|
|
98
|
+
this.remainderCount -= this.uploadList.length
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
showImgList(value) {
|
|
102
|
+
if (this.$refs.upload.fileList.length > 0) {
|
|
103
|
+
let uploadingImgs = this.$refs.upload.fileList.filter((item) => {
|
|
104
|
+
return item.status === 'uploading'
|
|
105
|
+
})
|
|
106
|
+
if (uploadingImgs.length > 0) {
|
|
107
|
+
return
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
this.remainderCount = this.maxUploadFiles
|
|
111
|
+
this.uploadList = []
|
|
112
|
+
if (!this.$isEmpty(value)) {
|
|
113
|
+
value.forEach((item, index) => {
|
|
114
|
+
this.uploadList.push({
|
|
115
|
+
name: item,
|
|
116
|
+
url: item,
|
|
117
|
+
status: 'finished'
|
|
118
|
+
})
|
|
119
|
+
})
|
|
120
|
+
}
|
|
121
|
+
this.defaultFiles = this.$deepCopy(this.uploadList)
|
|
122
|
+
this.remainderCount -= this.uploadList.length
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
methods: {
|
|
126
|
+
handleSuccess(res, file) {
|
|
127
|
+
const oriFile = this.$deepCopy(file)
|
|
128
|
+
file.url = res.data.path
|
|
129
|
+
file.name = res.data.path
|
|
130
|
+
file.status = 'finished'
|
|
131
|
+
this.uploadList = this.$refs.upload.fileList
|
|
132
|
+
if (
|
|
133
|
+
!this.$isEmpty(this._events) &&
|
|
134
|
+
typeof this._events['on-upload-complete'] === 'object'
|
|
135
|
+
) {
|
|
136
|
+
this.$emit('on-upload-complete', {
|
|
137
|
+
res: res,
|
|
138
|
+
file: file,
|
|
139
|
+
target: this,
|
|
140
|
+
oriFile
|
|
141
|
+
})
|
|
142
|
+
} else {
|
|
143
|
+
if (this.maxUploadFiles === 1) {
|
|
144
|
+
if (this.$containKey(this.$options.propsData, 'imagePath')) {
|
|
145
|
+
this.$emit('on-upload-complete', {
|
|
146
|
+
res: res,
|
|
147
|
+
file: file,
|
|
148
|
+
target: this,
|
|
149
|
+
oriFile
|
|
150
|
+
})
|
|
151
|
+
} else {
|
|
152
|
+
if (this.showImgList) {
|
|
153
|
+
this.showImgList.splice(0, this.showImgList.length)
|
|
154
|
+
this.showImgList.push(res.data.path)
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
} else {
|
|
158
|
+
if (this.showImgList) {
|
|
159
|
+
this.showImgList.push(res.data.path)
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
handleFormatError(file) {
|
|
165
|
+
this.remainderCount++
|
|
166
|
+
this.$Notice.warning({
|
|
167
|
+
title: '文件格式错误',
|
|
168
|
+
desc: '只能上传 jpeg, jpg 或 png 文件.'
|
|
169
|
+
})
|
|
170
|
+
},
|
|
171
|
+
handleMaxSize(file) {
|
|
172
|
+
this.remainderCount++
|
|
173
|
+
this.$Notice.warning({
|
|
174
|
+
title: `文件超过${this.fileMaxSize / this.sizeUnit}${this.sizeUnitStr}`,
|
|
175
|
+
desc: `文件不能大于 ${this.fileMaxSize / this.sizeUnit}${
|
|
176
|
+
this.sizeUnitStr
|
|
177
|
+
}`
|
|
178
|
+
})
|
|
179
|
+
},
|
|
180
|
+
handleBeforeUpload() {
|
|
181
|
+
var check = true
|
|
182
|
+
// if (this.remainderCount <= 0) {
|
|
183
|
+
// this.$Notice.warning({
|
|
184
|
+
// title: `只能上传 ${this.maxUploadFiles} 张图片.`
|
|
185
|
+
// })
|
|
186
|
+
// check = false
|
|
187
|
+
// } else {
|
|
188
|
+
// this.remainderCount--
|
|
189
|
+
// }
|
|
190
|
+
return check
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
mounted() {}
|
|
194
|
+
}
|
|
195
|
+
</script>
|
|
196
|
+
<style lang="less" scoped>
|
|
197
|
+
#upload-input {
|
|
198
|
+
width: fit-content !important;
|
|
199
|
+
.ivu-upload {
|
|
200
|
+
width: fit-content !important;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
</style>
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<upload-file
|
|
3
|
+
@on-remove="handleRemove"
|
|
4
|
+
@on-upload-complete="handleSuccess"
|
|
5
|
+
:showImgList="fileList"
|
|
6
|
+
:maxUploadFiles="1"
|
|
7
|
+
:max-size="fileMaxSize"
|
|
8
|
+
:action="action"
|
|
9
|
+
:disabled="disabled"
|
|
10
|
+
:defaultHint="defaultHint"
|
|
11
|
+
:hintText="hintText"
|
|
12
|
+
:sizeUnit="sizeUnit"
|
|
13
|
+
:sizeUnitStr="sizeUnitStr"
|
|
14
|
+
:imgTitle="imgTitle"
|
|
15
|
+
>
|
|
16
|
+
<slot slot="tips" name="tips"></slot>
|
|
17
|
+
</upload-file>
|
|
18
|
+
</template>
|
|
19
|
+
<script>
|
|
20
|
+
import UploadFile from '_c/upload-file/upload-file'
|
|
21
|
+
export default {
|
|
22
|
+
name: 'upload-file-single',
|
|
23
|
+
components: { UploadFile },
|
|
24
|
+
model: {
|
|
25
|
+
prop: 'imgPath',
|
|
26
|
+
event: 'img-changed'
|
|
27
|
+
},
|
|
28
|
+
props: {
|
|
29
|
+
imgTitle: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: '添加图片'
|
|
32
|
+
},
|
|
33
|
+
placeholder: {
|
|
34
|
+
type: String
|
|
35
|
+
},
|
|
36
|
+
disabled: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
default: false
|
|
39
|
+
},
|
|
40
|
+
defaultHint: {
|
|
41
|
+
type: Boolean
|
|
42
|
+
},
|
|
43
|
+
hintText: {
|
|
44
|
+
type: String
|
|
45
|
+
},
|
|
46
|
+
imgPath: {
|
|
47
|
+
default: ''
|
|
48
|
+
},
|
|
49
|
+
maxSize: {
|
|
50
|
+
default: 2048
|
|
51
|
+
},
|
|
52
|
+
sizeUnit: {
|
|
53
|
+
default: 1024
|
|
54
|
+
},
|
|
55
|
+
sizeUnitStr: {
|
|
56
|
+
default: 'MB'
|
|
57
|
+
},
|
|
58
|
+
action: ''
|
|
59
|
+
// imgType: {
|
|
60
|
+
// type: Number,
|
|
61
|
+
// default: () => {
|
|
62
|
+
// return 0
|
|
63
|
+
// }
|
|
64
|
+
// }
|
|
65
|
+
},
|
|
66
|
+
data() {
|
|
67
|
+
return {
|
|
68
|
+
fileList: [],
|
|
69
|
+
fileMaxSize: this.maxSize
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
watch: {
|
|
73
|
+
imgPath: {
|
|
74
|
+
immediate: true,
|
|
75
|
+
deep: true,
|
|
76
|
+
handler(value) {
|
|
77
|
+
if (value && value.length > 0) {
|
|
78
|
+
this.fileList = [value]
|
|
79
|
+
} else {
|
|
80
|
+
this.fileList = []
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
methods: {
|
|
86
|
+
handleRemove(event) {
|
|
87
|
+
this.fileList.splice(event.index, 1)
|
|
88
|
+
this.$emit('img-changed', null)
|
|
89
|
+
},
|
|
90
|
+
handleSuccess(event) {
|
|
91
|
+
this.fileList.push(event.res.data.path)
|
|
92
|
+
// 通过判断是否传入其他的url,来判断,后端的上传图片并不是一个统一的接口,
|
|
93
|
+
let path = event.res.data.path
|
|
94
|
+
if (this.action) {
|
|
95
|
+
path = path + '&imgid=' + event.res.data.id
|
|
96
|
+
}
|
|
97
|
+
// 兼容后端的垃圾设计, 给后端传ID,
|
|
98
|
+
this.$emit('img-changed', path)
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
mounted() {}
|
|
102
|
+
}
|
|
103
|
+
</script>
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<upload-file
|
|
3
|
+
@on-remove="handleRemove"
|
|
4
|
+
@on-upload-complete="handleSuccess"
|
|
5
|
+
:showImgList="fileList"
|
|
6
|
+
:maxUploadFiles="maxUploadFiles"
|
|
7
|
+
:add-icon-type="addIconType"
|
|
8
|
+
>
|
|
9
|
+
</upload-file>
|
|
10
|
+
</template>
|
|
11
|
+
<script>
|
|
12
|
+
import UploadFile from '_c/upload-file/upload-file'
|
|
13
|
+
export default {
|
|
14
|
+
name: 'UploadFileV2',
|
|
15
|
+
components: { UploadFile },
|
|
16
|
+
model: {
|
|
17
|
+
prop: 'imgList',
|
|
18
|
+
event: 'img-list-changed'
|
|
19
|
+
},
|
|
20
|
+
props: {
|
|
21
|
+
imgList: {
|
|
22
|
+
type: Array,
|
|
23
|
+
default: () => {
|
|
24
|
+
return []
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
addIconType: {
|
|
28
|
+
default: 'ios-camera'
|
|
29
|
+
},
|
|
30
|
+
maxUploadFiles: {
|
|
31
|
+
default: 1
|
|
32
|
+
}
|
|
33
|
+
// imgType: {
|
|
34
|
+
// type: Number,
|
|
35
|
+
// default: () => {
|
|
36
|
+
// return 0
|
|
37
|
+
// }
|
|
38
|
+
// }
|
|
39
|
+
},
|
|
40
|
+
data() {
|
|
41
|
+
return {
|
|
42
|
+
fileList: []
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
watch: {
|
|
46
|
+
imgList(value) {
|
|
47
|
+
this.fileList = []
|
|
48
|
+
if (!this.$isEmpty(value)) {
|
|
49
|
+
value.forEach((item) => {
|
|
50
|
+
this.fileList.push(item)
|
|
51
|
+
})
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
methods: {
|
|
56
|
+
handleRemove(event) {
|
|
57
|
+
this.fileList.splice(event.index, 1)
|
|
58
|
+
this.$emit('img-list-changed', this.fileList)
|
|
59
|
+
},
|
|
60
|
+
handleSuccess(event) {
|
|
61
|
+
this.fileList.push(event.res.data.path)
|
|
62
|
+
this.$emit('img-list-changed', this.fileList)
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
mounted() {
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
</script>
|
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="plus-upload">
|
|
3
|
+
<div class="i-flex-wrap">
|
|
4
|
+
<div
|
|
5
|
+
class="demo-upload-list"
|
|
6
|
+
:key="item.id"
|
|
7
|
+
v-for="(item, index) in uploadList"
|
|
8
|
+
>
|
|
9
|
+
<template v-if="item.status === 'finished'">
|
|
10
|
+
<img @click="handleView(item.name)" :src="item.url" />
|
|
11
|
+
<Icon
|
|
12
|
+
v-if="!disabled"
|
|
13
|
+
@click.native="handleRemove(item, index)"
|
|
14
|
+
type="md-close-circle"
|
|
15
|
+
size="16"
|
|
16
|
+
color=""
|
|
17
|
+
/>
|
|
18
|
+
</template>
|
|
19
|
+
<template v-else-if="item.showProgress">
|
|
20
|
+
<p class="f-s-14 f-w-400">上传中</p>
|
|
21
|
+
<Progress
|
|
22
|
+
:percent="item.percentage"
|
|
23
|
+
:stroke-width="4"
|
|
24
|
+
hide-info
|
|
25
|
+
></Progress>
|
|
26
|
+
</template>
|
|
27
|
+
</div>
|
|
28
|
+
<Upload
|
|
29
|
+
v-if="!disabled"
|
|
30
|
+
ref="upload"
|
|
31
|
+
:show-upload-list="false"
|
|
32
|
+
:default-file-list="defaultFiles"
|
|
33
|
+
:on-success="handleSuccess"
|
|
34
|
+
:format="['jpg', 'jpeg', 'png', 'gif']"
|
|
35
|
+
accept="image/*"
|
|
36
|
+
:headers="headers"
|
|
37
|
+
:max-size="fileMaxSize"
|
|
38
|
+
:on-format-error="handleFormatError"
|
|
39
|
+
:on-exceeded-size="handleMaxSize"
|
|
40
|
+
:on-progress="handleProgress"
|
|
41
|
+
:before-upload="handleBeforeUpload"
|
|
42
|
+
:disabled="disabled"
|
|
43
|
+
multiple
|
|
44
|
+
type="drag"
|
|
45
|
+
:action="action || baseUrl + 'api/open/common/image/uploadDefaultImage'"
|
|
46
|
+
:class="{ hideUpload: remainderCount <= 0 }"
|
|
47
|
+
>
|
|
48
|
+
<div class="icon-wrap">
|
|
49
|
+
<Icon :type="'ios-add'" size="40"></Icon>
|
|
50
|
+
<p class="f-s-14 f-w-400">{{ imgTitle }}</p>
|
|
51
|
+
</div>
|
|
52
|
+
</Upload>
|
|
53
|
+
</div>
|
|
54
|
+
<p v-if="defaultHint" style="color: #ccc; line-height: 20px">
|
|
55
|
+
最多上传{{ maxUploadFiles }}张图片,文件格式为png,jepg,jpg,或gif
|
|
56
|
+
</p>
|
|
57
|
+
<p v-if="hintText" class="f-s-12 f-w-400 upload-tips">{{ hintText }}</p>
|
|
58
|
+
<p class="f-s-12 f-w-400 upload-tips">
|
|
59
|
+
<slot name="tips"></slot>
|
|
60
|
+
</p>
|
|
61
|
+
<edit-modal title="查看图片" :show="visible">
|
|
62
|
+
<img
|
|
63
|
+
slot="editslot"
|
|
64
|
+
:src="imgName"
|
|
65
|
+
v-if="visible"
|
|
66
|
+
style="max-height: 100%; width: 100%"
|
|
67
|
+
/>
|
|
68
|
+
<Row slot="bottom" type="flex" justify="center">
|
|
69
|
+
<Button @click="visible = false">关闭</Button>
|
|
70
|
+
</Row>
|
|
71
|
+
</edit-modal>
|
|
72
|
+
</div>
|
|
73
|
+
</template>
|
|
74
|
+
<script>
|
|
75
|
+
import config from '@/config'
|
|
76
|
+
import store from '@/store'
|
|
77
|
+
import Emitter from 'iview/src/mixins/emitter'
|
|
78
|
+
const baseUrl = config.plusApiV5Domain()
|
|
79
|
+
let authHeader = {}
|
|
80
|
+
authHeader[config.tokenHeaderName] = store.state.user.token
|
|
81
|
+
authHeader['token'] = store.state.user.token
|
|
82
|
+
authHeader['app_name'] = 'op'
|
|
83
|
+
export default {
|
|
84
|
+
name: 'upload-file',
|
|
85
|
+
mixins: [Emitter],
|
|
86
|
+
props: {
|
|
87
|
+
imgTitle: {
|
|
88
|
+
type: String,
|
|
89
|
+
default: '添加图片'
|
|
90
|
+
},
|
|
91
|
+
defaultHint: {
|
|
92
|
+
type: Boolean,
|
|
93
|
+
default: false
|
|
94
|
+
},
|
|
95
|
+
disabled: {
|
|
96
|
+
type: Boolean,
|
|
97
|
+
default: false
|
|
98
|
+
},
|
|
99
|
+
hintText: {
|
|
100
|
+
type: String,
|
|
101
|
+
default: ''
|
|
102
|
+
},
|
|
103
|
+
showImgList: {
|
|
104
|
+
default: () => {
|
|
105
|
+
return undefined
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
imagePath: {
|
|
109
|
+
default: undefined
|
|
110
|
+
},
|
|
111
|
+
addIconType: {
|
|
112
|
+
default: 'ios-camera'
|
|
113
|
+
},
|
|
114
|
+
maxUploadFiles: {
|
|
115
|
+
default: 1
|
|
116
|
+
},
|
|
117
|
+
maxSize: {
|
|
118
|
+
default: 200
|
|
119
|
+
},
|
|
120
|
+
sizeUnit: {
|
|
121
|
+
default: 1024
|
|
122
|
+
},
|
|
123
|
+
sizeUnitStr: {
|
|
124
|
+
default: 'MB'
|
|
125
|
+
},
|
|
126
|
+
action: {
|
|
127
|
+
default: ''
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
data() {
|
|
131
|
+
return {
|
|
132
|
+
headers: authHeader,
|
|
133
|
+
baseUrl,
|
|
134
|
+
imgName: '',
|
|
135
|
+
visible: false,
|
|
136
|
+
remainderCount: this.maxUploadFiles,
|
|
137
|
+
uploadList: [],
|
|
138
|
+
defaultFiles: []
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
computed: {
|
|
142
|
+
fileMaxSize() {
|
|
143
|
+
return this.maxSize * this.sizeUnit
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
watch: {
|
|
147
|
+
imagePath(value) {
|
|
148
|
+
this.uploadList = []
|
|
149
|
+
this.$refs.upload.clearFiles()
|
|
150
|
+
this.remainderCount = this.maxUploadFiles
|
|
151
|
+
if (!this.$isEmpty(value)) {
|
|
152
|
+
if (!this.$isEmpty(this.uploadList)) {
|
|
153
|
+
this.uploadList.push({
|
|
154
|
+
name: value,
|
|
155
|
+
url: value,
|
|
156
|
+
status: 'finished'
|
|
157
|
+
})
|
|
158
|
+
} else {
|
|
159
|
+
this.uploadList = [{ name: value, url: value, status: 'finished' }]
|
|
160
|
+
}
|
|
161
|
+
this.defaultFiles = this.$deepCopy(this.uploadList)
|
|
162
|
+
this.remainderCount -= this.uploadList.length
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
showImgList: {
|
|
166
|
+
deep: true,
|
|
167
|
+
immediate: true,
|
|
168
|
+
handler(value) {
|
|
169
|
+
this.$nextTick(() => {
|
|
170
|
+
if (this.$refs.upload && this.$refs.upload.fileList.length > 0) {
|
|
171
|
+
let uploadingImgs = this.$refs.upload.fileList.filter((item) => {
|
|
172
|
+
return item.status === 'uploading' // 不用改变status值
|
|
173
|
+
})
|
|
174
|
+
if (uploadingImgs.length > 0) {
|
|
175
|
+
return
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
this.remainderCount = this.maxUploadFiles
|
|
179
|
+
this.uploadList = []
|
|
180
|
+
if (!this.$isEmpty(value)) {
|
|
181
|
+
value.forEach((item, index) => {
|
|
182
|
+
this.uploadList.push({
|
|
183
|
+
name: item,
|
|
184
|
+
url: item,
|
|
185
|
+
status: 'finished'
|
|
186
|
+
})
|
|
187
|
+
})
|
|
188
|
+
}
|
|
189
|
+
this.defaultFiles = this.$deepCopy(this.uploadList)
|
|
190
|
+
this.remainderCount -= this.uploadList.length
|
|
191
|
+
})
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
methods: {
|
|
196
|
+
handleView(name) {
|
|
197
|
+
this.imgName = name
|
|
198
|
+
this.visible = true
|
|
199
|
+
},
|
|
200
|
+
handleRemove(file, index) {
|
|
201
|
+
this.$refs.upload.fileList.splice(index, 1)
|
|
202
|
+
this.uploadList = this.$refs.upload.fileList
|
|
203
|
+
this.remainderCount++
|
|
204
|
+
if (
|
|
205
|
+
!this.$isEmpty(this._events) &&
|
|
206
|
+
typeof this._events['on-remove'] === 'object'
|
|
207
|
+
) {
|
|
208
|
+
this.$emit('on-remove', { index: index, target: this })
|
|
209
|
+
} else {
|
|
210
|
+
if (
|
|
211
|
+
this.maxUploadFiles === 1 &&
|
|
212
|
+
this.$containKey(this.$options.propsData, 'imagePath')
|
|
213
|
+
) {
|
|
214
|
+
this.$emit('on-remove', { index: index, target: this })
|
|
215
|
+
} else {
|
|
216
|
+
this.showImgList.splice(index, 1)
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
this.dispatch('FormItem', 'on-form-change', this.uploadList)
|
|
220
|
+
},
|
|
221
|
+
handleSuccess(res, file) {
|
|
222
|
+
if (this.action) {
|
|
223
|
+
// 对新露的上传接口做兼容, 他用的是其他字段
|
|
224
|
+
res.data.path = res.data.accessURL
|
|
225
|
+
}
|
|
226
|
+
if (!res.data) {
|
|
227
|
+
console.log(res)
|
|
228
|
+
file.status = 'fail'
|
|
229
|
+
this.$Notice.error({
|
|
230
|
+
title: `上传失败`,
|
|
231
|
+
desc: res.codex + ':' + res.message
|
|
232
|
+
})
|
|
233
|
+
this.uploadList.forEach((item, index) => {
|
|
234
|
+
if (item.status == 'fail') {
|
|
235
|
+
this.uploadList.splice(index, 1)
|
|
236
|
+
}
|
|
237
|
+
})
|
|
238
|
+
this.remainderCount++
|
|
239
|
+
return
|
|
240
|
+
}
|
|
241
|
+
if (!res.data.path) {
|
|
242
|
+
console.log(res)
|
|
243
|
+
file.status = 'fail'
|
|
244
|
+
this.$Notice.error({
|
|
245
|
+
title: `上传失败`,
|
|
246
|
+
desc: res.message
|
|
247
|
+
})
|
|
248
|
+
this.uploadList.forEach((item, index) => {
|
|
249
|
+
if (item.status == 'fail') {
|
|
250
|
+
this.uploadList.splice(index, 1)
|
|
251
|
+
}
|
|
252
|
+
})
|
|
253
|
+
this.remainderCount++
|
|
254
|
+
return
|
|
255
|
+
}
|
|
256
|
+
file.url = res.data.path
|
|
257
|
+
file.name = res.data.path
|
|
258
|
+
file.status = 'finished'
|
|
259
|
+
this.uploadList = this.$refs.upload.fileList
|
|
260
|
+
if (
|
|
261
|
+
!this.$isEmpty(this._events) &&
|
|
262
|
+
typeof this._events['on-upload-complete'] === 'object'
|
|
263
|
+
) {
|
|
264
|
+
this.$emit('on-upload-complete', { res: res, file: file, target: this })
|
|
265
|
+
} else {
|
|
266
|
+
if (this.maxUploadFiles === 1) {
|
|
267
|
+
if (this.$containKey(this.$options.propsData, 'imagePath')) {
|
|
268
|
+
this.$emit('on-upload-complete', {
|
|
269
|
+
res: res,
|
|
270
|
+
file: file,
|
|
271
|
+
target: this
|
|
272
|
+
})
|
|
273
|
+
} else {
|
|
274
|
+
this.showImgList.splice(0, this.showImgList.length)
|
|
275
|
+
this.showImgList.push(res.data.path)
|
|
276
|
+
}
|
|
277
|
+
} else {
|
|
278
|
+
this.showImgList.push(res.data.path)
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
this.dispatch('FormItem', 'on-form-change', this.uploadList)
|
|
282
|
+
},
|
|
283
|
+
handleFormatError(file) {
|
|
284
|
+
this.remainderCount++
|
|
285
|
+
this.$Notice.warning({
|
|
286
|
+
title: '文件格式错误',
|
|
287
|
+
desc: '只能上传 jpeg, jpg 或 png 文件.'
|
|
288
|
+
})
|
|
289
|
+
},
|
|
290
|
+
handleMaxSize(file) {
|
|
291
|
+
this.remainderCount++
|
|
292
|
+
console.log('-------handleMaxSize----------')
|
|
293
|
+
this.$Notice.warning({
|
|
294
|
+
title: `文件超过${this.fileMaxSize / this.sizeUnit}${this.sizeUnitStr}`,
|
|
295
|
+
desc: `文件不能大于 ${this.fileMaxSize / this.sizeUnit}${
|
|
296
|
+
this.sizeUnitStr
|
|
297
|
+
}`
|
|
298
|
+
})
|
|
299
|
+
},
|
|
300
|
+
handleBeforeUpload() {
|
|
301
|
+
var check = true
|
|
302
|
+
if (this.remainderCount <= 0) {
|
|
303
|
+
this.$Notice.warning({
|
|
304
|
+
title: `只能上传 ${this.maxUploadFiles} 张图片.`
|
|
305
|
+
})
|
|
306
|
+
check = false
|
|
307
|
+
} else {
|
|
308
|
+
this.remainderCount--
|
|
309
|
+
}
|
|
310
|
+
return check
|
|
311
|
+
},
|
|
312
|
+
// 图片上传进度
|
|
313
|
+
handleProgress(event, file, fileList) {
|
|
314
|
+
if (file) {
|
|
315
|
+
file.showProgress = true
|
|
316
|
+
file.status = 'uploading'
|
|
317
|
+
file.percentage = event.percent || 100
|
|
318
|
+
const hasThisUrl =
|
|
319
|
+
this.uploadList.filter((item) => {
|
|
320
|
+
return item.uid == file.uid
|
|
321
|
+
}).length > 0
|
|
322
|
+
if (!hasThisUrl) {
|
|
323
|
+
// file.url = file.response.result
|
|
324
|
+
this.uploadList.push(file)
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
},
|
|
329
|
+
mounted() {}
|
|
330
|
+
}
|
|
331
|
+
</script>
|
|
332
|
+
<style lang="less" scoped>
|
|
333
|
+
.hideUpload {
|
|
334
|
+
display: none !important;
|
|
335
|
+
}
|
|
336
|
+
.demo-upload-list {
|
|
337
|
+
position: relative;
|
|
338
|
+
display: flex;
|
|
339
|
+
flex-direction: column;
|
|
340
|
+
align-items: center;
|
|
341
|
+
justify-content: center;
|
|
342
|
+
width: 112px;
|
|
343
|
+
height: 112px;
|
|
344
|
+
border: 1px solid #dcdee2;
|
|
345
|
+
border-radius: 4px;
|
|
346
|
+
margin-right: 16px;
|
|
347
|
+
.f-s-14 {
|
|
348
|
+
margin-bottom: 12px;
|
|
349
|
+
color: #515a6e;
|
|
350
|
+
}
|
|
351
|
+
.ivu-icon-md-close-circle {
|
|
352
|
+
position: absolute;
|
|
353
|
+
top: 8px;
|
|
354
|
+
right: 8px;
|
|
355
|
+
background-color: #fff;
|
|
356
|
+
border-radius: 50%;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
.demo-upload-list img {
|
|
360
|
+
display: block;
|
|
361
|
+
margin: auto;
|
|
362
|
+
width: 104px;
|
|
363
|
+
height: 104px;
|
|
364
|
+
border-radius: 4px;
|
|
365
|
+
object-fit: contain;
|
|
366
|
+
}
|
|
367
|
+
.plus-upload {
|
|
368
|
+
.upload-tips {
|
|
369
|
+
color: #9ea7b4;
|
|
370
|
+
margin-top: 12px;
|
|
371
|
+
}
|
|
372
|
+
.ivu-progress {
|
|
373
|
+
line-height: 1;
|
|
374
|
+
width: ~'calc(100% - 16px)';
|
|
375
|
+
}
|
|
376
|
+
.ivu-upload {
|
|
377
|
+
display: inline-block;
|
|
378
|
+
width: 112px;
|
|
379
|
+
height: 112px;
|
|
380
|
+
background: #f8f8f9;
|
|
381
|
+
border-radius: 4px;
|
|
382
|
+
}
|
|
383
|
+
/deep/.ivu-upload-drag {
|
|
384
|
+
width: 112px;
|
|
385
|
+
height: 112px;
|
|
386
|
+
background: #f8f8f9;
|
|
387
|
+
.icon-wrap {
|
|
388
|
+
display: flex;
|
|
389
|
+
flex-direction: column;
|
|
390
|
+
align-items: center;
|
|
391
|
+
justify-content: center;
|
|
392
|
+
background: transparent;
|
|
393
|
+
width: 112px;
|
|
394
|
+
height: 112px;
|
|
395
|
+
.f-s-14 {
|
|
396
|
+
margin-top: 12px;
|
|
397
|
+
color: #515a6e;
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
</style>
|
package/src/index.js
CHANGED
|
@@ -5,6 +5,9 @@ import ExtentionPlugin from './extentionPlugin'
|
|
|
5
5
|
import importDirective from './directive'
|
|
6
6
|
import PlusComp from './components/plus-comp'
|
|
7
7
|
import BeginEndDatePicker from './components/begin-end-date-picker'
|
|
8
|
+
import UploadFileSingle from './components/upload-file/upload-file-single'
|
|
9
|
+
import UploadFile from './components/upload-file/upload-file'
|
|
10
|
+
import UploadFileInput from './components/upload-file/upload-file-input'
|
|
8
11
|
|
|
9
12
|
console.log('--------web-tool---index.js----------')
|
|
10
13
|
|
|
@@ -19,6 +22,9 @@ export default {
|
|
|
19
22
|
install(vue, opts = {}) {
|
|
20
23
|
vue.use(PlusComp)
|
|
21
24
|
vue.component('BeginEndDatePicker', BeginEndDatePicker)
|
|
25
|
+
vue.component('UploadFileSingle', UploadFileSingle)
|
|
26
|
+
vue.component('UploadFile', UploadFile)
|
|
27
|
+
vue.component('UploadFileInput', UploadFileInput)
|
|
22
28
|
/**
|
|
23
29
|
* 注册指令
|
|
24
30
|
*/
|