Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
npm
/
glsx-components
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 8e400715
authored
Aug 01, 2022
by
杨明
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fixed
1 parent
098df0d7
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
258 additions
and
62 deletions
src/assets/welcomeWord/add-link.png
src/packages/Editor/src/activityModel.vue
src/packages/Editor/src/index.vue
src/packages/Editor/src/materialModel.vue
src/packages/Editor/src/tag-textarea.vue
src/assets/welcomeWord/add-link.png
0 → 100644
View file @
8e40071
696 Bytes
src/packages/Editor/src/activityModel.vue
View file @
8e40071
<
template
>
<
template
>
<div
class=
"square-main"
>
<div
class=
"square-main"
>
<
el-dialog
title=
"选择活动"
:visible
.
sync=
"dialogVisible"
width=
"1088px"
:before-close=
"handleClose
"
>
<
GLDialog
bigTitle=
"选择活动"
:hasFooter=
"true"
:visible
.
sync=
"dialogVisible"
width=
"1088px"
:before-close=
"handleClose"
mode=
"big
"
>
<div
class=
"model-panel"
v-loading=
"loading"
>
<div
class=
"model-panel"
v-loading=
"loading"
>
<div
class=
"model-panel-tab"
>
<div
class=
"model-panel-tab"
>
<label>
活动类型:
</label>
<label>
活动类型:
</label>
...
@@ -81,7 +81,7 @@
...
@@ -81,7 +81,7 @@
<el-button
size=
"small"
type=
"primary"
@
click=
"handleOpen"
v-show=
"modelList.length == 0 && selectType == 'package' && couponMenu"
>
立即添加
</el-button>
<el-button
size=
"small"
type=
"primary"
@
click=
"handleOpen"
v-show=
"modelList.length == 0 && selectType == 'package' && couponMenu"
>
立即添加
</el-button>
<el-button
size=
"small"
type=
"primary"
@
click=
"handleOpen"
v-show=
"modelList.length == 0 && selectType == 'activity' && activityMenu"
>
立即添加
</el-button>
<el-button
size=
"small"
type=
"primary"
@
click=
"handleOpen"
v-show=
"modelList.length == 0 && selectType == 'activity' && activityMenu"
>
立即添加
</el-button>
</span>
</span>
</
el-d
ialog>
</
GLD
ialog>
</div>
</div>
</template>
</template>
...
@@ -93,8 +93,12 @@ const openUrl = function (url) {
...
@@ -93,8 +93,12 @@ const openUrl = function (url) {
link
.
rel
=
'opener'
link
.
rel
=
'opener'
link
.
click
()
link
.
click
()
}
}
import
GLDialog
from
'../../GLDialog/src/index'
export
default
{
export
default
{
name
:
'ActivityModel'
,
name
:
'ActivityModel'
,
components
:
{
GLDialog
},
data
()
{
data
()
{
return
{
return
{
dialogVisible
:
false
,
dialogVisible
:
false
,
...
@@ -116,7 +120,7 @@ export default {
...
@@ -116,7 +120,7 @@ export default {
},
},
computed
:
{
computed
:
{
selectType
()
{
selectType
()
{
return
this
.
activityList
.
find
(
act
=>
act
.
itemValue
==
this
.
activeName
).
itemType
return
this
.
activityList
.
length
?
this
.
activityList
.
find
(
act
=>
act
.
itemValue
==
this
.
activeName
).
itemType
:
''
}
}
},
},
methods
:
{
methods
:
{
...
...
src/packages/Editor/src/index.vue
View file @
8e40071
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
<div
class=
"content"
>
<div
class=
"content"
>
<div
class=
"content-bg"
>
<div
class=
"content-bg"
>
<wTextarea
ref=
"textContent"
v-model=
"textValue"
@
updateText=
"updateText"
:style=
"
{ 'min-height': boxHeight + 'px' }">
</wTextarea>
<wTextarea
ref=
"textContent"
v-model=
"textValue"
@
updateText=
"updateText"
:style=
"
{ 'min-height': boxHeight + 'px' }">
</wTextarea>
<vuedraggable
animation=
"300"
v-model=
"previewList"
v-if=
"isPreview(previewList) && Isdraggable"
>
<vuedraggable
animation=
"300"
v-model=
"previewList"
v-if=
"isPreview(previewList
, ATT_TYPE.IMAGE
) && Isdraggable"
>
<transition-group
class=
"welcome-file"
>
<transition-group
class=
"welcome-file"
>
<template
v-for=
"(itm, index) in previewList"
>
<template
v-for=
"(itm, index) in previewList"
>
<div
class=
"welcome-img-box"
v-if=
"itm.attType == ATT_TYPE.IMAGE"
:style=
"`background-image: url('$
{itm.attContent}')`" :key="itm">
<div
class=
"welcome-img-box"
v-if=
"itm.attType == ATT_TYPE.IMAGE"
:style=
"`background-image: url('$
{itm.attContent}')`" :key="itm">
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
,
,
</div>
</div>
</div>
</div>
<template
v-if=
"itm.attType == ATT_TYPE.VEDIO"
>
<
!--
<
template
v-if=
"itm.attType == ATT_TYPE.VEDIO"
>
<div
class=
"video-panel"
:key=
"itm"
>
<div
class=
"video-panel"
:key=
"itm"
>
<video
id=
"video"
width=
"100%"
height=
"100%"
preload
loop
muted
>
<video
id=
"video"
width=
"100%"
height=
"100%"
preload
loop
muted
>
<source
:src=
"itm.attContent"
type=
"video/mp4"
/>
<source
:src=
"itm.attContent"
type=
"video/mp4"
/>
...
@@ -21,10 +21,23 @@
...
@@ -21,10 +21,23 @@
<i
class=
"el-icon-video-play"
@
click=
"handleEnlarge(itm.attContent, 'video')"
></i>
<i
class=
"el-icon-video-play"
@
click=
"handleEnlarge(itm.attContent, 'video')"
></i>
<div
class=
"video-pane-close"
@
click=
"close(index)"
><img
src=
"../../../assets/welcomeWord/close-video.png"
alt=
""
/></div>
<div
class=
"video-pane-close"
@
click=
"close(index)"
><img
src=
"../../../assets/welcomeWord/close-video.png"
alt=
""
/></div>
</div>
</div>
</
template
>
</
template
>
-->
</template>
</template>
</transition-group>
</transition-group>
</vuedraggable>
</vuedraggable>
<div
class=
"welcome-file"
v-if=
"isPreview(previewList, ATT_TYPE.VEDIO) && Isdraggable"
>
<
template
v-for=
"(itm, index) in previewList"
>
<template
v-if=
"itm.attType == ATT_TYPE.VEDIO"
>
<div
class=
"video-panel"
:key=
"itm"
>
<video
id=
"video"
width=
"100%"
height=
"100%"
preload
loop
muted
>
<source
:src=
"itm.attContent"
type=
"video/mp4"
/>
</video>
<i
class=
"el-icon-video-play"
@
click=
"handleEnlarge(itm.attContent, 'video')"
></i>
<div
class=
"video-pane-close"
@
click=
"close(index)"
><img
src=
"../../../assets/welcomeWord/close-video.png"
alt=
""
/></div>
</div>
</
template
>
</template>
</div>
<div
class=
"welcome-file"
v-if=
"isPreview(previewList) && !Isdraggable"
>
<div
class=
"welcome-file"
v-if=
"isPreview(previewList) && !Isdraggable"
>
<
template
v-for=
"(itm, index) in previewList"
>
<
template
v-for=
"(itm, index) in previewList"
>
<div
v-if=
"itm.attType != ATT_TYPE.TEXT"
:key=
"index"
>
<div
v-if=
"itm.attType != ATT_TYPE.TEXT"
:key=
"index"
>
...
@@ -115,6 +128,9 @@
...
@@ -115,6 +128,9 @@
<div
class=
"welcome-activity-icon"
>
<div
class=
"welcome-activity-icon"
>
<img
src=
"../../../assets/welcomeWord/pdf_r.png"
v-if=
"itm.attContent"
/>
<img
src=
"../../../assets/welcomeWord/pdf_r.png"
v-if=
"itm.attContent"
/>
</div>
</div>
<div
class=
"welcome-activity-desc"
>
<div
class=
"model-item-title"
>
{{
JSON
.
parse
(
itm
.
attContent
).
fileName
}}
</div>
</div>
<div
class=
"delete-solid"
>
<div
class=
"delete-solid"
>
<i
class=
"el-icon-delete-solid"
@
click=
"close(index)"
></i>
<i
class=
"el-icon-delete-solid"
@
click=
"close(index)"
></i>
</div>
</div>
...
@@ -134,7 +150,7 @@
...
@@ -134,7 +150,7 @@
<span
v-else
>
{{ item.name }}
</span>
<span
v-else
>
{{ item.name }}
</span>
<input
v-if=
"item.type == 'img'"
type=
"file"
style=
"opacity: 0"
:id=
"item.type + 'file'"
ref=
"file"
class=
"welcome-input upload-img"
:accept=
"item.accept || 'image/png, image/jpeg, image/jpg'"
@
change=
"e => handleImgChange(e)"
/>
<input
v-if=
"item.type == 'img'"
type=
"file"
style=
"opacity: 0"
:id=
"item.type + 'file'"
ref=
"file"
class=
"welcome-input upload-img"
:accept=
"item.accept || 'image/png, image/jpeg, image/jpg'"
@
change=
"e => handleImgChange(e)"
/>
<input
v-else-if=
"item.type == 'video'"
type=
"file"
style=
"opacity: 0"
:id=
"item.type + 'file'"
ref=
"file"
class=
"welcome-input"
:accept=
"item.accept || 'video/*'"
@
change=
"e => handleVideoChange(e)"
/>
<input
v-else-if=
"item.type == 'video'"
type=
"file"
style=
"opacity: 0"
:id=
"item.type + 'file'"
ref=
"file"
class=
"welcome-input"
:accept=
"item.accept || 'video/*'"
@
change=
"e => handleVideoChange(e)"
/>
<el-link
v-else-if=
"item.type == 'nickname' || item.type == 'message' || item.type == 'activity' || item.type == 'material'"
style=
"opacity: 0"
@
click=
"handleFun(item.type)"
>
{{ item.name }}
</el-link>
<el-link
v-else-if=
"item.type == '
link' || item.type == '
nickname' || item.type == 'message' || item.type == 'activity' || item.type == 'material'"
style=
"opacity: 0"
@
click=
"handleFun(item.type)"
>
{{ item.name }}
</el-link>
</div>
</div>
</div>
</div>
</div>
</div>
...
@@ -163,7 +179,7 @@ const ATT_TYPE = {
...
@@ -163,7 +179,7 @@ const ATT_TYPE = {
ACTIVITY
:
7
,
ACTIVITY
:
7
,
MATERIAL
:
10
MATERIAL
:
10
}
}
const
wordType
=
[
'expression'
,
'img'
,
'video'
,
'nickname'
,
'activity'
,
'material'
,
'message'
]
const
wordType
=
[
'expression'
,
'img'
,
'video'
,
'nickname'
,
'activity'
,
'material'
,
'message'
,
'link'
]
import
emoji
from
'../../../utils/emo'
import
emoji
from
'../../../utils/emo'
import
ActivityModel
from
'./activityModel'
import
ActivityModel
from
'./activityModel'
import
MessageModel
from
'./messageModel'
import
MessageModel
from
'./messageModel'
...
@@ -217,7 +233,7 @@ export default {
...
@@ -217,7 +233,7 @@ export default {
},
},
computed
:
{
computed
:
{
activityList
()
{
activityList
()
{
return
this
.
btnList
.
find
(
item
=>
item
.
type
==
'activity'
)
.
funParams
||
{}
return
this
.
btnList
.
find
(
item
=>
item
.
type
==
'activity'
)
?
this
.
btnList
.
find
(
item
=>
item
.
type
==
'activity'
).
funParams
:
{}
},
},
messageList
()
{
messageList
()
{
return
this
.
btnList
.
find
(
item
=>
item
.
type
==
'message'
)
||
{}
return
this
.
btnList
.
find
(
item
=>
item
.
type
==
'message'
)
||
{}
...
@@ -234,6 +250,9 @@ export default {
...
@@ -234,6 +250,9 @@ export default {
materialList
()
{
materialList
()
{
return
this
.
btnList
.
find
(
item
=>
item
.
type
==
'material'
)
||
{}
return
this
.
btnList
.
find
(
item
=>
item
.
type
==
'material'
)
||
{}
},
},
linkList
()
{
return
this
.
btnList
.
find
(
item
=>
item
.
type
==
'link'
)
||
{}
},
materialItem
()
{
materialItem
()
{
let
attContent
let
attContent
this
.
previewList
.
forEach
(
item
=>
{
this
.
previewList
.
forEach
(
item
=>
{
...
@@ -252,8 +271,8 @@ export default {
...
@@ -252,8 +271,8 @@ export default {
}
}
},
},
methods
:
{
methods
:
{
isPreview
(
preview
)
{
isPreview
(
preview
,
type
)
{
return
preview
.
filter
(
item
=>
item
.
attType
!=
ATT_TYPE
.
TEXT
).
length
return
preview
.
filter
(
item
=>
item
.
attType
==
type
).
length
},
},
handleEnlarge
(
src
,
type
)
{
handleEnlarge
(
src
,
type
)
{
this
.
dialogVisibleImg
=
true
this
.
dialogVisibleImg
=
true
...
@@ -261,7 +280,7 @@ export default {
...
@@ -261,7 +280,7 @@ export default {
this
.
dialogType
=
type
?
type
:
'img'
this
.
dialogType
=
type
?
type
:
'img'
},
},
marketingContent
(
val
)
{
marketingContent
(
val
)
{
return
JSON
.
parse
(
val
.
attContent
)
.
marketingContent
return
val
.
attContent
.
marketingContent
},
},
checkedType
(
type
)
{
checkedType
(
type
)
{
return
wordType
.
indexOf
(
type
)
!==
-
1
?
type
:
'img'
return
wordType
.
indexOf
(
type
)
!==
-
1
?
type
:
'img'
...
@@ -410,12 +429,15 @@ export default {
...
@@ -410,12 +429,15 @@ export default {
this
.
$refs
.
message
.
init
()
this
.
$refs
.
message
.
init
()
}
else
if
(
name
==
'material'
)
{
}
else
if
(
name
==
'material'
)
{
this
.
$refs
.
material
.
init
()
this
.
$refs
.
material
.
init
()
}
else
if
(
name
==
'link'
)
{
this
.
$refs
.
textContent
.
addCardLink
(
this
.
linkList
)
}
}
},
},
close
(
index
)
{
close
(
index
)
{
this
.
previewList
.
splice
(
index
,
1
)
this
.
previewList
.
splice
(
index
,
1
)
},
},
textInput
(
val
)
{
textInput
(
val
)
{
val
=
val
.
replace
(
/ /g
,
''
)
const
hasText
=
this
.
previewList
.
some
(
item
=>
item
.
attType
==
this
.
ATT_TYPE
.
TEXT
)
const
hasText
=
this
.
previewList
.
some
(
item
=>
item
.
attType
==
this
.
ATT_TYPE
.
TEXT
)
if
(
hasText
)
{
if
(
hasText
)
{
this
.
$set
(
this
.
previewList
,
0
,
{
this
.
$set
(
this
.
previewList
,
0
,
{
...
@@ -441,14 +463,13 @@ export default {
...
@@ -441,14 +463,13 @@ export default {
})
})
}
else
{
}
else
{
this
.
previewList
.
push
({
this
.
previewList
.
push
({
attContent
:
JSON
.
stringify
(
val
)
,
attContent
:
val
,
attType
:
this
.
ATT_TYPE
[
type
]
attType
:
this
.
ATT_TYPE
[
type
]
})
})
}
}
},
},
// 素材
// 素材
handleMaterialConfirm
(
val
)
{
handleMaterialConfirm
(
val
)
{
console
.
log
(
val
)
const
{
materialContent
,
objectName
}
=
val
const
{
materialContent
,
objectName
}
=
val
const
imgSrc
=
materialContent
.
imgSrc
const
imgSrc
=
materialContent
.
imgSrc
const
videoSrc
=
materialContent
.
videoSrc
const
videoSrc
=
materialContent
.
videoSrc
...
@@ -456,11 +477,15 @@ export default {
...
@@ -456,11 +477,15 @@ export default {
let
html
=
materialContent
.
html
?
materialContent
.
html
:
''
let
html
=
materialContent
.
html
?
materialContent
.
html
:
''
if
(
pdfSrc
&&
!
this
.
materialList
.
pdfNo
)
{
if
(
pdfSrc
&&
!
this
.
materialList
.
pdfNo
)
{
this
.
previewList
.
push
({
this
.
previewList
.
push
({
attContent
:
pdfSrc
,
attContent
:
JSON
.
stringify
({
fileName
:
objectName
,
url
:
pdfSrc
})
,
attType
:
this
.
ATT_TYPE
.
FILE
attType
:
this
.
ATT_TYPE
.
FILE
})
})
return
return
}
}
if
((
pdfSrc
&&
this
.
materialList
.
pdfNo
)
||
(
videoSrc
&&
videoSrc
.
length
&&
this
.
materialList
.
videoNo
))
{
this
.
$message
.
error
(
pdfSrc
?
'不支持此类型'
:
'不支持视频'
)
return
}
if
(
imgSrc
&&
imgSrc
.
length
)
{
if
(
imgSrc
&&
imgSrc
.
length
)
{
imgSrc
.
forEach
(
item
=>
{
imgSrc
.
forEach
(
item
=>
{
this
.
previewList
.
push
({
this
.
previewList
.
push
({
...
@@ -479,19 +504,21 @@ export default {
...
@@ -479,19 +504,21 @@ export default {
}
}
const
idx
=
this
.
previewList
.
findIndex
(
item
=>
item
.
attType
==
this
.
ATT_TYPE
.
TEXT
)
const
idx
=
this
.
previewList
.
findIndex
(
item
=>
item
.
attType
==
this
.
ATT_TYPE
.
TEXT
)
if
(
idx
!==
-
1
)
{
if
(
idx
!==
-
1
)
{
this
.
textValue
=
this
.
previewList
[
idx
].
attContent
+
html
if
(
!
this
.
previewList
[
idx
].
attContent
)
{
html
=
html
.
replace
(
'\n'
,
''
)
}
this
.
$set
(
this
.
previewList
,
0
,
{
this
.
$set
(
this
.
previewList
,
0
,
{
attContent
:
this
.
previewList
[
idx
].
attContent
+
html
,
attContent
:
(
this
.
previewList
[
idx
].
attContent
+
html
).
substring
(
0
,
600
)
,
attType
:
this
.
ATT_TYPE
.
TEXT
attType
:
this
.
ATT_TYPE
.
TEXT
})
})
}
else
{
}
else
{
html
=
html
.
replace
(
'\n'
,
''
)
html
=
html
.
replace
(
'\n'
,
''
)
this
.
previewList
.
unshift
({
this
.
previewList
.
unshift
({
attContent
:
html
,
attContent
:
html
.
substring
(
0
,
600
)
,
attType
:
this
.
ATT_TYPE
.
TEXT
attType
:
this
.
ATT_TYPE
.
TEXT
})
})
this
.
textValue
=
html
}
}
this
.
updateList
(
this
.
previewList
,
1
)
},
},
selectMessage
(
val
)
{
selectMessage
(
val
)
{
const
content
=
val
.
content
const
content
=
val
.
content
...
@@ -538,13 +565,18 @@ export default {
...
@@ -538,13 +565,18 @@ export default {
})
})
this
.
textInput
(
str
)
this
.
textInput
(
str
)
},
300
),
},
300
),
updateList
(
val
)
{
updateList
(
val
,
status
)
{
this
.
previewList
=
this
.
$common
.
utils
.
deepClone
(
val
)
this
.
previewList
=
utils
.
deepClone
(
val
)
// this.eventBus.$emit('update', this.previewList)
// this.eventBus.$emit('update', this.previewList)
const
obj
=
val
.
find
(
item
=>
item
.
attType
==
this
.
ATT_TYPE
.
TEXT
)
const
obj
=
val
.
find
(
item
=>
item
.
attType
==
this
.
ATT_TYPE
.
TEXT
)
if
(
obj
)
{
if
(
obj
)
{
let
attContent
=
obj
.
attContent
.
replaceAll
(
'[@昵称]'
,
'<wise id="1">@昵称</wise>'
)
let
attContent
const
htm
=
attContent
.
replace
(
/
\[[\u
4E00-
\u
9FA56
]{1,4}
]/gi
,
function
(
res
)
{
if
(
status
)
{
attContent
=
obj
.
attContent
.
replace
(
/@昵称/g
,
'<wise id="1" contenteditable="false">@昵称</wise>'
)
}
else
{
attContent
=
obj
.
attContent
.
replace
(
/
\[
@昵称
\]
/g
,
'<wise id="1" contenteditable="false">@昵称</wise>'
)
}
let
htm
=
attContent
.
replace
(
/
\[[\u
4E00-
\u
9FA56
]{1,4}
]/gi
,
function
(
res
)
{
let
word
=
res
.
replace
(
/
\[
|
\]
/gi
,
''
)
let
word
=
res
.
replace
(
/
\[
|
\]
/gi
,
''
)
const
list
=
emoji
.
flat
(
Infinity
)
const
list
=
emoji
.
flat
(
Infinity
)
let
index
=
parseInt
(
list
.
indexOf
(
word
))
+
1
let
index
=
parseInt
(
list
.
indexOf
(
word
))
+
1
...
@@ -555,6 +587,9 @@ export default {
...
@@ -555,6 +587,9 @@ export default {
}
}
return
`<img src="https://img01.glsx.com.cn/weapp/resource/saas/scrm/emoji/
${
index
}
.png">`
return
`<img src="https://img01.glsx.com.cn/weapp/resource/saas/scrm/emoji/
${
index
}
.png">`
})
})
if
(
htm
.
substr
(
-
1
,
1
)
==
'>'
&&
navigator
.
userAgent
.
indexOf
(
'Firefox'
)
>
0
)
{
htm
+=
' '
}
setTimeout
(()
=>
{
setTimeout
(()
=>
{
document
.
querySelector
(
'.w-textarea_input'
).
innerHTML
=
htm
document
.
querySelector
(
'.w-textarea_input'
).
innerHTML
=
htm
},
100
)
},
100
)
...
...
src/packages/Editor/src/materialModel.vue
View file @
8e40071
<!-- 素材弹窗 -->
<!-- 素材弹窗 -->
<
template
>
<
template
>
<
el-dialog
title=
"选择素材"
:visible
.
sync=
"isMaterialVisible"
width=
"70%"
class=
"relateStore
"
>
<
GLDialog
bigTitle=
"选择素材"
:hasFooter=
"true"
:visible
.
sync=
"isMaterialVisible"
width=
"70%"
class=
"relateStore"
mode=
"big
"
>
<GLCombiForm
:rowNumber=
"1"
ref=
"showSearch"
:formObj=
"searchForm"
:formData=
"searchFormData"
@
handleOk=
"handleSearch"
@
handleRest=
"handleReset"
></GLCombiForm>
<GLCombiForm
:rowNumber=
"1"
ref=
"showSearch"
:formObj=
"searchForm"
:formData=
"searchFormData"
@
handleOk=
"handleSearch"
@
handleRest=
"handleReset"
></GLCombiForm>
<div
class=
"model-panel"
>
<div
class=
"model-panel"
>
<div
class=
"model-item-panel"
v-if=
"modelList.length > 0"
v-loading=
"loading"
>
<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)">
<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
"
>
<div
class=
"model-image"
>
<!--
<span
class=
"hide-content"
>
{{
item
.
materialContentRpcResponse
.
materialName
}}
</span>
-->
<img
src=
"../../../assets/welcomeWord/pdf_r.png"
v-if=
"item.materialType == 1"
/>
<div
class=
"model-item-title"
:title=
"item.materialContentRpcResponse.materialName"
>
{{
item
.
materialContentRpcResponse
?
item
.
materialContentRpcResponse
.
materialName
:
'-'
}}
</div>
<template
v-if=
"item.materialType != 1"
>
</el-tooltip>
<img
v-if=
"item.materialContent && item.materialContent.urlType == 'img' && item.materialContent.imgSrc.length == 1"
class=
"img-material"
:src=
"item.materialContent.materialUrl"
/>
<!--
<img
:src=
"item.materialContentRpcResponse.materialUrl"
/>
-->
<div
:style=
"`background-image: url('$
{item.materialContent.materialUrl}')`" class="image-panel" v-if="item.materialContent
&&
item.materialContent.urlType == 'img'
&&
item.materialContent.imgSrc.length > 1">
<!-- 素材内容 -->
<div
class=
"image-panel-filter"
><img
src=
"../../../assets/welcomeWord/imgNum.png"
/></div>
<!--
<div
slot=
"materialContentRpcResponse"
slot-scope=
"scope"
style=
"text-align: center"
>
-->
<div
class=
"image-panel-num"
>
{{
item
.
materialContent
.
imgSrc
.
length
}}
</div>
<!-- 素材为PDF -->
</div>
<span
v-if=
"item.materialType == 1"
class=
"material-content"
>
<div
class=
"video-panel"
v-if=
"item.materialContent && item.materialContent.urlType == 'video'"
>
<video
id=
"video"
width=
"100%"
height=
"100%"
preload
loop
muted
>
<source
:src=
"item.materialContent.materialUrl"
type=
"video/mp4"
/>
</video>
<i
class=
"el-icon-video-play"
></i>
</div>
</
template
>
<img
src=
"../../../assets/welcomeWord/text.png"
v-if=
"!item.materialContent.materialUrl && item.materialType != 1"
/>
</div>
<div
class=
"model-content"
>
<div
class=
"model-content-title"
>
{{ item.materialContentRpcResponse.materialName }}
</div>
<div
class=
"model-content-html"
v-html=
"item.htmlText"
></div>
</div>
<!-- <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">
<!-- <el-tooltip effect="dark" placement="top" :content="item.materialContentRpcResponse.materialName" :disabled="item.materialContentRpcResponse.materialName.length < 16">
<span class="hide-content">{{ item.materialContentRpcResponse.materialName }}</span>
<span class="hide-content">{{ item.materialContentRpcResponse.materialName }}</span>
</el-tooltip> -->
</el-tooltip> -->
<img
class=
"img-pdf"
src=
"../../../assets/welcomeWord/pdf.png"
alt=
""
/>
<!--
<img class="img-pdf" src="../../../assets/welcomeWord/pdf.png" alt="" />
<p class="model-item-content">{{ item.materialContentRpcResponse.materialName }}.png</p>
<p class="model-item-content">{{ item.materialContentRpcResponse.materialName }}.png</p>
</span>
</span>
-->
<!-- 素材为自定义链接 -->
<!-- 素材为自定义链接 -->
<!-- <span v-if="item.materialType == 2"></span> -->
<!-- <span v-if="item.materialType == 2"></span> -->
<!-- 图文 -->
<!-- 图文 -->
<span
v-if=
"item.materialType == 3"
class=
"material-content"
>
<!-- <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.materialContent && item.materialContent.urlType == 'img'" class="img-material" :src="item.materialContent.materialUrl" />
<img v-if="item.materialContent && item.materialContent.urlType == 'img'" class="img-material" :src="item.materialContent.materialUrl" />
<video v-if="item.materialContent && item.materialContent.urlType == 'video'" class="img-material" width="100%" height="100%" preload loop muted>
<video v-if="item.materialContent && item.materialContent.urlType == 'video'" class="img-material" width="100%" height="100%" preload loop muted>
<source :src="item.materialContent.materialUrl" type="video/mp4" />
<source :src="item.materialContent.materialUrl" type="video/mp4" />
</video>
</video>
</span>
</span>
-->
</div>
</div>
<!-- </div> -->
<!-- </div> -->
</div>
</div>
...
@@ -55,15 +55,17 @@
...
@@ -55,15 +55,17 @@
<el-button
size=
"small"
@
click=
"isMaterialVisible = false"
>
取 消
</el-button>
<el-button
size=
"small"
@
click=
"isMaterialVisible = false"
>
取 消
</el-button>
<el-button
size=
"small"
type=
"primary"
@
click=
"handleMaterialConfirm"
>
确 定
</el-button>
<el-button
size=
"small"
type=
"primary"
@
click=
"handleMaterialConfirm"
>
确 定
</el-button>
</span>
</span>
</
el-d
ialog>
</
GLD
ialog>
</template>
</template>
<
script
>
<
script
>
import
GLCombiForm
from
'../../GlCombiForm/src/index'
import
GLCombiForm
from
'../../GlCombiForm/src/index'
import
GLDialog
from
'../../GLDialog/src/index'
export
default
{
export
default
{
name
:
'materialModel'
,
name
:
'materialModel'
,
components
:
{
components
:
{
GLCombiForm
GLCombiForm
,
GLDialog
},
},
data
()
{
data
()
{
return
{
return
{
...
@@ -178,7 +180,7 @@ export default {
...
@@ -178,7 +180,7 @@ export default {
let
imgSrc
=
this
.
getimgsrc
(
html
)
let
imgSrc
=
this
.
getimgsrc
(
html
)
let
videoSrc
=
this
.
getvideosrc
(
html
)
let
videoSrc
=
this
.
getvideosrc
(
html
)
let
imgHtml
=
html
.
match
(
/<img.*
?(?:
>|
\/
>
)
/g
)
let
imgHtml
=
html
.
match
(
/<img.*
?(?:
>|
\/
>
)
/g
)
let
videoHtml
=
html
.
match
(
/<video.*<
\/
video>/g
)
let
videoHtml
=
html
.
match
(
/<video.*
?
<
\/
video>/g
)
let
materialUrl
,
urlType
,
imgCount
let
materialUrl
,
urlType
,
imgCount
if
(
imgSrc
.
length
)
{
if
(
imgSrc
.
length
)
{
materialUrl
=
imgSrc
[
0
]
materialUrl
=
imgSrc
[
0
]
...
@@ -195,7 +197,8 @@ export default {
...
@@ -195,7 +197,8 @@ export default {
html
=
html
.
replace
(
videoHtml
[
i
],
''
)
html
=
html
.
replace
(
videoHtml
[
i
],
''
)
}
}
}
}
html
=
html
.
replace
(
/<p><
\/
p>/g
,
''
).
replace
(
/<p>
([\s\S]
+
)
<
\/
p>/
,
'\n$1'
)
this
.
$set
(
item
,
'htmlText'
,
html
.
replace
(
/<p>/
,
'<p style="display: -webkit-box;-webkit-box-orient: vertical;-webkit-line-clamp: 3;overflow: hidden;word-break: break-all;-webkit-box-orient: vertical;">'
))
html
=
html
.
replace
(
/<p><
\/
p>/g
,
''
).
replace
(
/<p>
([\s\S]
+
?)
<
\/
p>/
,
'\n$1'
)
if
(
materialUrl
)
{
if
(
materialUrl
)
{
this
.
$set
(
item
,
'materialContent'
,
{
materialUrl
,
imgCount
,
urlType
,
imgSrc
,
videoSrc
,
html
})
this
.
$set
(
item
,
'materialContent'
,
{
materialUrl
,
imgCount
,
urlType
,
imgSrc
,
videoSrc
,
html
})
}
else
{
}
else
{
...
@@ -336,8 +339,8 @@ export default {
...
@@ -336,8 +339,8 @@ export default {
align-items
:
stretch
;
align-items
:
stretch
;
flex-direction
:
row
;
flex-direction
:
row
;
.model-item
{
.model-item
{
width
:
2
40px
;
width
:
2
3%
;
margin-right
:
2
4px
;
margin-right
:
2
%
;
margin-bottom
:
24px
;
margin-bottom
:
24px
;
padding
:
12px
16px
;
padding
:
12px
16px
;
position
:
relative
;
position
:
relative
;
...
@@ -348,6 +351,113 @@ export default {
...
@@ -348,6 +351,113 @@ export default {
border
:
1px
solid
#e6e6e6
;
border
:
1px
solid
#e6e6e6
;
padding
:
14px
24px
;
padding
:
14px
24px
;
box-sizing
:
border-box
;
box-sizing
:
border-box
;
display
:
flex
;
&:nth-child(4n)
{
margin-right
:
0px
;
}
.image-panel
{
border-radius
:
2px
;
background-size
:
100%
100%
;
position
:
relative
;
width
:
60px
;
height
:
60px
;
.image-panel-filter
{
position
:
absolute
;
top
:
0px
;
left
:
0px
;
width
:
60px
;
height
:
60px
;
background
:
rgba
(
0
,
0
,
0
,
0.5
);
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
img
{
width
:
36px
;
height
:
36px
;
}
}
.image-panel-num
{
position
:
absolute
;
font-size
:
12px
;
top
:
25px
;
left
:
25px
;
color
:
rgba
(
255
,
255
,
255
,
0.8
);
}
}
.video-panel
{
margin-right
:
10px
;
width
:
60px
;
height
:
60px
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
position
:
relative
;
video
{
position
:
absolute
;
object-fit
:
fill
;
}
.el-icon-video-play
{
z-index
:
10
;
font-size
:
20px
;
color
:
#fff
;
cursor
:
pointer
;
}
}
.model-image
{
width
:
60px
;
height
:
60px
;
img
{
width
:
60px
;
height
:
60px
;
}
video
{
width
:
60px
;
height
:
60px
;
object-fit
:
fill
;
}
}
.model-content
{
margin-left
:
10px
;
text-align
:
left
;
width
:
calc
(
100%
-
60px
);
&-title
{
font-size
:
14px
;
color
:
#333333
;
line-height
:
21px
;
font-weight
:
400
;
white-space
:
nowrap
;
text-overflow
:
ellipsis
;
overflow
:
hidden
;
width
:
100%
;
}
p
{
white-space
:
nowrap
;
text-overflow
:
ellipsis
;
overflow
:
hidden
;
width
:
calc
(
100%
-
120px
);
font-size
:
12px
!important
;
color
:
#666666
;
line-height
:
21px
;
font-weight
:
400
;
}
.model-content-html
{
line-height
:
14px
;
display
:
-webkit-box
;
-webkit-box-orient
:
vertical
;
-webkit-line-clamp
:
3
;
overflow
:
hidden
;
word-break
:
break-all
;
-webkit-box-orient
:
vertical
;
>
p
{
display
:
-webkit-box
;
-webkit-box-orient
:
vertical
;
-webkit-line-clamp
:
3
;
overflow
:
hidden
;
word-break
:
break-all
;
-webkit-box-orient
:
vertical
;
}
}
}
&
:nth-child
(
4n
)
{
&
:nth-child
(
4n
)
{
margin-right
:
0px
;
margin-right
:
0px
;
}
}
...
...
src/packages/Editor/src/tag-textarea.vue
View file @
8e40071
<
template
>
<
template
>
<div
class=
"w-textarea"
ref=
"wTextarea"
v-bind=
"$attr"
>
<div
class=
"w-textarea"
ref=
"wTextarea"
v-bind=
"$attr"
>
<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
contenteditable=
"true"
class=
"w-textarea_input"
ref=
"wTextareaContent"
:id=
"contentId"
@
keydown=
"textareaKeydown($event)"
@
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"
>
<!--
<div
class=
"w-textarea_tools"
v-if=
"tools.length > 0 || maxlength"
>
<button
<button
class=
"w-textarea_tools__item"
class=
"w-textarea_tools__item"
...
@@ -110,6 +110,50 @@ export default {
...
@@ -110,6 +110,50 @@ export default {
// 处理后需要调用 addTag() 或者 addLink() 将内容传回来
// 处理后需要调用 addTag() 或者 addLink() 将内容传回来
this
.
$emit
(
'add'
,
type
)
this
.
$emit
(
'add'
,
type
)
},
},
textareaKeydown
(
event
)
{
if
(
event
.
keyCode
==
13
)
{
this
.
insertHtml
(
'<br>'
)
let
nn
=
document
.
createElement
(
'br'
)
document
.
querySelector
(
'.w-textarea_input'
).
appendChild
(
nn
)
return
false
}
},
/*换行*/
insertHtml
(
html
)
{
var
sel
,
range
if
(
window
.
getSelection
)
{
// IE9 或 非IE浏览器
sel
=
window
.
getSelection
()
if
(
sel
.
getRangeAt
&&
sel
.
rangeCount
)
{
range
=
sel
.
getRangeAt
(
0
)
range
.
deleteContents
()
// Range.createContextualFragment() would be useful here but is
// non-standard and not supported in all browsers (IE9, for one)
var
el
=
document
.
createElement
(
'div'
)
el
.
innerHTML
=
html
var
frag
=
document
.
createDocumentFragment
(),
node
,
lastNode
while
((
node
=
el
.
firstChild
))
{
lastNode
=
frag
.
appendChild
(
node
)
}
range
.
insertNode
(
frag
)
// Preserve the selection
if
(
lastNode
)
{
range
=
range
.
cloneRange
()
range
.
setStartAfter
(
lastNode
)
range
.
collapse
(
true
)
sel
.
removeAllRanges
()
sel
.
addRange
(
range
)
}
}
}
else
if
(
document
.
selection
&&
document
.
selection
.
type
!=
'Control'
)
{
// IE < 9
document
.
selection
.
createRange
().
pasteHTML
(
html
)
}
this
.
currentText
=
document
.
querySelector
(
'.w-textarea_input'
).
innerHTML
this
.
$emit
(
'updateText'
,
this
.
currentText
)
},
addTag
(
text
)
{
addTag
(
text
)
{
// 创建模版标签
// 创建模版标签
let
node
=
document
.
createElement
(
this
.
tag
)
let
node
=
document
.
createElement
(
this
.
tag
)
...
@@ -221,8 +265,8 @@ export default {
...
@@ -221,8 +265,8 @@ export default {
let
htm
=
target
.
innerHTML
let
htm
=
target
.
innerHTML
const
list
=
emoji
.
flat
(
Infinity
)
const
list
=
emoji
.
flat
(
Infinity
)
const
cutImg
=
htm
const
cutImg
=
htm
.
replace
(
/<img src="https:
\/\/
img01.glsx.com.cn
\/
weapp
\/
resource
\/
saas
\/
scrm
\/
emoji/g
,
''
)
.
replace
(
/<img src="https:
\/\/
img01.glsx.com.cn
\/
weapp
\/
resource
\/
saas
\/
scrm
\/
emoji
\/
/g
,
''
)
.
replace
All
(
'<wise id="1">@昵称</wise>'
,
'@昵称'
)
.
replace
(
/<wise.+
?(?:
<
\/
wise>
)
/g
,
'@昵称'
)
.
replace
(
/<br>/g
,
'\n'
)
.
replace
(
/<br>/g
,
'\n'
)
const
replaceImg
=
cutImg
.
replace
(
/
(\d){3}
.png">/g
,
function
(
str
)
{
const
replaceImg
=
cutImg
.
replace
(
/
(\d){3}
.png">/g
,
function
(
str
)
{
let
s
=
list
[
parseInt
(
str
.
split
(
'.'
)[
0
])
-
1
]
let
s
=
list
[
parseInt
(
str
.
split
(
'.'
)[
0
])
-
1
]
...
@@ -257,7 +301,10 @@ export default {
...
@@ -257,7 +301,10 @@ export default {
let
htm
=
target
.
innerHTML
let
htm
=
target
.
innerHTML
console
.
log
(
htm
)
console
.
log
(
htm
)
const
list
=
emoji
.
flat
(
Infinity
)
const
list
=
emoji
.
flat
(
Infinity
)
const
cutImg
=
htm
.
replaceAll
(
'<img src="https://img01.glsx.com.cn/weapp/resource/saas/scrm/emoji/'
,
''
)
const
cutImg
=
htm
.
replace
(
/<img src="https:
\/\/
img01.glsx.com.cn
\/
weapp
\/
resource
\/
saas
\/
scrm
\/
emoji
\/
/g
,
''
)
.
replace
(
/<wise.+
?(?:
<
\/
wise>
)
/g
,
'@昵称'
)
.
replace
(
/<br>/g
,
'\n'
)
const
replaceImg
=
cutImg
.
replace
(
/
(\d){3}
.png">/g
,
function
(
str
)
{
const
replaceImg
=
cutImg
.
replace
(
/
(\d){3}
.png">/g
,
function
(
str
)
{
let
s
=
list
[
parseInt
(
str
.
split
(
'.'
)[
0
])
-
1
]
let
s
=
list
[
parseInt
(
str
.
split
(
'.'
)[
0
])
-
1
]
return
`[
${
s
}
]`
return
`[
${
s
}
]`
...
@@ -329,8 +376,8 @@ export default {
...
@@ -329,8 +376,8 @@ export default {
font-size
:
14px
;
font-size
:
14px
;
color
:
#5850ff
;
color
:
#5850ff
;
line-height
:
20px
;
line-height
:
20px
;
padding
:
2
px
;
padding
:
0
px
;
margin
:
0
5
px
;
margin
:
0
2
px
;
color
:
#26a2ff
;
color
:
#26a2ff
;
//
padding
:
0
1px
;
//
padding
:
0
1px
;
white-space
:
nowrap
;
white-space
:
nowrap
;
...
...
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