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"
,
"name"
:
"glsx-components"
,
"description"
:
"glsx vue components"
,
"description"
:
"glsx vue components"
,
"version"
:
"1.
4.8
"
,
"version"
:
"1.
5.3
"
,
"author"
:
"limin <17653212@qq.com>"
,
"author"
:
"limin <17653212@qq.com>"
,
"license"
:
"MIT"
,
"license"
:
"MIT"
,
"main"
:
"dist/glsx-components.common.js"
,
"main"
:
"dist/glsx-components.common.js"
,
...
...
src/packages/Editor/src/index.vue
View file @
f238fd7
...
@@ -168,7 +168,7 @@
...
@@ -168,7 +168,7 @@
<span
class=
"emotion-item"
v-if=
"item.type == 'expression'"
@
click
.
stop=
"selectEmotion"
>
{{ item.name }}
</span>
<span
class=
"emotion-item"
v-if=
"item.type == 'expression'"
@
click
.
stop=
"selectEmotion"
>
{{ item.name }}
</span>
<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
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>
<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>
</div>
</div>
...
@@ -260,6 +260,7 @@ export default {
...
@@ -260,6 +260,7 @@ export default {
},
},
mounted
()
{
mounted
()
{
document
.
addEventListener
(
'click'
,
e
=>
{
document
.
addEventListener
(
'click'
,
e
=>
{
console
.
log
(
e
.
target
.
className
)
if
(
e
.
target
.
className
!=
'emotion-item'
)
{
if
(
e
.
target
.
className
!=
'emotion-item'
)
{
this
.
emotionStatus
=
false
this
.
emotionStatus
=
false
}
}
...
@@ -390,12 +391,12 @@ export default {
...
@@ -390,12 +391,12 @@ export default {
if
(
res
)
{
if
(
res
)
{
let
len
=
this
.
previewList
.
length
-
1
let
len
=
this
.
previewList
.
length
-
1
this
.
previewList
[
len
].
attContent
=
res
this
.
previewList
[
len
].
attContent
=
res
document
.
querySelector
(
'.upload-img'
).
value
=
''
}
else
{
}
else
{
this
.
previewList
.
pop
()
this
.
previewList
.
pop
()
}
}
this
.
loading
=
false
this
.
loading
=
false
})
})
document
.
querySelector
(
'.upload-img'
).
value
=
''
}
}
}
}
},
},
...
@@ -423,6 +424,7 @@ export default {
...
@@ -423,6 +424,7 @@ export default {
})
})
}
}
})
})
document
.
querySelector
(
'.upload-video'
).
value
=
''
}
}
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
log
(
err
)
console
.
log
(
err
)
...
@@ -484,28 +486,13 @@ export default {
...
@@ -484,28 +486,13 @@ export default {
close
(
index
)
{
close
(
index
)
{
this
.
previewList
.
splice
(
index
,
1
)
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
)
{
textInput
(
val
)
{
val
=
val
.
replace
(
/ /g
,
''
)
val
=
val
this
.
textNum
=
this
.
conversion
(
val
,
'es'
).
replace
(
/
(\n
|
\s)
/g
,
''
).
length
.
replace
(
/ /g
,
''
)
.
replace
(
/&/g
,
'&'
)
.
replace
(
/</g
,
'<'
)
.
replace
(
/>/g
,
'>'
)
this
.
textNum
=
val
.
replace
(
/
(\n
|
\s)
/g
,
''
).
length
if
(
this
.
textNum
>
this
.
maxNum
)
{
if
(
this
.
textNum
>
this
.
maxNum
)
{
this
.
textNum
=
this
.
maxNum
this
.
textNum
=
this
.
maxNum
this
.
updateList
(
this
.
previewList
,
1
)
this
.
updateList
(
this
.
previewList
,
1
)
...
@@ -514,12 +501,12 @@ export default {
...
@@ -514,12 +501,12 @@ export default {
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
,
{
attContent
:
this
.
conversion
(
val
,
'special'
)
,
attContent
:
val
,
attType
:
this
.
ATT_TYPE
.
TEXT
attType
:
this
.
ATT_TYPE
.
TEXT
})
})
}
else
{
}
else
{
this
.
previewList
.
unshift
({
this
.
previewList
.
unshift
({
attContent
:
this
.
conversion
(
val
,
'special'
)
,
attContent
:
val
,
attType
:
this
.
ATT_TYPE
.
TEXT
attType
:
this
.
ATT_TYPE
.
TEXT
})
})
}
}
...
@@ -541,8 +528,22 @@ export default {
...
@@ -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
{
materialContent
,
objectName
}
=
val
const
imgSrc
=
materialContent
.
imgSrc
const
imgSrc
=
materialContent
.
imgSrc
const
videoSrc
=
materialContent
.
videoSrc
const
videoSrc
=
materialContent
.
videoSrc
...
@@ -560,6 +561,13 @@ export default {
...
@@ -560,6 +561,13 @@ export default {
return
return
}
}
if
(
imgSrc
&&
imgSrc
.
length
)
{
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
=>
{
imgSrc
.
forEach
(
item
=>
{
this
.
previewList
.
push
({
this
.
previewList
.
push
({
attContent
:
item
,
attContent
:
item
,
...
@@ -581,26 +589,31 @@ export default {
...
@@ -581,26 +589,31 @@ export default {
html
=
html
.
replace
(
'\n'
,
''
).
replace
(
/<br
\/
>/g
,
''
)
html
=
html
.
replace
(
'\n'
,
''
).
replace
(
/<br
\/
>/g
,
''
)
}
}
html
=
html
html
=
html
// .replace(/</g, '<
')
.
replace
(
/&/g
,
'&
'
)
// .replace(/>/g, '>
')
.
replace
(
/</g
,
'<
'
)
// .replace(/&/g, '&
')
.
replace
(
/>/g
,
'>
'
)
let
textLen
=
this
.
reduction
(
this
.
previewList
[
idx
].
attContent
)
+
html
let
textLen
=
this
.
previewList
[
idx
].
attContent
+
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
=
this
.
previewList
[
idx
].
attContent
textLen
=
this
.
previewList
[
idx
].
attContent
}
else
{
}
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
,
{
this
.
$set
(
this
.
previewList
,
0
,
{
attContent
:
textLen
,
attContent
:
textLen
,
attType
:
this
.
ATT_TYPE
.
TEXT
attType
:
this
.
ATT_TYPE
.
TEXT
})
})
}
else
{
}
else
{
html
=
html
.
replace
(
'\n'
,
''
).
replace
(
/<br
\/
>/g
,
''
)
html
=
html
.
replace
(
'\n'
,
''
)
.
replace
(
/<br
\/
>/g
,
''
)
.
replace
(
/&/g
,
'&'
)
.
replace
(
/</g
,
'<'
)
.
replace
(
/>/g
,
'>'
)
let
textLen
=
html
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
=
''
textLen
=
''
}
else
{
}
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
({
this
.
previewList
.
unshift
({
attContent
:
textLen
,
attContent
:
textLen
,
...
@@ -635,15 +648,15 @@ export default {
...
@@ -635,15 +648,15 @@ export default {
if
(
obj
)
{
if
(
obj
)
{
let
attContent
let
attContent
if
(
status
)
{
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
{
}
else
{
this
.
textNum
=
obj
.
attContent
this
.
textNum
=
obj
.
attContent
.
replace
(
/
(\n
|
\s)
/g
,
''
)
.
replace
(
/
(\n
|
\s)
/g
,
''
)
.
replace
(
/
\[(
@昵称|#兑换码
)\]
/g
,
'$1'
)
.
replace
(
/
\[(
@昵称|#兑换码
)\]
/g
,
'$1'
)
.
replace
(
/
\[
([\u
4E00-
\u
9FA5
]{1,4}
|OK|NO|666
)\
]
/g
,
''
).
length
.
replace
(
/
\[
[\u
4E00-
\u
9FA56
]{1,4}
]/g
,
''
).
length
attContent
=
this
.
reduction
(
obj
.
attContent
)
.
replace
(
/
\[(
@昵称|#兑换码
)\]
/g
,
'<wise id="1" contenteditable="false">$1</wise>'
)
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
,
''
)
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
...
@@ -660,11 +673,6 @@ export default {
...
@@ -660,11 +673,6 @@ export default {
setTimeout
(()
=>
{
setTimeout
(()
=>
{
document
.
querySelector
(
'.w-textarea_input'
).
innerHTML
=
htm
document
.
querySelector
(
'.w-textarea_input'
).
innerHTML
=
htm
},
100
)
},
100
)
this
.
previewList
.
forEach
(
item
=>
{
if
(
item
.
attType
==
this
.
ATT_TYPE
.
TEXT
)
{
item
.
attContent
=
this
.
conversion
(
item
.
attContent
,
'special'
)
}
})
}
else
{
}
else
{
this
.
textValue
=
''
this
.
textValue
=
''
}
}
...
@@ -693,8 +701,8 @@ export default {
...
@@ -693,8 +701,8 @@ export default {
position
:
relative
;
position
:
relative
;
.video-pane-close
{
.video-pane-close
{
position
:
absolute
;
position
:
absolute
;
right
:
0
px
;
right
:
-2
px
;
top
:
0
px
;
top
:
-3
px
;
width
:
14px
;
width
:
14px
;
height
:
14px
;
height
:
14px
;
cursor
:
pointer
;
cursor
:
pointer
;
...
...
src/packages/Editor/src/materialModel.vue
View file @
f238fd7
...
@@ -118,7 +118,8 @@ export default {
...
@@ -118,7 +118,8 @@ export default {
this
.
isMaterialVisible
=
true
this
.
isMaterialVisible
=
true
},
},
getBaseData
()
{
getBaseData
()
{
this
.
materialList
.
groupListApi
({}).
then
(
res
=>
{
const
params
=
this
.
materialList
.
params
||
{}
this
.
materialList
.
groupListApi
(
params
).
then
(
res
=>
{
this
.
baseData
.
groupList
=
res
this
.
baseData
.
groupList
=
res
this
.
getOptionsList
(
'searchFormData'
)
this
.
getOptionsList
(
'searchFormData'
)
})
})
...
@@ -136,7 +137,7 @@ export default {
...
@@ -136,7 +137,7 @@ export default {
return
arr
return
arr
},
},
getvideosrc
(
htmlstr
)
{
getvideosrc
(
htmlstr
)
{
var
reg
=
/<video.+
?
src=
(
'|"
)?([^
'"
]
+
)(
'|"
)?(?:\s
+|>
)
/gim
var
reg
=
/<video.+
?
src=
(
'|"
)?([^
'"
]
+
)(
'|"
)?(?:\s
+|
\/?
>
)
/gim
var
arr
=
[]
var
arr
=
[]
var
tem
var
tem
while
((
tem
=
reg
.
exec
(
htmlstr
)))
{
while
((
tem
=
reg
.
exec
(
htmlstr
)))
{
...
@@ -149,7 +150,8 @@ export default {
...
@@ -149,7 +150,8 @@ export default {
...
this
.
searchForm
,
...
this
.
searchForm
,
status
:
0
,
status
:
0
,
pageNum
:
this
.
pageNum
,
pageNum
:
this
.
pageNum
,
pageSize
:
this
.
pageSize
pageSize
:
this
.
pageSize
,
...
this
.
materialList
.
params
}
}
this
.
materialList
.
materialListApi
(
params
).
then
(
res
=>
{
this
.
materialList
.
materialListApi
(
params
).
then
(
res
=>
{
this
.
modelList
=
res
.
data
this
.
modelList
=
res
.
data
...
...
src/packages/Editor/src/messageModel.vue
View file @
f238fd7
...
@@ -214,7 +214,8 @@ export default {
...
@@ -214,7 +214,8 @@ export default {
},
},
getCreatedList
()
{
getCreatedList
()
{
const
{
getSearchApi
}
=
this
.
messageList
const
{
getSearchApi
}
=
this
.
messageList
getSearchApi
({}).
then
(
res
=>
{
const
{
params
=
{}
}
=
this
.
messageList
||
{}
getSearchApi
(
params
).
then
(
res
=>
{
this
.
createdList
=
res
this
.
createdList
=
res
this
.
$nextTick
(()
=>
{
this
.
$nextTick
(()
=>
{
this
.
messageLoading
=
false
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