Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
tea_resources_pc
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张伯涛
tea_resources_pc
Commits
fa9d0865
Commit
fa9d0865
authored
Apr 24, 2024
by
mengzixuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
意见反馈(优化富文本框校验问题)
parent
4cb9b50b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
7 deletions
+43
-7
index.vue
src/components/Tinymce/index.vue
+30
-6
index.vue
src/views/Feedback/index.vue
+13
-1
No files found.
src/components/Tinymce/index.vue
View file @
fa9d0865
<
template
>
<div
class=
"quill-edit
or"
>
<div
:class=
"col
or"
>
<!-- 图片上传组件辅助-->
<el-upload
class=
"avatar-uploader"
...
...
@@ -13,7 +13,7 @@
>
</el-upload>
<!--富文本编辑器组件-->
<quill-editor
ref=
"QuillEditor"
v-model=
"content"
:content=
"content"
:options=
"editorOption"
@
change=
"contentChange"
/>
<quill-editor
ref=
"QuillEditor"
v-model=
"content"
:content=
"content"
:options=
"editorOption"
@
blur=
"contentBlur"
@
change=
"contentChange"
/>
<!--
<div
v-html=
"content"
/>
-->
</div>
</
template
>
...
...
@@ -57,6 +57,7 @@ export default {
},
data
()
{
return
{
color
:
'quill-editor'
,
accept
:
'.jpg, .png, .jpeg, .JPEG.JPG, .PNG,.bmp,.DMP'
,
form
:
{
img
:
''
...
...
@@ -109,12 +110,20 @@ export default {
}
},
methods
:
{
/** 获取边框颜色*/
getClass
(
color
)
{
this
.
color
=
color
},
/** change事件*/
contentChange
()
{
if
(
this
.
content
===
''
)
{
this
.
content
=
'<p></p>'
}
},
/** 失焦时调用父组件校验方法父组件 */
contentBlur
()
{
this
.
$emit
(
'checkForm'
)
},
/** 上传接口*/
uploadStart
(
file
)
{
const
formData
=
new
FormData
()
...
...
@@ -150,12 +159,27 @@ export default {
/*.quill-editor {*/
/* width: 880px;*/
/*}*/
.ql-toolbar.ql-snow
{
.quill-editor
{
.ql-toolbar.ql-snow
{
border-radius
:
8px
8px
0
0
;
border
:
1px
solid
#E0E0E0
;
}
.ql-toolbar.ql-snow
+
.ql-container.ql-snow
{
border-radius
:
0
0
8px
8px
;
border
:
1px
solid
#E0E0E0
;
}
}
.quill-editor-red
{
.ql-toolbar.ql-snow
{
border-radius
:
8px
8px
0
0
;
border
:
1px
solid
#F57b7b
;
}
.ql-toolbar.ql-snow
+
.ql-container.ql-snow
{
.ql-toolbar.ql-snow
+
.ql-container.ql-snow
{
border-radius
:
0
0
8px
8px
;
border
:
1px
solid
#F57b7b
;
}
}
</
style
>
src/views/Feedback/index.vue
View file @
fa9d0865
...
...
@@ -34,7 +34,7 @@
<el-input
placeholder=
"请输入建议标题,50个字以内"
maxlength=
"50"
v-model=
"form.title"
/>
</el-form-item>
<el-form-item
label=
"详情描述:"
prop=
"detail"
>
<tinymce
ref=
"richEditor"
v-model=
"form.detail"
@
input=
"setContent"
/>
<tinymce
ref=
"richEditor"
v-model=
"form.detail"
@
checkForm=
"checkForm"
@
input=
"setContent"
/>
</el-form-item>
<el-form-item
label=
"上传附件:"
>
<el-upload
...
...
@@ -183,6 +183,16 @@ export default {
}
this
.
getFeedBackType
()
},
// 失焦时校验富文本框
checkForm
()
{
this
.
$refs
[
'form'
].
validateField
(
'detail'
,
(
vaild
)
=>
{
if
(
!
vaild
)
{
this
.
$refs
.
richEditor
.
getClass
(
'quill-editor'
)
}
else
if
(
vaild
)
{
this
.
$refs
.
richEditor
.
getClass
(
'quill-editor-red'
)
}
})
},
/** 提交建议*/
onSubmit
()
{
this
.
$refs
[
'form'
].
validate
(
valid
=>
{
...
...
@@ -202,6 +212,8 @@ export default {
this
.
$message
.
error
(
res
.
message
)
}
})
}
else
{
this
.
checkForm
()
}
})
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment