Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas
/
scrm-micro-activity
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 6c5b06a0
authored
Aug 02, 2022
by
杨明
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fixed
1 parent
57810959
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
15 additions
and
3609 deletions
src/views/activity/addActivity.vue
src/views/activity/components/Emotion.vue
src/views/activity/components/activityModel.vue
src/views/activity/components/basicInfo.vue
src/views/activity/components/emotionWords.vue
src/views/activity/components/marketConfig.vue
src/views/activity/components/materialModel.vue
src/views/activity/components/messageModel.vue
src/views/activity/components/preview.vue
src/views/activity/components/selectEmp.vue
src/views/activity/components/selectLabel.vue
src/views/activity/components/selectLord.vue
src/views/activity/components/selectMember.vue
src/views/activity/components/selectTree.vue
src/views/activity/components/tag-textarea.vue
src/views/activity/components/welcomeWords.vue
src/views/activity/addActivity.vue
View file @
6c5b06a
...
...
@@ -301,16 +301,12 @@ export default {
const
splitStr
=
file
.
name
.
split
(
'.'
)
const
fileUrl
=
splitStr
[
splitStr
.
length
-
1
]
+
'@'
+
arrBase64
[
1
]
this
.
$apis
.
common
.
pictureUpload
({
file
:
fileUrl
}).
then
(
res
=>
{
console
.
log
(
res
)
if
(
res
)
{
this
.
importName
=
file
.
name
this
.
exportUrl
=
res
this
.
handleSaveImport
()
}
this
.
$refs
.
file
.
value
=
''
this
.
downloadStatus
=
false
this
.
percentage
=
0
clearInterval
(
this
.
setInter
)
})
}
},
...
...
@@ -329,6 +325,9 @@ export default {
this
.
importName
=
''
this
.
exportUrl
=
''
}
this
.
downloadStatus
=
false
this
.
percentage
=
0
clearInterval
(
this
.
setInter
)
})
},
handleReset
(
scope
)
{
...
...
@@ -359,6 +358,7 @@ export default {
handleSure
:
utils
.
debounce
(
function
()
{
this
.
$refs
[
'addForm'
].
validate
(
valid
=>
{
if
(
valid
)
{
this
.
addLoading
=
true
let
params
=
this
.
addForm
params
.
configDetailRpcRequests
=
this
.
tableData
if
(
this
.
exportUrl
)
{
...
...
@@ -377,6 +377,7 @@ export default {
activityParams
=
'activityInsert'
}
this
.
$apis
.
activity
[
activityParams
](
params
).
then
(
res
=>
{
this
.
addLoading
=
false
if
(
res
)
{
this
.
$router
.
push
(
'/activityConfig/index'
)
}
...
...
src/views/activity/components/Emotion.vue
deleted
100644 → 0
View file @
5781095
<
template
>
<div
class=
"ly-emotion"
>
<slot></slot>
</div>
</
template
>
<
script
>
import
emoji
from
'@/utils/emo'
export
default
{
name
:
'ly-emotion'
,
mounted
()
{
const
name
=
this
.
$el
.
innerHTML
const
list
=
emoji
.
flat
(
Infinity
)
let
index
=
parseInt
(
list
.
indexOf
(
name
))
+
1
if
(
index
<
10
)
{
index
=
'00'
+
index
}
else
if
(
index
>=
10
&&
index
<
100
)
{
index
=
'0'
+
index
}
let
imgHTML
=
`<img src="https://img01.glsx.com.cn/weapp/resource/saas/scrm/emoji/
${
index
}
.png">`
this
.
$nextTick
(()
=>
{
this
.
$el
.
innerHTML
=
imgHTML
})
}
}
</
script
>
<
style
scoped
>
.ly-emotion
{
display
:
inline-block
;
}
.ly-static-emotion
{
width
:
24px
;
height
:
24px
;
display
:
inline-block
;
}
</
style
>
src/views/activity/components/activityModel.vue
deleted
100644 → 0
View file @
5781095
<
template
>
<div
class=
"square-main"
>
<el-dialog
title=
"选择活动"
:visible
.
sync=
"dialogVisible"
width=
"1088px"
:before-close=
"handleClose"
>
<div
class=
"model-panel"
v-loading=
"loading"
>
<div
class=
"model-panel-tab"
>
<label>
活动类型:
</label>
<el-tabs
v-model=
"activeName"
@
tab-click=
"handleClick"
type=
"card"
>
<el-tab-pane
:label=
"item.itemName"
:name=
"item.itemValue"
v-for=
"(item, index) in activityList"
:key=
"index"
></el-tab-pane>
<!--
<el-tab-pane
label=
"无忧服务"
name=
"6"
v-if=
"openFlag"
></el-tab-pane>
-->
</el-tabs>
</div>
<div
class=
"model-item-panel"
v-if=
"modelList.length > 0"
>
<div
class=
"model-item"
:class=
"
{ checked: selectItem == item }" v-for="(item, index) in modelList" :key="index" @click="handleSelectItem(item)">
<template
v-if=
"selectType == 'card'"
>
<div
class=
"model-item-title"
:title=
"item.equityName"
>
{{
item
.
equityName
}}
</div>
<div
class=
"model-item-content"
>
领取方式:免费领用
</div>
<div
class=
"model-item-content"
></div>
<div
class=
"model-item-content model-item-contents"
>
试用天数:
<span>
{{
item
.
freeDay
}}
天
</span>
</div>
</
template
>
<
template
v-else-if=
"selectType == 'package'"
>
<div
class=
"model-item-title"
:title=
"item.packageName"
>
{{
item
.
packageName
}}
</div>
<div
class=
"model-item-content"
>
领取方式:付费购买
</div>
<div
class=
"model-item-content"
></div>
<div
class=
"model-item-content model-item-contents"
>
销售价格:
<span>
{{
item
.
packagePrice
}}
元
</span>
</div>
</
template
>
<
template
v-else-if=
"selectType == 'coupon'"
>
<div
class=
"model-item-title"
:title=
"item.couponName"
>
{{
item
.
couponName
}}
</div>
<div
class=
"model-item-content"
v-if=
"item.effectiveType == 3"
>
有效期:无限制
</div>
<div
class=
"model-item-content"
v-if=
"item.effectiveType == 6"
>
有效期:
{{
item
.
effectiveDays
}}
天
</div>
<div
class=
"model-item-content"
v-if=
"item.effectiveType == 2"
>
有效期:
{{
item
.
effectiveStartTime
?
item
.
effectiveStartTime
.
split
(
' '
)[
0
]
:
''
}}
~
{{
item
.
effectiveEndTime
?
item
.
effectiveEndTime
.
split
(
' '
)[
0
]
:
''
}}
</div>
<div
class=
"model-item-content"
>
使用途径:
{{
item
.
useChannel
==
1
?
'线上商品'
:
'到店核销'
}}
</div>
<div
class=
"model-item-content model-item-contents"
>
数量:
<span>
{{
item
.
residueAmount
}}
</span>
</div>
</
template
>
<
template
v-else-if=
"selectType == 'activity'"
>
<div
class=
"model-item-title"
:title=
"item.activityName"
>
{{
item
.
activityName
}}
</div>
<div
class=
"model-item-content"
></div>
<div
class=
"model-item-content"
>
开始时间:
{{
item
.
startTime
}}
</div>
<div
class=
"model-item-content"
>
结束时间:
{{
item
.
endTime
}}
</div>
</
template
>
<
template
v-else
>
<div
class=
"model-item-title"
:title=
"item.couponName"
>
{{
item
.
equityName
}}
</div>
<div
class=
"model-item-content"
>
获取方式:需先购买无忧服务套餐
</div>
<div
class=
"model-item-content"
>
获取限制:每个服务套餐限领一次
</div>
<div
class=
"model-item-content model-item-weight"
>
赠送天数:
<span>
{{
item
.
effectiveType
==
2
?
item
.
effectivedDay
+
'天'
:
'永久有效'
}}
</span>
</div>
</
template
>
</div>
</div>
<div
class=
"model-item-empty"
v-else
v-loading=
"loading"
>
<img
src=
"@/assets/empty.png"
/>
<div
class=
"empty-item"
>
暂无数据
</div>
</div>
<el-pagination
v-if=
"activeName != 3"
@
size-change=
"handleSizeChange"
@
current-change=
"handleCurrentChange"
:current-page=
"pageNum"
:page-sizes=
"[12, 24, 36, 48]"
:page-size=
"pageSize"
:total=
"tableTotal"
layout=
"total, sizes, prev, pager, next, jumper"
></el-pagination>
</div>
<span
slot=
"footer"
class=
"dialog-footer"
>
<el-button
size=
"small"
@
click=
"dialogVisible = false"
>
取 消
</el-button>
<el-button
size=
"small"
type=
"primary"
@
click=
"handleSelect"
v-show=
"modelList.length"
>
确 定
</el-button>
<el-button
size=
"small"
type=
"primary"
@
click=
"handleOpen"
v-show=
"modelList.length == 0 && activeName == 2 && memberMenu"
>
立即添加
</el-button>
<el-button
size=
"small"
type=
"primary"
@
click=
"handleOpen"
v-show=
"modelList.length == 0 && activeName == 4 && couponMenu"
>
立即添加
</el-button>
<el-button
size=
"small"
type=
"primary"
@
click=
"handleOpen"
v-show=
"modelList.length == 0 && activeName == 5 && activityMenu"
>
立即添加
</el-button>
</span>
</el-dialog>
</div>
</template>
<
script
>
import
util
from
'@/utils/util'
export
default
{
name
:
'ActivityModel'
,
data
()
{
return
{
dialogVisible
:
false
,
couponMenu
:
false
,
loading
:
false
,
activeName
:
3
,
modelList
:
[],
pageNum
:
1
,
pageSize
:
12
,
tableTotal
:
0
,
openFlag
:
0
,
selectItem
:
{
id
:
''
}
}
},
props
:
{
activityList
:
Array
},
computed
:
{
selectType
()
{
return
this
.
activityList
.
find
(
act
=>
act
.
itemValue
==
this
.
activeName
).
itemType
}
},
methods
:
{
handleSelectItem
(
item
)
{
this
.
selectItem
=
item
if
(
item
.
equityClassId
)
{
this
.
selectItem
.
id
=
item
.
equityClassId
}
console
.
log
(
this
.
selectItem
)
},
handleSelect
()
{
if
(
!
this
.
selectItem
.
id
)
{
this
.
$message
({
type
:
'error'
,
message
:
'请选择活动'
})
return
}
this
.
dialogVisible
=
false
this
.
$emit
(
'selectActivity'
,
{
marketingId
:
this
.
selectItem
.
id
?
this
.
selectItem
.
id
:
this
.
selectItem
.
equityClassId
,
marketingType
:
this
.
activeName
,
marketingName
:
this
.
activeName
==
3
?
this
.
selectItem
.
equityName
:
this
.
activeName
==
4
?
this
.
selectItem
.
packageName
:
this
.
activeName
==
5
?
this
.
selectItem
.
activityName
:
this
.
activeName
==
2
?
this
.
selectItem
.
couponName
:
this
.
selectItem
.
equityName
})
},
handleSizeChange
(
val
)
{
this
.
pageSize
=
val
this
.
getModelList
()
},
handleCurrentChange
(
val
)
{
this
.
pageNum
=
val
this
.
getModelList
()
},
handleOpen
()
{
let
url
switch
(
this
.
activeName
)
{
case
'2'
:
url
=
'/marketing/couponManage/index'
break
case
'4'
:
url
=
'/marketing/memberCenter/setmealAddUpdate?%24title=%25E5%2588%259B%25E5%25BB%25BA%25E5%25A5%2597%25E9%25A4%2590'
break
case
'5'
:
url
=
'/marketing/seckillActivity/editActivity/1'
break
}
util
.
openUrl
(
location
.
origin
+
url
)
this
.
dialogVisible
=
false
},
getModelList
()
{
this
.
modelList
=
[]
this
.
loading
=
true
let
params
=
{
pageSize
:
this
.
pageSize
,
pageNum
:
this
.
pageNum
}
const
activityChecked
=
this
.
activityList
.
find
(
act
=>
act
.
itemValue
==
this
.
activeName
)
Object
.
assign
(
params
,
activityChecked
.
params
)
activityChecked
.
getInterfaceApi
(
params
)
.
then
(
res
=>
{
this
.
modelList
=
res
.
list
?
res
.
list
:
res
.
data
?
res
.
data
:
res
this
.
tableTotal
=
res
.
total
?
res
.
total
:
0
this
.
loading
=
false
})
.
catch
(()
=>
{
this
.
loading
=
false
})
},
merchantOpen
()
{
let
channel
=
null
if
(
location
.
host
==
'scrm.cgacar.com'
)
{
channel
=
2
}
this
.
$apis
.
customerTransform
.
merchantOpen
({
merchantId
:
this
.
$globalState
.
session
.
merchantId
,
channel
}).
then
(
res
=>
{
this
.
openFlag
=
res
.
openFlag
})
},
init
()
{
this
.
merchantOpen
()
this
.
couponMenu
=
false
this
.
activityMenu
=
false
this
.
memberMenu
=
false
const
menu
=
JSON
.
parse
(
sessionStorage
[
'SCRM_BASE_MENULIST'
])
menu
.
forEach
(
item
=>
{
if
(
item
.
name
==
'marketing'
)
{
if
(
!
item
.
children
)
{
return
}
item
.
children
.
forEach
(
itm
=>
{
console
.
log
(
itm
.
path
)
if
(
itm
.
path
==
'/couponManage/index'
)
{
this
.
couponMenu
=
true
}
if
(
itm
.
path
==
'/seckillActivity/index'
)
{
this
.
activityMenu
=
true
}
if
(
itm
.
path
==
'^'
)
{
this
.
memberMenu
=
true
}
})
}
})
this
.
dialogVisible
=
true
this
.
getModelList
()
this
.
selectItem
=
{}
},
handleClick
()
{
this
.
getModelList
()
}
}
}
</
script
>
<
style
lang=
"scss"
scoped
>
.square-main
{
/deep/
{
.el-dialog__footer
{
text-align
:
center
;
}
}
}
.model-panel
{
.model-panel-tab
{
display
:
flex
;
align-items
:
center
;
margin-bottom
:
18px
;
label
{
font-size
:
16px
;
font-weight
:
400
;
color
:
#000000
;
line-height
:
24px
;
}
/
deep
/
{
.
el-checkbox
:
last-of-type
{
margin-right
:
8px
;
}
.el-tabs__nav
{
border
:
0
;
}
.el-tabs__header
{
border
:
0
;
background-color
:
#f4f6fc
;
margin
:
0px
;
}
.el-tabs__item
{
border
:
none
;
width
:
180px
;
height
:
32px
;
line-height
:
32px
;
margin
:
2px
;
text-align
:
center
;
}
.el-tabs__item.is-active
{
background-color
:
#fff
;
border-radius
:
4px
;
font-weight
:
600
;
}
}
}
.model-item-empty
{
>
img
{
display
:
block
;
margin
:
50px
auto
0px
;
width
:
60px
;
height
:
auto
;
}
.empty-item
{
text-align
:
center
;
font-size
:
14px
;
font-weight
:
400
;
color
:
#000000
;
line-height
:
22px
;
margin-bottom
:
30px
;
}
}
.model-item-panel
{
//
display
:
grid
;
//
grid-template-columns
:
repeat
(
4
,
25%
);
//
grid-row-gap
:
10px
;
max-height
:
38vh
;
overflow
:
auto
;
display
:
flex
;
flex-wrap
:
wrap
;
align-items
:
stretch
;
flex-direction
:
row
;
.model-item
{
width
:
240px
;
margin-right
:
24px
;
margin-bottom
:
24px
;
padding
:
12px
16px
;
position
:
relative
;
height
:
128px
;
background
:
#ffffff
;
border-radius
:
4px
;
border
:
1px
solid
#e6e6e6
;
padding
:
14px
24px
;
box-sizing
:
border-box
;
&:nth-child(4n)
{
margin-right
:
0px
;
}
&
.checked
{
background
:
rgba
(
88
,
80
,
255
,
0.1
);
border
:
1px
solid
#5850ff
;
}
&
-qrcode
{
position
:
absolute
;
right
:
10px
;
bottom
:
10px
;
width
:
60px
;
height
:
60px
;
border
:
1px
solid
#979797
;
}
&
-title
{
font-size
:
18px
;
font-weight
:
600
;
color
:
#333333
;
line-height
:
25px
;
margin-bottom
:
5px
;
text-overflow
:
ellipsis
;
overflow
:
hidden
;
white-space
:
nowrap
;
}
&
-content
{
font-size
:
12px
;
font-weight
:
400
;
color
:
#666666
;
line-height
:
16px
;
height
:
16px
;
margin-top
:
6px
;
text-overflow
:
ellipsis
;
overflow
:
hidden
;
white-space
:
nowrap
;
&.model-item-weight
{
line-height
:
20px
;
height
:
20px
;
}
span
{
color
:
#5850ff
;
font-size
:
20px
;
}
}
&
-contents
{
line-height
:
22px
;
height
:
22px
;
}
}
}
}
</
style
>
src/views/activity/components/basicInfo.vue
deleted
100644 → 0
View file @
5781095
<
template
>
<div
class=
"container"
>
<div
class=
"title"
>
基础信息
</div>
<div
class=
"detail-content"
>
<div
class=
"content-info"
>
<div
class=
"content-text"
>
<div
class=
"detail-item"
>
<div
class=
"detail-label"
>
创建者:
</div>
<div
class=
"detail-value"
>
<el-tag
v-if=
"basicInfo.createdName"
type=
"info"
>
<i
class=
"el-icon-user-solid"
></i>
{{
basicInfo
.
createdName
}}
</el-tag>
<span
v-else
>
-
</span>
<!--
{{
basicInfo
.
createdName
?
basicInfo
.
createdName
:
'-'
}}
-->
</div>
</div>
<div
class=
"detail-item"
>
<div
class=
"detail-label"
>
群发内容:
</div>
<div
class=
"detail-value"
>
[共
{{
basicInfo
.
attachmentList
?
basicInfo
.
attachmentList
.
length
:
'0'
}}
条]
</div>
<div
class=
"detail-tips"
>
详见右侧视图
</div>
</div>
<div
class=
"detail-item"
v-show=
"form == 'customer'"
>
<div
class=
"detail-label"
>
群发类型:
</div>
<div
class=
"detail-value"
>
{{
basicInfo
.
sendType
==
1
?
'立即发送'
:
'定时发送'
}}
</div>
</div>
<div
class=
"detail-item"
v-show=
"form == 'customer'"
>
<div
class=
"detail-label"
>
发送状态:
</div>
<div
class=
"detail-value"
>
{{
STATUS_TYPE
[
basicInfo
.
status
]
}}
</div>
</div>
<div
class=
"detail-item"
>
<div
class=
"detail-label"
>
发送时间:
</div>
<div
class=
"detail-value"
>
{{
basicInfo
.
sendTime
?
basicInfo
.
sendTime
:
'-'
}}
</div>
</div>
<div
class=
"detail-item"
style=
"margin-bottom: 0"
>
<div
class=
"detail-label"
>
群发对象:
</div>
<div
class=
"detail-value"
>
在员工
<span
v-for=
"(item, index) in limitUserList"
class=
"el-tag-item"
:key=
"index"
>
<el-tag
type=
"info"
v-if=
"index
< 3
"
>
<i
class=
"el-icon-user-solid"
></i>
{{
item
.
staffName
}}
</el-tag>
<el-tag
type=
"info"
v-if=
"basicInfo.userList.length > 3 && index == 3"
>
<el-popover
placement=
"top"
width=
"300"
trigger=
"hover"
>
<span
slot=
"reference"
>
...(
{{
basicInfo
.
userList
.
length
}}
)
</span>
<div
class=
"entmicro-hover"
>
<el-tag
type=
"info"
v-for=
"(i, index) in basicInfo.userList"
:key=
"index"
:disable-transitions=
"false"
>
{{
i
.
staffName
}}
</el-tag>
</div>
</el-popover>
</el-tag>
</span>
中满足以下条件中的
{{
basicInfo
.
customerCount
?
basicInfo
.
customerCount
:
0
}}
个
{{
form
==
'customer'
?
'客户'
:
'群聊'
}}
<!-- v-if="selectType == 2"
<span
v-for=
"(item, index) in basicInfo.userList"
:key=
"item.id"
>
[
{{
item
.
staffName
}}
]
<span
v-show=
"basicInfo.userList.length -1 != index"
>
、
</span>
</span>
-->
</div>
</div>
<div
class=
"detail-condition"
v-if=
"form == 'customer' && basicInfo.selectType == 1"
>
<div
class=
"detail-condition-item"
>
<span
class=
"name"
>
性别
</span>
<span>
全部性别
</span>
</div>
</div>
<div
class=
"detail-condition"
v-if=
"form == 'customer' && basicInfo.selectType == 2"
>
<div
class=
"detail-condition-item"
>
<span
class=
"name"
>
性别
</span>
<span>
{{
SEX_TYPE
[
basicInfo
.
condition
.
sex
]
}}
</span>
</div>
<div
v-if=
"basicInfo.condition.startTime"
class=
"detail-condition-item"
>
<span
class=
"name"
>
添加时间
</span>
<span>
{{
basicInfo
.
condition
.
startTime
?
basicInfo
.
condition
.
startTime
.
split
(
' '
)[
0
]
:
'-'
}}
至
{{
basicInfo
.
condition
.
endTime
?
basicInfo
.
condition
.
endTime
.
split
(
' '
)[
0
]
:
'-'
}}
</span>
</div>
<div
class=
"detail-condition-item"
v-if=
"basicInfo.condition.chatName"
>
<span
class=
"name"
>
所在群聊
</span>
<span
v-for=
"(item, index) in basicInfo.condition.chatName.split(',')"
class=
"el-tag-item"
:key=
"index"
>
<el-tag
v-if=
"index
< 2
"
type=
"info"
class=
"hidden-tag"
>
{{
item
}}
</el-tag>
<el-tag
type=
"info"
v-if=
"basicInfo.condition.chatName.split(',').length > 2 && index == 2"
>
<el-popover
placement=
"top"
width=
"300"
trigger=
"hover"
>
<span
slot=
"reference"
>
...(
{{
basicInfo
.
condition
.
chatName
.
split
(
','
).
length
}}
)
</span>
<div
class=
"entmicro-hover"
>
<el-tag
type=
"info"
v-for=
"(i, index) in basicInfo.condition.chatName.split(',')"
:key=
"index"
:disable-transitions=
"false"
>
{{
i
}}
</el-tag>
</div>
</el-popover>
</el-tag>
</span>
</div>
<div
class=
"detail-condition-item"
v-if=
"basicInfo.condition.tagName"
>
<span
class=
"name"
>
标签筛选
</span>
<span
v-for=
"(itm, idx) in basicInfo.condition.tagName.split(',')"
class=
"el-tag-item"
:key=
"idx"
>
<!--
<el-tag
v-if=
"idx
< 2
"
type=
"info"
class=
"hidden-tag"
>
{{
itm
}}
</el-tag>
-->
<el-tooltip
class=
"toolTip"
effect=
"dark"
:content=
"itm"
placement=
"top"
:disabled=
"itm.length
< 4
||
basicInfo
.
condition
.
tagName
.
split
(',').
length
>
2">
<el-tag
v-if=
"idx
< 2
"
type=
"info"
class=
"hidden-tag"
>
{{
itm
}}
</el-tag>
</el-tooltip>
<el-tag
type=
"info"
v-if=
"basicInfo.condition.tagName.split(',').length > 2 && idx == 2"
>
<el-popover
placement=
"top"
width=
"300"
trigger=
"hover"
>
<span
slot=
"reference"
>
...(
{{
basicInfo
.
condition
.
tagName
.
split
(
','
).
length
}}
)
</span>
<div
class=
"entmicro-hover"
>
<el-tag
type=
"info"
v-for=
"(i, index) in basicInfo.condition.tagName.split(',')"
:key=
"index"
:disable-transitions=
"false"
>
{{
i
}}
</el-tag>
</div>
</el-popover>
</el-tag>
</span>
</div>
</div>
</div>
<div
class=
"title"
>
数据统计
</div>
<div
class=
"statistics-info"
>
<div
class=
"statistics-ul"
>
<div
class=
"statistics-li statistics-border"
>
<div
class=
"statistics-number"
>
<span>
{{
form
==
'customer'
?
statistic
.
senderStaffCount
:
statistic
.
senderStaffCount
}}
</span>
人
</div>
<div
class=
"statistics-text"
>
已发送
{{
form
==
'customer'
?
'成员'
:
'群主'
}}
</div>
</div>
<div
class=
"statistics-li"
>
<div
class=
"statistics-number"
>
<span>
{{
form
==
'customer'
?
statistic
.
senderCustomerCount
:
statistic
.
senderGroupCount
}}
</span>
{{
form
==
'customer'
?
'人'
:
'个'
}}
</div>
<div
class=
"statistics-text"
>
送达
{{
form
==
'customer'
?
'客户'
:
'群聊'
}}
</div>
</div>
</div>
<div
class=
"statistics-ul"
>
<div
class=
"statistics-li statistics-border"
>
<div
class=
"statistics-number"
>
<span>
{{
form
==
'customer'
?
statistic
.
unSenderStaffCount
:
statistic
.
unSenderStaffCount
}}
</span>
人
</div>
<div
class=
"statistics-text"
>
未发送
{{
form
==
'customer'
?
'成员'
:
'群主'
}}
</div>
</div>
<div
class=
"statistics-li"
>
<div
class=
"statistics-number"
>
<span>
{{
form
==
'customer'
?
statistic
.
unSenderCustomerCount
:
statistic
.
unSenderGroupCount
}}
</span>
{{
form
==
'customer'
?
'人'
:
'个'
}}
</div>
<div
class=
"statistics-text"
>
未送达
{{
form
==
'customer'
?
'客户'
:
'群聊'
}}
</div>
</div>
</div>
<div
v-if=
"form == 'customer'"
class=
"statistics-ul"
>
<div
class=
"statistics-li"
>
<div
class=
"statistics-number"
>
<span>
{{
statistic
.
senderCustomerFailureCount
}}
</span>
人
</div>
<div>
客户送达失败
</div>
</div>
</div>
</div>
</div>
<Preview
:eventBus=
"eventBus"
:list
.
sync=
"basicInfo.attachmentList"
></Preview>
</div>
</div>
</
template
>
<
script
>
const
STATUS
=
{
'-1'
:
'创建失败'
,
0
:
'创建成功'
,
1
:
'发送成功'
,
2
:
'发送失败'
,
3
:
'待发送'
}
const
SEX
=
{
null
:
'全部性别'
,
1
:
'男'
,
2
:
'女'
,
0
:
'未知性别'
}
import
*
as
dayjs
from
'dayjs'
import
Preview
from
'../components/preview.vue'
export
default
{
name
:
'BasicInof'
,
props
:
[
'form'
,
'id'
,
'eventBus'
],
components
:
{
Preview
},
data
()
{
return
{
STATUS_TYPE
:
STATUS
,
SEX_TYPE
:
SEX
,
basicInfo
:
{
condition
:
{}
},
statistic
:
{},
limitUserList
:
[]
}
},
watch
:
{
basicInfo
(
val
)
{
if
(
val
.
userList
.
length
>
4
)
{
this
.
limitUserList
=
val
.
userList
.
slice
(
0
,
4
)
}
else
{
this
.
limitUserList
=
val
.
userList
}
}
},
mounted
()
{
this
.
getCustomerDetail
(
this
.
id
)
this
.
getStatistic
()
// console.log(this.basicInfo.condition, '----')
},
computed
:
{
// tagWidth() {
// var jmz = {}
// jmz.GetLength = function (str) {
// return str.replace(/[\u0391-\uFFE5]/g, 'aa').length //先把中文替换成两个字节的英文,在计算长度
// }
// }
},
methods
:
{
getCustomerDetail
(
id
)
{
this
.
$apis
.
customerTransform
.
customerDetail
({
id
}).
then
(
res
=>
{
this
.
basicInfo
=
res
// console.log(this.basicInfo, '123');
// this.basicInfo.sendTime = dayjs(this.basicInfo.sendTime).format('YYYY-MM-DD HH:mm:ss')
const
previewList
=
res
.
attachmentList
.
map
(
item
=>
{
if
(
item
.
attType
==
7
&&
item
.
attContent
)
item
.
attContent
=
JSON
.
parse
(
item
.
attContent
)
// if (item.attType == 1) {
// item.attContent = item.attContent.replaceAll('[@昵称]', '@昵称')
// }
return
item
})
this
.
eventBus
.
$emit
(
'update'
,
previewList
)
})
},
getStatistic
()
{
const
{
id
,
form
}
=
this
if
(
form
==
'customer'
)
{
this
.
$apis
.
customerTransform
.
detailStatistic
({
id
}).
then
(
res
=>
{
this
.
statistic
=
res
})
}
else
if
(
form
==
'customerGroup'
)
{
this
.
$apis
.
customerTransform
.
groupDetailStatistic
({
id
}).
then
(
res
=>
{
this
.
statistic
=
res
})
}
}
}
}
</
script
>
<
style
lang=
"scss"
scope
>
.container
{
margin-bottom
:
20px
;
background-color
:
#ffffff
;
.title
{
padding
:
20px
0
17px
20px
;
font-size
:
16px
;
font-weight
:
600
;
color
:
#333
;
border-bottom
:
1px
solid
#d8d8d8
;
}
.detail-content
{
display
:
flex
;
align-items
:
flex-end
;
justify-content
:
space-between
;
box-sizing
:
border-box
;
width
:
100%
;
height
:
100%
;
padding
:
20px
24px
40px
0
;
.content-info
{
width
:
calc
(
100%
-
323px
);
.content-text
{
padding-left
:
52px
;
height
:
400px
;
}
.detail-item
{
display
:
flex
;
align-items
:
center
;
font-size
:
14px
;
color
:
#333
;
line-height
:
20px
;
margin-bottom
:
24px
;
.detail-label
{
width
:
70px
;
}
.detail-tips
{
margin-left
:
8px
;
color
:
#939393
;
}
.el-tag-item
{
margin-right
:
6px
;
&:last-child
{
margin-right
:
0
;
}
}
i
{
color
:
#75acff
;
margin-right
:
3px
;
font-size
:
14px
;
}
}
.detail-condition
{
display
:
flex
;
width
:
calc
(
100%
-
66px
);
margin-left
:
72px
;
margin-top
:
13px
;
border-radius
:
2px
;
font-size
:
14px
;
color
:
#333333
;
flex-wrap
:
wrap
;
//
div
:
nth-child
(
odd
)
{
//
border-right
:
none
;
//
}
div
:nth-child
(
2
),
div
:nth-child
(
4
)
{
border-left
:
none
;
}
div
:nth-child
(
3
),
div
:nth-child
(
4
)
{
border-top
:
none
;
}
&
-item
{
width
:
calc
(
50%
-
2px
);
min-width
:
327px
;
height
:
40px
;
line-height
:
40px
;
background
:
#f7f7f7
;
border
:
1px
solid
#d8d8d8
;
min-width
:
325px
;
.name
{
display
:
inline-block
;
width
:
68px
;
padding-left
:
10px
;
color
:
#999999
;
}
}
}
.statistics-info
{
margin-top
:
24px
;
margin-left
:
52px
;
display
:
flex
;
overflow-x
:
scroll
;
.statistics-ul
{
display
:
flex
;
border-radius
:
2px
;
background-color
:
#f6f6ff
;
border
:
1px
solid
rgba
(
88
,
80
,
255
,
0.8
);
margin-right
:
20px
;
height
:
142px
;
&:last-child
{
margin-right
:
0
;
}
}
.statistics-li
{
position
:
relative
;
color
:
#424242
;
font-size
:
14px
;
text-align
:
center
;
width
:
142px
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
flex-direction
:
column
;
&.statistics-border
{
margin-right
:
0
;
//
border-right
:
1px
solid
#5850ff
;
&::after
{
content
:
''
;
display
:
inline-block
;
position
:
absolute
;
right
:
0
;
height
:
58px
;
border-right
:
1px
solid
#5850ff
;
}
}
.statistics-number
{
margin-bottom
:
12px
;
font-size
:
16px
;
color
:
#333
;
span
{
font-size
:
26px
;
}
}
.statistics-text
{
width
:
70px
;
}
}
}
}
}
}
.el-tag
{
margin-right
:
6px
;
cursor
:
pointer
;
}
.el-popover
.el-tag
{
margin-bottom
:
6px
;
}
.el-tag-item
{
display
:
inline-flex
;
align-items
:
center
;
}
.hidden-tag
{
max-width
:
82px
;
text-overflow
:
ellipsis
;
overflow
:
hidden
;
white-space
:
nowrap
;
}
</
style
>
src/views/activity/components/emotionWords.vue
deleted
100644 → 0
View file @
5781095
<
template
>
<div>
<div
class=
"emotion-box"
:style=
"
{ height: height + 'px' }">
<div
class=
"emotion-box-line"
v-for=
"(line, i) in list"
:key=
"i"
>
<emotion
class=
"emotion-item"
v-for=
"(item, i) in line"
:key=
"i"
@
click
.
native=
"clickHandler(item)"
>
{{
item
}}
</emotion>
</div>
</div>
</div>
</
template
>
<
script
>
import
emoji
from
'@/utils/emo'
import
Emotion
from
'./Emotion'
export
default
{
props
:
{
height
:
{
type
:
Number
,
default
:
200
}
},
data
()
{
return
{
list
:
emoji
}
},
methods
:
{
clickHandler
(
i
)
{
let
emotion
=
`
${
i
}
`
this
.
$emit
(
'emotion'
,
emotion
)
}
},
components
:
{
Emotion
}
}
</
script
>
<
style
scoped
lang=
"scss"
>
.emotion-box
{
z-index
:
2004
;
background-color
:
#fff
;
border-radius
:
2px
;
box-shadow
:
0
2px
12px
0
rgba
(
0
,
0
,
0
,
0.15
);
width
:
300px
;
box-sizing
:
border-box
;
padding
:
5px
;
overflow
:
hidden
;
overflow-y
:
auto
;
}
.emotion-box-line
{
display
:
flex
;
}
.emotion-item
{
flex
:
1
;
text-align
:
center
;
cursor
:
pointer
;
line-height
:
23px
;
/deep/
{
img
{
width
:
24px
;
-webkit-user-select
:
none
;
cursor
:
default
;
pointer-events
:
none
;
}
}
}
</
style
>
src/views/activity/components/marketConfig.vue
View file @
6c5b06a
...
...
@@ -149,15 +149,15 @@ export default {
// funName: 'link',
// text: '车主朋友,您好!<br>我是您的福利官,欢迎您领取电子质保卡,<br>请点击下方链接进行领取及查看:<br><span style="color:#409eff;">https://dj.glsx.com.cn/dj-car-boutique-work-wechat/#/</span><br>祝您用车愉快!<br>'
// },
{
name
:
'素材'
,
type
:
'material'
,
funName
:
'material'
,
groupListApi
:
this
.
$apis
.
welcomeword
.
getGroupListApi
,
materialListApi
:
this
.
$apis
.
welcomeword
.
getMaterialListApi
,
// videoNo: true
pdfNo
:
true
},
//
{
//
name: '素材',
//
type: 'material',
//
funName: 'material',
//
groupListApi: this.$apis.welcomeword.getGroupListApi,
//
materialListApi: this.$apis.welcomeword.getMaterialListApi,
//
// videoNo: true
//
pdfNo: true
//
},
{
name
:
'模板'
,
type
:
'message'
,
...
...
src/views/activity/components/materialModel.vue
deleted
100644 → 0
View file @
5781095
<!-- 素材弹窗 -->
<
template
>
<el-dialog
title=
"选择素材"
:isVisible
.
sync=
"isMaterialVisible"
width=
"1088px"
@
confirmDialog=
"handleMaterialConfirm"
@
closeDialog=
"handleMaterialClose"
class=
"relateStore"
>
<GLCombiForm
ref=
"showSearch"
:formObj=
"searchForm"
:formData=
"searchFormData"
@
handleOk=
"handleSearch"
@
handleRest=
"handleReset"
></GLCombiForm>
<div
class=
"model-panel"
>
<div
class=
"model-item-panel"
v-if=
"modelList.length > 0"
v-loading=
"loading"
>
<div
class=
"model-item"
:class=
"
{ checked: selectItem.id == item.id }" v-for="(item, index) in modelList" :key="index" @click="handleSelectItem(item)">
<el-tooltip
effect=
"dark"
placement=
"top"
:content=
"item.materialContentRpcResponse.materialName"
:disabled=
"item.materialContentRpcResponse.materialName.length
< 16
"
>
<!--
<span
class=
"hide-content"
>
{{
item
.
materialContentRpcResponse
.
materialName
}}
</span>
-->
<div
class=
"model-item-title"
:title=
"item.materialContentRpcResponse.materialName"
>
{{
item
.
materialContentRpcResponse
?
item
.
materialContentRpcResponse
.
materialName
:
'-'
}}
</div>
</el-tooltip>
<!--
<img
:src=
"item.materialContentRpcResponse.materialUrl"
/>
-->
<!-- 素材内容 -->
<!--
<div
slot=
"materialContentRpcResponse"
slot-scope=
"scope"
style=
"text-align: center"
>
-->
<!-- 素材为PDF -->
<span
v-if=
"item.materialType == 1"
class=
"material-content"
>
<!--
<el-tooltip
effect=
"dark"
placement=
"top"
:content=
"item.materialContentRpcResponse.materialName"
:disabled=
"item.materialContentRpcResponse.materialName.length
< 16
"
>
<span
class=
"hide-content"
>
{{
item
.
materialContentRpcResponse
.
materialName
}}
</span>
</el-tooltip>
-->
<img
class=
"img-pdf"
src=
"@/assets/material/pdf.png"
alt=
""
/>
<p
class=
"model-item-content"
>
{{
item
.
materialContentRpcResponse
.
materialName
}}
.png
</p>
</span>
<!-- 素材为自定义链接 -->
<!--
<span
v-if=
"item.materialType == 2"
></span>
-->
<!-- 图文 -->
<span
v-if=
"item.materialType == 3"
class=
"material-content"
>
<!--
<el-tooltip
effect=
"dark"
placement=
"top"
:content=
"item.materialContentRpcResponse.materialName"
:disabled=
"item.materialContentRpcResponse.materialName.length
< 16
"
>
<span>
{{
item
.
materialContentRpcResponse
.
materialName
}}
</span>
</el-tooltip>
-->
<!--
<el-popover
placement=
"top"
trigger=
"click"
>
<div>
<img
style=
"width: 72px; height: 72px;"
v-if=
"item.materialContentRpcResponse.materialUrl"
:src=
"item.materialContentRpcResponse.materialUrl"
alt=
""
/>
<img
class=
"img-material"
v-else
src=
"@/assets/material/car.png"
alt=
""
/>
</div>
<span
slot=
"reference"
>
<img
v-if=
"item.materialContentRpcResponse.materialUrl"
class=
"img-material"
:src=
"item.materialContentRpcResponse.materialUrl"
/>
<img
v-else
class=
"img-material"
src=
"@/assets/material/car.png"
alt=
""
/>
</span>
</el-popover>
-->
<img
v-if=
"item.materialContentRpcResponse.materialUrl"
class=
"img-material"
:src=
"item.materialContentRpcResponse.materialUrl"
/>
<img
v-else
class=
"img-material"
src=
"@/assets/material/car.png"
alt=
""
/>
</span>
</div>
<!--
</div>
-->
</div>
<div
class=
"model-item-empty"
v-else
v-loading=
"loading"
>
<img
src=
"@/assets/img/empty.png"
/>
<div
class=
"empty-item"
>
暂无数据
</div>
</div>
<el-pagination
@
size-change=
"handleSizeChange"
@
current-change=
"handleCurrentChange"
:current-page=
"pageNum"
:page-sizes=
"[12, 24, 36, 48]"
:page-size=
"pageSize"
:total=
"tableTotal"
layout=
"total, sizes, prev, pager, next, jumper"
></el-pagination>
</div>
</el-dialog>
</
template
>
<
script
>
export
default
{
name
:
'materialModel'
,
data
()
{
return
{
searchForm
:
{
groupId
:
''
,
materialType
:
''
},
searchFormData
:
[
{
label
:
'素材分组'
,
name
:
'groupId'
,
type
:
'select'
,
optionList
:
[],
optionId
:
'id'
,
optionLabel
:
'materialGroupName'
,
optionsName
:
'groupList'
},
{
label
:
'素材类型'
,
name
:
'materialType'
,
type
:
'select'
,
optionList
:
[],
optionId
:
'confId'
,
optionLabel
:
'confName'
,
optionsName
:
'materialTypeList'
}
],
// selectedData: [],
// selectingData: [],
// needTip: ['editProduct'],
modelList
:
[],
selectItem
:
{
id
:
''
},
// 分页
pageNum
:
1
,
pageSize
:
12
,
tableTotal
:
0
,
baseData
:
{
groupList
:
[],
materialTypeList
:
[
{
confId
:
1
,
confName
:
'PDF'
},
// {
// confId: 2,
// confName: '自定义链接'
// },
{
confId
:
3
,
confName
:
'图文'
}
]
}
}
},
props
:
{
isMaterialVisible
:
{
type
:
Boolean
,
default
:
false
}
},
created
()
{
this
.
getBaseData
()
},
mounted
()
{
this
.
getModelList
()
},
methods
:
{
getBaseData
()
{
this
.
$apis
.
sop
.
getGroupListApi
({}).
then
(
res
=>
{
this
.
baseData
.
groupList
=
res
this
.
getOptionsList
(
'searchFormData'
)
})
},
handleSelectItem
(
item
)
{
this
.
selectItem
=
item
},
getModelList
()
{
var
params
=
{
...
this
.
searchForm
,
status
:
0
,
pageNum
:
this
.
pageNum
,
pageSize
:
this
.
pageSize
}
this
.
$apis
.
sop
.
getMaterialListApi
(
params
).
then
(
res
=>
{
this
.
modelList
=
res
.
data
this
.
tableTotal
=
res
.
count
let
tableData
=
[]
this
.
modelList
.
forEach
(
item
=>
{
if
(
item
.
materialType
!=
3
)
{
item
.
materialContentRpcResponse
.
materialUrl
=
''
}
if
(
item
.
materialType
==
3
)
{
let
html
=
decodeURIComponent
(
item
.
materialContentRpcResponse
.
materialUrl
)
let
imgHtml
=
html
.
match
(
/<img.*
?(?:
>|
\/
>
)
/g
)
if
(
imgHtml
)
{
let
imgSrc
=
imgHtml
[
0
].
match
(
'<img[^<>]*? src="([^<>]*?)"'
)
item
.
materialContentRpcResponse
.
materialUrl
=
imgSrc
[
1
]
}
else
{
item
.
materialContentRpcResponse
.
materialUrl
=
''
}
}
tableData
.
push
(
item
)
})
})
},
handleReset
()
{
this
.
searchForm
=
{
groupId
:
''
,
materialType
:
''
}
this
.
handleSearch
()
},
handleSearch
()
{
this
.
pageNum
=
1
this
.
getModelList
()
},
handleSizeChange
(
val
)
{
this
.
pageSize
=
val
this
.
getModelList
()
},
handleCurrentChange
(
val
)
{
this
.
pageNum
=
val
this
.
getModelList
()
},
getOptionsList
(
formName
,
hasAll
=
true
,
refreshSigle
)
{
if
(
refreshSigle
)
{
var
item
=
this
[
formName
].
find
(
k
=>
k
.
name
==
refreshSigle
)
var
index
=
this
[
formName
].
findIndex
(
k
=>
k
.
name
==
refreshSigle
)
this
.
$set
(
this
[
formName
][
index
],
'optionList'
,
this
.
$common
.
utils
.
deepClone
(
this
.
baseData
[
item
.
optionsName
]))
if
(
hasAll
&&
this
.
baseData
[
item
.
optionsName
].
length
&&
this
.
baseData
[
item
.
optionsName
][
0
][
this
[
formName
][
index
].
optionLabel
]
!==
'全部'
)
{
const
temp
=
{}
temp
[
this
[
formName
][
index
].
optionId
]
=
''
temp
[
this
[
formName
][
index
].
optionLabel
]
=
'全部'
this
[
formName
][
index
].
optionList
.
unshift
(
temp
)
}
}
else
{
this
[
formName
].
forEach
((
item
,
index
)
=>
{
if
(
item
.
type
===
'select'
&&
this
.
baseData
[
item
.
optionsName
].
length
)
{
this
.
$set
(
this
[
formName
][
index
],
'optionList'
,
this
.
$common
.
utils
.
deepClone
(
this
.
baseData
[
item
.
optionsName
]))
if
(
hasAll
&&
this
.
baseData
[
item
.
optionsName
].
length
&&
this
.
baseData
[
item
.
optionsName
][
0
][
this
[
formName
][
index
].
optionLabel
]
!==
'全部'
)
{
const
temp
=
{}
temp
[
this
[
formName
][
index
].
optionId
]
=
''
temp
[
this
[
formName
][
index
].
optionLabel
]
=
'全部'
this
[
formName
][
index
].
optionList
.
unshift
(
temp
)
}
}
})
}
},
handleMaterialConfirm
()
{
this
.
$emit
(
'handleMaterialConfirm'
,
{
objectId
:
this
.
selectItem
.
id
,
objectType
:
10
,
objectName
:
this
.
selectItem
.
materialContentRpcResponse
.
materialName
,
additionalType
:
1
})
},
handleMaterialClose
()
{
this
.
$emit
(
'handleMaterialClose'
)
}
}
}
</
script
>
<
style
lang=
"scss"
scoped
>
.relateStore
{
/deep/
{
.gl-operate
{
margin-left
:
10px
;
}
}
}
.model-panel
{
.model-panel-tab
{
display
:
flex
;
align-items
:
center
;
margin-bottom
:
18px
;
label
{
font-size
:
16px
;
font-weight
:
400
;
color
:
#000000
;
line-height
:
24px
;
}
/
deep
/
{
.
el-checkbox
:
last-of-type
{
margin-right
:
8px
;
}
.el-tabs__nav
{
border
:
0
;
}
.el-tabs__header
{
border
:
0
;
background-color
:
#f4f6fc
;
margin
:
0px
;
}
.el-tabs__item
{
border
:
none
;
width
:
180px
;
height
:
32px
;
line-height
:
32px
;
margin
:
2px
;
text-align
:
center
;
}
.el-tabs__item.is-active
{
background-color
:
#fff
;
border-radius
:
4px
;
font-weight
:
600
;
}
.el-pagination
{
padding
:
5px
;
}
}
}
.model-item-empty
{
>
img
{
display
:
block
;
margin
:
50px
auto
0px
;
width
:
60px
;
height
:
auto
;
}
.empty-item
{
text-align
:
center
;
font-size
:
14px
;
font-weight
:
400
;
color
:
#000000
;
line-height
:
22px
;
margin-bottom
:
30px
;
}
}
.model-item-panel
{
//
display
:
grid
;
//
grid-template-columns
:
repeat
(
4
,
25%
);
//
grid-row-gap
:
10px
;
max-height
:
38vh
;
overflow
:
auto
;
display
:
flex
;
flex-wrap
:
wrap
;
align-items
:
stretch
;
flex-direction
:
row
;
.model-item
{
width
:
240px
;
margin-right
:
24px
;
margin-bottom
:
24px
;
padding
:
12px
16px
;
position
:
relative
;
text-align
:
center
;
//
height
:
128px
;
background
:
#ffffff
;
border-radius
:
4px
;
border
:
1px
solid
#e6e6e6
;
padding
:
14px
24px
;
box-sizing
:
border-box
;
&:nth-child(4n)
{
margin-right
:
0px
;
}
&
.checked
{
background
:
rgba
(
88
,
80
,
255
,
0.1
);
border
:
1px
solid
#5850ff
;
}
&
-qrcode
{
position
:
absolute
;
right
:
10px
;
bottom
:
10px
;
width
:
60px
;
height
:
60px
;
border
:
1px
solid
#979797
;
}
&
-title
{
font-size
:
18px
;
font-weight
:
600
;
color
:
#333333
;
line-height
:
25px
;
margin-bottom
:
5px
;
text-overflow
:
ellipsis
;
overflow
:
hidden
;
white-space
:
nowrap
;
}
.img-pdf
{
width
:
40px
;
height
:
40px
;
margin-top
:
10px
;
}
.img-material
{
width
:
72px
;
height
:
72px
;
}
&
-content
{
font-size
:
12px
;
font-weight
:
400
;
color
:
#666666
;
line-height
:
16px
;
height
:
16px
;
margin-top
:
6px
;
text-overflow
:
ellipsis
;
overflow
:
hidden
;
white-space
:
nowrap
;
&.model-item-weight
{
line-height
:
20px
;
height
:
20px
;
}
span
{
color
:
#5850ff
;
font-size
:
20px
;
}
}
&
-contents
{
line-height
:
22px
;
height
:
22px
;
}
}
}
}
</
style
>
src/views/activity/components/messageModel.vue
deleted
100644 → 0
View file @
5781095
<
template
>
<div
class=
"square-main"
>
<el-dialog
title=
"选择模板"
:visible
.
sync=
"dialogVisible"
width=
"1142px"
:before-close=
"handleClose"
:close-on-click-modal=
"false"
>
<div
class=
"model-panel"
v-loading=
"messageLoading"
>
<el-form
:inline=
"true"
class=
"message-form"
:model=
"searchForm"
ref=
"searchForm"
>
<el-form-item
label=
"模板标题"
size=
"small"
>
<el-input
v-model=
"searchForm.title"
:size=
"size"
placeholder=
"请输入模板名称搜索"
></el-input>
</el-form-item>
<el-form-item
label=
"创建者"
size=
"small"
style=
"margin-left: 10px"
>
<el-select
v-model=
"searchForm.createdBy"
:size=
"size"
placeholder=
"全部"
>
<el-option
v-for=
"item in createdList"
:key=
"item.id"
:label=
"item.createdName"
:value=
"item.createdBy"
></el-option>
</el-select>
</el-form-item>
<el-form-item
size=
"small"
style=
"margin-left: 10px"
>
<el-button
type=
"primary"
:size=
"size"
@
click=
"search"
>
查询
</el-button>
</el-form-item>
<el-form-item
style=
"float: right;margin-right: 0;"
>
<el-button
:size=
"size"
icon=
"el-icon-plus"
@
click=
"createModel"
>
新增模板
</el-button>
</el-form-item>
</el-form>
<!--
<div
class=
"model-panel-tab"
>
<label>
模板类型:
</label>
<el-tabs
v-model=
"activeName"
@
tab-click=
"handleClick"
type=
"card"
>
<el-tab-pane
label=
"售前"
name=
"1"
></el-tab-pane>
<el-tab-pane
label=
"售中"
name=
"2"
></el-tab-pane>
<el-tab-pane
label=
"售后"
name=
"3"
></el-tab-pane>
</el-tabs>
</div>
-->
<div
class=
"model-item-panel"
v-if=
"!loading && modelList.length > 0"
v-loading=
"loading"
>
<div
class=
"model-item"
v-for=
"item in modelList"
:key=
"item.id"
>
<div
class=
"model-item-radio"
>
<el-radio
v-model=
"messageRadio"
:label=
"item"
></el-radio>
</div>
<div
class=
"model-item-title"
>
<div
class=
"model-title-h1"
>
{{
item
.
title
}}
</div>
<div
class=
"model-title-h2"
>
{{
item
.
content
}}
</div>
</div>
<div
class=
"model-item-content"
>
<div
class=
"model-content"
>
创建人:
{{
item
.
createdName
}}
</div>
<div
class=
"model-content"
>
创建日期:
{{
item
.
createdTime
}}
</div>
</div>
<div
class=
"model-item-btn"
>
<el-button
v-if=
"item.createdBy == userId"
type=
"text"
:size=
"size"
@
click=
"editModel(item.id)"
>
编辑
</el-button>
</div>
</div>
</div>
<div
class=
"model-item-panel"
v-else
>
<img
src=
"@/assets/empty.png"
/>
<div
class=
"empty-item"
>
暂无数据
</div>
</div>
<el-pagination
background
@
size-change=
"handleSizeChange"
@
current-change=
"handleCurrentChange"
:current-page=
"pageNum"
:page-sizes=
"[10, 20, 30, 40]"
:page-size=
"pageSize"
:total=
"tableTotal"
:layout=
"layout"
></el-pagination>
</div>
<span
slot=
"footer"
class=
"dialog-footer"
>
<el-button
size=
"small"
@
click=
"handleClose"
>
取 消
</el-button>
<el-button
size=
"small"
type=
"primary"
@
click=
"selectModelItem"
>
复制文本
</el-button>
</span>
</el-dialog>
<el-dialog
:title=
"modelTitle"
:visible
.
sync=
"createVisible"
width=
"547px"
:before-close=
"handleCreateClose"
:close-on-click-modal=
"false"
>
<el-form
:model=
"templateForm"
:rules=
"templateRules"
ref=
"templateForm"
label-width=
"100px"
class=
"templateForm"
>
<el-form-item
label=
"标题"
prop=
"title"
>
<el-input
v-model=
"templateForm.title"
maxlength=
"10"
show-word-limit
placeholder=
"输入10个字以内的标题,如活动促销"
></el-input>
</el-form-item>
<el-form-item
label=
"内容说明"
prop=
"content"
>
<el-input
type=
"textarea"
v-model=
"templateForm.content"
maxlength=
"600"
:rows=
"7"
show-word-limit
placeholder=
"输入不超过600字内的文字说明"
></el-input>
</el-form-item>
</el-form>
<div
class=
"template-footer"
>
<el-button
size=
"small"
@
click=
"createModel"
>
取 消
</el-button>
<el-button
size=
"small"
type=
"primary"
:loading=
"createLoading"
@
click=
"handleCreate"
>
立即创建
</el-button>
</div>
</el-dialog>
</div>
</
template
>
<
script
>
export
default
{
name
:
'MessageModel'
,
data
()
{
return
{
dialogVisible
:
false
,
createVisible
:
false
,
loading
:
false
,
activeName
:
'1'
,
messageRadio
:
{},
messageLoading
:
false
,
modelList
:
[
// {
// title: '121',
// content: 'jlkjl就离开家离开家离开jlkjl就离开家离开家离开jlkjl就离开家离开家离开jlkjl就离开家离开家离开jlkjl就离开家离开家离开jlkjl就离开家离开家离开jlkjl就离开家离开家离开',
// createdTime: '2022-01-04'
// }
],
pageNum
:
1
,
pageSize
:
10
,
tableTotal
:
0
,
layout
:
''
,
searchForm
:
{},
templateForm
:
{},
templateRules
:
{
title
:
[{
required
:
true
,
message
:
'请输入标题'
,
trigger
:
'blur'
}],
content
:
[{
required
:
true
,
message
:
'请输入标题'
,
trigger
:
'blur'
}]
},
createLoading
:
false
,
createdList
:
[],
modelTitle
:
'创建群发模板'
,
userId
:
''
}
},
mounted
()
{
console
.
log
(
this
.
$globalState
,
'222323'
)
if
(
this
.
$globalState
)
{
this
.
userId
=
this
.
$globalState
.
session
.
id
}
},
props
:
{
messageList
:
Object
},
methods
:
{
init
()
{
this
.
messageLoading
=
true
this
.
pageNum
=
1
this
.
messageRadio
=
{}
this
.
dialogVisible
=
true
this
.
dracImMessage
()
this
.
getCreatedList
()
},
selectModelItem
()
{
this
.
dialogVisible
=
false
this
.
$emit
(
'selectItem'
,
this
.
messageRadio
)
},
handleClick
()
{
this
.
dracImMessage
()
},
search
()
{
this
.
dracImMessage
(
this
.
searchForm
)
},
handleClose
()
{
this
.
dialogVisible
=
false
this
.
modelList
=
[]
this
.
tableTotal
=
0
},
dracImMessage
(
searcher
)
{
this
.
modelList
=
[]
this
.
loading
=
true
let
params
=
{
pageSize
:
this
.
pageSize
,
pageNum
:
this
.
pageNum
}
if
(
searcher
)
{
params
.
title
=
searcher
.
title
params
.
createdBy
=
searcher
.
createdBy
}
const
{
templateApi
}
=
this
.
messageList
templateApi
(
params
).
then
(
res
=>
{
if
(
res
)
{
this
.
modelList
=
res
.
data
this
.
tableTotal
=
res
.
count
if
(
res
.
count
>
10
)
{
this
.
layout
=
'pager'
}
}
this
.
loading
=
false
})
},
handleSizeChange
(
val
)
{
console
.
log
(
`每页
${
val
}
条`
)
},
handleCurrentChange
(
val
)
{
this
.
pageNum
=
val
this
.
dracImMessage
()
console
.
log
(
`当前页:
${
val
}
`
)
},
createModel
()
{
this
.
createVisible
=
!
this
.
createVisible
if
(
!
this
.
createVisible
)
{
this
.
templateForm
=
{}
}
},
handleCreate
()
{
this
.
$refs
.
templateForm
.
validate
(
valid
=>
{
if
(
valid
)
{
console
.
log
(
this
.
templateForm
)
this
.
createLoading
=
true
const
params
=
{
title
:
this
.
templateForm
.
title
,
content
:
this
.
templateForm
.
content
}
const
{
templateSaveApi
,
templateUpdateApi
}
=
this
.
messageList
let
api
=
templateSaveApi
if
(
this
.
templateForm
.
id
)
{
api
=
templateUpdateApi
params
.
id
=
this
.
templateForm
.
id
}
api
(
params
).
then
(
res
=>
{
console
.
log
(
res
)
this
.
createLoading
=
false
if
(
res
)
{
this
.
$message
({
type
:
'success'
,
message
:
'操作成功!'
})
this
.
pageNum
=
1
this
.
createModel
()
this
.
dracImMessage
()
}
})
}
})
},
editModel
(
id
)
{
this
.
createModel
()
this
.
modelTitle
=
'编辑群发模板'
this
.
getTemplateDetail
(
id
)
},
getCreatedList
()
{
const
{
getSearchApi
}
=
this
.
messageList
getSearchApi
({}).
then
(
res
=>
{
this
.
createdList
=
res
this
.
$nextTick
(()
=>
{
this
.
messageLoading
=
false
})
})
},
getTemplateDetail
(
id
)
{
const
{
templateDetailApi
}
=
this
.
messageList
templateDetailApi
({
id
}).
then
(
res
=>
{
console
.
log
(
res
)
if
(
res
)
{
this
.
templateForm
=
res
}
})
}
}
}
</
script
>
<
style
lang=
"scss"
scoped
>
.model-panel
{
padding
:
0
20px
;
.model-panel-tab
{
display
:
flex
;
align-items
:
center
;
margin-bottom
:
18px
;
label
{
font-size
:
16px
;
font-weight
:
400
;
color
:
#000000
;
line-height
:
24px
;
}
/
deep
/
{
.
el-checkbox
:
last-of-type
{
margin-right
:
8px
;
}
.el-tabs__nav
{
border
:
0
;
}
.el-tabs__header
{
border
:
0
;
background-color
:
#f4f6fc
;
margin
:
0px
;
}
.el-tabs__item
{
border
:
none
;
width
:
180px
;
height
:
32px
;
line-height
:
32px
;
margin
:
2px
;
text-align
:
center
;
}
.el-tabs__item.is-active
{
background-color
:
#fff
;
border-radius
:
4px
;
}
}
}
.model-item-panel
{
max-height
:
400px
;
overflow
:
auto
;
>
img
{
display
:
block
;
margin
:
50px
auto
0px
;
width
:
60px
;
height
:
auto
;
}
.empty-item
{
text-align
:
center
;
font-size
:
14px
;
font-weight
:
400
;
color
:
#000000
;
line-height
:
22px
;
margin-bottom
:
30px
;
}
.model-item
{
display
:
flex
;
padding
:
20px
;
border-bottom
:
1px
solid
#e9e9e9
;
&:last-child
{
border-bottom
:
none
;
}
&
-radio
{
width
:
60px
;
/deep/
{
.el-radio__input
{
margin-top
:
10px
;
}
.el-radio__label
{
display
:
none
;
}
}
}
&
-content
{
min-width
:
210px
;
margin-right
:
50px
;
.model-content
{
font-size
:
14px
;
font-weight
:
400
;
color
:
#999999
;
line-height
:
20px
;
}
}
&
-title
{
flex
:
1
;
.model-title-h1
{
font-size
:
14px
;
font-weight
:
400
;
max-width
:
658px
;
color
:
#333333
;
line-height
:
20px
;
overflow
:
hidden
;
white-space
:
nowrap
;
text-overflow
:
ellipsis
;
}
.model-title-h2
{
font-size
:
14px
;
font-weight
:
400
;
color
:
#999999
;
line-height
:
20px
;
max-width
:
658px
;
overflow
:
hidden
;
white-space
:
nowrap
;
text-overflow
:
ellipsis
;
}
}
&
-btn
{
width
:
30px
;
height
:
40px
;
}
}
}
}
.message-form
.el-form-item
{
margin-bottom
:
0
!important
;
}
/
deep
/
.el-pager
{
height
:
30px
;
}
.el-pagination
{
margin-top
:
21px
;
}
.templateForm
{
padding
:
0
20px
;
/deep/
{
.el-textarea__inner
{
background-color
:
#fff
;
}
.el-textarea
.el-input__count
{
background-color
:
#fff
;
}
}
}
.template-footer
{
text-align
:
center
;
border-top
:
1px
solid
#e6e6e6
;
padding-top
:
16px
;
margin-bottom
:
-14px
;
}
/
deep
/
{
.el-dialog__body
{
padding
:
30px
0
;
}
}
</
style
>
src/views/activity/components/preview.vue
deleted
100644 → 0
View file @
5781095
File mode changed
src/views/activity/components/selectEmp.vue
deleted
100644 → 0
View file @
5781095
<
template
>
<div
class=
"select-emp-panel"
>
<div
class=
"scrm-p10 emp-tree-panel"
>
<div
class=
"popper-arrow"
></div>
<div
class=
"emp-scroll-panel"
:style=
"
{
height: treeHeight + 'px'
}"
>
<div
class=
"tree-title"
>
所在门店/部门
</div>
<el-tree
v-loading=
"loading"
:data=
"listTree"
:expand-on-click-node=
"false"
highlight-current
:props=
"defaultProps"
@
node-click=
"handleNodeClick"
></el-tree>
</div>
</div>
<el-col
class=
"scrm-p10 emp-table-panel"
:style=
"
{
height: treeHeight + 20 + 'px'
}"
>
<GLTable
v-loading=
"loading"
ref=
"saleTable"
:tableData=
"tableEmpData"
:tableParams=
"tableParams"
:hasNum=
"false"
:hasPage=
"false"
@
selectionTable=
"selectionTable"
></GLTable>
</el-col>
</div>
</
template
>
<
script
>
export
default
{
name
:
'selectEmp'
,
props
:
[
'selectData'
,
'islord'
],
data
()
{
return
{
treeHeight
:
0
,
staffName
:
''
,
listTree
:
[],
defaultProps
:
{
children
:
'children'
,
label
:
'departmentName'
},
// 表格参数
tableParams
:
{
checkSelectKey
:
'id'
,
checkSelectVal
:
[],
listName
:
'list'
,
// 行数据的key
mutiSelectUniqueKey
:
'id'
,
// 多选ref的名称
mutiSelectName
:
'salelist'
,
btnId
:
new
Date
().
getTime
()
+
parseInt
(
Math
.
random
()
*
1000
),
tableColumns
:
[
{
label
:
'姓名'
,
prop
:
'staffName'
},
{
label
:
'职务'
,
prop
:
'staffTitle'
}
]
},
tableEmpData
:
[],
currentArr
:
[],
loading
:
true
}
},
methods
:
{
selectionTable
(
val
)
{
this
.
$emit
(
'selectTable'
,
val
)
},
listDepartmentTree
()
{
const
params
=
{
merchantId
:
10001001
,
addChildrensFlag
:
true
}
if
(
this
.
islord
)
{
params
.
islord
=
this
.
islord
}
params
.
isHavCustomer
=
true
this
.
$apis
.
customerTransform
.
listDepartmentTree
(
params
).
then
(
res
=>
{
this
.
listTree
=
res
this
.
loading
=
false
if
(
this
.
listTree
.
length
)
{
this
.
listTree
[
0
].
entmicroStaffResponses
=
this
.
getEmployee
(
this
.
listTree
)
this
.
currentArr
=
this
.
$common
.
utils
.
deepClone
(
this
.
listTree
[
0
].
entmicroStaffResponses
)
}
if
(
this
.
selectData
&&
this
.
selectData
.
length
)
{
this
.
selectData
.
forEach
(
i
=>
{
const
row
=
this
.
getEmployee
(
this
.
listTree
).
find
(
j
=>
j
.
id
==
i
.
staffId
)
this
.
clearSelect
(
row
)
})
}
this
.
$nextTick
(()
=>
{
document
.
getElementsByClassName
(
'el-tree-node__expand-icon'
)[
0
].
click
()
document
.
getElementsByClassName
(
'el-tree-node__content'
)[
0
].
click
()
})
})
},
clearSelect
(
row
)
{
this
.
$refs
.
saleTable
.
$refs
.
salelistMutiTable
.
toggleRowSelection
(
row
)
},
clearSelection
()
{
this
.
$refs
.
saleTable
.
$refs
.
salelistMutiTable
.
clearSelection
()
},
handleNodeClick
(
data
)
{
this
.
departmentId
=
data
.
id
this
.
tableEmpData
=
data
.
entmicroStaffResponses
// this.currentArr = this.$common.utils.deepClone(data.entmicroStaffResponses)
// this.listEntmicroStaff()
},
getEmployee
(
d
,
arr
=
[])
{
d
.
forEach
(
i
=>
{
if
(
i
.
entmicroStaffResponses
)
{
i
.
entmicroStaffResponses
.
forEach
(
j
=>
{
const
flag
=
arr
.
find
(
m
=>
m
.
id
==
j
.
id
)
if
(
!
flag
)
{
arr
.
push
(
j
)
}
})
}
if
(
i
.
children
)
{
this
.
getEmployee
(
i
.
children
,
arr
)
}
})
return
arr
},
searchTable
(
search
)
{
const
arr
=
[]
if
(
this
.
currentArr
&&
this
.
currentArr
.
length
!=
0
)
{
this
.
currentArr
.
forEach
(
item
=>
{
if
(
item
.
staffName
.
indexOf
(
search
)
!=
-
1
)
{
arr
.
push
(
item
)
}
})
}
this
.
tableEmpData
=
arr
}
// listEntmicroStaff(staffName) {
// let params = {
// departmentId: this.departmentId,
// staffName: staffName ? staffName : this.staffName,
// merchantid: this.$globalState.session.merchantId
// }
// this.$apis.emp.listEntmicroStaff(params).then(res => {
// this.tableEmpData = res
// })
// }
},
mounted
()
{
let
clientHeight
=
document
.
documentElement
.
clientHeight
this
.
treeHeight
=
clientHeight
-
650
this
.
listDepartmentTree
()
}
}
</
script
>
<
style
scoped
lang=
"scss"
>
.select-emp-panel
{
display
:
flex
;
.emp-tree-panel
{
margin-top
:
10px
;
width
:
200px
;
position
:
relative
;
background
:
#ffffff
;
box-shadow
:
0px
2px
12px
0px
rgba
(
0
,
0
,
0
,
0.06
);
border
:
1px
solid
#e4e7ed
;
.emp-scroll-panel
{
min-height
:
200px
;
overflow
:
auto
;
box-sizing
:
border-box
;
}
.popper-arrow
{
border-top-width
:
0
;
border-width
:
6px
;
position
:
absolute
;
top
:
-12px
;
left
:
30px
;
display
:
block
;
width
:
0
;
height
:
0
;
border-color
:
transparent
;
border-style
:
solid
;
border-bottom-color
:
#e4e7ed
;
&:after
{
content
:
' '
;
border-width
:
6px
;
top
:
1px
;
margin-left
:
-6px
;
border-top-width
:
0
;
position
:
absolute
;
display
:
block
;
width
:
0
;
height
:
0
;
border-color
:
transparent
;
border-style
:
solid
;
border-bottom-color
:
#fff
;
}
}
}
.emp-table-panel
{
flex
:
1
;
min-height
:
200px
;
overflow
:
auto
;
margin-top
:
10px
;
background
:
#ffffff
;
box-shadow
:
0px
2px
12px
0px
rgba
(
0
,
0
,
0
,
0.06
);
border
:
1px
solid
#e4e7ed
;
/deep/
.el-checkbox__input.is-disabled
.el-checkbox__inner
{
background-color
:
#999999
;
}
}
.emp-tree-panel
{
margin-right
:
10px
;
font-size
:
15px
;
/deep/
.
el-tree-node
:
focus
>
.
el-tree-node__content
{
color
:
#5850ff
;
background
:
#f2f5fa
;
}
}
.tree-title
{
font-size
:
16px
;
font-weight
:
500
;
color
:
#333333
;
line-height
:
14px
;
padding
:
10px
;
}
}
</
style
>
src/views/activity/components/selectLabel.vue
deleted
100644 → 0
View file @
5781095
<
template
>
<div
class=
"tag-main"
>
<el-dialog
title=
"选择标签"
:visible
.
sync=
"dialogVisible"
width=
"50%"
:before-close=
"handleClose"
>
<div
class=
"tag-panel"
>
<div
class=
"tag-panel-select"
>
<div
class=
"tag-title"
>
预选标签
</div>
<div
class=
"tag-select-box"
>
<div
class=
"tag-box-header"
>
<el-input
size=
"small"
v-model=
"labelGroupName"
placeholder=
"请输入搜索内容"
clearable
@
keydown
.
enter
.
native=
"handleSearch"
></el-input>
<el-button
size=
"small"
type=
"primary"
@
click=
"handleSearch"
>
查询
</el-button>
<el-button
size=
"small"
@
click=
"handleReset"
>
重置
</el-button>
</div>
<div
class=
"checkbox-group-box"
:style=
"
{ height: heightBox + 'px' }">
<div
style=
"margin-bottom: 8px"
class=
"checkbox-box"
v-for=
"(item, index) in labelTreeRets"
:key=
"index"
@
click
.
self=
"item.checked = !item.checked"
>
<span
class=
"el-tree-node__expand-icon el-icon-caret-right"
:class=
"
{ expanded: item.checked }" @click.self="item.checked = !item.checked">
</span>
{{
item
.
labelGroup
.
name
}}
<el-tag
:size=
"size"
>
{{
item
.
labelType
}}
</el-tag>
<el-radio-group
class=
"tag-group"
v-model=
"item.tagChecked"
v-show=
"item.checked"
>
<div
v-for=
"(itm, idx) in item.labelList"
:key=
"idx"
class=
"radio-tag"
>
<el-tooltip
effect=
"dark"
placement=
"top"
:disabled=
"itm.name.length
< 8
"
>
<el-radio
class=
"radio-text"
:label=
"itm"
>
{{
itm
.
name
}}
</el-radio>
<!--
<el-radio
:label=
"itm"
>
{{
itm
.
name
.
length
>
4
?
itm
.
name
.
slice
(
0
,
3
)
+
'...'
:
itm
.
name
}}
</el-radio>
-->
<div
slot=
"content"
>
{{
itm
.
name
}}
</div>
</el-tooltip>
</div>
</el-radio-group>
</div>
</div>
</div>
</div>
<div
class=
"tag-panel-selected"
>
<div
class=
"tag-title"
>
已选标签
</div>
<div
class=
"tag-select-box"
>
<div
class=
"tag-box-header"
>
标签名称(
{{
selectNum
}}
项)
</div>
<div
class=
"tag-selected-box"
:style=
"
{ height: heightBox + 'px' }">
<template
v-for=
"item in labelTreeRets"
>
<el-tag
:title=
"item.tagChecked.name"
v-if=
"item.tagChecked"
type=
"info"
class=
"tag-selected-item"
:key=
"item.tagChecked"
closable
:disable-transitions=
"false"
@
close=
"remove(item, idx)"
>
{{
item
.
tagChecked
.
name
}}
</el-tag>
</
template
>
</div>
</div>
</div>
</div>
<span
slot=
"footer"
class=
"dialog-footer"
>
<!-- <a class="dialog-jump" @click="jumpUrl" v-if="this.$globalState.session.accountLevel == 4 && this.$globalState.session.merchantModel == 2">没有意向标签?点我创建</a> -->
<el-button
size=
"small"
@
click=
"dialogVisible = false"
>
取 消
</el-button>
<el-button
size=
"small"
type=
"primary"
@
click=
"handleSelect"
>
确 定
</el-button>
</span>
</el-dialog>
</div>
</template>
<
script
>
import
{
utils
}
from
'glsx-common'
import
util
from
'@/utils/util'
export
default
{
name
:
'activityModel'
,
data
()
{
return
{
heightBox
:
200
,
dialogVisible
:
false
,
labelGroupName
:
''
,
selectNum
:
0
,
searchStatus
:
false
,
labelTreeRets
:
[
// {
// labelGroup: { id: '109', name: '湖口123' },
// labelList: [
// { id: '372', name: '12345678' },
// { id: '371', name: '7654321' },
// { id: '370', name: '1234567' }
// ],
// checked: false,
// tagChecked: [],
// isIndeterminate: false,
// checkAll: false
// },
// {
// labelGroup: { id: '65', name: '自店标签111' },
// labelList: [
// { id: '179', name: '标签44' },
// { id: '178', name: '标签33' },
// { id: '176', name: '标签1112' }
// ],
// checked: false,
// tagChecked: [],
// isIndeterminate: false,
// checkAll: false
// }
]
}
},
watch
:
{
labelTreeRets
:
{
handler
()
{
this
.
selectNum
=
0
this
.
labelTreeRets
.
forEach
(
item
=>
{
if
(
item
.
tagChecked
)
{
this
.
selectNum
++
}
})
},
deep
:
true
}
},
methods
:
{
jumpUrl
()
{
util
.
openUrl
(
location
.
origin
+
'/custom/tagsManage/index'
)
this
.
dialogVisible
=
false
},
init
(
item
)
{
this
.
labelGroupName
=
''
this
.
dialogVisible
=
true
this
.
querylabeltree
(
item
)
},
handleSearch
()
{
this
.
searchStatus
=
true
this
.
querylabeltree
()
},
querylabeltree
(
selectItem
)
{
console
.
log
(
selectItem
,
'-----'
)
this
.
$apis
.
customerTransform
.
querylabeltree
({
labelTreeReq
:
{
pageNum
:
1
,
pageSize
:
1000
,
shopId
:
this
.
$globalState
.
session
.
merchantId
,
// shopId: '44210934',
labelGroupName
:
this
.
labelGroupName
,
// labelTypesStr: '自店标签,企业标签',
edition
:
this
.
$globalState
.
session
.
merchantModel
// edition: 4
}
})
.
then
(
res
=>
{
if
(
selectItem
&&
selectItem
.
length
>
0
)
{
console
.
log
(
res
.
labelTreeRets
)
this
.
labelTreeRets
=
res
.
labelTreeRets
.
map
(
item
=>
{
return
{
labelType
:
item
.
labelType
==
'企业标签'
?
(
this
.
$globalState
.
session
.
merchantModel
==
1
?
'集团标签'
:
'企业标签'
)
:
item
.
labelType
,
labelGroup
:
item
.
labelGroup
,
labelList
:
item
.
labelList
,
checked
:
false
,
tagChecked
:
null
,
isIndeterminate
:
false
,
checkAll
:
false
}
})
//回显
selectItem
.
forEach
(
item
=>
{
this
.
labelTreeRets
.
forEach
(
tag
=>
{
if
(
item
.
labelGroup
.
id
==
tag
.
labelGroup
.
id
)
{
let
labelId
=
item
.
labelList
[
0
].
id
let
index
=
tag
.
labelList
.
findIndex
(
iem
=>
iem
.
id
==
labelId
)
console
.
log
(
index
)
// tag.tagChecked = item.tagChecked
tag
.
tagChecked
=
tag
.
labelList
[
index
]
}
})
})
console
.
log
(
this
.
labelTreeRets
)
}
else
{
const
labelTreeRets
=
utils
.
deepClone
(
this
.
labelTreeRets
)
console
.
log
(
labelTreeRets
)
this
.
labelTreeRets
=
res
.
labelTreeRets
.
map
(
item
=>
{
return
{
labelType
:
item
.
labelType
==
'企业标签'
?
(
this
.
$globalState
.
session
.
merchantModel
==
1
?
'集团标签'
:
'企业标签'
)
:
item
.
labelType
,
labelGroup
:
item
.
labelGroup
,
labelList
:
item
.
labelList
,
checked
:
false
,
tagChecked
:
null
,
isIndeterminate
:
false
,
checkAll
:
false
}
})
console
.
log
(
labelTreeRets
)
labelTreeRets
.
forEach
(
item
=>
{
this
.
labelTreeRets
.
forEach
(
tag
=>
{
if
(
item
.
labelGroup
.
id
==
tag
.
labelGroup
.
id
)
{
let
labelId
=
item
.
tagChecked
?
item
.
tagChecked
.
id
:
''
let
index
=
tag
.
labelList
.
findIndex
(
iem
=>
iem
.
id
==
labelId
)
tag
.
tagChecked
=
tag
.
labelList
[
index
]
}
})
})
}
})
},
remove
(
item
,
idx
)
{
item
.
tagChecked
=
null
},
//选中
handleSelect
()
{
this
.
dialogVisible
=
false
let
labelTreeRets
=
this
.
labelTreeRets
.
map
(
item
=>
{
if
(
item
.
tagChecked
)
{
return
{
labelGroup
:
item
.
labelGroup
,
labelType
:
item
.
labelType
,
labelList
:
[
item
.
tagChecked
]
}
}
})
.
filter
(
item
=>
item
)
console
.
log
(
labelTreeRets
)
this
.
$emit
(
'tagSelected'
,
labelTreeRets
)
},
handleReset
()
{
this
.
labelGroupName
=
''
this
.
querylabeltree
()
}
},
mounted
()
{
let
clientHeight
=
document
.
documentElement
.
clientHeight
this
.
heightBox
=
clientHeight
-
0.15
*
clientHeight
-
350
}
}
</
script
>
<
style
lang=
"scss"
scoped
>
//
::v-deep
.el-tag
{
//
color
:
red
!important
;
//
}
.dialog-jump
{
color
:
#5850ff
;
float
:
left
;
line-height
:
24px
;
text-decoration
:
underline
;
cursor
:
pointer
;
}
.tag-panel
{
display
:
flex
;
.tag-panel-select
{
width
:
60%
;
/deep/
{
.el-checkbox__label
{
width
:
100%
;
vertical-align
:
middle
;
text-overflow
:
ellipsis
;
white-space
:
nowrap
;
overflow
:
hidden
;
word-wrap
:
break-word
;
}
}
}
.tag-panel-selected
{
width
:
40%
;
margin-left
:
10px
;
.tag-box-header
{
font-size
:
14px
;
font-weight
:
400
;
color
:
#333333
;
line-height
:
20px
;
padding-left
:
20px
!important
;
}
}
.tag-title
{
font-size
:
16px
;
font-weight
:
400
;
color
:
#333333
;
line-height
:
22px
;
}
.tag-select-box
{
margin-top
:
10px
;
border-radius
:
2px
;
border
:
1px
solid
#eeeeee
;
padding
:
6px
;
.tag-box-header
{
box-sizing
:
border-box
;
display
:
flex
;
height
:
56px
;
align-items
:
center
;
border-bottom
:
1px
solid
#eeeeee
;
margin
:
-6px
;
margin-bottom
:
10px
;
padding
:
0px
6px
;
/deep/
{
.el-input
{
width
:
60%
;
margin-right
:
10px
;
}
}
}
.tag-selected-item
{
margin
:
0px
6px
6px
0px
;
height
:
26px
;
line-height
:
24px
;
font-size
:
14px
;
color
:
#666
;
max-width
:
200px
;
text-overflow
:
ellipsis
;
overflow
:
hidden
;
white-space
:
nowrap
;
}
.el-tree-node__expand-icon
{
color
:
#5850ff
;
font-size
:
16px
;
}
.tag-group
{
margin-left
:
26px
;
display
:
flex
;
flex-wrap
:
wrap
;
.radio-tag
{
display
:
inline-block
;
width
:
50%
;
.el-radio
{
margin
:
8px
0
;
display
:
inline-flex
;
align-items
:
center
;
/deep/.el-radio__inner
{
box-shadow
:
none
!important
;
}
/
deep
/
.el-radio__label
{
display
:
inline-block
;
max-width
:
120px
;
text-overflow
:
ellipsis
;
white-space
:
nowrap
;
overflow
:
hidden
;
word-wrap
:
break-word
;
}
}
}
}
}
}
.checkbox-group-box
{
overflow
:
auto
;
.checkbox-box
{
cursor
:
pointer
;
font-size
:
14px
;
font-family
:
PingFangSC-Regular
,
PingFang
SC
;
font-weight
:
400
;
color
:
#333333
;
line-height
:
20px
;
/deep/
{
.el-tag
{
color
:
#aaa5fa
!important
;
font-size
:
12px
;
border
:
none
;
background
:
rgba
(
$
color
:
#5850ff
,
$
alpha
:
0.1
);
}
}
}
}
.tag-selected-box
{
min-height
:
200px
;
}
</
style
>
src/views/activity/components/selectLord.vue
deleted
100644 → 0
View file @
5781095
<
template
>
<div
class=
"member-wrapper"
>
<div
class=
"member-left"
>
<div
class=
"member-title"
>
预选
<span>
共
{{
chatGroupCount
}}
个群聊,
{{
tableEmpData
.
length
}}
个群主成员
</span>
</div>
<div
class=
"member-content"
>
<el-form
:inline=
"true"
class=
"member-form"
:model=
"searchForm"
@
submit
.
native
.
prevent
>
<el-form-item
style=
"margin-bottom: 0"
>
<span
class=
"lord-label"
slot=
"label"
>
所在门店/部门
</span>
<el-popover
ref=
"popover"
placement=
"bottom"
width=
"215"
trigger=
"click"
v-model=
"popoverVisible"
@
show=
"onShowPopover"
@
hide=
"onHidePopover"
>
<el-tree
class=
"select-tree"
:data=
"treeData"
:props=
"defaultProps"
default-expand-all
@
node-click=
"handleNodeClick"
></el-tree>
<el-input
v-model=
"searchForm.department"
slot=
"reference"
:size=
"size"
readonly
style=
"width: 215px"
placeholder=
"请选择所在门店/部门"
:class=
"
{ rotate: popoverVisible }" suffix-icon="el-icon-arrow-down" @keyup.enter.native="search">
</el-input>
</el-popover>
</el-form-item>
<el-form-item
label=
"姓名"
style=
"margin-bottom: 0"
>
<el-input
:size=
"size"
v-model
.
trim=
"searchForm.lordName"
@
keyup
.
enter
.
native=
"search"
clearable
placeholder=
"请输入姓名搜索"
></el-input>
</el-form-item>
<el-form-item
style=
"margin-bottom: 0"
>
<span
class=
"lord-label"
slot=
"label"
>
跟进专员类型
</span>
<el-select
v-model=
"searchForm.followerId"
style=
"width: 215px"
:size=
"size"
placeholder=
"请选择"
>
<el-option
v-for=
"item in followTypeList"
:key=
"item.id"
:label=
"item.followName"
:value=
"item.id"
></el-option>
</el-select>
</el-form-item>
<!--
<el-form-item>
<el-checkbox
v-model=
"searchForm.checked"
>
仅看跟进专员
</el-checkbox>
</el-form-item>
-->
<el-form-item
label
style=
"margin-bottom: 0; margin-left: 40px"
>
<el-button
:size=
"size"
@
click=
"handleReset"
>
重置
</el-button>
<el-button
type=
"primary"
:size=
"size"
@
click=
"search"
>
搜索
</el-button>
</el-form-item>
</el-form>
<div
class=
"table-content"
style=
"max-height: 456px"
>
<GLTable
v-loading=
"loading"
ref=
"empTable"
:tableData=
"tableEmpData"
:tableParams=
"tableParams"
:hasNum=
"false"
:hasPage=
"false"
:noDataImg=
"url"
@
selectionTable=
"selectionTable"
@
row-click=
"rowClick"
>
<div
slot=
"staffName"
slot-scope=
"scope"
>
<span>
{{
scope
.
scope
.
staffName
}}
</span>
<span
class=
"staff-title"
v-show=
"scope.scope.staffTitle"
>
{{
scope
.
scope
.
staffTitle
}}
</span>
</div>
</GLTable>
</div>
</div>
</div>
<div
class=
"member-right"
>
<div
class=
"member-title"
>
已选
</div>
<div
class=
"member-name"
>
成员名称(
{{
innerTags
.
length
}}
项)
</div>
<div
class=
"input-tag-wrapper"
>
<div
class=
"tag-box"
>
<el-tag
v-for=
"(tag, idx) in innerTags"
:key=
"idx"
type=
"info"
closable
:disable-transitions=
"false"
@
close=
"remove(tag)"
>
<i
class=
"el-icon-user-solid"
></i>
{{
tag
.
staffName
}}
</el-tag>
</div>
</div>
</div>
</div>
</
template
>
<
script
>
import
url
from
'@/assets/empty.png'
export
default
{
name
:
'SelectLord'
,
props
:
[
'selectData'
],
data
()
{
return
{
url
:
url
,
searchForm
:
{},
checked
:
''
,
treeData
:
[],
defaultProps
:
{
children
:
'children'
,
label
:
'departmentName'
},
popoverVisible
:
false
,
loading
:
false
,
// 表格参数
tableParams
:
{
checkSelectKey
:
'id'
,
checkSelectVal
:
[],
listName
:
'list'
,
// 行数据的key
mutiSelectUniqueKey
:
'id'
,
// 多选ref的名称
mutiSelectName
:
'salelist'
,
btnId
:
new
Date
().
getTime
()
+
parseInt
(
Math
.
random
()
*
1000
),
tableColumns
:
[
{
label
:
'姓名'
,
prop
:
'staffName'
,
addHtml
:
'staffName'
},
{
label
:
'所在门店/部门'
,
prop
:
'departmentName'
},
{
label
:
'跟进专员类型'
,
prop
:
'followerTypeName'
,
formatter
:
cellValue
=>
{
return
cellValue
.
followerTypeName
?
cellValue
.
followerTypeName
:
'-'
}
},
{
label
:
'群数量'
,
prop
:
'chatCount'
}
]
},
tableEmpData
:
[],
allTreeData
:
[],
currentTreeData
:
[],
innerTags
:
[],
followTypeList
:
[],
chatGroupCount
:
0
}
},
mounted
()
{
this
.
getFindLordGroup
({},
true
)
this
.
getFollowerType
()
this
.
listDepartmentTree
()
},
methods
:
{
selectionTable
(
val
)
{
this
.
innerTags
=
val
},
// 清空搜索条件
resetSearch
()
{
this
.
searchForm
=
{}
this
.
tableEmpData
=
this
.
allTreeData
},
// 显示时触发
onShowPopover
()
{
this
.
popoverVisible
=
true
},
// 隐藏时触发
onHidePopover
()
{
this
.
popoverVisible
=
false
},
getFindLordGroup
(
params
,
isFirst
)
{
this
.
$apis
.
customerTransform
.
findLordGroup
(
params
).
then
(
res
=>
{
this
.
loading
=
false
if
(
res
)
{
this
.
tableEmpData
=
res
this
.
tableEmpData
.
map
(
item
=>
(
this
.
chatGroupCount
+=
item
.
chatCount
))
this
.
$refs
.
empTable
.
tableHeightValues
=
this
.
tableEmpData
.
length
?
''
:
'230px'
if
(
isFirst
&&
this
.
selectData
&&
this
.
selectData
.
length
)
{
this
.
selectData
.
forEach
(
item
=>
{
this
.
$refs
.
empTable
.
$refs
.
salelistMutiTable
.
toggleRowSelection
(
item
)
})
}
}
else
{
this
.
treeData
=
[]
}
})
},
listDepartmentTree
()
{
const
params
=
{
addChildrensFlag
:
true
}
params
.
islord
=
true
this
.
$apis
.
customerTransform
.
listDepartmentTree
(
params
).
then
(
res
=>
{
this
.
treeData
=
res
})
},
handleNodeClick
(
data
)
{
this
.
searchForm
.
department
=
data
.
departmentName
this
.
currentTreeData
=
data
this
.
onHidePopover
()
},
getEmployee
(
d
,
arr
=
[])
{
d
.
reverse
().
forEach
(
i
=>
{
if
(
i
.
entmicroStaffResponses
)
{
i
.
entmicroStaffResponses
.
forEach
(
j
=>
{
const
flag
=
arr
.
find
(
m
=>
m
.
id
==
j
.
id
)
if
(
!
flag
)
{
arr
.
push
(
j
)
}
})
}
if
(
i
.
children
)
{
this
.
getEmployee
(
i
.
children
,
arr
)
}
})
return
arr
},
search
()
{
this
.
getFindLordGroup
(
this
.
searchForm
)
},
remove
(
item
)
{
this
.
$refs
.
empTable
.
$refs
.
salelistMutiTable
.
toggleRowSelection
(
item
)
},
rowClick
(
row
)
{
this
.
$refs
.
empTable
.
$refs
.
salelistMutiTable
.
toggleRowSelection
(
row
)
},
getFollowerType
()
{
this
.
$apis
.
customerTransform
.
followerType
({}).
then
(
res
=>
{
this
.
followTypeList
=
res
})
},
handleReset
()
{
this
.
searchForm
=
{}
this
.
search
()
}
}
}
</
script
>
<
style
lang=
"scss"
>
.el-input.el-input--suffix.rotate
.el-input__suffix
.el-icon-arrow-down
{
transform
:
rotate
(
-180deg
);
}
.select-tree
{
max-height
:
400px
;
overflow-y
:
scroll
;
}
.staff-title
{
position
:
relative
;
font-size
:
12px
;
padding
:
0
10px
;
line-height
:
12px
;
color
:
#999
;
&::before
{
content
:
''
;
position
:
absolute
;
top
:
50%
;
left
:
5px
;
transform
:
translateY
(
-50%
);
display
:
inline-block
;
width
:
1px
;
height
:
12px
;
background-color
:
#999
;
}
}
.lord-label
{
display
:
inline-block
;
width
:
110px
;
}
.member-wrapper
{
display
:
flex
;
.member-title
{
font-size
:
16px
;
font-weight
:
600
;
line-height
:
22px
;
margin-bottom
:
6px
;
span
{
display
:
inline-block
;
padding-left
:
5px
;
font-size
:
12px
;
color
:
#999
;
font-weight
:
500
;
}
}
.member-left
{
width
:
800px
;
.member-content
{
border
:
1px
solid
#eee
;
border-bottom
:
none
;
.member-form
{
padding
:
10px
20px
;
}
.table-content
{
max-height
:
456px
;
overflow
:
auto
;
border
:
1px
solid
#eee
;
}
}
.member-checked
{
text-align
:
right
;
margin-top
:
10px
;
}
}
.member-right
{
width
:
286px
;
margin-left
:
14px
;
.member-name
{
font-size
:
14px
;
color
:
#333
;
line-height
:
20px
;
padding
:
18px
;
border
:
1px
solid
#eee
;
}
}
}
.tag-box
{
height
:
100%
;
}
.input-tag-wrapper
{
position
:
relative
;
font-size
:
14px
;
border
:
1px
solid
#eee
;
border-top
:
none
;
box-sizing
:
border-box
;
color
:
#606266
;
display
:
inline-block
;
padding
:
8px
10px
;
line-height
:
32px
;
transition
:
border-color
0.2s
cubic-bezier
(
0.645
,
0.045
,
0.355
,
1
);
width
:
100%
;
height
:
calc
(
100%
-
86px
);
display
:
flex
;
align-items
:
center
;
max-height
:
500px
;
overflow
:
auto
;
//
margin-bottom
:
10px
;
i
{
color
:
#75acff
;
margin-right
:
3px
;
font-size
:
14px
;
}
/
deep
/
input
{
/* input { */
/* background-color: red!important; 调试用的样式 */
outline
:
none
!important
;
border
:
none
!important
;
}
/
deep
/
.el-input
{
min-width
:
150px
;
width
:
auto
;
flex
:
1
;
}
}
.el-tag
{
margin-right
:
10px
;
line-height
:
22px
;
margin-bottom
:
5px
;
height
:
24px
;
}
</
style
>
src/views/activity/components/selectMember.vue
View file @
6c5b06a
...
...
@@ -196,7 +196,7 @@ export default {
listDepartmentTree
(
isFollowerStaff
)
{
const
params
=
{
addChildrensFlag
:
true
}
this
.
loading
=
true
params
.
isHavCustomer
=
tru
e
params
.
isHavCustomer
=
fals
e
params
.
isFollowerStaff
=
isFollowerStaff
this
.
$apis
.
custom
.
listDepartmentTree
(
params
).
then
(
res
=>
{
console
.
log
(
res
)
...
...
src/views/activity/components/selectTree.vue
deleted
100644 → 0
View file @
5781095
<!-- 树形搜索 -->
<
template
>
<div>
<el-popover
ref=
"popover"
placement=
"bottom-start"
trigger=
"click"
v-model=
"popoverVisible"
:disabled=
"targetItem.isDisabled"
@
show=
"onShowPopover"
@
hide=
"onHidePopover"
>
<el-tree
ref=
"tree"
class=
"select-tree"
highlight-current
default-expand-all
node-key=
"id"
:expand-on-click-node=
"isExpand"
:style=
"`min-width: $
{treeWidth}`" :data="treeData" :current-node-key="form[targetItem.name]" :props="defaultProps" :filter-node-method="handleFilterNode" @current-change="handleNodeClick">
</el-tree>
<el-input
slot=
"reference"
ref=
"input"
v-model=
"form[targetItem.nameLabel]"
clearable
:disabled=
"targetItem.isDisabled"
:style=
"`width: $
{width}px`" :class="{ rotate: popoverVisible }" suffix-icon="el-icon-arrow-down" :placeholder="'请选择' + targetItem.label" @change="handleClear">
</el-input>
</el-popover>
</div>
</
template
>
<
script
>
export
default
{
name
:
'SelectTree'
,
data
()
{
return
{
isExpand
:
false
,
// 树状菜单显示状态
popoverVisible
:
false
,
treeWidth
:
'auto'
}
},
props
:
{
// 输入框宽度
width
:
String
,
form
:
{
type
:
Object
,
default
:
()
=>
{}
},
targetItem
:
{
type
:
Object
,
default
:
()
=>
{}
},
treeData
:
{
type
:
Array
,
default
:
()
=>
[]
},
defaultProps
:
{
type
:
Object
,
default
:
()
=>
({
parent
:
'parentId'
,
value
:
'id'
,
label
:
'menuName'
,
children
:
'childlist'
})
}
},
watch
:
{
form
(
val
)
{
if
(
this
.
form
[
this
.
targetItem
.
name
])
{
this
.
form
[
this
.
targetItem
.
nameLabel
]
=
this
.
queryTree
(
this
.
treeData
,
this
.
form
[
this
.
targetItem
.
name
])
this
.
$nextTick
().
then
(()
=>
{
this
.
$refs
.
tree
.
setCheckedKeys
([
this
.
form
[
this
.
targetItem
.
name
]])
})
}
}
},
created
()
{
// 获取输入框宽度同步至树状菜单宽度
this
.
$nextTick
(()
=>
{
this
.
treeWidth
=
`
${(
this
.
width
||
this
.
$refs
.
input
.
$refs
.
input
.
clientWidth
)
-
24
}
px`
})
},
mounted
()
{
if
(
this
.
form
[
this
.
targetItem
.
name
])
{
// console.log(this.treeData)
// console.log(this.form)
this
.
form
[
this
.
targetItem
.
nameLabel
]
=
this
.
queryTree
(
this
.
treeData
,
this
.
form
[
this
.
targetItem
.
name
])
this
.
$nextTick
().
then
(()
=>
{
this
.
$refs
.
tree
.
setCheckedKeys
([
this
.
form
[
this
.
targetItem
.
name
]])
})
}
},
methods
:
{
// 显示时触发
onShowPopover
()
{
this
.
popoverVisible
=
true
this
.
$refs
.
tree
.
filter
(
false
)
},
// 隐藏时触发
onHidePopover
()
{
this
.
popoverVisible
=
false
},
// 树节点过滤方法
handleFilterNode
(
query
,
data
)
{
if
(
!
query
)
return
true
return
data
[
this
.
defaultProps
.
label
].
indexOf
(
query
)
!==
-
1
},
handleNodeClick
(
val
)
{
this
.
$emit
(
'selected'
,
{
val
:
val
,
targetItem
:
this
.
targetItem
,
formName
:
this
.
targetItem
.
formName
})
this
.
onHidePopover
()
},
handleClear
(
val
)
{
this
.
$emit
(
'selected'
,
{
val
:
val
,
targetItem
:
this
.
targetItem
,
formName
:
this
.
targetItem
.
formName
})
window
.
event
.
stopPropagation
()
},
// 搜索树状数据中的 ID
queryTree
(
tree
,
id
)
{
let
stark
=
[]
stark
=
stark
.
concat
(
tree
)
while
(
stark
.
length
)
{
const
temp
=
stark
.
shift
()
if
(
temp
[
this
.
defaultProps
.
children
])
{
stark
=
stark
.
concat
(
temp
[
this
.
defaultProps
.
children
])
}
if
(
temp
[
this
.
defaultProps
.
value
]
===
id
)
{
return
temp
[
this
.
defaultProps
.
label
]
}
}
return
}
}
}
</
script
>
<
style
>
.el-input.el-input--suffix.rotate
.el-input__suffix
.el-icon-arrow-down
{
transform
:
rotate
(
-180deg
);
}
.select-tree
{
max-height
:
400px
;
overflow-y
:
scroll
;
}
</
style
>
src/views/activity/components/tag-textarea.vue
deleted
100644 → 0
View file @
5781095
<
template
>
<div
class=
"w-textarea"
ref=
"wTextarea"
>
<div
contenteditable=
"true"
class=
"w-textarea_input"
ref=
"wTextareaContent"
:id=
"contentId"
@
click=
"inputClick($event)"
@
focus=
"onFocus"
@
blur=
"onBlur"
@
keydown
.
delete=
"handleDelete($event)"
@
input=
"handleInput($event.target)"
></div>
<!--
<div
class=
"w-textarea_tools"
v-if=
"tools.length > 0 || maxlength"
>
<button
class=
"w-textarea_tools__item"
v-for=
"item in tools"
:key=
"item.type"
@
click=
"openTagDialog(item.type)"
>
{{
item
.
text
}}
</button>
<span
:class=
"['w-textarea_tools__text',
count.num
< 0
?
'
__danger
'
:
'']"
v-if=
"maxlength"
>
{{
count
.
text
}}
</span>
</div>
-->
<!--
<div
class=
"w-textarea_dialog"
>
<slot></slot>
</div>
-->
</div>
</
template
>
<
script
>
import
emoji
from
'@/utils/emo'
export
default
{
name
:
'wTextarea'
,
data
()
{
return
{
// 记录currentText以计算长度
currentText
:
this
.
value
,
// 为input区域生成随机id,当在页面上有多个组件时,用于监听光标的变化
contentId
:
`content
${
this
.
getGuid
()}
`
,
// 输入的时候锁定,禁止更新innerHTML
isLocked
:
false
,
isInsert
:
false
,
// 记录当前选中tag的ID
currentTagId
:
null
,
// 当前光标位置
savedRange
:
{}
}
},
props
:
{
value
:
{
type
:
String
,
default
:
''
},
tag
:
{
// 自定义模版标签的标签名
type
:
String
,
// 默认使用wise作为标签名,并添加了默认样式
// 当使用其他标签名的时候,需要另写标签样式
default
:
'wise'
},
tools
:
{
// 自定义扩展功能:超链接'link',模版标签'tag'
type
:
Array
,
default
()
{
return
[
{
type
:
'link'
,
text
:
'添加超链接'
},
{
type
:
'tag'
,
text
:
'添加模版标签'
}
]
}
},
maxlength
:
{
// 最大输入长度
type
:
[
String
,
Number
],
default
:
''
}
},
computed
:
{
count
()
{
// 字符长度记数
let
num
=
this
.
maxlength
-
this
.
currentText
.
length
let
text
=
num
<
0
?
`已超出
${
Math
.
abs
(
num
)}
个字符`
:
`还可以输入
${
num
}
个字符`
return
{
num
,
text
}
}
},
mounted
()
{
// 初始化数据
this
.
currentText
&&
(
this
.
$refs
.
wTextareaContent
.
innerHTML
=
this
.
currentText
)
// 创建模版标签的style
this
.
createStyle
()
// 每次光标变化的时候,保存 range
document
.
addEventListener
(
'selectionchange'
,
this
.
selectHandler
)
},
beforeDestroy
()
{
// 卸载事件
document
.
removeEventListener
(
'selectionchange'
,
this
.
selectHandler
)
},
methods
:
{
updateData
(
text
)
{
this
.
$emit
(
'input'
,
text
)
},
createStyle
()
{
// 为自定义的模版标签添加样式,使之不可编辑
let
style
=
document
.
createElement
(
'style'
)
style
.
innerHTML
=
`.w-textarea
${
this
.
tag
}
{
cursor: default;
-webkit-user-modify: read-only !important;
}`
this
.
$refs
.
wTextarea
.
appendChild
(
style
)
},
closeModal
()
{
this
.
form
.
text
=
''
this
.
showModal
=
false
},
openTagDialog
(
type
)
{
// if (addLink)
// 将事件抛给父组件处理
// 处理后需要调用 addTag() 或者 addLink() 将内容传回来
this
.
$emit
(
'add'
,
type
)
},
addTag
(
text
)
{
console
.
log
(
88
)
// 创建模版标签
let
node
=
document
.
createElement
(
this
.
tag
)
if
(
navigator
.
userAgent
.
indexOf
(
'Firefox'
)
>
0
)
{
node
.
setAttribute
(
'contenteditable'
,
'false'
)
}
node
.
innerText
=
text
// 添加id便于删除
node
.
id
=
this
.
getGuid
()
this
.
insertNode
(
node
)
},
addNode
()
{
let
target
=
this
.
$refs
.
wTextareaContent
this
.
updateData
(
target
.
innerHTML
)
},
promiseAdd
(
item
,
num
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
setTimeout
(()
=>
{
document
.
querySelector
(
'.w-textarea_input'
).
innerHTML
+=
item
document
.
querySelector
(
'.w-textarea_input'
).
focus
()
resolve
()
},
num
*
100
)
})
},
promiseAddNode
(
item
,
num
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
setTimeout
(()
=>
{
document
.
querySelector
(
'.w-textarea_input'
).
innerHTML
+=
item
document
.
querySelector
(
'.w-textarea_input'
).
focus
()
resolve
()
},
num
*
100
)
})
},
addContent
(
attContent
)
{
attContent
.
forEach
(
async
(
item
,
index
)
=>
{
await
this
.
promiseAdd
(
item
,
index
)
this
.
addTag
(
'@昵称'
)
// await this.promiseAddNode(item, index)
// this.addNode()
// t2(item)
})
// for (let i = 0; i < attContent.length; i++) {
// if (attContent[i] || (i == 0 && !attContent[i])) {
// document.querySelector('.w-textarea_input').innerHTML += attContent[i]
// document.querySelector('.w-textarea_input').focus()
// document.querySelector('.w-textarea_input').click()
// this.$nextTick(()=>{
// this.addTag('@昵称')
// })
// }
// // 代码格式
// // (function(a) {})(b)
// }
},
addLink
(
text
,
url
)
{
// 创建a标签
let
node
=
document
.
createElement
(
'a'
)
node
.
innerText
=
text
node
.
href
=
url
node
.
target
=
'blank'
this
.
insertNode
(
node
)
},
addImg
(
url
)
{
// 创建a标签
let
node
=
document
.
createElement
(
'img'
)
node
.
src
=
url
// node.setAttribute('ondragstart', 'return false;')
this
.
insertNode
(
node
)
},
onFocus
()
{
this
.
isLocked
=
true
this
.
isInsert
=
true
},
onBlur
()
{
this
.
isLocked
=
false
},
insertNode
(
node
)
{
// 在内容中插入标签
// 删掉选中的内容(如有)
if
(
this
.
savedRange
.
startContainer
)
{
this
.
insertNodeFirst
(
node
)
}
else
{
document
.
querySelector
(
'.w-textarea_input'
).
focus
()
setTimeout
(()
=>
{
this
.
insertNodeFirst
(
node
)
document
.
querySelector
(
'.w-textarea_input'
).
blur
()
},
100
)
}
},
insertNodeFirst
(
node
)
{
this
.
savedRange
.
deleteContents
()
// 插入链接
if
(
this
.
isInsert
)
{
this
.
savedRange
.
insertNode
(
node
)
}
else
{
document
.
querySelector
(
'.w-textarea_input'
).
appendChild
(
node
)
}
this
.
isInsert
=
false
// 更新双向绑定数据
let
target
=
this
.
$refs
.
wTextareaContent
if
(
navigator
.
userAgent
.
indexOf
(
'Firefox'
)
>
0
||
navigator
.
userAgent
.
indexOf
(
'QQBrowser'
)
>
0
)
{
this
.
updateData
(
target
.
innerHTML
+
' '
)
}
else
{
this
.
updateData
(
target
.
innerHTML
)
}
let
htm
=
target
.
innerHTML
const
list
=
emoji
.
flat
(
Infinity
)
const
cutImg
=
htm
.
replaceAll
(
'<img src="https://img01.glsx.com.cn/weapp/resource/saas/scrm/emoji/'
,
''
)
const
replaceImg
=
cutImg
.
replace
(
/
(\d){3}
.png">/g
,
function
(
str
)
{
let
s
=
list
[
parseInt
(
str
.
split
(
'.'
)[
0
])
-
1
]
return
`[
${
s
}
]`
})
console
.
log
(
replaceImg
)
let
Textnode
=
document
.
createElement
(
'div'
)
Textnode
.
innerHTML
=
replaceImg
this
.
currentText
=
Textnode
.
innerText
.
substring
(
0
,
600
)
this
.
$emit
(
'updateText'
,
this
.
currentText
)
},
placeCaretAtEnd
(
el
)
{
//传入光标要去的jq节点对象
el
.
focus
()
if
(
typeof
window
.
getSelection
!=
'undefined'
&&
typeof
document
.
createRange
!=
'undefined'
)
{
var
range
=
document
.
createRange
()
range
.
selectNodeContents
(
el
)
range
.
collapse
(
false
)
var
sel
=
window
.
getSelection
()
sel
.
removeAllRanges
()
sel
.
addRange
(
range
)
}
else
if
(
typeof
document
.
body
.
createTextRange
!=
'undefined'
)
{
var
textRange
=
document
.
body
.
createTextRange
()
textRange
.
moveToElementText
(
el
)
textRange
.
collapse
(
false
)
textRange
.
select
()
}
},
handleInput
(
target
)
{
// 即时更新数据
this
.
updateData
(
target
.
innerHTML
)
let
htm
=
target
.
innerHTML
console
.
log
(
htm
)
const
list
=
emoji
.
flat
(
Infinity
)
const
cutImg
=
htm
.
replaceAll
(
'<img src="https://img01.glsx.com.cn/weapp/resource/saas/scrm/emoji/'
,
''
)
const
replaceImg
=
cutImg
.
replace
(
/
(\d){3}
.png">/g
,
function
(
str
)
{
let
s
=
list
[
parseInt
(
str
.
split
(
'.'
)[
0
])
-
1
]
return
`[
${
s
}
]`
})
let
Textnode
=
document
.
createElement
(
'div'
)
Textnode
.
innerHTML
=
replaceImg
this
.
currentText
=
Textnode
.
innerText
.
substring
(
0
,
600
)
this
.
$emit
(
'updateText'
,
this
.
currentText
)
},
handleDelete
(
e
)
{
// 监听“删除”事件
if
(
this
.
currentTagId
)
{
// 若已选中模版标签,直接删除dom节点
let
t
=
document
.
getElementById
(
this
.
currentTagId
)
this
.
$refs
.
wTextareaContent
.
removeChild
(
t
)
this
.
currentTagId
=
null
// 阻止浏览器默认的删除事件,并手动更新数据
e
.
preventDefault
()
this
.
handleInput
(
e
.
target
)
}
},
inputClick
(
e
)
{
// 监听点击事件
this
.
isLocked
=
true
const
TAG_NAME
=
e
.
target
.
nodeName
if
(
TAG_NAME
===
this
.
tag
.
toUpperCase
())
{
// 点击模版标签时,记录id
this
.
currentTagId
=
e
.
target
.
id
e
.
target
.
className
=
'active'
}
else
if
(
this
.
currentTagId
)
{
// 清空active样式
let
target
=
document
.
getElementById
(
this
.
currentTagId
)
target
.
className
=
''
this
.
currentTagId
=
null
}
else
{
this
.
currentTagId
=
null
}
},
getGuid
()
{
// 生成随机ID
return
`r
${
new
Date
().
getTime
()}
d
${
Math
.
ceil
(
Math
.
random
()
*
1000
)}
`
},
selectHandler
()
{
// 监听选定文本的变动
let
sel
=
window
.
getSelection
()
let
range
=
sel
.
rangeCount
>
0
?
sel
.
getRangeAt
(
0
)
:
null
if
(
range
&&
range
.
commonAncestorContainer
.
ownerDocument
.
activeElement
.
id
===
this
.
contentId
)
{
this
.
savedRange
=
range
}
}
},
watch
:
{
value
(
val
)
{
// 非锁定状态下,实时更新innerHTML
if
(
!
this
.
isLocked
)
{
this
.
$refs
.
wTextareaContent
.
innerHTML
=
val
}
}
}
}
</
script
>
<
style
lang=
"scss"
>
.w-textarea
{
wise
{
border-radius
:
2px
;
background-color
:
#fff
;
font-size
:
14px
;
color
:
#5850ff
;
line-height
:
20px
;
padding
:
2px
;
margin
:
0
5px
;
color
:
#26a2ff
;
//
padding
:
0
1px
;
white-space
:
nowrap
;
cursor
:
default
;
-webkit-user-modify
:
read-only
!important
;
}
img
{
width
:
24px
;
height
:
24px
;
-webkit-user-select
:
none
;
cursor
:
default
;
pointer-events
:
none
;
}
.active
{
background
:
#dcdfe6
;
}
}
</
style
>
<
style
lang=
"scss"
scoped
>
$
borderColor
:
#dcdfe6
;
$
bgColor
:
#f5f7fa
;
$
textColor
:
#666
;
.w-textarea
{
width
:
100%
;
box-sizing
:
border-box
;
//
border-radius
:
4px
;
border
:
1px
solid
$
borderColor
;
min-height
:
400px
;
position
:
relative
;
overflow-y
:
auto
;
&_input
{
width
:
100%
;
height
:
200px
;
min-height
:
100px
;
box-sizing
:
border-box
;
padding
:
10px
;
line-height
:
1.5
;
word-break
:
break-word
;
//
允许编辑,禁止富文本
-webkit-user-modify
:
read-write-plaintext-only
!important
;
&:focus
{
outline
:
none
;
}
}
&
_tools
{
padding
:
0
10px
;
height
:
40px
;
line-height
:
40px
;
border-top
:
1px
solid
$
borderColor
;
background-color
:
$
bgColor
;
color
:
$
textColor
;
font-size
:
12px
;
&__item
{
display
:
inline-block
;
line-height
:
1
;
padding
:
5px
8px
;
margin-right
:
8px
;
color
:
$
textColor
;
cursor
:
pointer
;
border
:
1px
solid
$
borderColor
;
border-radius
:
4px
;
background
:
#fff
;
transition
:
all
0.3s
;
&:hover
{
background
:
$
bgColor
;
opacity
:
0.7
;
}
&
:focus
{
outline
:
none
;
}
}
&
__text
{
display
:
inline-block
;
line-height
:
40px
;
padding
:
0
8px
;
float
:
right
;
color
:
$
textColor
;
cursor
:
default
;
transition
:
all
0.3s
;
&:hover
{
opacity
:
1
;
}
&
.__danger
{
color
:
red
;
}
}
}
}
</
style
>
src/views/activity/components/welcomeWords.vue
deleted
100644 → 0
View file @
5781095
<
template
>
<div
class=
"welcome-box"
>
<div
class=
"content"
>
<div
class=
"content-bg"
>
<wTextarea
ref=
"textContent"
v-model=
"textValue"
@
updateText=
"updateText"
></wTextarea>
<div
v-for=
"(itm, index) in previewList"
:key=
"itm.id"
>
<div
class=
"welcome-file"
v-if=
"itm.attType != 1"
>
<template
v-if=
"itm.attType == 2"
>
<i
v-show=
"index == previewList.length - 1 && loading"
class=
"el-icon-loading"
></i>
<img
v-show=
"!loading"
src=
"@/assets/img/guestCustom/icon-img.png"
alt
/>
<span
:title=
"itm.attContent"
>
{{
itm
.
attContent
}}
</span>
</
template
>
<
template
v-else-if=
"itm.attType == 3"
>
<img
src=
"@/assets/img/guestCustom/icon-video.png"
alt
/>
<span
:title=
"itm.attContent"
>
{{
itm
.
attContent
}}
</span>
</
template
>
<
template
v-else-if=
"itm.attType == 7"
>
<img
src=
"@/assets/img/guestCustom/icon-applet.png"
alt
/>
<span
:title=
"JSON.parse(itm.attContent).marketingName"
>
{{
JSON
.
parse
(
itm
.
attContent
).
marketingName
}}
</span>
</
template
>
<
template
v-else-if=
"itm.attType == 5"
>
<img
src=
"@/assets/img/guestCustom/icon-applet.png"
alt
/>
<span
:title=
"itm.attContent.title"
>
{{
itm
.
attContent
.
title
}}
</span>
</
template
>
<i
class=
"el-icon-circle-close"
@
click=
"close(index)"
></i>
</div>
</div>
<div
class=
"btn-group"
>
<div
class=
"add-btn"
v-for=
"item in btnList"
:key=
"item.id"
>
<!-- <i class="el-icon-circle-plus-outline"></i> -->
<img
:src=
"require(`@/assets/img/guestCustom/add-${item.type}.png`)"
alt
v-if=
"item.id == 1"
@
click=
"selectEmotion"
/>
<img
:src=
"require(`@/assets/img/guestCustom/add-${item.type}.png`)"
v-else
alt
/>
<span
v-if=
"item.id == 1"
@
click
.
stop=
"selectEmotion"
>
{{ item.name }}
</span>
<span
v-else
>
{{ item.name }}
</span>
<input
v-if=
"item.type == 'img'"
type=
"file"
style=
"opacity: 0"
:id=
"item.name + 'file'"
ref=
"file"
class=
"welcome-input upload-img"
:accept=
"item.accept || 'image/png, image/jpeg, image/jpg'"
@
change=
"e => handleImgChange(e, item)"
/>
<input
v-else-if=
"item.type == 'video'"
type=
"file"
style=
"opacity: 0"
:id=
"item.name + 'file'"
ref=
"file"
class=
"welcome-input"
:accept=
"item.accept || 'video/*'"
@
change=
"e => handleVideoChange(e, item)"
/>
<el-link
v-else-if=
"item.type == 'nickname' || item.type == 'message' || item.type == 'acivity'"
style=
"opacity: 0"
@
click=
"handleFun(item.funName)"
>
{{ item.name }}
</el-link>
</div>
</div>
</div>
<div
v-show=
"emotionStatus"
class=
"emotion-panel"
>
<emotion
class=
"emotion-panel-box"
@
emotion=
"handleEmotion"
:height=
"280"
></emotion>
</div>
</div>
<ActivityModel
ref=
"activity"
@
selectActivity=
"selectActivity"
:activityList=
"activityList"
></ActivityModel>
<MessageModel
ref=
"message"
@
selectItem=
"selectMessage"
:messageList=
"messageList"
></MessageModel>
<!-- <material-model v-if="isMaterialVisible" :isMaterialVisible.sync="isMaterialVisible" @handleMaterialConfirm="handleMaterialConfirm" @handleMaterialClose="handleMaterialClose"></material-model> -->
</div>
</template>
<
script
>
const
ATT_TYPE
=
{
TEXT
:
1
,
IMAGE
:
2
,
VEDIO
:
3
,
URL
:
4
,
MINIPROGRAM
:
5
,
FILE
:
6
,
ACTIVITY
:
7
}
import
emoji
from
'@/utils/emo'
import
ActivityModel
from
'./activityModel'
import
MessageModel
from
'./messageModel'
// import materialModel from './materialModel'
import
Emotion
from
'./emotionWords'
import
wTextarea
from
'./tag-textarea'
import
{
utils
}
from
'glsx-common'
export
default
{
name
:
'WelcomeWords'
,
components
:
{
ActivityModel
,
Emotion
,
wTextarea
,
MessageModel
// materialModel
},
props
:
{
btnList
:
Array
,
form
:
String
},
data
()
{
return
{
loading
:
false
,
emotionStatus
:
false
,
guestForm
:
{},
previewList
:
[],
sendType
:
''
,
sendTime
:
''
,
sendDate
:
''
,
editor
:
{},
textValue
:
''
,
text
:
''
}
},
mounted
()
{
console
.
log
(
this
.
previewList
)
},
computed
:
{
activityList
()
{
return
this
.
btnList
.
find
(
item
=>
item
.
type
==
'acivity'
).
funParams
},
messageList
()
{
return
this
.
btnList
.
find
(
item
=>
item
.
type
==
'message'
)
}
},
watch
:
{
previewList
:
{
handler
(
val
)
{
this
.
$emit
(
'previewWord'
,
val
)
},
deep
:
true
}
},
methods
:
{
selectEmotion
()
{
this
.
emotionStatus
=
!
this
.
emotionStatus
},
handleEmotion
(
i
)
{
this
.
emotionStatus
=
false
const
list
=
emoji
.
flat
(
Infinity
)
let
index
=
list
.
indexOf
(
i
)
+
1
if
(
index
<
10
)
{
index
=
'00'
+
index
}
else
if
(
index
>=
10
&&
index
<
100
)
{
index
=
'0'
+
index
}
this
.
$refs
.
textContent
.
addImg
(
`https://img01.glsx.com.cn/weapp/resource/saas/scrm/emoji/
${
index
}
.png`
)
},
updateText
(
val
)
{
this
.
textInput
(
val
)
},
// 上传图片
handleImgChange
(
e
,
targetItem
)
{
var
reader
=
new
FileReader
()
var
file
=
e
.
srcElement
.
files
[
0
]
// 默认1MB
const
limitSize
=
targetItem
.
limitSize
||
1
const
isLt
=
file
.
size
/
1024
/
1024
<
limitSize
if
(
!
isLt
)
{
this
.
$message
.
error
(
'上传图片大小不能超过'
+
limitSize
+
'MB!'
)
return
true
}
this
.
loading
=
true
reader
.
readAsDataURL
(
file
)
this
.
previewList
.
push
({
attType
:
ATT_TYPE
.
IMAGE
,
attContent
:
''
})
reader
.
onload
=
e
=>
{
var
image
=
new
Image
()
image
.
src
=
e
.
target
.
result
image
.
onload
=
()
=>
{
const
imgFile
=
e
.
target
.
result
const
base64
=
file
.
name
.
split
(
'.'
)[
1
]
+
'@'
+
imgFile
.
split
(
','
)[
1
]
this
.
$apis
.
common
.
pictureUpload
({
file
:
base64
}).
then
(
res
=>
{
if
(
res
)
{
let
len
=
this
.
previewList
.
length
-
1
this
.
previewList
[
len
].
attContent
=
res
document
.
querySelector
(
'.upload-img'
).
value
=
''
}
else
{
let
len
=
this
.
previewList
.
length
-
1
this
.
previewList
.
splice
(
len
,
1
)
}
this
.
loading
=
false
})
}
}
},
// 上传视频
handleVideoChange
(
e
,
targetItem
)
{
var
file
=
e
.
srcElement
.
files
[
0
]
var
reader
=
new
FileReader
()
// 默认1MB
const
limitSize
=
targetItem
.
limitSize
||
1
const
isLt
=
file
.
size
/
1024
/
1024
<
limitSize
if
(
!
isLt
)
{
this
.
$message
.
error
(
'上传视频大小不能超过'
+
limitSize
+
'MB!'
)
return
true
}
reader
.
readAsDataURL
(
file
)
reader
.
onload
=
e
=>
{
const
imgFile
=
e
.
target
.
result
const
base64
=
file
.
name
.
split
(
'.'
)[
1
]
+
'@'
+
imgFile
.
split
(
','
)[
1
]
this
.
$apis
.
common
.
pictureUpload
({
file
:
base64
}).
then
(
res
=>
{
if
(
res
)
{
this
.
previewList
.
push
({
attType
:
ATT_TYPE
.
VEDIO
,
attContent
:
res
})
}
})
}
},
handleFun
(
name
)
{
if
(
name
==
'nickname'
)
{
this
.
$refs
.
textContent
.
addTag
(
'@昵称'
)
}
else
if
(
name
==
'activity'
)
{
this
.
$refs
.
activity
.
init
()
}
else
if
(
name
==
'message'
)
{
this
.
$refs
.
message
.
init
()
}
else
if
(
name
==
'material'
)
{
this
.
$refs
.
material
.
init
()
}
},
close
(
index
)
{
this
.
previewList
.
splice
(
index
,
1
)
},
textInput
(
val
)
{
console
.
log
(
val
)
const
hasText
=
this
.
previewList
.
some
(
item
=>
item
.
attType
==
1
)
console
.
log
(
hasText
)
if
(
hasText
)
{
this
.
$set
(
this
.
previewList
,
0
,
{
attContent
:
val
,
attType
:
ATT_TYPE
.
TEXT
})
}
else
{
this
.
previewList
.
unshift
({
attContent
:
val
,
attType
:
ATT_TYPE
.
TEXT
})
}
},
selectActivity
(
val
)
{
let
idx
const
hasActivity
=
this
.
previewList
.
some
((
item
,
index
)
=>
{
if
(
item
.
attType
==
7
)
{
idx
=
index
return
item
}
})
if
(
val
)
{
if
(
hasActivity
)
{
this
.
$set
(
this
.
previewList
,
idx
,
{
attContent
:
JSON
.
stringify
(
val
),
attType
:
ATT_TYPE
.
ACTIVITY
})
}
else
{
this
.
previewList
.
push
({
attContent
:
JSON
.
stringify
(
val
),
attType
:
ATT_TYPE
.
ACTIVITY
})
}
}
},
selectMessage
(
val
)
{
const
content
=
val
.
content
this
.
updateText
(
content
)
this
.
textValue
=
content
},
insertHtmlAtCaret
(
html
)
{
var
sel
,
range
,
frag
if
(
window
.
getSelection
)
{
sel
=
window
.
getSelection
()
if
(
sel
.
getRangeAt
&&
sel
.
rangeCount
)
{
range
=
sel
.
getRangeAt
(
0
)
range
.
deleteContents
()
var
el
=
document
.
createElement
(
'span'
)
el
.
innerHTML
=
'<span contenteditable="false" class="nickname">@昵称<i class="el-icon-error"></i></span>'
// var el = document.createElement('div')
// el.innerHTML = html
frag
=
document
.
createDocumentFragment
()
var
node
var
lastNode
while
((
node
=
el
.
firstChild
))
{
lastNode
=
frag
.
appendChild
(
node
)
}
range
.
insertNode
(
frag
)
if
(
lastNode
)
{
range
=
range
.
cloneRange
()
range
.
setEndAfter
(
lastNode
)
range
.
collapse
(
true
)
sel
.
removeAllRanges
()
sel
.
addRange
(
range
)
}
}
}
},
changeInput
:
utils
.
debounce
(
function
()
{
var
allNodes
=
document
.
getElementById
(
'editor'
).
childNodes
var
str
=
''
allNodes
.
forEach
(
item
=>
{
if
(
item
.
className
==
'nickname'
)
{
str
+=
item
.
innerText
}
else
if
(
item
.
data
)
{
str
+=
item
.
data
}
})
this
.
textInput
(
str
)
},
300
),
updateList
(
val
)
{
this
.
previewList
=
this
.
$common
.
utils
.
deepClone
(
val
)
// this.eventBus.$emit('update', this.previewList)
const
obj
=
val
.
find
(
item
=>
item
.
attType
==
1
)
if
(
obj
)
{
let
attContent
=
obj
.
attContent
.
replaceAll
(
'[@昵称]'
,
'<wise id="1">@昵称</wise>'
)
const
htm
=
attContent
.
replace
(
/
\[[\u
4E00-
\u
9FA56
]{1,4}
]/gi
,
function
(
res
)
{
let
word
=
res
.
replace
(
/
\[
|
\]
/gi
,
''
)
const
list
=
emoji
.
flat
(
Infinity
)
let
index
=
parseInt
(
list
.
indexOf
(
word
))
+
1
if
(
index
<
10
)
{
index
=
'00'
+
index
}
else
if
(
index
>=
10
&&
index
<
100
)
{
index
=
'0'
+
index
}
return
`<img src="https://img01.glsx.com.cn/weapp/resource/saas/scrm/emoji/
${
index
}
.png">`
})
setTimeout
(()
=>
{
document
.
querySelector
(
'.w-textarea_input'
).
innerHTML
=
htm
},
100
)
}
else
{
this
.
textValue
=
''
}
}
}
}
</
script
>
<
style
lang=
"scss"
scoped
>
.welcome-box
{
}
.emotion-panel
{
position
:
relative
;
height
:
0px
;
&-box
{
position
:
absolute
;
top
:
-320px
;
}
}
.content-bg
{
//
background-color
:
#f7f7f7
;
}
.content
{
display
:
inline-block
;
vertical-align
:
text-top
;
//
width
:
calc
(
100%
-
103px
);
width
:
100%
;
//
margin-left
:
12px
;
.welcome-file
{
display
:
flex
;
align-items
:
center
;
color
:
#999
;
line-height
:
20px
;
padding
:
10px
;
margin-bottom
:
10px
;
border-left
:
1px
solid
#dcdfe6
;
border-right
:
1px
solid
#dcdfe6
;
img
{
width
:
20px
;
height
:
20px
;
margin-right
:
5px
;
}
span
{
display
:
inline-block
;
margin-right
:
20px
;
max-width
:
200px
;
white-space
:
nowrap
;
overflow
:
hidden
;
text-overflow
:
ellipsis
;
font-size
:
14px
;
}
i
{
font-size
:
16px
;
cursor
:
pointer
;
}
.el-icon-loading
{
font-size
:
24px
;
}
&
:last-child
{
margin-bottom
:
0
;
}
}
.btn-group
{
padding
:
12px
0
12px
20px
;
border
:
1px
solid
#dcdfe6
;
border-top
:
0
;
.add-btn
{
display
:
inline-flex
;
position
:
relative
;
align-items
:
center
;
padding-right
:
25px
;
font-size
:
16px
;
color
:
#666
;
cursor
:
pointer
;
span
{
font-size
:
14px
;
margin-left
:
5px
;
cursor
:
pointer
;
}
input
{
position
:
absolute
;
width
:
100%
;
cursor
:
pointer
;
font-size
:
0
;
height
:
40px
;
}
img
{
width
:
16px
;
height
:
16px
;
cursor
:
pointer
;
}
.el-link
{
position
:
absolute
;
width
:
100%
;
}
}
}
.date-picker
{
margin-top
:
10px
;
font-size
:
14px
;
color
:
#999
;
}
}
.required
{
display
:
inline-block
;
line-height
:
40px
;
text-align
:
right
;
width
:
90px
;
}
.required
::before
{
content
:
'*'
;
color
:
#f56c6c
;
margin-right
:
4
px
;
}
.form-tips
{
font-size
:
12px
;
color
:
#999
;
}
.form-upload
{
position
:
absolute
;
top
:
0
;
width
:
140px
;
//
width
:
100%
;
height
:
100%
;
cursor
:
pointer
;
z-index
:
1
;
}
/
deep
/
{
.el-textarea__inner
{
background-color
:
#f7f7f7
;
border-radius
:
0
;
}
.el-textarea__inner
:focus
{
border-color
:
#dcdfe6
;
}
.el-textarea
.el-input__count
{
background-color
:
#f7f7f7
;
}
}
.upload
{
position
:
relative
;
}
.upload-bg
{
position
:
relative
;
width
:
140px
;
height
:
140px
;
background-color
:
#f7f7f7
;
color
:
#999
;
border
:
1px
dashed
#dcdfe6
;
i
{
position
:
absolute
;
top
:
40px
;
left
:
50%
;
transform
:
translateX
(
-50%
);
font-size
:
30px
;
}
.upload-text
{
position
:
absolute
;
bottom
:
40px
;
left
:
50%
;
transform
:
translateX
(
-50%
);
font-size
:
12px
;
}
}
.tips-text
{
display
:
flex
;
align-items
:
center
;
justify-self
:
center
;
color
:
#000
;
font-size
:
14px
;
padding
:
0
16px
;
margin-top
:
10px
;
background-color
:
rgba
(
230
,
233
,
255
,
0.49
);
border
:
1px
solid
rgba
(
88
,
80
,
255
,
0.49
);
border-radius
:
4px
;
.tips-icon
{
width
:
14px
;
height
:
14px
;
margin-right
:
8px
;
}
}
//
编辑器
.editor-container
{
border
:
1px
solid
#dcdfe6
;
min-height
:
165px
;
/deep/
{
.w-e-text
{
background-color
:
#f7f7f7
;
}
}
}
.text-editor
{
outline
:
0
;
width
:
100%
;
min-height
:
200px
;
max-height
:
200px
;
border
:
1px
solid
#dcdfe6
;
box-sizing
:
border-box
;
padding
:
5px
;
line-height
:
20px
;
font-size
:
12px
;
word-wrap
:
break-word
;
overflow-x
:
hidden
;
overflow-y
:
auto
;
_overflow-y
:
visible
;
}
/
deep
/
.nickname
{
display
:
inline
;
//
width
:
64px
;
//
height
:
20px
;
border-radius
:
2px
;
background-color
:
#fff
;
font-size
:
14px
;
color
:
#5850ff
;
line-height
:
20px
;
padding
:
2px
;
margin
:
0
5px
;
i
{
font-size
:
10px
;
}
}
</
style
>
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