Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas
/
scrm-micro-marketing
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 fe4f0511
authored
Jul 12, 2022
by
匡雅琴
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
素材类型优化
1 parent
fab7e516
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
44 deletions
src/views/material/addMaterial.vue
src/views/material/index.vue
src/views/material/materialDetail.vue
src/views/material/addMaterial.vue
View file @
fe4f051
...
...
@@ -286,9 +286,26 @@ export default {
if
(
this
.
materialAddForm
.
isNotifySender
)
{
params
.
isNotifySender
=
0
}
if
(
params
.
materialType
==
1
)
{
if
(
this
.
materialAddForm
.
materialType
==
1
)
{
params
.
materialUrl
=
this
.
pdfUrl
}
else
if
(
params
.
materialType
==
3
)
{
}
else
if
(
this
.
materialAddForm
.
materialType
==
3
)
{
let
html
=
this
.
textBoxContent
let
imgHtml
=
html
.
match
(
/<img.*
?(?:
>|
\/
>
)
/g
)
let
videoHtml
=
html
.
match
(
/<video.*
?(?:
>|
\/
>
)
/g
)
if
(
imgHtml
)
{
for
(
let
i
=
0
;
i
<
imgHtml
.
length
;
i
++
)
{
html
=
html
.
replace
(
imgHtml
[
i
],
''
)
}
}
if
(
videoHtml
)
{
for
(
let
i
=
0
;
i
<
videoHtml
.
length
;
i
++
)
{
html
=
html
.
replace
(
videoHtml
[
i
],
''
)
}
}
html
=
html
.
replace
(
/<
[^
>
]
+>/g
,
''
)
if
(
videoHtml
&&
videoHtml
.
length
&&
!
imgHtml
&&
!
html
.
length
)
params
.
materialType
=
4
if
(
!
imgHtml
&&
!
videoHtml
)
params
.
materialType
=
5
if
(
imgHtml
&&
imgHtml
.
length
&&
!
videoHtml
&&
!
html
.
length
)
params
.
materialType
=
6
this
.
textBoxContent
=
encodeURIComponent
(
this
.
textBoxContent
)
params
.
materialUrl
=
this
.
textBoxContent
}
...
...
@@ -303,19 +320,20 @@ export default {
}
this
.
$apis
.
material
.
materialDetail
(
params
).
then
(
res
=>
{
this
.
materialAddForm
=
res
if
(
this
.
materialAddForm
.
businessType
)
{
if
(
res
.
businessType
)
{
const
businessTypeArr
=
this
.
materialAddForm
.
businessType
.
split
(
','
)
this
.
materialAddForm
.
businessType
=
businessTypeArr
.
map
(
item
=>
parseInt
(
item
))
}
else
{
this
.
materialAddForm
.
businessType
=
[]
}
if
(
this
.
materialAddForm
.
materialType
==
3
)
{
if
(
res
.
materialType
==
3
||
res
.
materialType
==
4
||
res
.
materialType
==
5
||
res
.
materialType
==
6
)
{
this
.
materialAddForm
.
materialType
=
3
this
.
materialAddForm
.
materialUrl
=
decodeURIComponent
(
this
.
materialAddForm
.
materialUrl
)
this
.
$refs
.
textBox
.
setEdit
(
this
.
materialAddForm
.
materialUrl
)
}
else
if
(
this
.
materialAddForm
.
materialType
==
1
)
{
}
else
if
(
res
.
materialType
==
1
)
{
this
.
pdfUrl
=
this
.
materialAddForm
.
materialUrl
}
if
(
this
.
materialAddForm
.
tagJson
)
{
if
(
res
.
tagJson
)
{
const
tagging
=
eval
(
this
.
materialAddForm
.
tagJson
)
// let arr = []
this
.
tagging
=
tagging
.
map
(
item
=>
{
...
...
@@ -479,20 +497,6 @@ export default {
handleSubmit
()
{
this
.
$refs
.
materialAddForm
.
validate
(
valid
=>
{
if
(
valid
)
{
// let tagging = this.tagging.map(item => {
// let tagIds = item.labelList.map(tag => {
// return tag.id
// })
// let name = item.labelList.map(tag => {
// return tag.name
// })
// return {
// groupId: item.labelGroup.id,
// tagIds: tagIds.join(','),
// name: name.join(','),
// labelType: item.labelGroup.name
// }
// })
var
params
=
this
.
getParams
()
if
(
!
params
.
materialUrl
)
{
this
.
$message
({
...
...
@@ -503,23 +507,13 @@ export default {
}
// status 状态 0 启用 -1 禁用 1 存草稿
params
.
status
=
0
// params.isNotifySender = -1
// params.tagJson = JSON.stringify(tagging)
// if (this.materialAddForm.isNotifySender) {
// params.isNotifySender = 0
// }
// if (params.materialType == 1) {
// params.materialUrl = this.pdfUrl
// } else if (params.materialType == 3) {
// this.textBoxContent = encodeURIComponent(this.textBoxContent)
// params.materialUrl = this.textBoxContent
// }
let
material
if
(
params
.
id
)
{
material
=
'materialEdit'
}
else
{
material
=
'materialInsert'
}
console
.
log
(
params
,
'===='
)
this
.
$apis
.
material
[
material
](
params
).
then
(
res
=>
{
if
(
res
)
{
this
.
$message
({
...
...
src/views/material/index.vue
View file @
fe4f051
...
...
@@ -13,7 +13,7 @@
</span>
<div
class=
"container"
>
<div
class=
"search-form"
>
<GLCombiForm
ref=
"showSearch"
:rowNumber=
"
1
"
:formObj=
"searchForm"
:formData=
"materialFormData"
@
handleOk=
"getListApi"
@
handleRest=
"handleReset"
></GLCombiForm>
<GLCombiForm
ref=
"showSearch"
:rowNumber=
"
2
"
:formObj=
"searchForm"
:formData=
"materialFormData"
@
handleOk=
"getListApi"
@
handleRest=
"handleReset"
></GLCombiForm>
</div>
<div
class=
"tabelList"
>
<el-row>
...
...
@@ -38,7 +38,7 @@
<!-- 素材为自定义链接 -->
<span
v-if=
"scope.scope.materialType == 2"
></span>
<!-- 素材为图文 -->
<span
v-if=
"scope.scope.materialType == 3"
class=
"material-content"
>
<span
v-if=
"scope.scope.materialType == 3
|| scope.scope.materialType == 4 || scope.scope.materialType == 5 || scope.scope.materialType == 6
"
class=
"material-content"
>
<!-- 图片 -->
<el-popover
placement=
"top"
trigger=
"hover"
v-if=
"scope.scope.urlType == 'img'"
>
<div>
...
...
@@ -55,7 +55,7 @@
<!-- 视频 -->
<el-popover
placement=
"right"
trigger=
"hover"
v-if=
"scope.scope.urlType == 'video'"
>
<div>
<video
controls
autoplay
width=
"300"
height=
"300"
>
<video
controls
width=
"300"
height=
"300"
>
<source
:src=
"scope.scope.materialContentRpcResponse.materialUrl"
type=
"video/mp4"
/>
</video>
</div>
...
...
@@ -84,9 +84,10 @@
<div
slot=
"materialType"
slot-scope=
"scope"
>
<span
v-if=
"scope.scope.materialType == 1"
>
pdf文件
</span>
<span
v-if=
"scope.scope.materialType == 2"
>
自定义链接
</span>
<span
v-if=
"scope.scope.urlType == 'video'"
>
视频
</span>
<span
v-if=
"scope.scope.urlType == 'img'"
>
图文
</span>
<span
v-if=
"!scope.scope.urlType && scope.scope.materialType == 3"
>
纯文字
</span>
<span
v-if=
"scope.scope.materialType == 3"
>
图文
</span>
<span
v-if=
"scope.scope.materialType == 4"
>
视频
</span>
<span
v-if=
"scope.scope.materialType == 5"
>
纯文字
</span>
<span
v-if=
"scope.scope.materialType == 6"
>
纯图片
</span>
</div>
<span
slot=
"auth-button"
slot-scope=
"scope"
>
<GLTableButton
:buttonList=
"tableButtonList"
:buttonItem=
"scope.scope"
:buttonNum=
"3"
></GLTableButton>
...
...
@@ -175,6 +176,18 @@ export default {
{
optionId
:
3
,
optionLabel
:
'图文'
},
{
optionId
:
4
,
optionLabel
:
'视频'
},
{
optionId
:
5
,
optionLabel
:
'纯文字'
},
{
optionId
:
6
,
optionLabel
:
'纯图片'
}
],
optionId
:
'optionId'
,
...
...
@@ -513,11 +526,8 @@ export default {
let
data
=
res
let
tableData
=
[]
data
.
forEach
(
item
=>
{
// 根据素材类型是图文还是pdf处理数据
if
(
item
.
materialType
!=
3
)
{
item
.
materialContentRpcResponse
.
materialUrl
=
''
}
if
(
item
.
materialType
==
3
)
{
// 根据素材类型是图文处理数据
if
(
item
.
materialType
==
3
||
item
.
materialType
==
4
||
item
.
materialType
==
5
||
item
.
materialType
==
6
)
{
let
html
=
decodeURIComponent
(
item
.
materialContentRpcResponse
.
materialUrl
)
let
imgHtml
=
html
.
match
(
/<img.*
?(?:
>|
\/
>
)
/g
)
let
videoHtml
=
html
.
match
(
/<video.*
?(?:
>|
\/
>
)
/g
)
...
...
src/views/material/materialDetail.vue
View file @
fe4f051
...
...
@@ -216,12 +216,13 @@ export default {
params
.
flag
=
0
this
.
$apis
.
material
.
materialDetail
(
params
).
then
(
res
=>
{
this
.
detailInfo
=
res
if
(
this
.
detailInfo
.
tagJson
)
{
if
(
res
.
tagJson
)
{
this
.
detailInfo
.
tagJson
=
eval
(
this
.
detailInfo
.
tagJson
)
}
else
{
this
.
detailInfo
.
tagJson
=
[]
}
if
(
this
.
detailInfo
.
materialType
==
3
)
{
if
(
res
.
materialType
==
3
||
res
.
materialType
==
4
||
res
.
materialType
==
5
||
res
.
materialType
==
6
)
{
this
.
detailInfo
.
materialType
=
3
this
.
detailInfo
.
materialUrl
=
decodeURIComponent
(
this
.
detailInfo
.
materialUrl
)
let
html
=
this
.
detailInfo
.
materialUrl
let
imgHtml
=
html
.
match
(
/<img.*
?(?:
>|
\/
>
)
/g
)
...
...
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