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 f238fd7a
authored
Nov 15, 2022
by
前端
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'dev_v1.0.0' of
http://192.168.3.233:8090/npm/glsx-components
into dev_v1.0.0
2 parents
3793ae2f
9d7ff296
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
62 additions
and
51 deletions
package.json
src/packages/Editor/src/index.vue
src/packages/Editor/src/materialModel.vue
src/packages/Editor/src/messageModel.vue
package.json
View file @
f238fd7
{
"name"
:
"glsx-components"
,
"description"
:
"glsx vue components"
,
"version"
:
"1.
4.8
"
,
"version"
:
"1.
5.3
"
,
"author"
:
"limin <17653212@qq.com>"
,
"license"
:
"MIT"
,
"main"
:
"dist/glsx-components.common.js"
,
...
...
src/packages/Editor/src/index.vue
View file @
f238fd7
...
...
@@ -168,7 +168,7 @@
<span
class=
"emotion-item"
v-if=
"item.type == 'expression'"
@
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.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
upload-video
"
:accept=
"item.accept || 'video/*'"
@
change=
"e => handleVideoChange(e)"
/>
<el-link
v-else-if=
"item.type != 'video' && item.type != 'img' && item.type != 'expression'"
style=
"opacity: 0"
@
click=
"handleFun(item)"
>
{{ item.name }}
</el-link>
</div>
</div>
...
...
@@ -260,6 +260,7 @@ export default {
},
mounted
()
{
document
.
addEventListener
(
'click'
,
e
=>
{
console
.
log
(
e
.
target
.
className
)
if
(
e
.
target
.
className
!=
'emotion-item'
)
{
this
.
emotionStatus
=
false
}
...
...
@@ -390,12 +391,12 @@ export default {
if
(
res
)
{
let
len
=
this
.
previewList
.
length
-
1
this
.
previewList
[
len
].
attContent
=
res
document
.
querySelector
(
'.upload-img'
).
value
=
''
}
else
{
this
.
previewList
.
pop
()
}
this
.
loading
=
false
})
document
.
querySelector
(
'.upload-img'
).
value
=
''
}
}
},
...
...
@@ -423,6 +424,7 @@ export default {
})
}
})
document
.
querySelector
(
'.upload-video'
).
value
=
''
}
}
catch
(
err
)
{
console
.
log
(
err
)
...
...
@@ -484,28 +486,13 @@ export default {
close
(
index
)
{
this
.
previewList
.
splice
(
index
,
1
)
},
conversion
(
val
,
status
=
'emo'
)
{
let
retult
=
val
.
replace
(
/ /g
,
''
)
if
(
status
==
'emo'
||
status
==
'es'
)
{
retult
=
retult
.
replace
(
/
\[([\u
4E00-
\u
9FA5
]{1,4}
|OK|NO|666
)\]
/g
,
''
)
}
if
(
status
==
'special'
||
status
==
'es'
)
{
retult
=
retult
.
replace
(
/&/g
,
'&'
)
.
replace
(
/</g
,
'<'
)
.
replace
(
/>/g
,
'>'
)
}
return
retult
},
reduction
(
val
)
{
return
val
.
replace
(
/&/g
,
'&'
)
.
replace
(
/</g
,
'<'
)
.
replace
(
/>/g
,
'>'
)
},
textInput
(
val
)
{
val
=
val
.
replace
(
/ /g
,
''
)
this
.
textNum
=
this
.
conversion
(
val
,
'es'
).
replace
(
/
(\n
|
\s)
/g
,
''
).
length
val
=
val
.
replace
(
/ /g
,
''
)
.
replace
(
/&/g
,
'&'
)
.
replace
(
/</g
,
'<'
)
.
replace
(
/>/g
,
'>'
)
this
.
textNum
=
val
.
replace
(
/
(\n
|
\s)
/g
,
''
).
length
if
(
this
.
textNum
>
this
.
maxNum
)
{
this
.
textNum
=
this
.
maxNum
this
.
updateList
(
this
.
previewList
,
1
)
...
...
@@ -514,12 +501,12 @@ export default {
const
hasText
=
this
.
previewList
.
some
(
item
=>
item
.
attType
==
this
.
ATT_TYPE
.
TEXT
)
if
(
hasText
)
{
this
.
$set
(
this
.
previewList
,
0
,
{
attContent
:
this
.
conversion
(
val
,
'special'
)
,
attContent
:
val
,
attType
:
this
.
ATT_TYPE
.
TEXT
})
}
else
{
this
.
previewList
.
unshift
({
attContent
:
this
.
conversion
(
val
,
'special'
)
,
attContent
:
val
,
attType
:
this
.
ATT_TYPE
.
TEXT
})
}
...
...
@@ -541,8 +528,22 @@ export default {
})
}
},
//图片验证
imageCheck
(
src
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
var
img
=
new
Image
()
img
.
src
=
src
img
.
onerror
=
function
()
{
resolve
()
}
img
.
onload
=
function
()
{
resolve
(
1
)
}
})
},
// 素材
handleMaterialConfirm
(
val
)
{
async
handleMaterialConfirm
(
val
)
{
console
.
log
(
val
)
const
{
materialContent
,
objectName
}
=
val
const
imgSrc
=
materialContent
.
imgSrc
const
videoSrc
=
materialContent
.
videoSrc
...
...
@@ -560,6 +561,13 @@ export default {
return
}
if
(
imgSrc
&&
imgSrc
.
length
)
{
for
(
let
i
=
0
;
i
<
imgSrc
.
length
;
i
++
)
{
const
checkStatus
=
await
this
.
imageCheck
(
imgSrc
[
i
])
if
(
!
checkStatus
)
{
this
.
$message
.
error
(
'图片访问失败'
)
return
}
}
imgSrc
.
forEach
(
item
=>
{
this
.
previewList
.
push
({
attContent
:
item
,
...
...
@@ -581,26 +589,31 @@ export default {
html
=
html
.
replace
(
'\n'
,
''
).
replace
(
/<br
\/
>/g
,
''
)
}
html
=
html
// .replace(/</g, '<
')
// .replace(/>/g, '>
')
// .replace(/&/g, '&
')
let
textLen
=
this
.
reduction
(
this
.
previewList
[
idx
].
attContent
)
+
html
if
(
t
his
.
conversion
(
textLen
,
'es'
).
replace
(
/
(\n
|
\s
|
)
/g
,
''
).
length
>
this
.
maxNum
)
{
.
replace
(
/&/g
,
'&
'
)
.
replace
(
/</g
,
'<
'
)
.
replace
(
/>/g
,
'>
'
)
let
textLen
=
this
.
previewList
[
idx
].
attContent
+
html
if
(
t
extLen
.
replace
(
/
(\n
|
\s
)
/g
,
''
).
length
>
this
.
maxNum
)
{
textLen
=
this
.
previewList
[
idx
].
attContent
}
else
{
this
.
textNum
=
t
his
.
conversion
(
textLen
,
'es'
).
replace
(
/
(\n
|
\s
|
)
/g
,
''
).
length
this
.
textNum
=
t
extLen
.
replace
(
/
(\n
|
\s
)
/g
,
''
).
length
}
this
.
$set
(
this
.
previewList
,
0
,
{
attContent
:
textLen
,
attType
:
this
.
ATT_TYPE
.
TEXT
})
}
else
{
html
=
html
.
replace
(
'\n'
,
''
).
replace
(
/<br
\/
>/g
,
''
)
html
=
html
.
replace
(
'\n'
,
''
)
.
replace
(
/<br
\/
>/g
,
''
)
.
replace
(
/&/g
,
'&'
)
.
replace
(
/</g
,
'<'
)
.
replace
(
/>/g
,
'>'
)
let
textLen
=
html
if
(
t
his
.
conversion
(
textLen
,
'es'
).
replace
(
/
(\n
|
\s
|
)
/g
,
''
).
length
>
this
.
maxNum
)
{
if
(
t
extLen
.
replace
(
/
(\n
|
\s
)
/g
,
''
).
length
>
this
.
maxNum
)
{
textLen
=
''
}
else
{
this
.
textNum
=
t
his
.
conversion
(
textLen
,
'es'
).
replace
(
/
(\n
|
\s
|
)
/g
,
''
).
length
this
.
textNum
=
t
extLen
.
replace
(
/
(\n
|
\s
)
/g
,
''
).
length
}
this
.
previewList
.
unshift
({
attContent
:
textLen
,
...
...
@@ -635,15 +648,15 @@ export default {
if
(
obj
)
{
let
attContent
if
(
status
)
{
attContent
=
obj
.
attContent
.
replace
(
/
\[(
@昵称|#兑换码
)\]
/g
,
'<wise id="1" contenteditable="false">$1</wise>'
)
attContent
=
obj
.
attContent
.
replace
(
/
(
@昵称|#兑换码
)
/g
,
'<wise id="1" contenteditable="false">$1</wise>'
)
}
else
{
this
.
textNum
=
obj
.
attContent
.
replace
(
/
(\n
|
\s)
/g
,
''
)
.
replace
(
/
\[(
@昵称|#兑换码
)\]
/g
,
'$1'
)
.
replace
(
/
\[
([\u
4E00-
\u
9FA5
]{1,4}
|OK|NO|666
)\
]
/g
,
''
).
length
attContent
=
this
.
reduction
(
obj
.
attContent
)
.
replace
(
/
\[(
@昵称|#兑换码
)\]
/g
,
'<wise id="1" contenteditable="false">$1</wise>'
)
.
replace
(
/
\[
[\u
4E00-
\u
9FA56
]{1,4}
]/g
,
''
).
length
attContent
=
obj
.
attContent
.
replace
(
/
\[(
@昵称|#兑换码
)\]
/g
,
'<wise id="1" contenteditable="false">$1</wise>'
)
}
let
htm
=
attContent
.
replace
(
/
\[
([\u
4E00-
\u
9FA5
]{1,4}
|OK|NO|666
)
]/gi
,
function
(
res
)
{
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
...
...
@@ -660,11 +673,6 @@ export default {
setTimeout
(()
=>
{
document
.
querySelector
(
'.w-textarea_input'
).
innerHTML
=
htm
},
100
)
this
.
previewList
.
forEach
(
item
=>
{
if
(
item
.
attType
==
this
.
ATT_TYPE
.
TEXT
)
{
item
.
attContent
=
this
.
conversion
(
item
.
attContent
,
'special'
)
}
})
}
else
{
this
.
textValue
=
''
}
...
...
@@ -693,8 +701,8 @@ export default {
position
:
relative
;
.video-pane-close
{
position
:
absolute
;
right
:
0
px
;
top
:
0
px
;
right
:
-2
px
;
top
:
-3
px
;
width
:
14px
;
height
:
14px
;
cursor
:
pointer
;
...
...
src/packages/Editor/src/materialModel.vue
View file @
f238fd7
...
...
@@ -118,7 +118,8 @@ export default {
this
.
isMaterialVisible
=
true
},
getBaseData
()
{
this
.
materialList
.
groupListApi
({}).
then
(
res
=>
{
const
params
=
this
.
materialList
.
params
||
{}
this
.
materialList
.
groupListApi
(
params
).
then
(
res
=>
{
this
.
baseData
.
groupList
=
res
this
.
getOptionsList
(
'searchFormData'
)
})
...
...
@@ -136,7 +137,7 @@ export default {
return
arr
},
getvideosrc
(
htmlstr
)
{
var
reg
=
/<video.+
?
src=
(
'|"
)?([^
'"
]
+
)(
'|"
)?(?:\s
+|>
)
/gim
var
reg
=
/<video.+
?
src=
(
'|"
)?([^
'"
]
+
)(
'|"
)?(?:\s
+|
\/?
>
)
/gim
var
arr
=
[]
var
tem
while
((
tem
=
reg
.
exec
(
htmlstr
)))
{
...
...
@@ -149,7 +150,8 @@ export default {
...
this
.
searchForm
,
status
:
0
,
pageNum
:
this
.
pageNum
,
pageSize
:
this
.
pageSize
pageSize
:
this
.
pageSize
,
...
this
.
materialList
.
params
}
this
.
materialList
.
materialListApi
(
params
).
then
(
res
=>
{
this
.
modelList
=
res
.
data
...
...
src/packages/Editor/src/messageModel.vue
View file @
f238fd7
...
...
@@ -214,7 +214,8 @@ export default {
},
getCreatedList
()
{
const
{
getSearchApi
}
=
this
.
messageList
getSearchApi
({}).
then
(
res
=>
{
const
{
params
=
{}
}
=
this
.
messageList
||
{}
getSearchApi
(
params
).
then
(
res
=>
{
this
.
createdList
=
res
this
.
$nextTick
(()
=>
{
this
.
messageLoading
=
false
...
...
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