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 c1015020
authored
Jun 30, 2023
by
ext.wangyuman1
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
朋友圈
1 parent
45b0fd28
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
103 additions
and
50 deletions
vue3-lw-pc/src/components/ContentCenter/MaterialCenter/index.vue
vue3-lw-pc/src/components/ContentCenter/MaterialCenter/index.vue
View file @
c101502
...
@@ -9,33 +9,45 @@
...
@@ -9,33 +9,45 @@
width=
"80%"
width=
"80%"
append-to-body
append-to-body
:close-on-click-modal=
"false"
:close-on-click-modal=
"false"
@
close=
"dialogClose"
>
@
close=
"dialogClose"
>
<el-tabs
v-model=
"activeName"
@
tab-click=
"tabClick"
>
<el-tabs
v-model=
"activeName"
@
tab-click=
"tabClick"
>
<el-tab-pane
<el-tab-pane
v-for=
"(item, index) in paneList"
v-for=
"(item, index) in paneList"
:key=
"index"
:key=
"index"
:label=
"item.label + '(' + item.list.length + ')'"
:label=
"item.label + '(' + item.list.length + ')'"
:name=
"item.name"
>
:name=
"item.name"
<MaPage
ref=
"page"
:type=
"item.type"
v-slot=
"
{ list }" @listChange="listChange">
>
<MaPage
ref=
"page"
:type=
"item.type"
:isFriends =
'isFriends'
v-slot=
"
{ list }" @listChange="listChange">
<div
v-if=
"item.type === '0'"
>
<div
v-if=
"item.type === '0'"
>
<div
v-if=
"list && list.length"
>
<div
v-if=
"list && list.length"
>
<el-checkbox-group
v-model=
"paneList[picindex].list"
class=
"imgStyle"
>
<el-checkbox-group
v-model=
"paneList[picindex].list"
class=
"imgStyle"
>
<div
class=
"imgItem"
v-for=
"(item, index) in list"
:key=
"index"
@
click=
"changeBox($event, item)"
>
<div
class=
"imgItem"
v-for=
"(item, index) in list"
:key=
"index"
@
click=
"changeBox($event, item)"
>
<div
class=
"checkboxStyle"
>
<div
class=
"checkboxStyle"
>
<el-checkbox
<el-checkbox
:label=
"item"
:label=
"item"
style=
"width: 20px; height: 20px"
style=
"width: 20px; height: 20px"
:checked=
"item.isCheck"
></el-checkbox>
:checked=
"item.isCheck"
></el-checkbox>
<el-tooltip
<el-tooltip
:content=
"item.materialName"
:content=
"item.materialName"
placement=
"top"
placement=
"top"
:disabled=
"item.materialName ? item.materialName.length
< 6
:
true
"
>
:disabled=
"item.materialName ? item.materialName.length
< 6
:
true
"
>
<div
class=
"title ml10"
>
<div
class=
"title ml10"
>
{{
coverContent
(
item
.
materialName
,
6
)
}}
{{
coverContent
(
item
.
materialName
,
6
)
}}
</div>
</div>
</el-tooltip>
</el-tooltip>
</div>
</div>
<div
class=
"img"
:style=
"
{ 'background-image': 'url(' + item.materialUrl + ')' }">
</div>
<div
class=
"img"
:style=
"
{ 'background-image': 'url(' + item.materialUrl + ')' }"
>
</div>
</div>
</div>
</el-checkbox-group>
</el-checkbox-group>
</div>
</div>
...
@@ -43,7 +55,13 @@
...
@@ -43,7 +55,13 @@
<span>
暂无数据
</span>
<span>
暂无数据
</span>
</div>
</div>
</div>
</div>
<el-table
:data=
"list"
ref=
"multipleTable"
@
select=
"handleSelect"
@
select-all=
"selectAll"
v-else
>
<el-table
:data=
"list"
ref=
"multipleTable"
@
select=
"handleSelect"
@
select-all=
"selectAll"
v-else
>
<el-table-column
type=
"selection"
width=
"50"
align=
"center"
/>
<el-table-column
type=
"selection"
width=
"50"
align=
"center"
/>
<el-table-column
label=
"素材"
align=
"left"
>
<el-table-column
label=
"素材"
align=
"left"
>
<template
#
default=
"
{ row }">
<template
#
default=
"
{ row }">
...
@@ -101,6 +119,11 @@ export default {
...
@@ -101,6 +119,11 @@ export default {
type
:
Boolean
,
type
:
Boolean
,
default
:
false
,
default
:
false
,
},
},
// 朋友圈
isFriends
:
{
type
:
Boolean
,
default
:
false
,
},
},
},
watch
:
{
watch
:
{
choseDialog
:
{
choseDialog
:
{
...
@@ -108,6 +131,11 @@ export default {
...
@@ -108,6 +131,11 @@ export default {
this
.
dialogVisibel
=
val
this
.
dialogVisibel
=
val
},
},
},
},
maxlength
:
{
handler
(
val
)
{
this
.
maxlength2
=
val
},
},
},
},
computed
:
{},
computed
:
{},
components
:
{
components
:
{
...
@@ -129,6 +157,7 @@ export default {
...
@@ -129,6 +157,7 @@ export default {
ids
:
[],
// 选中数组
ids
:
[],
// 选中数组
itemArry
:
[],
// 选中数组
itemArry
:
[],
// 选中数组
inx
:
0
,
inx
:
0
,
maxlength2
:
9
,
// 最大确认数
}
}
},
},
methods
:
{
methods
:
{
...
@@ -185,6 +214,19 @@ export default {
...
@@ -185,6 +214,19 @@ export default {
},
},
changeBox
(
event
,
obj
)
{
changeBox
(
event
,
obj
)
{
event
.
preventDefault
()
event
.
preventDefault
()
let
setStatus
=
true
if
(
this
.
isFriends
)
{
// 如果是朋友圈的
this
.
maxlength2
=
9
this
.
paneList
.
forEach
((
item
,
i
)
=>
{
if
(
item
.
list
.
length
>
0
&&
i
!==
0
)
{
this
.
$message
.
error
(
'仅允许选择一种类型的素材'
)
setStatus
=
false
return
}
})
}
if
(
setStatus
)
{
this
.
ids
=
[]
this
.
ids
=
[]
this
.
paneList
.
forEach
((
item
)
=>
{
this
.
paneList
.
forEach
((
item
)
=>
{
if
(
item
.
list
&&
item
.
list
.
length
)
{
if
(
item
.
list
&&
item
.
list
.
length
)
{
...
@@ -194,11 +236,13 @@ export default {
...
@@ -194,11 +236,13 @@ export default {
}
}
})
})
if
(
if
(
(
this
.
ids
.
length
+
this
.
talkListLength
>
this
.
maxlength
||
(
this
.
ids
.
length
+
this
.
talkListLength
>
this
.
maxlength2
||
this
.
ids
.
length
+
this
.
talkListLength
===
this
.
maxlength
)
&&
this
.
ids
.
length
+
this
.
talkListLength
===
this
.
maxlength2
)
&&
!
obj
.
isCheck
!
obj
.
isCheck
)
{
)
{
this
.
$message
.
error
(
'最多新建或选择'
+
this
.
maxlength
+
'个素材,已新建'
+
this
.
talkListLength
+
'个素材'
)
this
.
$message
.
error
(
'最多新建或选择'
+
this
.
maxlength2
+
'个素材,已新建'
+
this
.
talkListLength
+
'个素材'
)
return
return
}
}
obj
.
isCheck
=
!
obj
.
isCheck
obj
.
isCheck
=
!
obj
.
isCheck
...
@@ -217,6 +261,7 @@ export default {
...
@@ -217,6 +261,7 @@ export default {
})
})
}
}
})
})
}
},
},
centerCancel
()
{
centerCancel
()
{
this
.
dialogVisibel
=
false
this
.
dialogVisibel
=
false
...
@@ -237,12 +282,17 @@ export default {
...
@@ -237,12 +282,17 @@ export default {
this
.
ids
=
[]
this
.
ids
=
[]
},
},
centerSubmit
()
{
centerSubmit
()
{
if
(
this
.
ids
.
length
+
this
.
talkListLength
>
this
.
maxlength
)
{
if
(
this
.
ids
.
length
+
this
.
talkListLength
>
this
.
maxlength2
)
{
this
.
$message
.
error
(
'最多新建或选择'
+
this
.
maxlength
+
'个素材'
)
if
(
this
.
isFriends
)
{
this
.
$message
.
error
(
'除图片素材可选9条数据,其他类型仅可选择一条数据,且只能选择一种类型'
)
}
else
{
this
.
$message
.
error
(
'最多新建或选择'
+
this
.
maxlength2
+
'个素材'
)
}
return
return
}
else
{
}
else
{
this
.
dialogVisibel
=
false
this
.
dialogVisibel
=
false
this
.
$emit
(
'itemArry'
,
this
.
ids
)
this
.
$emit
(
'itemArry'
,
this
.
ids
,
this
.
maxlength2
)
this
.
$emit
(
'update:choseDialog'
,
this
.
dialogVisibel
)
this
.
$emit
(
'update:choseDialog'
,
this
.
dialogVisibel
)
this
.
$refs
.
multipleTable
.
forEach
((
item
)
=>
{
this
.
$refs
.
multipleTable
.
forEach
((
item
)
=>
{
item
.
clearSelection
()
item
.
clearSelection
()
...
@@ -251,7 +301,21 @@ export default {
...
@@ -251,7 +301,21 @@ export default {
this
.
clearPaneList
()
this
.
clearPaneList
()
}
}
},
},
// 单个选择
handleSelect
(
select
,
row
)
{
handleSelect
(
select
,
row
)
{
if
(
this
.
isFriends
)
{
// 如果是朋友圈的
this
.
maxlength2
=
1
this
.
paneList
.
forEach
((
item
,
i
)
=>
{
if
(
item
.
list
.
length
>
0
&&
i
!==
+
this
.
index
)
{
this
.
$message
.
error
(
'仅允许选择一种类型的素材'
)
return
}
})
if
(
this
.
paneList
[
this
.
index
].
list
.
length
>
0
)
{
this
.
$message
.
error
(
'除图片素材可选9条数据,其他类型仅可选择一条数据'
)
}
}
let
list
=
this
.
paneList
[
this
.
index
].
list
let
list
=
this
.
paneList
[
this
.
index
].
list
let
falg
=
false
let
falg
=
false
if
(
list
.
length
)
{
if
(
list
.
length
)
{
...
@@ -270,11 +334,16 @@ export default {
...
@@ -270,11 +334,16 @@ export default {
})
})
}
}
this
.
getIds
()
this
.
getIds
()
if
(
this
.
ids
.
length
+
this
.
talkListLength
>
this
.
maxlength
)
{
if
(
this
.
ids
.
length
+
this
.
talkListLength
>
this
.
maxlength
2
)
{
this
.
$nextTick
(()
=>
{
this
.
$nextTick
(()
=>
{
if
(
this
.
index
)
this
.
$refs
.
multipleTable
[
this
.
inx
].
toggleRowSelection
(
row
,
false
)
if
(
this
.
index
)
this
.
$refs
.
multipleTable
[
this
.
inx
].
toggleRowSelection
(
row
,
false
)
})
})
this
.
$message
.
error
(
'最多新建或选择'
+
this
.
maxlength
+
'个素材,已新建'
+
this
.
talkListLength
+
'个素材'
)
if
(
!
this
.
isFriends
)
{
this
.
$message
.
error
(
'最多新建或选择'
+
this
.
maxlength2
+
'个素材,已新建'
+
this
.
talkListLength
+
'个素材'
)
}
this
.
paneList
[
this
.
index
].
list
=
this
.
paneList
[
this
.
index
].
list
.
filter
((
item
)
=>
{
this
.
paneList
[
this
.
index
].
list
=
this
.
paneList
[
this
.
index
].
list
.
filter
((
item
)
=>
{
return
item
.
id
!=
row
.
id
return
item
.
id
!=
row
.
id
})
})
...
@@ -282,6 +351,16 @@ export default {
...
@@ -282,6 +351,16 @@ export default {
}
}
},
},
selectAll
(
select
)
{
selectAll
(
select
)
{
if
(
this
.
isFriends
)
{
// 如果是朋友圈的
this
.
maxlength2
=
1
// this.paneList.forEach((item, i) => {
// if (item.list.length > 0 && i !== +this.index) {
// this.$message.error('仅允许选择一种类型的素材')
// return
// }
// })
}
if
(
select
.
length
)
{
if
(
select
.
length
)
{
// 全选
// 全选
this
.
paneList
[
this
.
index
].
list
=
select
this
.
paneList
[
this
.
index
].
list
=
select
...
@@ -290,11 +369,16 @@ export default {
...
@@ -290,11 +369,16 @@ export default {
this
.
paneList
[
this
.
index
].
list
=
[]
this
.
paneList
[
this
.
index
].
list
=
[]
}
}
this
.
getIds
()
this
.
getIds
()
if
(
this
.
ids
.
length
+
this
.
talkListLength
>
this
.
maxlength
)
{
if
(
this
.
ids
.
length
+
this
.
talkListLength
>
this
.
maxlength
2
)
{
select
.
forEach
((
item
)
=>
{
select
.
forEach
((
item
)
=>
{
this
.
$refs
.
multipleTable
[
this
.
inx
].
toggleAllSelection
(
item
,
false
)
this
.
$refs
.
multipleTable
[
this
.
inx
].
toggleAllSelection
(
item
,
false
)
})
})
this
.
$message
.
error
(
'最多新建或选择'
+
this
.
maxlength
+
'个素材,已新建'
+
this
.
talkListLength
+
'个素材'
)
if
(
!
this
.
isFriends
)
{
this
.
$message
.
error
(
'最多新建或选择'
+
this
.
maxlength2
+
'个素材,已新建'
+
this
.
talkListLength
+
'个素材'
)
}
this
.
paneList
[
this
.
index
].
list
=
[]
this
.
paneList
[
this
.
index
].
list
=
[]
this
.
getIds
()
this
.
getIds
()
}
}
...
@@ -309,30 +393,6 @@ export default {
...
@@ -309,30 +393,6 @@ export default {
}
}
})
})
},
},
// 多选框选中数据
// handleSelectionChange(selection) {
// let list = JSON.parse(JSON.stringify(this.paneList[this.index].list))
// this.paneList[this.index].list = selection
// this.ids = []
// this.paneList.forEach((item) => {
// if (item.list && item.list.length) {
// item.list.forEach((item1) => {
// this.ids.push(item1)
// })
// }
// })
// if (this.ids.length + this.talkListLength > this.maxlength) {
// this.paneList[this.index].list = list
// this.ids = []
// this.paneList.forEach((item) => {
// if (item.list && item.list.length) {
// item.list.forEach((item1) => {
// this.ids.push(item1)
// })
// }
// })
// }
// },
// 处理文件类型
// 处理文件类型
filType
(
file
)
{
filType
(
file
)
{
let
filecontent
=
JSON
.
parse
(
JSON
.
stringify
(
file
))
let
filecontent
=
JSON
.
parse
(
JSON
.
stringify
(
file
))
...
@@ -356,13 +416,6 @@ export default {
...
@@ -356,13 +416,6 @@ export default {
}
else
{
}
else
{
this
.
inx
=
index
this
.
inx
=
index
}
}
// if (this.picindex === 0) {
// // 不包含文本
// this.inx = this.index - 1
// } else if (this.picindex === 1) {
// // 包含文本
// }
},
},
},
},
}
}
...
@@ -436,7 +489,7 @@ export default {
...
@@ -436,7 +489,7 @@ export default {
height
:
210px
;
height
:
210px
;
margin-bottom
:
20px
;
margin-bottom
:
20px
;
margin-right
:
2%
;
margin-right
:
2%
;
border
:
1px
solid
#eaeaea
;
border
:
1px
solid
var
(
--border-black-9
)
;
.img
{
.img
{
width
:
100%
;
width
:
100%
;
height
:
180px
;
height
:
180px
;
...
...
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