Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cy-admin-ui
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
webpack
cy-admin-ui
Commits
29cdcdb6
Commit
29cdcdb6
authored
Feb 18, 2022
by
廖伟胜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改上创组件
parent
13518f2c
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
71 additions
and
40 deletions
+71
-40
upload-audio.vue
packages/form/upload/src/upload-audio.vue
+26
-16
upload-file.vue
packages/form/upload/src/upload-file.vue
+18
-8
upload-img.vue
packages/form/upload/src/upload-img.vue
+1
-1
upload-video.vue
packages/form/upload/src/upload-video.vue
+24
-13
upload.vue
packages/form/upload/src/upload.vue
+1
-1
layout-form.vue
packages/layout/src/layout-form.vue
+1
-1
No files found.
packages/form/upload/src/upload-audio.vue
View file @
29cdcdb6
...
...
@@ -2,10 +2,10 @@
<div>
<el-upload
ref=
"upload"
:show-file-list=
"false"
:on-preview=
"handler().handlePreview()"
:list-type=
"listType"
:on-exceed=
"(files, fileList)=>handler().handleExceed(files,fileList)"
:drag=
"uploadStyle === 'drag' ? true : false"
:limit=
"limit"
:on-success=
"(file) => handler().imageSuccess(file)"
:action=
"uploadDomain"
:before-upload=
"init().beforeUpload"
:multiple=
"multiple"
:headers=
"headers"
class=
"avatar-uploader"
>
<!--音频-->
<div
v-if=
"
data
.length >0 && !isList"
style=
"display:inline"
>
<div
v-for=
"(item,index) in
data
"
:key=
"index"
style=
"float:left;margin-right:10px;"
@
click
.
stop=
"handler().getIndex(index)"
>
<div
v-if=
"
list
.length >0 && !isList"
style=
"display:inline"
>
<div
v-for=
"(item,index) in
list
"
:key=
"index"
style=
"float:left;margin-right:10px;"
@
click
.
stop=
"handler().getIndex(index)"
>
<div
class=
"avatar"
style=
"border:none"
>
<i
class=
"el-icon-close delete-icon"
title=
"删除"
@
click
.
stop=
"
data.splice(index, 1
)"
/>
<i
class=
"el-icon-close delete-icon"
title=
"删除"
@
click
.
stop=
"
handler().handelDelete(index
)"
/>
<aplayer
class=
"audio-player"
:music=
"item"
...
...
@@ -22,12 +22,12 @@
</div>
</div>
</div>
<div
v-else-if=
"
data
.length >0 && isList"
style=
"display:inline"
>
<div
v-else-if=
"
list
.length >0 && isList"
style=
"display:inline"
>
<div
class=
"avatar"
style=
"border:none"
>
<i
class=
"el-icon-close delete-icon"
title=
"删除"
@
click
.
stop=
"
data.splice(index, 1
)"
/>
<i
class=
"el-icon-close delete-icon"
title=
"删除"
@
click
.
stop=
"
handler().handelDelete(index
)"
/>
<aplayer
class=
"audio-player"
:list=
"
data
"
:list=
"
list
"
:mini=
"mini"
:float=
"float"
:showLrc=
"showLrc"
...
...
@@ -141,7 +141,7 @@ export default{
// 图片大小限制(kb)
sizeLimit
:
{
type
:
Number
,
default
:
3
000
,
default
:
10
000
,
},
//显示删除
showDel
:
{
...
...
@@ -156,6 +156,11 @@ export default{
show
:
{
type
:
Boolean
,
default
:
true
,
},
// 类型
dataType
:
{
type
:
String
,
default
:
'array'
,
},
//上传组件风格
uploadStyle
:{
...
...
@@ -185,6 +190,7 @@ export default{
return
{
index
:
null
,
data
:
''
,
list
:[],
qiniuToken
:
''
,
baseUrl
:
process
.
env
.
VUE_APP_BASE_API
,
videoFlag
:
false
,
...
...
@@ -265,16 +271,17 @@ export default{
},
watch: {
value(value) {
this.
data
= this.init().data(value)
this.
list
= this.init().data(value)
},
data() {
this.$emit('
input
', this.data)
this.data = this.list;
this.$emit('
input
', this.init().value(this.data))
this.$emit('
on
-
success
', this.data)
},
},
created() {
this.index = null;
this.
data = this.value
this.
list = this.init().data(this.value);
this.init().token()
},
methods: {
...
...
@@ -378,10 +385,9 @@ export default{
const link = data.url;
// this.data = url
let attrs = {
title:file.name,
src:link
}
this.data = this.
data
.push(attrs);
this.data = this.
list
.push(attrs);
this.$refs.upload.clearFiles();
},
//获取索引
...
...
@@ -418,6 +424,10 @@ export default{
this.data = ''
this.$emit('
delete
')
},
//删除音频
handelDelete:(index)=>{
this.data = this.list.splice(index,1);
},
}
},
/**
...
...
packages/form/upload/src/upload-file.vue
View file @
29cdcdb6
<
template
>
<div>
<el-upload
ref=
"upload"
:show-file-list=
"false"
:on-preview=
"handler().handlePreview()"
:list-type=
"listType"
:on-exceed=
"(files, fileList)=>handler().handleExceed(files,fileList)"
:drag=
"uploadStyle === 'drag' ? true : false"
:limit=
"limit"
:on-success=
"(file
) => handler().imageSuccess(file
)"
:action=
"uploadDomain"
:before-upload=
"init().beforeUpload"
:multiple=
"multiple"
:headers=
"headers"
class=
"avatar-uploader"
>
<el-upload
ref=
"upload"
:show-file-list=
"false"
:on-preview=
"handler().handlePreview()"
:list-type=
"listType"
:on-exceed=
"(files, fileList)=>handler().handleExceed(files,fileList)"
:drag=
"uploadStyle === 'drag' ? true : false"
:limit=
"limit"
:on-success=
"(file
,files) => handler().imageSuccess(file,files
)"
:action=
"uploadDomain"
:before-upload=
"init().beforeUpload"
:multiple=
"multiple"
:headers=
"headers"
class=
"avatar-uploader"
>
<i
class=
"el-icon-upload"
v-if=
"uploadStyle === 'drag'"
></i>
<div
class=
"el-upload__text"
v-if=
"uploadStyle === 'drag'"
>
将文件拖到此处,或
<em>
点击上传
</em></div>
<!--文件上传-->
...
...
@@ -10,12 +10,12 @@
</el-upload>
<!-- 文件列表 -->
<transition-group
class=
"upload-file-list el-upload-list el-upload-list--text"
name=
"el-fade-in-linear"
tag=
"ul"
>
<li
:key=
"index"
class=
"el-upload-list__item ele-upload-list__item-content"
v-for=
"(file, index) in
data
"
>
<li
:key=
"index"
class=
"el-upload-list__item ele-upload-list__item-content"
v-for=
"(file, index) in
list
"
>
<el-link
:href=
"`$
{baseUrl}${file.url}`" :underline="false" target="_blank">
<span
class=
"el-icon-document"
>
{{
file
.
name
}}
</span>
</el-link>
<div
class=
"ele-upload-list__item-content-action"
>
<el-link
:underline=
"false"
@
click=
"handleDelete(index)"
type=
"danger"
>
删除
</el-link>
<el-link
:underline=
"false"
@
click=
"handle
r().handel
Delete(index)"
type=
"danger"
>
删除
</el-link>
</div>
</li>
</transition-group>
...
...
@@ -59,6 +59,11 @@ export default{
sizeLimit
:
{
type
:
Number
,
default
:
3000
,
},
// 类型
dataType
:
{
type
:
String
,
default
:
'array'
,
},
fileSize
:{
type
:
Number
,
...
...
@@ -97,6 +102,7 @@ export default{
return
{
index
:
null
,
data
:
[],
list
:[],
qiniuToken
:
''
,
baseUrl
:
process
.
env
.
VUE_APP_BASE_API
,
imgDomain
:
''
,
...
...
@@ -165,16 +171,17 @@ export default{
},
watch: {
value(value) {
this.
data
= this.init().data(value)
this.
list
= this.init().data(value)
},
data() {
this.$emit('
input
', this.data)
this.data = this.list;
this.$emit('
input
', this.init().value(this.data))
this.$emit('
on
-
success
', this.data)
},
},
created() {
this.index = null;
this.
data = this.value
this.
list = this.init().data(this.value);
this.init().token()
},
methods: {
...
...
@@ -281,8 +288,7 @@ export default{
name:file.name,
url:link
}
this.data = this.data.push(attrs);
this.$refs.upload.clearFiles();
this.data = this.list.push(attrs);
},
// 文件个数超出
handleExceed:(file,fileList)=>{
...
...
@@ -314,6 +320,10 @@ export default{
this.data = ''
this.$emit('
delete
')
},
//删除文件
handelDelete:(index)=>{
this.data = this.list.splice(index,1);
},
}
},
/**
...
...
packages/form/upload/src/upload-img.vue
View file @
29cdcdb6
...
...
@@ -196,7 +196,7 @@ export default{
handler() {
return {
// 图片上传成功回调
imageSuccess: (
{ data }
) => {
imageSuccess: (
data
) => {
const { url } = data
this.data = url
},
...
...
packages/form/upload/src/upload-video.vue
View file @
29cdcdb6
<
template
>
<div>
<el-upload
ref=
"upload"
:show-file-list=
"false"
:on-preview=
"handler().handlePreview()"
:on-progress=
"(event, file, fileList)=>handler().uploadVideoProcess(event, file, fileList)"
:file-list=
"data"
:list-type=
"listType"
:on-exceed=
"(files, fileList)=>handler().handleExceed(files,fileList
)"
:drag=
"uploadStyle === 'drag' ? true : false"
:limit=
"limit"
:on-success=
"(file) => handler().imageSuccess(file)"
:action=
"uploadDomain"
:before-upload=
"init().beforeUpload"
:multiple=
"multiple"
:headers=
"headers"
class=
"avatar-uploader"
>
<el-upload
ref=
"upload"
:show-file-list=
"false"
:on-progress=
"(event, file)=>handler().uploadVideoProcess(event, file)"
:list-type=
"listType"
:on-exceed=
"(files)=>handler().handleExceed(files
)"
:drag=
"uploadStyle === 'drag' ? true : false"
:limit=
"limit"
:on-success=
"(file) => handler().imageSuccess(file)"
:action=
"uploadDomain"
:before-upload=
"init().beforeUpload"
:multiple=
"multiple"
:headers=
"headers"
class=
"avatar-uploader"
>
<!--视频-->
<div
v-if=
"
data
.length >0"
style=
"display:inline"
@
click
.
stop=
"handler().getIndex(index)"
>
<div
v-for=
"(item,index) in
data
"
:key=
"index"
style=
"float:left;"
@
click
.
stop=
"handler().getIndex(index)"
>
<div
v-if=
"
list
.length >0"
style=
"display:inline"
@
click
.
stop=
"handler().getIndex(index)"
>
<div
v-for=
"(item,index) in
list
"
:key=
"index"
style=
"float:left;"
@
click
.
stop=
"handler().getIndex(index)"
>
<div
:style=
"style"
class=
"avatar video-box"
>
<i
class=
"el-icon-close delete-icon"
title=
"删除"
@
click
.
stop=
"
data.splice(index, 1
)"
/>
<i
class=
"el-icon-close delete-icon"
title=
"删除"
@
click
.
stop=
"
handler().handelDelete(index
)"
/>
<video
id=
"myVideo"
:src=
"item.url"
:autoplay=
"autoplay == true ? 'autoplay' : false"
...
...
@@ -86,6 +86,11 @@ export default{
preload
:{
type
:
Boolean
,
default
:
false
,
},
// 类型
dataType
:
{
type
:
String
,
default
:
'array'
,
},
// 是否多选
multiple
:
{
...
...
@@ -148,6 +153,7 @@ export default{
return
{
index
:
null
,
data
:
''
,
list
:[],
qiniuToken
:
''
,
baseUrl
:
process
.
env
.
VUE_APP_BASE_API
,
videoFlag
:
false
,
...
...
@@ -228,16 +234,17 @@ export default{
},
watch: {
value(value) {
this.
data
= this.init().data(value)
this.
list
= this.init().data(value)
},
data() {
this.$emit('
input
', this.data)
this.data = this.list;
this.$emit('
input
', this.init().value(this.data))
this.$emit('
on
-
success
', this.data)
},
},
created() {
this.index = null;
this.
data = this.value
this.
list = this.init().data(this.value);
this.init().token()
},
methods: {
...
...
@@ -356,11 +363,11 @@ export default{
this.isShowUploadVideo = true;
this.videoFlag = false;
this.videoUploadPercent = 0;
this.data = this.index != null ? this.
data.splice(this.index,1,attr) : this.data
.push(attr);
this.$refs.upload.clearFiles();
this.data = this.index != null ? this.
list.splice(this.index,1,attr) : this.list
.push(attr);
//
this.$refs.upload.clearFiles();
},
//进度条
uploadVideoProcess:(event, file
, fileList
)=>{
uploadVideoProcess:(event, file)=>{
this.videoFlag = true;
this.videoUploadPercent = file.percentage.toFixed(0) * 1;
},
...
...
@@ -369,7 +376,7 @@ export default{
this.index = index;
},
// 文件个数超出
handleExceed:(file
,fileList
)=>{
handleExceed:(file)=>{
this.$message.error(`上传文件数量不能超过 ${this.limit} 个!`);
},
handlePreview:(file)=>{
...
...
@@ -411,6 +418,10 @@ export default{
this.data = ''
this.$emit('
delete
')
},
//删除视频
handelDelete:(index)=>{
this.data = this.list.splice(index,1);
},
}
},
/**
...
...
packages/form/upload/src/upload.vue
View file @
29cdcdb6
...
...
@@ -91,7 +91,7 @@ export default {
},
limit
:
{
// 图片上传数量限制,默认10
type
:
Number
,
default
:
1
,
default
:
1
0
,
},
value
:
{
type
:
[
String
,
Object
,
Array
],
...
...
packages/layout/src/layout-form.vue
View file @
29cdcdb6
...
...
@@ -49,7 +49,7 @@
:ref=
"form[item.field]"
v-model=
"form[item.field]"
:type=
"item.type"
:limit=
"(item.upload && item.upload.limit) ||
1
"
:limit=
"(item.upload && item.upload.limit) ||
5
"
:size=
"(item.upload && item.upload.size) || 100"
:dataType=
"(item.upload && item.upload.dataType) || 'array'"
:edit=
"(item.upload && item.upload.edit) || true"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment