Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas
/
scrm-micro-presale
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 37465db3
authored
May 16, 2023
by
zhangquan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
保存封装前代码
1 parent
f3b24ee3
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
118 deletions
src/components/Editor/index.vue
src/util/quillTool.js
src/views/ContractManager/addTmpl.vue
src/views/ContractManager/components/FoldFrame/index.vue
src/components/Editor/index.vue
deleted
100644 → 0
View file @
f3b24ee
<
template
>
<div
class=
"upload-wrap"
>
<label
v-if=
"name"
class=
"label"
for=
""
>
{{
name
}}
</label>
<div
class=
"add-img"
:style=
"defaultStyle"
>
<i
class=
"el-icon-plus add"
></i>
<p>
上传照片
</p>
</div>
</div>
</
template
>
<
script
>
export
default
{
name
:
'Upload'
,
props
:
{
name
:
{
type
:
String
,
default
:
''
},
url
:
{
type
:
String
,
default
:
''
},
key
:
{
type
:
String
,
default
:
''
},
defaultStyle
:
{
type
:
Object
,
default
:
()
=>
{
return
{}
}
}
},
data
()
{
return
{
}
},
methods
:
{
}
}
</
script
>
<
style
lang=
"scss"
scoped
>
.upload-wrap
{
cursor
:
pointer
;
.label{
display
:
inline-block
;
vertical-align
:
top
;
width
:
154px
;
height
:
20px
;
font-size
:
14px
;
color
:
#333333
;
text-align
:
right
;
line-height
:
20px
;
box-sizing
:
border-box
;
}
.add-img
{
box-sizing
:
border-box
;
width
:
104px
;
height
:
104px
;
background
:
#0000000
a
;
border
:
1px
dashed
#00000026
;
border-radius
:
4px
;
display
:
inline-flex
;
flex-direction
:
column
;
justify-content
:
center
;
align-items
:
center
;
color
:
#666666
;
.add
{
font-size
:
18px
;
}
p
{
height
:
32px
;
line-height
:
32px
;
}
}
}
</
style
>
\ No newline at end of file
src/util/quillTool.js
View file @
37465db
...
...
@@ -7,7 +7,7 @@ class Label extends Parchment.Embed {
const
node
=
super
.
create
(
value
);
node
.
innerText
=
value
;
node
.
contentEditable
=
'false'
;
this
.
_addRemovalButton
(
node
);
//
this._addRemovalButton(node);
return
node
;
}
...
...
@@ -16,7 +16,6 @@ class Label extends Parchment.Embed {
}
static
_addRemovalButton
(
node
)
{
console
.
log
(
123
)
const
button
=
document
.
createElement
(
'button'
);
button
.
innerText
=
'x'
;
button
.
onclick
=
()
=>
node
.
remove
();
...
...
@@ -25,7 +24,7 @@ class Label extends Parchment.Embed {
// Extra span forces the cursor to the end of the label, otherwise it appears inside the removal button
const
span
=
document
.
createElement
(
'span'
);
span
.
innerText
=
'
'
;
span
.
innerText
=
''
;
node
.
appendChild
(
span
);
}
}
...
...
src/views/ContractManager/addTmpl.vue
View file @
37465db
...
...
@@ -12,15 +12,16 @@
<FoldFrame
name=
"合同介绍区域"
>
<div
class=
"bar-content"
>
<label
for=
""
class=
"content-label"
>
标题和介绍:
</label>
<quill-editor
ref=
"myQuillEditor"
class=
"quill"
v-model=
"serviceContent"
:options=
"editorOption"
></quill-editor>
<div>
<i
class=
"el-icon-circle-plus"
></i>
购买条件
<div
class=
"editor"
>
<quill-editor
ref=
"myQuillEditor"
class=
"quill"
v-model=
"serviceContent"
:options=
"editorOption"
></quill-editor>
<div
class=
"extend-bar"
>
<i
class=
"el-icon-circle-plus extend-icon"
@
click=
"insertContent"
>
购买条件
</i>
</div>
</div>
</div>
</FoldFrame>
</div>
<div
class=
"preview-area"
>
<el-button
@
click=
"insertContent"
>
dasdsa
</el-button>
<div
v-html=
"serviceContent"
></div>
</div>
...
...
@@ -60,11 +61,6 @@ export default {
// ['clean']
// ['link', 'image']
],
// handlers: {
// label:()=>{
// this.insertContent()
// }
// }
}
}
},
...
...
@@ -76,30 +72,9 @@ export default {
methods
:
{
insertContent
(){
// // 文本内容
// const text = 'hello'
// // 获取编辑器对象
// let quill = this.$refs.myQuillEditor.quill;
// // 获取编辑器光标位置
// let index = quill.selection.savedRange.index;
// // 插入文本至光标位置,
// // quill.insertText(index, text);
// // quill.clipboard.dangerouslyPasteHTML(index, `<span> </span><span style="color: '#26a2ff'">${text}</span><span> </span>`);
// quill.clipboard.dangerouslyPasteHTML(5, ' <b>World</b>');
// // 重新计算index
// index+=text.length
// // 移动光标至文本后面
// quill.setSelection(index);
let
quill
=
this
.
$refs
.
myQuillEditor
.
quill
;
let
length
=
quill
.
selection
.
savedRange
.
index
;
quill
.
insertEmbed
(
length
,
'label'
,
132
);
// 调整光标到最后
quill
.
setSelection
(
length
+
1
);
}
...
...
@@ -128,6 +103,42 @@ export default {
text-align
:
right
;
line-height
:
20px
;
}
.editor
{
display
:
inline-block
;
background-color
:
#fff
;
.quill{
background-color
:
#fff
;
display
:
inline-block
;
border-color
:
#E5E5E5
;
/deep/
.ql-toolbar.ql-snow,
/deep/
.ql-container.ql-snow{
border-color
:
#E5E5E5
;
}
/
deep
/
.ql-label
{
color
:
#26a2ff
;
}
}
.extend-bar
{
width
:
100%
;
height
:
40px
;
padding
:
0
20px
;
line-height
:
40px
;
margin-top
:
-1px
;
background
:
#FAFBFE
;
border
:
1px
solid
#E5E5E5
;
box-sizing
:
border-box
;
border-radius
:
0
0
4px
4px
;
border-top
:
none
;
.extend-icon{
cursor
:
pointer
;
&::before{
//
font-size
:
16px
;
margin-right
:
5px
;
}
font-size
:
14px
;
color
:
#666
;
}
}
}
.upload-wrap
{
display
:
inline-block
;
}
...
...
@@ -139,10 +150,6 @@ export default {
vertical-align
:
bottom
;
margin-left
:
10px
;
}
.quill
{
background-color
:
#fff
;
display
:
inline-block
;
}
}
}
}
...
...
src/views/ContractManager/components/FoldFrame/index.vue
View file @
37465db
...
...
@@ -20,7 +20,7 @@
},
data
()
{
return
{
isExpansion
:
fals
e
isExpansion
:
tru
e
}
},
methods
:
{
...
...
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