lw-cdp-ui 1.2.47 → 1.2.49
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/dist/assets/images/empty.jpg +0 -0
- package/dist/assets/images/login.svg +0 -558
- package/dist/assets/images/logo.jpg +0 -0
- package/dist/assets/images/logo.svg +0 -78
- package/dist/assets/images/logo1.svg +0 -86
- package/dist/assets/images/register.svg +0 -351
- package/dist/components/lwCronSelect/index.vue +0 -218
- package/dist/components/lwFlow/components/lfControl.vue +0 -126
- package/dist/components/lwFlow/components/lfNodePanel.vue +0 -98
- package/dist/components/lwFlow/config/dagre.js +0 -279
- package/dist/components/lwFlow/config/nodesList.js +0 -243
- package/dist/components/lwFlow/index.vue +0 -781
- package/dist/components/lwFlow/nodeEdit/audienceReceive.vue +0 -262
- package/dist/components/lwFlow/nodeEdit/basicSettings.vue +0 -88
- package/dist/components/lwFlow/nodeEdit/eventReceive.vue +0 -145
- package/dist/components/lwFlow/nodeEdit/index.vue +0 -306
- package/dist/components/lwFlow/nodeEdit/sms.vue +0 -107
- package/dist/components/lwFlow/nodeEdit/styleSettings.vue +0 -236
- package/dist/components/lwFlow/nodes/basisEnd.js +0 -56
- package/dist/components/lwFlow/nodes/basisStart.js +0 -56
- package/dist/components/lwFlow/nodes/custom.js +0 -129
- package/dist/components/lwFlow/nodes/et2lTable.js +0 -132
- package/dist/components/lwFlow/nodesData/datas/audienceReceive.js +0 -137
- package/dist/components/lwFlow/nodesData/datas/base.js +0 -190
- package/dist/components/lwFlow/nodesData/datas/collap.js +0 -95
- package/dist/components/lwFlow/nodesData/datas/eventReceive.js +0 -106
- package/dist/components/lwFlow/nodesData/datas/expand.js +0 -85
- package/dist/components/lwFlow/nodesData/datas/filter.js +0 -85
- package/dist/components/lwFlow/nodesData/datas/joiner.js +0 -96
- package/dist/components/lwFlow/nodesData/datas/mapper.js +0 -111
- package/dist/components/lwFlow/nodesData/datas/reduce.js +0 -69
- package/dist/components/lwFlow/nodesData/datas/sms.js +0 -69
- package/dist/components/lwFlow/nodesData/datas/source.js +0 -142
- package/dist/components/lwFlow/nodesData/datas/target.js +0 -95
- package/dist/components/lwFlow/nodesData/datas/timer.js +0 -180
- package/dist/components/lwFlow/nodesData/index.js +0 -41
- package/dist/components/lwForm/index.vue +0 -631
- package/dist/components/lwFormJson/JsonItem.vue +0 -302
- package/dist/components/lwFormJson/StatsConfig.vue +0 -544
- package/dist/components/lwFormJson/TreeItem.vue +0 -149
- package/dist/components/lwFormJson/index.vue +0 -362
- package/dist/components/lwFormJson/menuList.js +0 -324
- package/dist/components/lwFormMini/FormItem.vue +0 -466
- package/dist/components/lwFormMini/ViewItem.vue +0 -391
- package/dist/components/lwFormMini/index.vue +0 -421
- package/dist/components/lwFormMini/textToPassword.vue +0 -61
- package/dist/components/lwFormView/index.vue +0 -390
- package/dist/components/lwFormView/textToPassword.vue +0 -59
- package/dist/components/lwIconSelect/iconSelect.js +0 -289
- package/dist/components/lwIconSelect/index.vue +0 -142
- package/dist/components/lwLayout/components/NavMenu.vue +0 -36
- package/dist/components/lwLayout/components/aside.vue +0 -295
- package/dist/components/lwLayout/components/bu.vue +0 -88
- package/dist/components/lwLayout/components/iframeView.vue +0 -57
- package/dist/components/lwLayout/components/lang.vue +0 -77
- package/dist/components/lwLayout/components/setting.vue +0 -102
- package/dist/components/lwLayout/components/sideM.vue +0 -135
- package/dist/components/lwLayout/components/tags.vue +0 -388
- package/dist/components/lwLayout/components/topbar.vue +0 -69
- package/dist/components/lwLayout/components/userbar.vue +0 -214
- package/dist/components/lwLayout/index.vue +0 -460
- package/dist/components/lwLogin/index.vue +0 -506
- package/dist/components/lwLogin/locale/en-us.js +0 -37
- package/dist/components/lwLogin/locale/zh-cn.js +0 -37
- package/dist/components/lwSearch/date/date.vue +0 -113
- package/dist/components/lwSearch/dateRange/dateRange.vue +0 -118
- package/dist/components/lwSearch/dates/dates.vue +0 -366
- package/dist/components/lwSearch/index.vue +0 -628
- package/dist/components/lwSearch/input/input.vue +0 -55
- package/dist/components/lwSearch/locale/en-us.js +0 -15
- package/dist/components/lwSearch/locale/zh-cn.js +0 -15
- package/dist/components/lwSearch/select/select.vue +0 -58
- package/dist/components/lwSvgIcon/index.vue +0 -29
- package/dist/components/lwTable/index.js +0 -286
- package/dist/components/lwTable/index.scss +0 -238
- package/dist/components/lwTable/index.vue +0 -344
- package/dist/components/lwTable/locale/en-US.js +0 -26
- package/dist/components/lwTable/locale/zh-CN.js +0 -26
- package/dist/components/lwTable/useFullscreen.js +0 -73
- package/dist/components/lwTableForm/index.vue +0 -662
- package/dist/components/lwTableSelect/index.vue +0 -266
- package/dist/components/lwTableSelect/tableSelect.js +0 -23
- package/dist/components/lwUpload/index.vue +0 -564
- package/dist/lw-cdp-ui.esm.js +0 -19893
- package/dist/lw-cdp-ui.umd.js +0 -22
- package/dist/style.css +0 -1
- package/dist/vite.svg +0 -1
|
@@ -1,564 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="lw-upload"
|
|
3
|
-
:class="{ 'lw-upload-round': round }">
|
|
4
|
-
<!-- 文件预览列表 -->
|
|
5
|
-
<div class="view-img-list">
|
|
6
|
-
<template v-for="(f, index) in fileList"
|
|
7
|
-
:key="index">
|
|
8
|
-
<div class="lw-upload__img"
|
|
9
|
-
:style="style">
|
|
10
|
-
<!-- 如果允许图片,显示图片预览 -->
|
|
11
|
-
<el-image v-if="isAcceptImage"
|
|
12
|
-
class="image"
|
|
13
|
-
:src="getShowValue(f)"
|
|
14
|
-
:preview-src-list="fileList"
|
|
15
|
-
fit="cover"
|
|
16
|
-
hide-on-click-modal
|
|
17
|
-
append-to-body
|
|
18
|
-
:z-index="9999">
|
|
19
|
-
<template #placeholder>
|
|
20
|
-
<div class="lw-upload__img-slot">
|
|
21
|
-
Loading...
|
|
22
|
-
</div>
|
|
23
|
-
</template>
|
|
24
|
-
</el-image>
|
|
25
|
-
<!-- 如果允许视频,显示视频预览 -->
|
|
26
|
-
<video v-if="isAcceptVideo"
|
|
27
|
-
:src="getShowValue(f)"
|
|
28
|
-
controls></video>
|
|
29
|
-
<!-- 删除按钮,仅在未禁用状态下显示 -->
|
|
30
|
-
<div class="lw-upload__img-actions"
|
|
31
|
-
v-if="!disabled">
|
|
32
|
-
<span class="del"
|
|
33
|
-
@click="handleRemove(index)">
|
|
34
|
-
<el-icon><el-icon-delete /></el-icon>
|
|
35
|
-
</span>
|
|
36
|
-
</div>
|
|
37
|
-
</div>
|
|
38
|
-
</template>
|
|
39
|
-
|
|
40
|
-
<!-- 上传按钮(当文件数量未达到限制时显示) -->
|
|
41
|
-
<el-upload v-if="fileList.length < limit"
|
|
42
|
-
class="uploader"
|
|
43
|
-
:style="style"
|
|
44
|
-
ref="uploader"
|
|
45
|
-
:auto-upload="autoUpload"
|
|
46
|
-
:disabled="disabled"
|
|
47
|
-
:show-file-list="showFileList"
|
|
48
|
-
:action="action"
|
|
49
|
-
:name="name"
|
|
50
|
-
:data="data"
|
|
51
|
-
:accept="accept"
|
|
52
|
-
:limit="limit"
|
|
53
|
-
:http-request="request"
|
|
54
|
-
:on-change="change"
|
|
55
|
-
:before-upload="before"
|
|
56
|
-
:on-success="success"
|
|
57
|
-
:on-error="error"
|
|
58
|
-
:on-exceed="handleExceed">
|
|
59
|
-
<slot>
|
|
60
|
-
<div class="el-upload--picture-card">
|
|
61
|
-
<div class="file-empty">
|
|
62
|
-
<el-icon>
|
|
63
|
-
<component :is="icon" />
|
|
64
|
-
</el-icon>
|
|
65
|
-
<h4 v-if="title">{{ title }}</h4>
|
|
66
|
-
</div>
|
|
67
|
-
<!-- 上传过程中显示进度条 -->
|
|
68
|
-
<div v-if="file && file.percentage"
|
|
69
|
-
:style="style"
|
|
70
|
-
class="lw-upload__progress">
|
|
71
|
-
<el-progress :percentage="file.percentage"
|
|
72
|
-
:text-inside="true"
|
|
73
|
-
:stroke-width="16" />
|
|
74
|
-
<span v-if="file.percentage == 100">已上传,处理中···</span>
|
|
75
|
-
</div>
|
|
76
|
-
</div>
|
|
77
|
-
</slot>
|
|
78
|
-
</el-upload>
|
|
79
|
-
</div>
|
|
80
|
-
|
|
81
|
-
<!-- 上传提示信息 -->
|
|
82
|
-
<div v-if="tip"
|
|
83
|
-
class="el-upload__tip">
|
|
84
|
-
{{ tip }}
|
|
85
|
-
</div>
|
|
86
|
-
</div>
|
|
87
|
-
</template>
|
|
88
|
-
|
|
89
|
-
<script>
|
|
90
|
-
export default {
|
|
91
|
-
name: 'lwUpload',
|
|
92
|
-
/**
|
|
93
|
-
* @property {String} modelValue - 绑定的值,默认为空字符串
|
|
94
|
-
* @property {Number} height - 上传组件的高度,默认为 148
|
|
95
|
-
* @property {Number} width - 上传组件的宽度,默认为 148
|
|
96
|
-
* @property {String} title - 上传组件的标题,默认为空字符串
|
|
97
|
-
* @property {String} icon - 上传按钮的图标,默认为 'el-icon-plus'
|
|
98
|
-
* @property {String|Function} action - 上传的地址或函数,默认为空函数
|
|
99
|
-
* @property {Object} apiObj - API 对象配置,默认为空对象
|
|
100
|
-
* @property {String} name - 表单提交的文件字段名,默认为 'file'
|
|
101
|
-
* @property {Object} data - 上传时附带的额外参数,默认为空对象
|
|
102
|
-
* @property {String} accept - 允许上传的文件类型,默认为 'image/gif, image/jpeg, image/png'
|
|
103
|
-
* @property {Number} maxSize - 文件的最大大小,默认为 10MB
|
|
104
|
-
* @property {Number} limit - 允许上传的最大文件数,默认为 1
|
|
105
|
-
* @property {Boolean} autoUpload - 是否自动上传,默认为 true
|
|
106
|
-
* @property {Boolean} showFileList - 是否显示已上传文件列表,默认为 false
|
|
107
|
-
* @property {Boolean} disabled - 是否禁用上传功能,默认为 false
|
|
108
|
-
* @property {Boolean} round - 是否显示圆角按钮,默认为 false
|
|
109
|
-
* @property {Boolean} multiple - 是否多个文件,默认为 false
|
|
110
|
-
* @property {Array} returnFile - 需要返回的字段,例如为 ['url', 'type', 'name'] 第一个参数为图片地址
|
|
111
|
-
* @property {Function} onSuccess - 上传成功后的回调函数,默认为空函数
|
|
112
|
-
* @property {Function} parseData - 解析上传响应数据的函数,默认为解析状态码、文件名、图片远程地址和描述字段
|
|
113
|
-
*/
|
|
114
|
-
props: {
|
|
115
|
-
modelValue: { type: [String, Array, Boolean, Object], default: "" },
|
|
116
|
-
height: { type: Number, default: 148 },
|
|
117
|
-
width: { type: Number, default: 148 },
|
|
118
|
-
title: { type: String, default: "" },
|
|
119
|
-
tip: { type: String, default: "" },
|
|
120
|
-
icon: { type: String, default: "el-icon-plus" },
|
|
121
|
-
action: { type: String, default: () => { } },
|
|
122
|
-
apiObj: { type: [Object, Function], default: () => { } },
|
|
123
|
-
name: { type: String, default: "file" },
|
|
124
|
-
data: { type: Object, default: () => { } },
|
|
125
|
-
accept: { type: String, default: "image/gif, image/jpeg, image/png" },
|
|
126
|
-
maxSize: { type: Number, default: 10 },
|
|
127
|
-
limit: { type: Number, default: 1 },
|
|
128
|
-
autoUpload: { type: Boolean, default: true },
|
|
129
|
-
showFileList: { type: Boolean, default: false },
|
|
130
|
-
multiple: { type: Boolean, default: false },
|
|
131
|
-
disabled: { type: Boolean, default: false },
|
|
132
|
-
round: { type: Boolean, default: false },
|
|
133
|
-
onSuccess: { type: Function, default: () => { return true } },
|
|
134
|
-
returnFile: { // 单传'url' 就返回数组 传对象映射关系就返回数组对象
|
|
135
|
-
type: [Object, String],
|
|
136
|
-
default: {
|
|
137
|
-
url: 'url', // 第一个就是默认图片字段
|
|
138
|
-
code: 'code',
|
|
139
|
-
fileName: 'fileName',
|
|
140
|
-
src: 'src',
|
|
141
|
-
type: 'type',
|
|
142
|
-
name: 'name',
|
|
143
|
-
size: 'size',
|
|
144
|
-
tempCropperFile: 'tempCropperFile',
|
|
145
|
-
}
|
|
146
|
-
},
|
|
147
|
-
parseData: {
|
|
148
|
-
type: Function, default: (res) => {
|
|
149
|
-
return {
|
|
150
|
-
code: 200,//分析状态字段结构
|
|
151
|
-
fileName: res.fileName,//分析文件名称
|
|
152
|
-
src: res.previewInfo.url, //分析图片远程地址结构
|
|
153
|
-
msg: res.message //分析描述字段结构
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
},
|
|
158
|
-
data() {
|
|
159
|
-
return {
|
|
160
|
-
value: "",
|
|
161
|
-
file: null,
|
|
162
|
-
fileList: []
|
|
163
|
-
}
|
|
164
|
-
},
|
|
165
|
-
computed: {
|
|
166
|
-
// 计算上传组件的样式
|
|
167
|
-
style() {
|
|
168
|
-
return {
|
|
169
|
-
width: this.width + "px",
|
|
170
|
-
height: this.height + "px"
|
|
171
|
-
}
|
|
172
|
-
},
|
|
173
|
-
// 计算上传组件是否显示上传按钮
|
|
174
|
-
acceptedTypes() {
|
|
175
|
-
return this.accept.replace(/\s/g, "").split(",");
|
|
176
|
-
},
|
|
177
|
-
// 判断是否允许上传图片(判断字符串中是否包含 "image")
|
|
178
|
-
isAcceptImage() {
|
|
179
|
-
return this.accept.indexOf('image') > -1;
|
|
180
|
-
},
|
|
181
|
-
// 判断是否允许上传视频(判断字符串中是否包含 "video")
|
|
182
|
-
isAcceptVideo() {
|
|
183
|
-
return this.accept.indexOf('video') > -1;
|
|
184
|
-
}
|
|
185
|
-
},
|
|
186
|
-
watch: {
|
|
187
|
-
/**
|
|
188
|
-
* 监听外部绑定值的变化,更新内部值和文件列表
|
|
189
|
-
*/
|
|
190
|
-
modelValue(val) {
|
|
191
|
-
this.value = val;
|
|
192
|
-
this.newFile(val);
|
|
193
|
-
},
|
|
194
|
-
/**
|
|
195
|
-
* 当内部值变化时,通过事件通知外部更新绑定值
|
|
196
|
-
*/
|
|
197
|
-
value(val) {
|
|
198
|
-
this.$emit('update:modelValue', val);
|
|
199
|
-
}
|
|
200
|
-
},
|
|
201
|
-
mounted() {
|
|
202
|
-
// 初始化组件内部值和文件列表
|
|
203
|
-
this.value = this.modelValue;
|
|
204
|
-
this.newFile(this.modelValue);
|
|
205
|
-
},
|
|
206
|
-
methods: {
|
|
207
|
-
/**
|
|
208
|
-
* 根据传入的值初始化文件列表及当前文件
|
|
209
|
-
* @param {String|Array} url - 外部绑定的值
|
|
210
|
-
*/
|
|
211
|
-
newFile(url) {
|
|
212
|
-
if (this.multiple) {
|
|
213
|
-
this.fileList = url || [];
|
|
214
|
-
} else {
|
|
215
|
-
this.fileList = url ? [url] : [];
|
|
216
|
-
}
|
|
217
|
-
this.file = url ? { status: "success", url: url } : null;
|
|
218
|
-
},
|
|
219
|
-
/**
|
|
220
|
-
* 删除指定索引的文件,并清理相关数据
|
|
221
|
-
* @param {Number} index - 要删除的文件索引
|
|
222
|
-
*/
|
|
223
|
-
handleRemove(index) {
|
|
224
|
-
this.fileList.splice(index, 1);
|
|
225
|
-
this.clearFiles();
|
|
226
|
-
},
|
|
227
|
-
/**
|
|
228
|
-
* 清除当前文件及上传组件内部缓存的文件数据
|
|
229
|
-
*/
|
|
230
|
-
clearFiles() {
|
|
231
|
-
if (this.file && this.file.tempFile) {
|
|
232
|
-
URL.revokeObjectURL(this.file.tempFile);
|
|
233
|
-
}
|
|
234
|
-
this.value = this.multiple ? this.fileList : "";
|
|
235
|
-
this.file = null;
|
|
236
|
-
this.$nextTick(() => {
|
|
237
|
-
this.$refs.uploader && this.$refs.uploader.clearFiles();
|
|
238
|
-
});
|
|
239
|
-
},
|
|
240
|
-
/**
|
|
241
|
-
* 上传文件状态变化时的回调函数
|
|
242
|
-
* @param {Object} file - 当前上传的文件对象
|
|
243
|
-
* @param {Array} files - 上传组件中所有文件的列表
|
|
244
|
-
* @returns {Boolean} 返回 false 可中断后续上传流程
|
|
245
|
-
*/
|
|
246
|
-
change(file, files) {
|
|
247
|
-
if (!this.multiple && files.length > 1) {
|
|
248
|
-
files.splice(1);
|
|
249
|
-
}
|
|
250
|
-
const fileType = file.raw && file.raw.type;
|
|
251
|
-
if (file.status === 'ready' && fileType && !this.acceptedTypes.includes(fileType)) {
|
|
252
|
-
this.$notify.warning({
|
|
253
|
-
title: '上传文件警告',
|
|
254
|
-
message: '选择的文件类型不符合要求'
|
|
255
|
-
});
|
|
256
|
-
return false;
|
|
257
|
-
}
|
|
258
|
-
if (file.status === 'ready' && file.raw) {
|
|
259
|
-
file.tempFile = URL.createObjectURL(file.raw);
|
|
260
|
-
}
|
|
261
|
-
this.file = file;
|
|
262
|
-
},
|
|
263
|
-
/**
|
|
264
|
-
* 上传前的校验函数
|
|
265
|
-
* @param {Object} file - 待上传的文件对象
|
|
266
|
-
* @returns {Boolean} 返回 false 可阻止上传
|
|
267
|
-
*/
|
|
268
|
-
before(file) {
|
|
269
|
-
// 校验文件类型是否符合允许列表
|
|
270
|
-
if (!this.acceptedTypes.includes(file.type)) {
|
|
271
|
-
this.$notify.warning({
|
|
272
|
-
title: '上传文件错误',
|
|
273
|
-
message: '选择的文件类型不正确'
|
|
274
|
-
});
|
|
275
|
-
this.clearFiles();
|
|
276
|
-
return false;
|
|
277
|
-
}
|
|
278
|
-
// 校验文件大小是否超出限制(单位:MB)
|
|
279
|
-
if (file.size / 1024 / 1024 > this.maxSize) {
|
|
280
|
-
this.$message.warning(`上传文件大小不能超过 ${this.maxSize}MB!`);
|
|
281
|
-
this.clearFiles();
|
|
282
|
-
return false;
|
|
283
|
-
}
|
|
284
|
-
return true;
|
|
285
|
-
},
|
|
286
|
-
/**
|
|
287
|
-
* 当上传文件数量超过限制时的处理函数
|
|
288
|
-
* @param {Array} files - 超出限制的文件列表
|
|
289
|
-
*/
|
|
290
|
-
handleExceed(files) {
|
|
291
|
-
const file = files[0];
|
|
292
|
-
file.uid = this.$tool ? this.$tool.getUUID('file', 16) : Date.now();
|
|
293
|
-
this.$refs.uploader.handleStart(file);
|
|
294
|
-
},
|
|
295
|
-
/**
|
|
296
|
-
* 上传成功的回调函数
|
|
297
|
-
* @param {Object} res - 上传接口返回的数据
|
|
298
|
-
* @param {Object} file - 上传成功的文件对象
|
|
299
|
-
*/
|
|
300
|
-
success(res, file) {
|
|
301
|
-
file.type = file.raw.type;
|
|
302
|
-
if (file.tempFile) {
|
|
303
|
-
URL.revokeObjectURL(file.tempFile);
|
|
304
|
-
}
|
|
305
|
-
// 清理不必要的属性
|
|
306
|
-
delete file.tempFile;
|
|
307
|
-
delete file.percentage;
|
|
308
|
-
delete file.raw;
|
|
309
|
-
delete file.response;
|
|
310
|
-
delete file.uid;
|
|
311
|
-
|
|
312
|
-
const callbackResult = this.onSuccess(res, file);
|
|
313
|
-
if (callbackResult === false) {
|
|
314
|
-
this.$nextTick(() => {
|
|
315
|
-
this.file = null;
|
|
316
|
-
this.value = "";
|
|
317
|
-
});
|
|
318
|
-
return false;
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
// 解析上传接口返回的数据
|
|
322
|
-
const response = this.parseData(res);
|
|
323
|
-
file.url = response.src;
|
|
324
|
-
|
|
325
|
-
const sourceObject = { ...response, ...file };
|
|
326
|
-
if (typeof this.returnFile === 'object') {
|
|
327
|
-
const mappedObject = Object.entries(this.returnFile).reduce((acc, [key, value]) => {
|
|
328
|
-
if (sourceObject[key] !== undefined) {
|
|
329
|
-
acc[value] = sourceObject[key];
|
|
330
|
-
}
|
|
331
|
-
return acc;
|
|
332
|
-
}, {});
|
|
333
|
-
this.fileList.push(mappedObject);
|
|
334
|
-
} else {
|
|
335
|
-
// 若 returnFile 为字符串,则直接返回对应字段的值
|
|
336
|
-
this.fileList.push(sourceObject[this.returnFile]);
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
// 更新绑定值:多文件上传返回数组,否则返回单个文件 URL
|
|
340
|
-
this.value = this.multiple ? this.fileList : file.url;
|
|
341
|
-
},
|
|
342
|
-
/**
|
|
343
|
-
* 上传失败的回调函数
|
|
344
|
-
* @param {Object} err - 错误信息
|
|
345
|
-
*/
|
|
346
|
-
error(err) {
|
|
347
|
-
this.$nextTick(() => {
|
|
348
|
-
if (this.file) delete this.file.percentage;
|
|
349
|
-
});
|
|
350
|
-
this.$notify.error({
|
|
351
|
-
title: '上传文件失败',
|
|
352
|
-
message: err
|
|
353
|
-
});
|
|
354
|
-
},
|
|
355
|
-
/**
|
|
356
|
-
* 自定义上传请求方法,支持上传进度更新
|
|
357
|
-
* @param {Object} param - 上传请求的参数对象
|
|
358
|
-
*/
|
|
359
|
-
request(param) {
|
|
360
|
-
let apiObj = this.apiObj || this.$api.auth.upload
|
|
361
|
-
const data = new FormData();
|
|
362
|
-
data.append(param.filename, param.file);
|
|
363
|
-
data.append('fileName', param.file.name);
|
|
364
|
-
for (const key in param.data) {
|
|
365
|
-
data.append(key, param.data[key]);
|
|
366
|
-
}
|
|
367
|
-
apiObj(data, {
|
|
368
|
-
onUploadProgress: e => {
|
|
369
|
-
this.file.percentage = parseInt(((e.loaded / e.total) * 100) | 0, 10)
|
|
370
|
-
}
|
|
371
|
-
}).then(res => {
|
|
372
|
-
var response = this.parseData(res);
|
|
373
|
-
if (response.code == 200) {
|
|
374
|
-
param.onSuccess(res)
|
|
375
|
-
} else {
|
|
376
|
-
param.onError(response.msg || "未知错误")
|
|
377
|
-
}
|
|
378
|
-
}).catch(err => {
|
|
379
|
-
param.onError(err)
|
|
380
|
-
})
|
|
381
|
-
},
|
|
382
|
-
/**
|
|
383
|
-
* 获取用于预览显示的文件 URL
|
|
384
|
-
* @param {Object|String} item - 文件信息对象或直接的 URL 字符串
|
|
385
|
-
* @returns {String} 返回预览所需的 URL 地址
|
|
386
|
-
*/
|
|
387
|
-
getShowValue(item) {
|
|
388
|
-
if (this.multiple) {
|
|
389
|
-
if (typeof this.returnFile === 'object') {
|
|
390
|
-
const firstKey = Object.keys(this.returnFile)[0];
|
|
391
|
-
return item[this.returnFile[firstKey]];
|
|
392
|
-
} else {
|
|
393
|
-
return item;
|
|
394
|
-
}
|
|
395
|
-
} else {
|
|
396
|
-
return item;
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
</script>
|
|
402
|
-
|
|
403
|
-
<style lang="scss" scoped>
|
|
404
|
-
.el-form-item.is-error .lw-upload .el-upload--picture-card {
|
|
405
|
-
border-color: var(--el-color-danger);
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
.lw-upload {
|
|
409
|
-
width: 100%;
|
|
410
|
-
|
|
411
|
-
&.lw-upload-round {
|
|
412
|
-
border-radius: 50%;
|
|
413
|
-
overflow: hidden;
|
|
414
|
-
|
|
415
|
-
.el-upload--picture-card {
|
|
416
|
-
border-radius: 50%;
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
.lw-upload__img-actions {
|
|
420
|
-
top: auto;
|
|
421
|
-
left: 0;
|
|
422
|
-
right: 0;
|
|
423
|
-
bottom: 0;
|
|
424
|
-
|
|
425
|
-
span {
|
|
426
|
-
width: 100%;
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
.el-upload--picture-card {
|
|
432
|
-
border-radius: 0;
|
|
433
|
-
height: 100%;
|
|
434
|
-
width: 100%;
|
|
435
|
-
position: relative;
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
.uploader,
|
|
439
|
-
:deep(.el-upload) {
|
|
440
|
-
width: 100%;
|
|
441
|
-
height: 100%;
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
.file-empty {
|
|
445
|
-
width: 100%;
|
|
446
|
-
height: 100%;
|
|
447
|
-
display: flex;
|
|
448
|
-
justify-content: center;
|
|
449
|
-
align-items: center;
|
|
450
|
-
flex-direction: column;
|
|
451
|
-
|
|
452
|
-
i {
|
|
453
|
-
font-size: 28px;
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
h4 {
|
|
457
|
-
font-size: 12px;
|
|
458
|
-
font-weight: normal;
|
|
459
|
-
color: #8c939d;
|
|
460
|
-
margin-top: 8px;
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
.lw-upload__img {
|
|
466
|
-
width: 100%;
|
|
467
|
-
height: 100%;
|
|
468
|
-
position: relative;
|
|
469
|
-
display: flex;
|
|
470
|
-
align-items: center;
|
|
471
|
-
justify-content: center;
|
|
472
|
-
|
|
473
|
-
.image {
|
|
474
|
-
width: 100%;
|
|
475
|
-
height: 100%;
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
video {
|
|
479
|
-
background-color: #000;
|
|
480
|
-
width: 100%;
|
|
481
|
-
height: 100%;
|
|
482
|
-
object-fit: contain;
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
&-actions {
|
|
486
|
-
position: absolute;
|
|
487
|
-
top: 0;
|
|
488
|
-
right: 0;
|
|
489
|
-
display: none;
|
|
490
|
-
|
|
491
|
-
span {
|
|
492
|
-
display: flex;
|
|
493
|
-
justify-content: center;
|
|
494
|
-
align-items: center;
|
|
495
|
-
width: 25px;
|
|
496
|
-
height: 25px;
|
|
497
|
-
cursor: pointer;
|
|
498
|
-
color: #fff;
|
|
499
|
-
|
|
500
|
-
i {
|
|
501
|
-
font-size: 12px;
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
&.del {
|
|
505
|
-
background: #f56c6c;
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
&:hover {
|
|
510
|
-
display: block;
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
&-slot {
|
|
515
|
-
display: flex;
|
|
516
|
-
justify-content: center;
|
|
517
|
-
align-items: center;
|
|
518
|
-
width: 100%;
|
|
519
|
-
height: 100%;
|
|
520
|
-
font-size: 12px;
|
|
521
|
-
background-color: var(--el-fill-color-lighter);
|
|
522
|
-
}
|
|
523
|
-
|
|
524
|
-
&-uploading .image {
|
|
525
|
-
width: 100%;
|
|
526
|
-
height: 100%;
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
.lw-upload__progress {
|
|
531
|
-
position: absolute;
|
|
532
|
-
top: 0;
|
|
533
|
-
left: 0;
|
|
534
|
-
width: 100%;
|
|
535
|
-
height: 100%;
|
|
536
|
-
display: flex;
|
|
537
|
-
justify-content: center;
|
|
538
|
-
align-items: center;
|
|
539
|
-
flex-direction: column;
|
|
540
|
-
background-color: rgba(#000, 0.4);
|
|
541
|
-
backdrop-filter: blur(10px);
|
|
542
|
-
z-index: 1;
|
|
543
|
-
padding: 10px;
|
|
544
|
-
|
|
545
|
-
.el-progress {
|
|
546
|
-
width: 100%;
|
|
547
|
-
}
|
|
548
|
-
span {
|
|
549
|
-
font-size: 12px;
|
|
550
|
-
}
|
|
551
|
-
}
|
|
552
|
-
|
|
553
|
-
.view-img-list {
|
|
554
|
-
display: flex;
|
|
555
|
-
align-items: center;
|
|
556
|
-
flex-wrap: wrap;
|
|
557
|
-
gap: 10px;
|
|
558
|
-
&:hover {
|
|
559
|
-
.lw-upload__img-actions {
|
|
560
|
-
display: block;
|
|
561
|
-
}
|
|
562
|
-
}
|
|
563
|
-
}
|
|
564
|
-
</style>
|