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
Hide 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
>
<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-tab"
>
<label>
活动类型:
</label>
...
...
@@ -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 == 'activity' && activityMenu"
>
立即添加
</el-button>
</span>
</
el-d
ialog>
</
GLD
ialog>
</div>
</template>
...
...
@@ -93,8 +93,12 @@ const openUrl = function (url) {
link
.
rel
=
'opener'
link
.
click
()
}
import
GLDialog
from
'../../GLDialog/src/index'
export
default
{
name
:
'ActivityModel'
,
components
:
{
GLDialog
},
data
()
{
return
{
dialogVisible
:
false
,
...
...
@@ -116,7 +120,7 @@ export default {
},
computed
:
{
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
:
{
...
...
src/packages/Editor/src/index.vue
View file @
8e40071
...
...
@@ -3,7 +3,7 @@
<div
class=
"content"
>
<div
class=
"content-bg"
>
<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"
>
<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">
...
...
@@ -13,7 +13,7 @@
,
</div>
</div>
<template
v-if=
"itm.attType == ATT_TYPE.VEDIO"
>
<
!--
<
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"
/>
...
...
@@ -21,10 +21,23 @@
<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
>
-->
</template>
</transition-group>
</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"
>
<
template
v-for=
"(itm, index) in previewList"
>
<div
v-if=
"itm.attType != ATT_TYPE.TEXT"
:key=
"index"
>
...
...
@@ -115,6 +128,9 @@
<div
class=
"welcome-activity-icon"
>
<img
src=
"../../../assets/welcomeWord/pdf_r.png"
v-if=
"itm.attContent"
/>
</div>
<div
class=
"welcome-activity-desc"
>
<div
class=
"model-item-title"
>
{{
JSON
.
parse
(
itm
.
attContent
).
fileName
}}
</div>
</div>
<div
class=
"delete-solid"
>
<i
class=
"el-icon-delete-solid"
@
click=
"close(index)"
></i>
</div>
...
...
@@ -134,7 +150,7 @@
<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-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>
...
...
@@ -163,7 +179,7 @@ const ATT_TYPE = {
ACTIVITY
:
7
,
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
ActivityModel
from
'./activityModel'
import
MessageModel
from
'./messageModel'
...
...
@@ -217,7 +233,7 @@ export default {
},
computed
:
{
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
()
{
return
this
.
btnList
.
find
(
item
=>
item
.
type
==
'message'
)
||
{}
...
...
@@ -234,6 +250,9 @@ export default {
materialList
()
{
return
this
.
btnList
.
find
(
item
=>
item
.
type
==
'material'
)
||
{}
},
linkList
()
{
return
this
.
btnList
.
find
(
item
=>
item
.
type
==
'link'
)
||
{}
},
materialItem
()
{
let
attContent
this
.
previewList
.
forEach
(
item
=>
{
...
...
@@ -252,8 +271,8 @@ export default {
}
},
methods
:
{
isPreview
(
preview
)
{
return
preview
.
filter
(
item
=>
item
.
attType
!=
ATT_TYPE
.
TEXT
).
length
isPreview
(
preview
,
type
)
{
return
preview
.
filter
(
item
=>
item
.
attType
==
type
).
length
},
handleEnlarge
(
src
,
type
)
{
this
.
dialogVisibleImg
=
true
...
...
@@ -261,7 +280,7 @@ export default {
this
.
dialogType
=
type
?
type
:
'img'
},
marketingContent
(
val
)
{
return
JSON
.
parse
(
val
.
attContent
)
.
marketingContent
return
val
.
attContent
.
marketingContent
},
checkedType
(
type
)
{
return
wordType
.
indexOf
(
type
)
!==
-
1
?
type
:
'img'
...
...
@@ -410,12 +429,15 @@ export default {
this
.
$refs
.
message
.
init
()
}
else
if
(
name
==
'material'
)
{
this
.
$refs
.
material
.
init
()
}
else
if
(
name
==
'link'
)
{
this
.
$refs
.
textContent
.
addCardLink
(
this
.
linkList
)
}
},
close
(
index
)
{
this
.
previewList
.
splice
(
index
,
1
)
},
textInput
(
val
)
{
val
=
val
.
replace
(
/ /g
,
''
)
const
hasText
=
this
.
previewList
.
some
(
item
=>
item
.
attType
==
this
.
ATT_TYPE
.
TEXT
)
if
(
hasText
)
{
this
.
$set
(
this
.
previewList
,
0
,
{
...
...
@@ -441,14 +463,13 @@ export default {
})
}
else
{
this
.
previewList
.
push
({
attContent
:
JSON
.
stringify
(
val
)
,
attContent
:
val
,
attType
:
this
.
ATT_TYPE
[
type
]
})
}
},
// 素材
handleMaterialConfirm
(
val
)
{
console
.
log
(
val
)
const
{
materialContent
,
objectName
}
=
val
const
imgSrc
=
materialContent
.
imgSrc
const
videoSrc
=
materialContent
.
videoSrc
...
...
@@ -456,11 +477,15 @@ export default {
let
html
=
materialContent
.
html
?
materialContent
.
html
:
''
if
(
pdfSrc
&&
!
this
.
materialList
.
pdfNo
)
{
this
.
previewList
.
push
({
attContent
:
pdfSrc
,
attContent
:
JSON
.
stringify
({
fileName
:
objectName
,
url
:
pdfSrc
})
,
attType
:
this
.
ATT_TYPE
.
FILE
})
return
}
if
((
pdfSrc
&&
this
.
materialList
.
pdfNo
)
||
(
videoSrc
&&
videoSrc
.
length
&&
this
.
materialList
.
videoNo
))
{
this
.
$message
.
error
(
pdfSrc
?
'不支持此类型'
:
'不支持视频'
)
return
}
if
(
imgSrc
&&
imgSrc
.
length
)
{
imgSrc
.
forEach
(
item
=>
{
this
.
previewList
.
push
({
...
...
@@ -479,19 +504,21 @@ export default {
}
const
idx
=
this
.
previewList
.
findIndex
(
item
=>
item
.
attType
==
this
.
ATT_TYPE
.
TEXT
)
if
(
idx
!==
-
1
)
{
this
.
textValue
=
this
.
previewList
[
idx
].
attContent
+
html
if
(
!
this
.
previewList
[
idx
].
attContent
)
{
html
=
html
.
replace
(
'\n'
,
''
)
}
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
})
}
else
{
html
=
html
.
replace
(
'\n'
,
''
)
this
.
previewList
.
unshift
({
attContent
:
html
,
attContent
:
html
.
substring
(
0
,
600
)
,
attType
:
this
.
ATT_TYPE
.
TEXT
})
this
.
textValue
=
html
}
this
.
updateList
(
this
.
previewList
,
1
)
},
selectMessage
(
val
)
{
const
content
=
val
.
content
...
...
@@ -538,13 +565,18 @@ export default {
})
this
.
textInput
(
str
)
},
300
),
updateList
(
val
)
{
this
.
previewList
=
this
.
$common
.
utils
.
deepClone
(
val
)
updateList
(
val
,
status
)
{
this
.
previewList
=
utils
.
deepClone
(
val
)
// this.eventBus.$emit('update', this.previewList)
const
obj
=
val
.
find
(
item
=>
item
.
attType
==
this
.
ATT_TYPE
.
TEXT
)
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
attContent
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
,
''
)
const
list
=
emoji
.
flat
(
Infinity
)
let
index
=
parseInt
(
list
.
indexOf
(
word
))
+
1
...
...
@@ -555,6 +587,9 @@ export default {
}
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
(()
=>
{
document
.
querySelector
(
'.w-textarea_input'
).
innerHTML
=
htm
},
100
)
...
...
src/packages/Editor/src/materialModel.vue
View file @
8e40071
<!-- 素材弹窗 -->
<
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>
<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"
>
<div
class=
"model-image"
>
<img
src=
"../../../assets/welcomeWord/pdf_r.png"
v-if=
"item.materialType == 1"
/>
<template
v-if=
"item.materialType != 1"
>
<img
v-if=
"item.materialContent && item.materialContent.urlType == 'img' && item.materialContent.imgSrc.length == 1"
class=
"img-material"
:src=
"item.materialContent.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
class=
"image-panel-num"
>
{{
item
.
materialContent
.
imgSrc
.
length
}}
</div>
</div>
<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">
<span class="hide-content">{{ item.materialContentRpcResponse.materialName }}</span>
</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>
</span>
</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>
-->
<!-- <span v-if="item.materialType == 3" class="material-content">
<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>
<source :src="item.materialContent.materialUrl" type="video/mp4" />
</video>
</span>
</span>
-->
</div>
<!-- </div> -->
</div>
...
...
@@ -55,15 +55,17 @@
<el-button
size=
"small"
@
click=
"isMaterialVisible = false"
>
取 消
</el-button>
<el-button
size=
"small"
type=
"primary"
@
click=
"handleMaterialConfirm"
>
确 定
</el-button>
</span>
</
el-d
ialog>
</
GLD
ialog>
</template>
<
script
>
import
GLCombiForm
from
'../../GlCombiForm/src/index'
import
GLDialog
from
'../../GLDialog/src/index'
export
default
{
name
:
'materialModel'
,
components
:
{
GLCombiForm
GLCombiForm
,
GLDialog
},
data
()
{
return
{
...
...
@@ -178,7 +180,7 @@ export default {
let
imgSrc
=
this
.
getimgsrc
(
html
)
let
videoSrc
=
this
.
getvideosrc
(
html
)
let
imgHtml
=
html
.
match
(
/<img.*
?(?:
>|
\/
>
)
/g
)
let
videoHtml
=
html
.
match
(
/<video.*<
\/
video>/g
)
let
videoHtml
=
html
.
match
(
/<video.*
?
<
\/
video>/g
)
let
materialUrl
,
urlType
,
imgCount
if
(
imgSrc
.
length
)
{
materialUrl
=
imgSrc
[
0
]
...
...
@@ -195,7 +197,8 @@ export default {
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
)
{
this
.
$set
(
item
,
'materialContent'
,
{
materialUrl
,
imgCount
,
urlType
,
imgSrc
,
videoSrc
,
html
})
}
else
{
...
...
@@ -336,8 +339,8 @@ export default {
align-items
:
stretch
;
flex-direction
:
row
;
.model-item
{
width
:
2
40px
;
margin-right
:
2
4px
;
width
:
2
3%
;
margin-right
:
2
%
;
margin-bottom
:
24px
;
padding
:
12px
16px
;
position
:
relative
;
...
...
@@ -348,6 +351,113 @@ export default {
border
:
1px
solid
#e6e6e6
;
padding
:
14px
24px
;
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
)
{
margin-right
:
0px
;
}
...
...
src/packages/Editor/src/tag-textarea.vue
View file @
8e40071
<
template
>
<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"
>
<button
class=
"w-textarea_tools__item"
...
...
@@ -110,6 +110,50 @@ export default {
// 处理后需要调用 addTag() 或者 addLink() 将内容传回来
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
)
{
// 创建模版标签
let
node
=
document
.
createElement
(
this
.
tag
)
...
...
@@ -221,8 +265,8 @@ export default {
let
htm
=
target
.
innerHTML
const
list
=
emoji
.
flat
(
Infinity
)
const
cutImg
=
htm
.
replace
(
/<img src="https:
\/\/
img01.glsx.com.cn
\/
weapp
\/
resource
\/
saas
\/
scrm
\/
emoji/g
,
''
)
.
replace
All
(
'<wise id="1">@昵称</wise>'
,
'@昵称'
)
.
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
)
{
let
s
=
list
[
parseInt
(
str
.
split
(
'.'
)[
0
])
-
1
]
...
...
@@ -257,7 +301,10 @@ export default {
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
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
)
{
let
s
=
list
[
parseInt
(
str
.
split
(
'.'
)[
0
])
-
1
]
return
`[
${
s
}
]`
...
...
@@ -329,8 +376,8 @@ export default {
font-size
:
14px
;
color
:
#5850ff
;
line-height
:
20px
;
padding
:
2
px
;
margin
:
0
5
px
;
padding
:
0
px
;
margin
:
0
2
px
;
color
:
#26a2ff
;
//
padding
:
0
1px
;
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