Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas
/
scrm-micro-marketing
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 dff493f7
authored
Mar 18, 2022
by
匡雅琴
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
富文本框图片
1 parent
0b5eb58e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
1 deletions
src/views/material/addMaterial.vue
src/views/material/components/textBox.vue
src/views/material/index.vue
src/views/material/addMaterial.vue
View file @
dff493f
...
...
@@ -426,6 +426,7 @@ export default {
// 提交
handleSubmit
()
{
this
.
$refs
.
materialAddForm
.
validate
(
valid
=>
{
console
.
log
(
this
.
textBoxContent
,
'text'
);
if
(
valid
)
{
var
params
=
this
.
getParams
()
params
.
status
=
0
...
...
src/views/material/components/textBox.vue
View file @
dff493f
...
...
@@ -20,6 +20,7 @@ export default {
},
methods
:
{
getEdit
()
{
const
_this
=
this
;
this
.
editor
=
new
E
(
'#div-demo'
)
this
.
editor
.
config
.
uploadImgShowBase64
=
true
this
.
editor
.
config
.
showMenuTooltips
=
true
...
...
@@ -33,6 +34,34 @@ export default {
this
.
content
=
html
// 绑定当前逐渐地值
this
.
$emit
(
'change'
,
this
.
content
)
// 将内容同步到父组件中
}
this
.
editor
.
config
.
customUploadImg
=
function
(
resultFiles
,
insertImgFn
)
{
console
.
log
(
resultFiles
)
var
file
=
resultFiles
[
0
]
var
reader
=
new
FileReader
()
// 默认1MB
const
limitSize
=
10
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
)
{
// console.log(res)
insertImgFn
(
res
)
}
})
// resultFiles 是 input 中选中的文件列表
// insertImgFn 是获取图片 url 后,插入到编辑器的方法
// 上传图片,返回结果,将图片插入到编辑器中
}
}
this
.
editor
.
config
.
onchangeTimeout
=
5000
this
.
editor
.
create
()
},
...
...
@@ -59,6 +88,6 @@ export default {
</
style
>
<
style
>
.w-e-text-container
{
z-index
:
1
!important
;
z-index
:
1
!important
;
}
</
style
>
\ No newline at end of file
src/views/material/index.vue
View file @
dff493f
...
...
@@ -525,6 +525,7 @@ export default {
}
.material-content
{
display
:
flex
;
align-items
:
center
;
justify-content
:
space-between
;
.hide-content
{
display
:
inline-block
;
...
...
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