Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas_plus
/
dj-car-life-system
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 4811da74
authored
Mar 16, 2024
by
zhangquan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
细节优化
1 parent
b2b4f04e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
100 additions
and
65 deletions
src/views/contentManager/components/preview/index.vue
src/views/contentManager/components/uploadPdf/index.vue
src/views/contentManager/contentAdd.vue
src/views/contentManager/contentManagerList.vue
src/views/contentManager/components/preview/index.vue
View file @
4811da7
...
...
@@ -2,7 +2,7 @@
<div
class=
"activity-img-box"
>
<template
v-if=
"imageUrlArr && imageUrlArr.length > 0"
>
<div
v-for=
"(item, index) in imageUrlArr"
:key=
"index"
>
<div
v-if=
"picOptions.type == 'video'"
>
<
!--
<
div
v-if=
"picOptions.type == 'video'"
>
<video
controls
class=
"pic-box"
...
...
@@ -12,6 +12,27 @@
<div
class=
"pic-pane-close"
@
click=
"handleEnlarge(item, 'video')"
>
<img
:src=
"require('@/assets/view.png')"
alt=
""
/>
</div>
</div>
-->
<div
class=
"pic-box"
:style=
"
{ width: picOptions.width, height: picOptions.height }"
v-if="picOptions.type == 'video'"
>
<video
id=
"video"
width=
"100%"
height=
"100%"
preload
loop
muted
>
<source
:src=
"item"
type=
"video/mp4"
/>
</video>
<div
class=
"mask"
>
<div
class=
"pic-pane-close"
@
click=
"handleEnlarge(item, 'video')"
>
<img
:src=
"require('@/assets/view.png')"
alt=
""
/>
</div>
<div
class=
"pic-pane-close"
@
click=
"close('video', index)"
v-if=
"picOptions.isClose"
>
<img
:src=
"require('@/assets/icon-delete.png')"
alt=
""
/>
</div>
</div>
</div>
<div
class=
"pic-box"
...
...
@@ -41,7 +62,10 @@
(imageUrlArr && imageUrlArr.length == 0 && limit == 1)
"
>
<div
class=
"upload-img"
>
<div
class=
"upload-img"
:style=
"
{ width: picOptions.width, height: picOptions.height }"
>
<i
class=
"el-icon-plus avatar-uploader-desc-icon"
></i>
<div
class=
"avatar-uploader-desc-word"
>
上传
{{
picOptions
.
type
==
"video"
?
"视频"
:
"图片"
}}
...
...
@@ -50,6 +74,7 @@
type=
"file"
ref=
"uploadImg"
class=
"upload-img"
:style=
"
{ width: picOptions.width, height: picOptions.height }"
style="opacity: 0"
:accept="picOptions.type == 'video' ? '.mp4' : '.jpg, .jpeg, .png,'"
@change="(e) => handleImgChange(e)"
...
...
@@ -103,14 +128,14 @@ export default {
methods
:
{
// 上传图片
handleImgChange
(
e
)
{
this
.
$notify
({
title
:
"提示"
,
message
:
`
${
this
.
picOptions
.
type
==
"video"
?
"视频"
:
"图片"
}
上传中,请稍后
`
})
var
file
=
e
.
srcElement
.
files
[
0
]
var
reader
=
new
FileReader
()
if
(
this
.
picOptions
.
type
==
"video"
&&
file
.
type
?.
indexOf
(
"mp4"
)
==
-
1
)
{
return
this
.
$message
.
error
(
`上传文件不是mp4的格式!`
)
}
if
(
this
.
picOptions
.
type
!=
"video"
&&
!
/jpg|jpeg|png/i
.
test
(
file
.
type
))
{
return
this
.
$message
.
error
(
`上传图片不是jpg、jpeg或png的格式!`
)
}
// 默认1MB
const
limitSize
=
this
.
picOptions
.
limitSize
||
10
const
isLt
=
file
.
size
/
1024
/
1024
<
limitSize
...
...
@@ -130,6 +155,12 @@ export default {
)
return
}
this.$notify({
title: "提示",
message: `
$
{
this
.
picOptions
.
type
==
"video"
?
"视频"
:
"图片"
}
上传中,请稍后
`
})
this.$emit("beforeUpload")
reader.readAsDataURL(file)
reader.onload = (e) => {
...
...
@@ -158,10 +189,10 @@ export default {
index: this.index
})
}
e.target.value = ""
})
.finally((end) => {
this.$refs.uploadImg.value = ""
this.$refs.uploadImg && (this.$refs.uploadImg.value = "")
e.target.value = ""
this.$emit("afterUpload", end)
})
}
...
...
@@ -174,23 +205,13 @@ export default {
},
// 删除图片/视频
close(type, index) {
switch (type) {
case "radio":
this.videoUrl = ""
this.videoImage = ""
break
case "img":
this.imageUrlArr.splice(index, 1)
this.$emit("change", {
arr: this.imageUrlArr,
key: this.picOptions.key,
id: 1,
index: this.index
})
break
default:
this.videoUrl = ""
}
this.imageUrlArr.splice(index, 1)
this.$emit("change", {
arr: this.imageUrlArr,
key: this.picOptions.key,
id: 1,
index: this.index
})
}
}
}
...
...
@@ -202,8 +223,6 @@ export default {
max-width
:
600px
;
.pic-box
{
position
:
relative
;
width
:
104px
;
height
:
104px
;
border-radius
:
4px
;
margin-right
:
8px
;
margin-bottom
:
5px
;
...
...
@@ -229,8 +248,8 @@ export default {
opacity
:
0
;
top
:
0
;
right
:
0
;
width
:
104px
;
height
:
104px
;
left
:
0
;
bottom
:
0
;
z-index
:
999
;
.pic-pane-close
{
width
:
16px
;
...
...
@@ -252,8 +271,6 @@ export default {
flex-direction
:
column
;
align-items
:
center
;
justify-content
:
center
;
width
:
104px
;
height
:
104px
;
background
:
rgba
(
0
,
0
,
0
,
0.04
);
border
:
1px
dashed
rgba
(
0
,
0
,
0
,
0.15
);
border-radius
:
4px
;
...
...
@@ -262,8 +279,6 @@ export default {
position
:
absolute
;
//
top
:
0
;
//
left
:
0
;
width
:
104px
;
height
:
104px
;
}
}
.avatar-uploader-desc-word
{
...
...
src/views/contentManager/components/uploadPdf/index.vue
View file @
4811da7
...
...
@@ -95,12 +95,11 @@ export default {
methods
:
{
// 上传图片
handleImgChange
(
e
)
{
this
.
$notify
({
title
:
"提示"
,
message
:
`pdf上传中,请稍后`
})
var
file
=
e
.
srcElement
.
files
[
0
]
var
reader
=
new
FileReader
()
if
(
file
.
type
?.
indexOf
(
"pdf"
)
==
-
1
)
{
return
this
.
$message
.
error
(
`上传文件不是pdf的格式!`
)
}
// 默认1MB
const
limitSize
=
this
.
picOptions
.
limitSize
||
10
const
isLt
=
file
.
size
/
1024
/
1024
<
limitSize
...
...
@@ -112,6 +111,10 @@ export default {
this
.
$message
.
error
(
`最多上传
${
this
.
limit
}
个pdf文件`
)
return
}
this
.
$notify
({
title
:
"提示"
,
message
:
`pdf上传中,请稍后`
})
this
.
$emit
(
"beforeUpload"
)
const
idx
=
this
.
imageUrlArr
.
length
this
.
$set
(
this
.
imageUrlArr
,
idx
,
{
imageName
:
file
.
name
,
image
:
""
})
...
...
src/views/contentManager/contentAdd.vue
View file @
4811da7
...
...
@@ -37,6 +37,7 @@
</el-form-item>
<el-form-item
label-width=
"120px"
label=
"封面:"
prop=
"cover"
>
<glsx-preview
:picOptions=
"coverOptions"
:imageUrlArr=
"formData.cover"
limit=
"1"
></glsx-preview>
...
...
@@ -67,7 +68,7 @@
limit=
"10"
></glsx-preview>
<p
class=
"photo-top-tips"
>
支持 .jpg .png,单个文件不超过10M,最多上传10个文件
支持 .jpg .
jpeg .
png,单个文件不超过10M,最多上传10个文件
</p>
</div>
<div
v-if=
"formData.type == 1"
>
...
...
@@ -190,7 +191,12 @@
<el-button
type=
"primary"
class=
"width_100"
@
click=
"confirmAdd(1)"
>
保存并使用
</el-button
>
<el-button
type=
"primary"
plain
class=
"width_100"
@
click=
"commitFn(0)"
<el-button
type=
"primary"
plain
class=
"width_100"
@
click=
"commitFn(0)"
v-if=
"!routeInfo.status"
>
存草稿
</el-button
>
<el-button
class=
"width_100 cancel-btn"
@
click=
"handleCancel"
...
...
@@ -242,16 +248,22 @@ export default {
merchantVisible
:
false
,
brandVisible
:
false
,
tableData
:
[],
coverOptions
:
{
width
:
"88px"
,
height
:
"88px"
,
isClose
:
true
,
limitSize
:
1
},
picOptions
:
{
width
:
"
104
px"
,
height
:
"
104
px"
,
width
:
"
88
px"
,
height
:
"
88
px"
,
isClose
:
true
,
limitSize
:
10
,
type
:
"img"
},
videoOptions
:
{
width
:
"
104
px"
,
height
:
"
104
px"
,
width
:
"
88
px"
,
height
:
"
88
px"
,
isClose
:
true
,
limitSize
:
200
,
type
:
"video"
...
...
@@ -264,10 +276,12 @@ export default {
},
formData
:
{
title
:
""
,
type
:
0
,
type
:
1
,
cover
:
[],
subtitle
:
""
,
imageList
:
[],
imageList
:
[
"http://qcimg01.glsx.com.cn:7060/group1/M00/06/80/wKgD3mX0-0qAchRTAIh_w-FpA1U588.mp4"
],
scene
:
""
,
showChannel
:
0
,
showMerchant
:
0
...
...
@@ -348,12 +362,14 @@ export default {
prop
:
"label"
}
]
}
},
routeInfo
:
{}
}
},
mounted
()
{
const
{
id
}
=
this
.
$route
.
params
this
.
routeInfo
=
this
.
$route
.
params
if
(
id
)
this
.
getDetail
()
},
...
...
@@ -377,22 +393,13 @@ export default {
this
.
formData
[
key
]
=
res
[
key
]
}
}
console
.
log
(
res
)
this
.
tableData
=
res
?.
assignInfos
||
[]
}
})
},
clearTableFn
()
{
this
.
tableData
=
[]
},
handleImgChange
()
{},
handleImgLook
(
src
)
{
this
.
lookImgVisible
=
true
this
.
dialogObj
=
{
url
:
src
,
uploadType
:
"photo"
}
},
handleImgDelete
()
{},
getParams
(
type
)
{
const
params
=
deepClone
(
this
.
formData
)
params
.
cover
=
params
.
cover
[
0
]
...
...
@@ -419,12 +426,20 @@ export default {
return
params
},
confirmAdd
(
type
)
{
this
.
$refs
.
ruleForm
.
validate
((
valid
)
=>
{
this
.
$refs
.
channelForm
.
validate
((
cvalid
)
=>
{
if
(
valid
&&
cvalid
)
{
this
.
commitFn
(
type
)
}
})
this
.
$confirm
(
"删除后内容不可恢复"
,
"提示"
,
{
confirmButtonText
:
"确定"
,
cancelButtonText
:
"取消"
,
type
:
"warning"
}).
then
((
end
)
=>
{
if
(
end
==
"confirm"
)
{
this
.
$refs
.
ruleForm
.
validate
((
valid
)
=>
{
this
.
$refs
.
channelForm
.
validate
((
cvalid
)
=>
{
if
(
valid
&&
cvalid
)
{
this
.
commitFn
(
type
)
}
})
})
}
})
},
commitFn
(
type
)
{
...
...
@@ -442,7 +457,8 @@ export default {
})
},
openMerchantDialog
()
{
if
(
!
this
.
formData
.
scene
)
return
this
.
$message
.
error
(
"请先选择业务场景"
)
if
(
!
this
.
formData
.
scene
&&
this
.
formData
.
scene
!==
0
)
return
this
.
$message
.
error
(
"请先选择业务场景"
)
if
(
this
.
formData
.
showMerchant
==
1
)
{
this
.
brandVisible
=
true
}
else
{
...
...
src/views/contentManager/contentManagerList.vue
View file @
4811da7
...
...
@@ -335,6 +335,7 @@ export default {
}
if
(
row
?.
id
)
{
params
.
id
=
row
.
id
params
.
status
=
row
.
status
}
this
.
$router
.
push
({
name
:
"contentAdd"
,
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment