Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cust_web
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张伯涛
cust_web
Commits
8270fee1
Commit
8270fee1
authored
Jan 17, 2025
by
罗林杰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改活动发布
parent
62be76e8
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
89 additions
and
21 deletions
+89
-21
opmArticle.js
src/api/contentManagement/opmArticle.js
+8
-0
index.vue
src/views/contentManagement/activity/index.vue
+4
-2
index.vue
src/views/operationsManagement/article/index.vue
+77
-19
No files found.
src/api/contentManagement/opmArticle.js
View file @
8270fee1
...
@@ -74,3 +74,11 @@ export function deleteComment(businessId) {
...
@@ -74,3 +74,11 @@ export function deleteComment(businessId) {
method
:
'delete'
method
:
'delete'
})
})
}
}
// oss查询图片路径
export
function
getOssUrl
(
id
)
{
return
request
({
url
:
'/common/getOssUrl?businessId='
+
id
,
method
:
'GET'
})
}
src/views/contentManagement/activity/index.vue
View file @
8270fee1
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
</el-form-item>
</el-form-item>
<el-form-item
label=
"置顶:"
prop=
"isTop"
>
<el-form-item
label=
"置顶:"
prop=
"isTop"
>
<el-select
v-model=
"queryParams.isTop"
placeholder=
"请选择置顶状态"
style=
"width: 150px"
clearable
>
<el-select
v-model=
"queryParams.isTop"
placeholder=
"请选择置顶状态"
style=
"width: 150px"
clearable
>
<el-option
v-for=
"item in yesOrNo"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value"
/>
<el-option
v-for=
"item in yesOrNo"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value"
/>
</el-select>
</el-select>
</el-form-item>
</el-form-item>
<el-form-item
label=
"推荐:"
prop=
"isRecommended"
>
<el-form-item
label=
"推荐:"
prop=
"isRecommended"
>
...
@@ -162,6 +162,7 @@
...
@@ -162,6 +162,7 @@
@
click=
"handleView(scope.row)"
@
click=
"handleView(scope.row)"
>
查看
</el-button>
>
查看
</el-button>
<el-button
<el-button
v-if=
"scope.row.publishStatus!='1'"
v-has-permi=
"hasUpdatePerm"
v-has-permi=
"hasUpdatePerm"
:class=
"commonField.updateClass"
:class=
"commonField.updateClass"
:type=
"commonField.typeParent"
:type=
"commonField.typeParent"
...
@@ -169,6 +170,7 @@
...
@@ -169,6 +170,7 @@
@
click=
"handleUpdate(scope.row)"
@
click=
"handleUpdate(scope.row)"
>
编辑
</el-button>
>
编辑
</el-button>
<el-button
<el-button
v-if=
"scope.row.publishStatus!='1'"
:class=
"commonField.resetPasClass"
:class=
"commonField.resetPasClass"
:type=
"commonField.typeParent"
:type=
"commonField.typeParent"
:size=
"commonField.size"
:size=
"commonField.size"
...
@@ -309,7 +311,7 @@
...
@@ -309,7 +311,7 @@
import
commonField
from
'@/utils/commonField'
import
commonField
from
'@/utils/commonField'
import
{
import
{
delCmsActivity
,
delCmsActivity
,
listCmsActivity
,
updatePushStatus
,
updateStatus
listCmsActivity
,
updatePushStatus
}
from
'@/api/contentManagement/activity'
}
from
'@/api/contentManagement/activity'
import
{
parseTime
}
from
'@/utils'
import
{
parseTime
}
from
'@/utils'
import
{
getDataCache
,
setDataCache
}
from
'@/assets/js/filterData'
import
{
getDataCache
,
setDataCache
}
from
'@/assets/js/filterData'
...
...
src/views/operationsManagement/article/index.vue
View file @
8270fee1
...
@@ -136,20 +136,41 @@
...
@@ -136,20 +136,41 @@
</div>
</div>
<!-- 详情弹窗 -->
<!-- 详情弹窗 -->
<el-dialog
:title=
"title"
:visible
.
sync=
"open"
width=
"
7
00px"
append-to-body
>
<el-dialog
:title=
"title"
:visible
.
sync=
"open"
width=
"
5
00px"
append-to-body
>
<el-form
ref=
"deviceFormRef"
:model=
"form"
label-position=
"right"
label-width=
"auto"
>
<el-form
ref=
"deviceFormRef"
:model=
"form"
label-position=
"right"
label-width=
"auto"
>
<el-row
:gutter=
"20"
>
<el-row
:gutter=
"20"
>
<el-col
:span=
"24"
>
<el-col
:span=
"24"
>
<span
style=
"font-size: 20px;font-weight: bold;padding-left: 20px"
>
内容:
</span>
<span
style=
"font-size: 20px;font-weight: bold;padding-left: 20px"
>
内容:
</span>
<div
style=
"font-size: 15px;padding-left: 20px;padding-bottom: 20px;padding-top: 10px"
class=
"content"
>
{{ form.content }}
</div>
<div
style=
"font-size: 15px;padding-left: 20px;padding-bottom: 20px;padding-top: 10px"
class=
"content"
>
{{ form.content }}
</div>
</el-col>
</el-col>
<el-row
:gutter=
"20"
>
<div>
<el-col
v-for=
"(imagePath, index) in form.url"
:key=
"index"
:span=
"7"
>
<!-- 当没有图片时 -->
<div
style=
"padding-left: 20px;padding-bottom: 20px"
>
<div
v-if=
"!form.url || form.url.length === 0"
style=
"text-align: center; color: #999;"
>
<img
:src=
"imagePath"
alt=
"Avatar"
class=
"avatar"
>
没有图片
</div>
<!-- 当图片数量为1时 -->
<div
v-else-if=
"form.url.length === 1"
style=
"text-align: center;"
>
<img
:src=
"form.url[0]"
alt=
"Avatar"
class=
"avatar1"
>
</div>
<!-- 当图片数量为4或6时,上下两排展示 -->
<div
v-else-if=
"form.url.length === 4 || form.url.length === 2"
>
<el-row
v-for=
"(row, rowIndex) in Math.ceil(form.url.length / 2)"
:key=
"rowIndex"
:gutter=
"20"
>
<el-col
v-for=
"(imagePath, index) in form.url.slice(rowIndex * 2, rowIndex * 2 + 2)"
:key=
"index"
:span=
"12"
>
<div
style=
"padding: 10px;"
>
<img
:src=
"imagePath"
alt=
"Avatar"
class=
"avatar3"
>
</div>
</el-col>
</el-row>
</div>
<!-- 当图片数量为5, 7, 8或9时,按九宫格显示 -->
<el-row
v-else
:gutter=
"20"
>
<el-col
v-for=
"(imagePath, index) in form.url"
:key=
"index"
:span=
"8"
>
<div
style=
"padding: 10px;"
>
<img
:src=
"imagePath"
alt=
"Avatar"
class=
"avatar2"
>
</div>
</div>
</el-col>
</el-col>
</el-row>
</el-row>
</div>
<el-col
:span=
"12"
>
<el-col
:span=
"12"
>
<span
style=
"font-size: 15px;padding-left: 20px"
>
评论数:{{ form.commentCount }}
</span>
<span
style=
"font-size: 15px;padding-left: 20px"
>
评论数:{{ form.commentCount }}
</span>
</el-col>
</el-col>
...
@@ -226,7 +247,7 @@ import { getDataCache, setDataCache } from '@/assets/js/filterData'
...
@@ -226,7 +247,7 @@ import { getDataCache, setDataCache } from '@/assets/js/filterData'
import
{
import
{
deleteComment
,
deleteComment
,
delOpmArticle
,
delOpmArticle
,
getOpmArticle
,
getOpmArticle
,
getOssUrl
,
listOpmArticle
,
listOpmArticle
,
updateOpmArticle
updateOpmArticle
}
from
'@/api/contentManagement/opmArticle'
}
from
'@/api/contentManagement/opmArticle'
...
@@ -386,8 +407,15 @@ export default {
...
@@ -386,8 +407,15 @@ export default {
getOpmArticle
(
id
).
then
(
response
=>
{
getOpmArticle
(
id
).
then
(
response
=>
{
this
.
form
=
response
.
data
this
.
form
=
response
.
data
// 处理图片url 将url按逗号分隔成数组
// 处理图片url 将url按逗号分隔成数组
if
(
this
.
form
.
url
!=
null
&&
this
.
form
.
url
!==
''
)
{
if
(
response
.
data
.
pictureId
!==
''
&&
response
.
data
.
pictureId
!==
null
)
{
this
.
form
.
url
=
this
.
form
.
url
.
split
(
','
)
const
urlArray
=
JSON
.
parse
(
response
.
data
.
pictureId
)
const
url
=
[]
urlArray
.
id
.
forEach
(
item
=>
{
getOssUrl
(
item
).
then
(
imgRes
=>
{
url
.
push
(
imgRes
.
data
)
})
})
this
.
form
.
url
=
url
}
}
this
.
title
=
this
.
form
.
memCode
this
.
title
=
this
.
form
.
memCode
this
.
open
=
true
this
.
open
=
true
...
@@ -401,14 +429,23 @@ export default {
...
@@ -401,14 +429,23 @@ export default {
const
id
=
row
.
businessId
const
id
=
row
.
businessId
getOpmArticle
(
id
).
then
(
response
=>
{
getOpmArticle
(
id
).
then
(
response
=>
{
this
.
form
=
response
.
data
this
.
form
=
response
.
data
// 处理图片url 将url按逗号分隔成数组
// 处理图片url
if
(
this
.
form
.
url
!=
null
&&
this
.
form
.
url
!==
''
)
{
if
(
response
.
data
.
pictureId
!==
''
&&
response
.
data
.
pictureId
!==
null
)
{
this
.
form
.
url
=
this
.
form
.
url
.
split
(
','
)
const
urlArray
=
JSON
.
parse
(
response
.
data
.
pictureId
)
const
url
=
[]
urlArray
.
id
.
forEach
(
item
=>
{
getOssUrl
(
item
).
then
(
imgRes
=>
{
url
.
push
(
imgRes
.
data
)
})
})
this
.
form
.
url
=
url
}
}
this
.
title
=
this
.
form
.
memCode
this
.
title
=
this
.
form
.
memCode
this
.
open
=
true
this
.
open
=
true
this
.
isEdit
=
true
this
.
isEdit
=
true
if
(
this
.
form
.
articleCommentVOList
!==
null
&&
this
.
form
.
articleCommentVOList
.
length
>
0
)
{
this
.
getComment
()
this
.
getComment
()
}
})
})
},
},
getComment
()
{
getComment
()
{
...
@@ -418,13 +455,13 @@ export default {
...
@@ -418,13 +455,13 @@ export default {
const
rootComments
=
[]
const
rootComments
=
[]
// 首先填充映射表
// 首先填充映射表
this
.
form
.
articleComment
DT
OList
.
forEach
(
comment
=>
{
this
.
form
.
articleComment
V
OList
.
forEach
(
comment
=>
{
comment
.
children
=
[]
// 为每个评论添加 children 属性
comment
.
children
=
[]
// 为每个评论添加 children 属性
commentMap
.
set
(
comment
.
businessId
,
comment
)
commentMap
.
set
(
comment
.
businessId
,
comment
)
})
})
// 再次遍历评论列表,这次是为了设置父子关系
// 再次遍历评论列表,这次是为了设置父子关系
this
.
form
.
articleComment
DT
OList
.
forEach
(
comment
=>
{
this
.
form
.
articleComment
V
OList
.
forEach
(
comment
=>
{
if
(
comment
.
parentId
===
null
)
{
if
(
comment
.
parentId
===
null
)
{
// 如果是顶级评论,直接添加到 rootComments
// 如果是顶级评论,直接添加到 rootComments
rootComments
.
push
(
comment
)
rootComments
.
push
(
comment
)
...
@@ -487,7 +524,7 @@ export default {
...
@@ -487,7 +524,7 @@ export default {
return
deleteComment
(
row
.
businessId
)
return
deleteComment
(
row
.
businessId
)
}).
then
(()
=>
{
}).
then
(()
=>
{
// 使用 filter 创建一个新的数组,并重新赋值给 this.form.comments
// 使用 filter 创建一个新的数组,并重新赋值给 this.form.comments
this
.
form
.
comments
=
this
.
form
.
comments
.
filter
(
comment
=>
comment
.
businessId
!==
row
.
businessId
)
this
.
form
.
articleCommentVOList
=
this
.
form
.
articleCommentVOList
.
filter
(
comment
=>
comment
.
businessId
!==
row
.
businessId
)
this
.
$forceUpdate
()
this
.
$forceUpdate
()
// 触发视图更新
// 触发视图更新
this
.
$nextTick
(()
=>
{
this
.
$nextTick
(()
=>
{
...
@@ -507,7 +544,7 @@ export default {
...
@@ -507,7 +544,7 @@ export default {
return
deleteComment
(
row
.
businessId
)
return
deleteComment
(
row
.
businessId
)
}).
then
(()
=>
{
}).
then
(()
=>
{
// 遍历找到对应的父评论,并更新其子评论
// 遍历找到对应的父评论,并更新其子评论
this
.
form
.
comments
.
forEach
(
comment
=>
{
this
.
form
.
articleCommentVOList
.
forEach
(
comment
=>
{
if
(
comment
.
businessId
===
row
.
parentId
)
{
if
(
comment
.
businessId
===
row
.
parentId
)
{
comment
.
children
=
comment
.
children
.
filter
(
reply
=>
reply
.
businessId
!==
row
.
businessId
)
comment
.
children
=
comment
.
children
.
filter
(
reply
=>
reply
.
businessId
!==
row
.
businessId
)
}
}
...
@@ -597,4 +634,25 @@ export default {
...
@@ -597,4 +634,25 @@ export default {
}
}
}
}
}
}
.avatar1
{
width
:
280px
;
height
:
240px
;
display
:
block
;
margin
:
0
auto
;
}
.avatar2
{
width
:
120px
;
height
:
100px
;
display
:
block
;
}
.avatar3
{
width
:
200px
;
height
:
178px
;
display
:
block
;
}
.avatar4
{
width
:
200px
;
height
:
178px
;
display
:
block
;
}
</
style
>
</
style
>
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