Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
江名洋
/
linkwe-scrm
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 1d4aa3f4
authored
Jul 19, 2023
by
xinla
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
内容中心素材新增分组刷新优化
1 parent
974183a8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
90 additions
and
193 deletions
vue3-lw-pc/src/views/contentCenter/components/MaPage.vue
vue3-lw-pc/src/views/contentCenter/components/MaPage.vue
View file @
1d4aa3f
...
...
@@ -145,9 +145,7 @@ export default {
categoryId
:
[{
required
:
true
,
message
:
'不能为空'
,
trigger
:
'change'
}],
content
:
[{
required
:
true
,
message
:
'不能为空'
,
trigger
:
'blur'
}],
materialUrl
:
[{
required
:
true
,
message
:
'不能为空'
,
trigger
:
'change'
}],
weMaterialImgAoList
:
[
{
type
:
'array'
,
required
:
true
,
message
:
'不能为空'
,
trigger
:
'change'
},
],
weMaterialImgAoList
:
[{
type
:
'array'
,
required
:
true
,
message
:
'不能为空'
,
trigger
:
'change'
}],
digest
:
[{
required
:
true
,
message
:
'不能为空'
,
trigger
:
'blur'
}],
coverUrl
:
[{
required
:
true
,
message
:
'不能为空'
,
trigger
:
'blur'
}],
html
:
[
...
...
@@ -190,8 +188,8 @@ export default {
computed
:
{},
created
()
{
this
.
query
.
mediaType
=
this
.
type
this
.
getTree
()
this
.
getCodeCategoryListFn
()
this
.
getTree
(
true
)
//
this.getCodeCategoryListFn()
},
mounted
()
{
this
.
mobForm
[
0
].
mediaType
=
this
.
type
...
...
@@ -235,25 +233,21 @@ export default {
}
this
.
groupVisible
=
true
},
getCodeCategoryListFn
()
{
getCodeCategoryList
({
mediaType
:
this
.
type
}).
then
((
res
)
=>
{
if
(
res
.
code
==
200
)
{
this
.
groupList
=
res
.
data
this
.
query
.
categoryId
=
this
.
groupList
[
0
].
id
this
.
groupIndex
=
0
this
.
query
.
pageNum
=
1
this
.
getList
()
}
})
},
//
getCodeCategoryListFn() {
//
getCodeCategoryList({ mediaType: this.type }).then((res) => {
//
if (res.code == 200) {
//
this.groupList = res.data
//
this.query.categoryId = this.groupList[0].id
//
this.groupIndex = 0
//
this.query.pageNum = 1
//
this.getList()
//
}
//
})
//
},
switchGroup
(
index
,
data
)
{
this
.
groupIndex
=
index
this
.
query
.
categoryId
=
data
.
id
this
.
search
()
},
search
()
{
this
.
query
.
pageNum
=
1
this
.
getList
()
this
.
getList
(
1
)
},
// 新增分组
onAddOrUpdateGroup
()
{
...
...
@@ -267,18 +261,16 @@ export default {
this
.
groupForm
=
obj
}
if
(
validate
)
{
;(
this
.
groupForm
.
id
?
updateCodeCategory
:
addCodeCategory
)(
this
.
groupForm
).
then
(
(
res
)
=>
{
this
.
groupVisible
=
false
this
.
groupForm
=
{
name
:
''
,
mediaType
:
this
.
type
,
}
this
.
$refs
.
groupForm
.
clearValidate
()
this
.
getCodeCategoryListFn
()
this
.
getTree
()
;(
this
.
groupForm
.
id
?
updateCodeCategory
:
addCodeCategory
)(
this
.
groupForm
).
then
((
res
)
=>
{
this
.
groupVisible
=
false
this
.
groupForm
=
{
name
:
''
,
mediaType
:
this
.
type
,
}
)
this
.
$refs
.
groupForm
.
clearValidate
()
// this.getCodeCategoryListFn()
this
.
getTree
()
})
}
})
},
...
...
@@ -298,21 +290,17 @@ export default {
this
.
groupVisible
=
true
},
removeGroup
(
id
)
{
this
.
$confirm
(
'是否确认删除当前分组?删除后该分组下素材移动到默认分组中,该操作不可撤销,请谨慎操作。'
,
'提示'
,
{
confirmButtonText
:
'确定'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
,
}
)
this
.
$confirm
(
'是否确认删除当前分组?删除后该分组下素材移动到默认分组中,该操作不可撤销,请谨慎操作。'
,
'提示'
,
{
confirmButtonText
:
'确定'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
,
})
.
then
(()
=>
{
this
.
delObj
.
ids
=
[]
this
.
delObj
.
ids
.
push
(
id
)
delAndRemoves
(
this
.
delObj
).
then
((
res
)
=>
{
this
.
getCodeCategoryListFn
()
this
.
getTree
()
//
this.getCodeCategoryListFn()
this
.
getTree
(
true
)
})
})
.
catch
(()
=>
{})
...
...
@@ -321,11 +309,11 @@ export default {
resetQuery
()
{
this
.
query
.
materialName
=
''
delete
this
.
query
.
type
this
.
search
(
)
this
.
getList
(
1
)
},
// 结束
// 获取类目树
getTree
()
{
getTree
(
refresh
)
{
getTree
(
this
.
type
).
then
(({
data
})
=>
{
// 删除每一项的children属性
data
.
forEach
((
item
)
=>
{
...
...
@@ -341,6 +329,12 @@ export default {
children
:
data
||
[],
},
]
this
.
groupList
=
data
if
(
refresh
)
{
this
.
query
.
categoryId
=
data
[
0
].
id
this
.
groupIndex
=
0
this
.
getList
(
1
)
}
})
},
// 获取素材列表
...
...
@@ -490,7 +484,8 @@ export default {
.
then
(()
=>
{
this
.
msgSuccess
(
'操作成功'
)
this
.
dialogVisible
=
false
this
.
getList
()
this
.
getTree
()
this
.
getList
(
1
)
// this.picReset()
this
.
$refs
[
'form'
].
resetFields
()
this
.
submitLoading
=
false
...
...
@@ -517,15 +512,11 @@ export default {
// 素材删除
remove
(
id
)
{
const
Ids
=
id
||
this
.
selected
+
''
this
.
$confirm
(
'是否确认删除当前'
+
this
.
typeTitle
[
this
.
type
]
+
'?该操作不可撤销,请谨慎操作。'
,
'警告'
,
{
confirmButtonText
:
'确定'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
,
}
)
this
.
$confirm
(
'是否确认删除当前'
+
this
.
typeTitle
[
this
.
type
]
+
'?该操作不可撤销,请谨慎操作。'
,
'警告'
,
{
confirmButtonText
:
'确定'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
,
})
.
then
(
function
()
{
return
remove
(
Ids
)
})
...
...
@@ -553,8 +544,9 @@ export default {
delAndRemoves
(
form
).
then
((
res
)
=>
{
if
(
res
.
code
===
200
)
{
this
.
$message
.
success
(
res
.
msg
)
this
.
getCodeCategoryListFn
()
//
this.getCodeCategoryListFn()
this
.
getTree
()
this
.
getList
(
1
)
this
.
group
=
''
}
})
...
...
@@ -612,17 +604,12 @@ export default {
<div
class=
"item-list"
>
<div
class=
"item"
:class=
"
{ active: groupIndex ==
key
}"
v-for="(group,
key
) in groupList"
:class=
"
{ active: groupIndex ==
index
}"
v-for="(group,
index
) in groupList"
:key="group.id"
@click="switchGroup(key, group)"
>
@click="switchGroup(index, group)">
<div
class=
"name"
>
{{
group
.
name
+
' ('
+
group
.
number
+
')'
}}
</div>
<el-dropdown
v-if=
"group.flag === 0"
class=
"dropdown"
@
command=
"onGroupCommand($event, group)"
>
<el-dropdown
v-if=
"group.flag === 0"
class=
"dropdown"
@
command=
"onGroupCommand($event, group)"
>
<span
class=
"dot"
>
<el-icon-MoreFilled
class=
"el-icon-MoreFilled content-icon"
></el-icon-MoreFilled>
</span>
...
...
@@ -645,20 +632,9 @@ export default {
clearable
prefix-icon=
"el-icon-search"
style=
"width: 300px"
@
keyup
.
enter=
"search()"
/>
<el-select
v-model=
"query.type"
placeholder=
"请选择海报类型"
class=
"ml20"
v-if=
"type === '5'"
>
<el-option
v-for=
"item in posterType"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value"
></el-option>
@
keyup
.
enter=
"getList(1)"
/>
<el-select
v-model=
"query.type"
placeholder=
"请选择海报类型"
class=
"ml20"
v-if=
"type === '5'"
>
<el-option
v-for=
"item in posterType"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value"
></el-option>
</el-select>
<el-button
style=
"margin-left: 10px"
type=
"primary"
@
click=
"getList(1)"
>
查询
</el-button>
<el-button
@
click=
"resetQuery"
>
重置
</el-button>
...
...
@@ -668,31 +644,21 @@ export default {
<div
class=
"mid-action"
>
<div
class=
""
>
<!-- v-hasPermi="['wechat:material:add']" -->
<el-button
type=
"primary"
@
click=
"edit(0, ~~type)"
>
新建{{ typeTitle[type] }}
</el-button
>
<el-button
type=
"primary"
@
click=
"edit(0, ~~type)"
>
新建{{ typeTitle[type] }}
</el-button>
<el-button
@
click=
"importText"
plain
v-if=
"type === '4'"
>
导入文本
</el-button>
</div>
<div
class=
""
>
<el-popover
placement=
"top"
width=
"260"
v-model=
"groupDialogVisible"
>
<div>
选择分组
</div>
<div
style=
"position: relative; margin: 10px 0"
>
<el-cascader
v-model=
"group"
:options=
"treeData[0].children"
:props=
"groupProps"
></el-cascader>
<el-cascader
v-model=
"group"
:options=
"treeData[0].children"
:props=
"groupProps"
></el-cascader>
</div>
<div
style=
"text-align: right"
>
<el-button
@
click=
"groupDialogVisible = false"
>
取消
</el-button>
<el-button
type=
"primary"
@
click=
"moveGroup"
>
确定
</el-button>
</div>
<
template
#
reference
>
<el-button
style=
"margin-right: 10px"
:disabled=
"selected.length === 0"
type=
"primary"
>
<el-button
style=
"margin-right: 10px"
:disabled=
"selected.length === 0"
type=
"primary"
>
批量分组
</el-button>
</
template
>
...
...
@@ -707,27 +673,15 @@ export default {
:total=
"total"
v-model:page=
"query.pageNum"
v-model:limit=
"query.pageSize"
@
pagination=
"getList()"
/>
@
pagination=
"getList()"
/>
</div>
</div>
</div>
<!-- 分组弹框 -->
<el-dialog
:title=
"`${groupForm.id ? '修改' : '新建'}分组`"
v-model=
"groupVisible"
width=
"30%"
v-if=
"groupVisible"
>
<el-dialog
:title=
"`${groupForm.id ? '修改' : '新建'}分组`"
v-model=
"groupVisible"
width=
"30%"
v-if=
"groupVisible"
>
<el-form
:model=
"groupForm"
:rules=
"groupRules"
ref=
"groupForm"
>
<el-form-item
label=
"分组名称"
prop=
"name"
label-width=
"80px"
>
<el-input
v-model=
"groupForm.name"
clearable
autocomplete=
"off"
maxlength=
"15"
show-word-limit
></el-input>
<el-input
v-model=
"groupForm.name"
clearable
autocomplete=
"off"
maxlength=
"15"
show-word-limit
></el-input>
</el-form-item>
</el-form>
<
template
#
footer
>
...
...
@@ -741,21 +695,16 @@ export default {
<el-dialog
:title=
"(form.id ? '编辑' : '新建') + typeTitle[type]"
v-model=
"dialogVisible"
width=
"
60%
"
width=
"
auto
"
append-to-body
:close-on-click-modal=
"false"
>
:close-on-click-modal=
"false"
>
<el-alert
type=
"warning"
show-icon
v-if=
"type === '11'"
>
<
template
#
title
>
<div
style=
"display: flex"
>
<div
style=
"color: var(--font-black)"
>
小程序必须已经绑定关联到企业微信,否则将无法在欢迎语、群发、话术中正常发送。
</div>
<a
href=
"https://www.yuque.com/linkwechat/help/gy4ghv"
target=
"_blank"
style=
"color: var(--color)"
>
<a
href=
"https://www.yuque.com/linkwechat/help/gy4ghv"
target=
"_blank"
style=
"color: var(--color)"
>
如何关联绑定?
</a>
</div>
...
...
@@ -765,21 +714,12 @@ export default {
<el-col
:span=
"14"
>
<el-form
ref=
"form"
:model=
"form"
:rules=
"rules"
label-width=
"100px"
>
<el-form-item
label=
"选择分组"
prop=
"categoryId"
>
<el-cascader
v-model=
"form.categoryId"
:options=
"treeData[0].children"
:props=
"groupProps"
></el-cascader>
<el-cascader
v-model=
"form.categoryId"
:options=
"treeData[0].children"
:props=
"groupProps"
></el-cascader>
</el-form-item>
<!-- 文本 -->
<el-form-item
:label=
"typeTitle[type] + '标题'"
prop=
"materialName"
v-if=
"type === '4'"
>
<el-input
v-model=
"form.materialName"
placeholder=
"请输入标题"
maxlength=
"50"
show-word-limit
></el-input>
<el-input
v-model=
"form.materialName"
placeholder=
"请输入标题"
maxlength=
"50"
show-word-limit
></el-input>
<div
class=
"tip"
>
标题对客户不可见,仅用于查询场景
</div>
</el-form-item>
<el-form-item
label=
"文本内容"
prop=
"content"
v-if=
"type === '4'"
>
...
...
@@ -788,8 +728,7 @@ export default {
:autosize=
"{ minRows: 2, maxRows: 50 }"
placeholder=
"请输入内容"
maxlength=
"1000"
show-word-limit
></TextareaExtend>
show-word-limit
></TextareaExtend>
</el-form-item>
<!-- 图片 -->
...
...
@@ -801,13 +740,8 @@ export default {
:maxSize=
"20"
type=
"0"
:multiple=
"true"
:limit=
"10"
>
<template
#
tip
><div>
支持jpg/jpeg/png格式,图片大小不超过20M,支持最多10张批量上传
</div></
template
>
:limit=
"10"
>
<template
#
tip
><div>
支持jpg/jpeg/png格式,图片大小不超过20M,支持最多10张批量上传
</div></
template
>
</Upload>
</el-form-item>
<el-form-item
label=
"图片标题"
prop=
"materialName"
v-else
>
...
...
@@ -816,8 +750,7 @@ export default {
placeholder=
"请输入"
:maxlength=
"50"
show-word-limit
:disabled=
"true"
></el-input>
:disabled=
"true"
></el-input>
<div
class=
"tip"
>
标题对客户不可见,仅用于查询场景
</div>
</el-form-item>
</template>
...
...
@@ -827,8 +760,7 @@ export default {
<el-input
v-model=
"form.materialUrl"
type=
"text"
placeholder=
"请输入图文地址,以http://或https://开头"
></el-input>
placeholder=
"请输入图文地址,以http://或https://开头"
></el-input>
</el-form-item>
<el-form-item
label=
"图文标题"
prop=
"materialName"
>
<el-input
...
...
@@ -836,8 +768,7 @@ export default {
type=
"text"
:maxlength=
"32"
show-word-limit
placeholder=
"请输入图文标题"
></el-input>
placeholder=
"请输入图文标题"
></el-input>
</el-form-item>
<el-form-item
label=
"图文描述"
>
<el-input
...
...
@@ -846,16 +777,10 @@ export default {
:maxlength=
"128"
show-word-limit
:autosize=
"
{ minRows: 3, maxRows: 50 }"
placeholder="请输入图文描述"
>
</el-input>
placeholder="请输入图文描述">
</el-input>
</el-form-item>
<el-form-item
label=
"图文封面"
>
<Upload
v-model:fileUrl=
"form.coverUrl"
v-model:imgSize=
"form.memorySize"
type=
"0"
v-if=
"dialogVisible"
>
<Upload
v-model:fileUrl=
"form.coverUrl"
v-model:imgSize=
"form.memorySize"
type=
"0"
v-if=
"dialogVisible"
>
<template
#
tip
><div>
支持jpg/jpeg/png格式,建议200*200
</div></
template
>
</Upload>
</el-form-item>
...
...
@@ -873,8 +798,7 @@ export default {
type=
"text"
:maxlength=
"64"
show-word-limit
placeholder=
"请输入链接标题"
></el-input>
placeholder=
"请输入链接标题"
></el-input>
</el-form-item>
<el-form-item
label=
"链接"
prop=
"materialUrl"
:rules=
"rules.http"
>
<el-input
v-model=
"form.materialUrl"
placeholder=
"请输入链接"
></el-input>
...
...
@@ -889,22 +813,16 @@ export default {
v-model=
"form.materialName"
placeholder=
"请输入小程序标题"
:maxlength=
"16"
show-word-limit
></el-input>
show-word-limit
></el-input>
</el-form-item>
<el-form-item
label=
"小程序ID"
prop=
"digest"
>
<el-input
v-model=
"form.digest"
placeholder=
"小程序AppID"
></el-input>
<div
class=
"sub-des"
>
<a
href=
"https://www.yuque.com/linkwechat/help/gy4ghv#cAwOh"
target=
"_blank"
>
如何查询小程序ID?
</a
>
<a
href=
"https://www.yuque.com/linkwechat/help/gy4ghv#cAwOh"
target=
"_blank"
>
如何查询小程序ID?
</a>
</div>
</el-form-item>
<el-form-item
label=
"页面路径"
prop=
"materialUrl"
:rules=
"rules.html"
>
<el-input
v-model=
"form.materialUrl"
placeholder=
"请输入小程序路径,必须以 .html 作为后缀"
></el-input>
<el-input
v-model=
"form.materialUrl"
placeholder=
"请输入小程序路径,必须以 .html 作为后缀"
></el-input>
<div
class=
"sub-des"
>
<a
href=
"https://www.yuque.com/linkwechat/help/gy4ghv#a1bXG"
target=
"_blank"
>
如何添加小程序页面路径?
...
...
@@ -912,12 +830,7 @@ export default {
</div>
</el-form-item>
<el-form-item
label=
"封面"
prop=
"coverUrl"
>
<Upload
v-model:fileUrl=
"form.coverUrl"
v-model:imgSize=
"form.memorySize"
type=
"0"
v-if=
"dialogVisible"
>
<Upload
v-model:fileUrl=
"form.coverUrl"
v-model:imgSize=
"form.memorySize"
type=
"0"
v-if=
"dialogVisible"
>
<template
#
tip
><div>
支持jpg/jpeg/png格式,建议520*416
</div></
template
>
</Upload>
</el-form-item>
...
...
@@ -930,13 +843,8 @@ export default {
v-model:fileUrl=
"form.materialUrl"
v-model:fileName=
"form.materialName"
:type=
"type"
:format=
"audioType"
>
<template
#
tip
><div>
只能上传amr格式的语音文件。单个文件大小不超过2M,时长不超过1分钟
</div></
template
>
:format=
"audioType"
>
<template
#
tip
><div>
只能上传amr格式的语音文件。单个文件大小不超过2M,时长不超过1分钟
</div></
template
>
</Upload>
</el-form-item>
<el-form-item
label=
"名称"
prop=
"materialName"
>
...
...
@@ -950,8 +858,7 @@ export default {
v-model=
"form.materialName"
placeholder=
"请输入视频标题"
:maxlength=
"32"
show-word-limit
></el-input>
show-word-limit
></el-input>
</el-form-item>
<el-form-item
label=
"视频描述"
>
<el-input
...
...
@@ -960,8 +867,7 @@ export default {
placeholder=
"请输入视频描述"
:autosize=
"
{ minRows: 3, maxRows: 10 }"
:maxlength="128"
show-word-limit
>
</el-input>
show-word-limit>
</el-input>
</el-form-item>
<el-form-item
label=
"上传视频"
prop=
"materialUrl"
v-if=
"!form.id"
>
<Upload
...
...
@@ -970,8 +876,7 @@ export default {
v-model:fileName=
"form.materialName"
:format=
"['mp4', 'mov']"
@
getPicUrl=
"getPicUrl"
:type=
"type"
>
:type=
"type"
>
<template
#
tip
><div>
支持mp4/mov格式,视频大小不超过100M
</div></
template
>
</Upload>
</el-form-item>
...
...
@@ -989,8 +894,7 @@ export default {
v-model=
"form.materialName"
placeholder=
"请输入文件标题"
:maxlength=
"32"
show-word-limit
></el-input>
show-word-limit
></el-input>
</el-form-item>
<el-form-item
label=
"文件描述"
>
<el-input
...
...
@@ -999,8 +903,7 @@ export default {
placeholder=
"请输入文件描述"
:maxlength=
"100"
show-word-limit
:autosize=
"
{ minRows: 3, maxRows: 10 }"
>
</el-input>
:autosize=
"
{ minRows: 3, maxRows: 10 }">
</el-input>
</el-form-item>
<el-form-item
label=
"上传文件"
prop=
"materialUrl"
v-if=
"!form.id"
>
<Upload
...
...
@@ -1008,8 +911,7 @@ export default {
v-model:fileUrl=
"form.materialUrl"
v-model:fileName=
"form.materialName"
:type=
"type"
:format=
"['doc', 'docx', 'pdf', 'ppt', 'pptx', 'pps', 'pptsx']"
>
:format=
"['doc', 'docx', 'pdf', 'ppt', 'pptx', 'pps', 'pptsx']"
>
<template
#
tip
><div>
支持pdf/ppt/word文件,单个文件大小不超过50M
</div></
template
>
</Upload>
</el-form-item>
...
...
@@ -1023,9 +925,7 @@ export default {
<
template
#
footer
>
<div
class=
"dialog-footer"
>
<el-button
type=
"primary"
v-loading=
"submitLoading"
:disabled=
"flag"
@
click=
"submit"
>
确 定
</el-button
>
<el-button
type=
"primary"
v-loading=
"submitLoading"
:disabled=
"flag"
@
click=
"submit"
>
确 定
</el-button>
<el-button
@
click=
"cancel"
>
取 消
</el-button>
</div>
</
template
>
...
...
@@ -1044,8 +944,7 @@ export default {
:on-change=
"setFileData"
:on-success=
"handleFileSuccess"
:auto-upload=
"false"
:on-remove=
"removeFileData"
>
:on-remove=
"removeFileData"
>
<!-- <el-icon-upload class="el-icon-upload"></el-icon-upload> -->
<div
style=
"font-size: 12px"
>
<!-- 将文件拖拽到此区域 -->
...
...
@@ -1054,9 +953,7 @@ export default {
</div>
</el-upload>
<div>
<el-button
style=
"margin-left: 10px"
text
plain
@
click=
"downloadFn"
v-if=
"reUp"
>
下载模板
</el-button
>
<el-button
style=
"margin-left: 10px"
text
plain
@
click=
"downloadFn"
v-if=
"reUp"
>
下载模板
</el-button>
<el-button
plain
text
@
click=
"reUploade"
v-else
>
重新上传
</el-button>
</div>
</div>
...
...
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