Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Litemall
Commits
3e672d47
Commit
3e672d47
authored
Apr 06, 2018
by
Junling Bu
Browse files
update[litemall-admin]: 商品详细信息支持tinymce富文本编辑
parent
de55333c
Changes
7
Hide whitespace changes
Inline
Side-by-side
litemall-admin/src/components/BackToTop/index.vue
View file @
3e672d47
...
@@ -25,14 +25,16 @@ export default {
...
@@ -25,14 +25,16 @@ export default {
},
},
customStyle
:
{
customStyle
:
{
type
:
Object
,
type
:
Object
,
default
:
{
default
:
function
()
{
right
:
'
50px
'
,
return
{
bottom
:
'
50px
'
,
right
:
'
50px
'
,
width
:
'
40px
'
,
bottom
:
'
50px
'
,
height
:
'
40px
'
,
width
:
'
40px
'
,
'
border-radius
'
:
'
4px
'
,
height
:
'
40px
'
,
'
line-height
'
:
'
45px
'
,
'
border-radius
'
:
'
4px
'
,
background
:
'
#e7eaf1
'
'
line-height
'
:
'
45px
'
,
background
:
'
#e7eaf1
'
}
}
}
},
},
transitionName
:
{
transitionName
:
{
...
...
litemall-admin/src/components/Tinymce/components/editorImage.vue
deleted
100644 → 0
View file @
de55333c
<
template
>
<div
class=
"upload-container"
>
<el-button
icon=
'el-icon-upload'
size=
"mini"
:style=
"
{background:color,borderColor:color}" @click=" dialogVisible=true" type="primary">上传图片
</el-button>
<el-dialog
:visible.sync=
"dialogVisible"
>
<el-upload
class=
"editor-slide-upload"
action=
"https://httpbin.org/post"
:multiple=
"true"
:file-list=
"fileList"
:show-file-list=
"true"
list-type=
"picture-card"
:on-remove=
"handleRemove"
:on-success=
"handleSuccess"
:before-upload=
"beforeUpload"
>
<el-button
size=
"small"
type=
"primary"
>
点击上传
</el-button>
</el-upload>
<el-button
@
click=
"dialogVisible = false"
>
取 消
</el-button>
<el-button
type=
"primary"
@
click=
"handleSubmit"
>
确 定
</el-button>
</el-dialog>
</div>
</
template
>
<
script
>
// import { getToken } from 'api/qiniu'
export
default
{
name
:
'
editorSlideUpload
'
,
props
:
{
color
:
{
type
:
String
,
default
:
'
#1890ff
'
}
},
data
()
{
return
{
dialogVisible
:
false
,
listObj
:
{},
fileList
:
[]
}
},
methods
:
{
checkAllSuccess
()
{
return
Object
.
keys
(
this
.
listObj
).
every
(
item
=>
this
.
listObj
[
item
].
hasSuccess
)
},
handleSubmit
()
{
const
arr
=
Object
.
keys
(
this
.
listObj
).
map
(
v
=>
this
.
listObj
[
v
])
if
(
!
this
.
checkAllSuccess
())
{
this
.
$message
(
'
请等待所有图片上传成功 或 出现了网络问题,请刷新页面重新上传!
'
)
return
}
console
.
log
(
arr
)
this
.
$emit
(
'
successCBK
'
,
arr
)
this
.
listObj
=
{}
this
.
fileList
=
[]
this
.
dialogVisible
=
false
},
handleSuccess
(
response
,
file
)
{
const
uid
=
file
.
uid
const
objKeyArr
=
Object
.
keys
(
this
.
listObj
)
for
(
let
i
=
0
,
len
=
objKeyArr
.
length
;
i
<
len
;
i
++
)
{
if
(
this
.
listObj
[
objKeyArr
[
i
]].
uid
===
uid
)
{
this
.
listObj
[
objKeyArr
[
i
]].
url
=
response
.
files
.
file
this
.
listObj
[
objKeyArr
[
i
]].
hasSuccess
=
true
return
}
}
},
handleRemove
(
file
)
{
const
uid
=
file
.
uid
const
objKeyArr
=
Object
.
keys
(
this
.
listObj
)
for
(
let
i
=
0
,
len
=
objKeyArr
.
length
;
i
<
len
;
i
++
)
{
if
(
this
.
listObj
[
objKeyArr
[
i
]].
uid
===
uid
)
{
delete
this
.
listObj
[
objKeyArr
[
i
]]
return
}
}
},
beforeUpload
(
file
)
{
const
_self
=
this
const
_URL
=
window
.
URL
||
window
.
webkitURL
const
fileName
=
file
.
uid
this
.
listObj
[
fileName
]
=
{}
return
new
Promise
((
resolve
,
reject
)
=>
{
const
img
=
new
Image
()
img
.
src
=
_URL
.
createObjectURL
(
file
)
img
.
onload
=
function
()
{
_self
.
listObj
[
fileName
]
=
{
hasSuccess
:
false
,
uid
:
file
.
uid
,
width
:
this
.
width
,
height
:
this
.
height
}
}
resolve
(
true
)
})
}
}
}
</
script
>
<
style
rel=
"stylesheet/scss"
lang=
"scss"
scoped
>
.upload-container
{
.editor-slide-upload
{
margin-bottom
:
20px
;
}
}
</
style
>
litemall-admin/src/components/Tinymce/index.vue
View file @
3e672d47
<
template
>
<
template
>
<div
class=
"tinymce-container editor-container"
>
<div
class=
"tinymce-container editor-container"
>
<textarea
class=
"tinymce-textarea"
:id=
"tinymceId"
></textarea>
<textarea
class=
"tinymce-textarea"
:id=
"tinymceId"
></textarea>
<div
class=
"editor-custom-btn-container"
>
<editorImage
color=
"#1890ff"
class=
"editor-upload-btn"
@
successCBK=
"imageSuccessCBK"
></editorImage>
</div>
</div>
</div>
</
template
>
</
template
>
<
script
>
<
script
>
import
editorImage
from
'
./components/editorImage
'
import
plugins
from
'
./plugins
'
import
plugins
from
'
./plugins
'
import
toolbar
from
'
./toolbar
'
import
toolbar
from
'
./toolbar
'
import
{
createStorage
}
from
'
@/api/storage
'
export
default
{
export
default
{
name
:
'
tinymce
'
,
name
:
'
tinymce
'
,
components
:
{
editorImage
},
props
:
{
props
:
{
id
:
{
id
:
{
type
:
String
type
:
String
...
@@ -68,6 +64,7 @@ export default {
...
@@ -68,6 +64,7 @@ export default {
window
.
tinymce
.
init
({
window
.
tinymce
.
init
({
selector
:
`#
${
this
.
tinymceId
}
`
,
selector
:
`#
${
this
.
tinymceId
}
`
,
height
:
this
.
height
,
height
:
this
.
height
,
language
:
'
zh_CN
'
,
body_class
:
'
panel-body
'
,
body_class
:
'
panel-body
'
,
object_resizing
:
false
,
object_resizing
:
false
,
toolbar
:
this
.
toolbar
.
length
>
0
?
this
.
toolbar
:
toolbar
,
toolbar
:
this
.
toolbar
.
length
>
0
?
this
.
toolbar
:
toolbar
,
...
@@ -79,7 +76,6 @@ export default {
...
@@ -79,7 +76,6 @@ export default {
code_dialog_width
:
1000
,
code_dialog_width
:
1000
,
advlist_bullet_styles
:
'
square
'
,
advlist_bullet_styles
:
'
square
'
,
advlist_number_styles
:
'
default
'
,
advlist_number_styles
:
'
default
'
,
imagetools_cors_hosts
:
[
'
www.tinymce.com
'
,
'
codepen.io
'
],
default_link_target
:
'
_blank
'
,
default_link_target
:
'
_blank
'
,
link_title
:
false
,
link_title
:
false
,
init_instance_callback
:
editor
=>
{
init_instance_callback
:
editor
=>
{
...
@@ -91,6 +87,15 @@ export default {
...
@@ -91,6 +87,15 @@ export default {
this
.
hasChange
=
true
this
.
hasChange
=
true
this
.
$emit
(
'
input
'
,
editor
.
getContent
({
format
:
'
raw
'
}))
this
.
$emit
(
'
input
'
,
editor
.
getContent
({
format
:
'
raw
'
}))
})
})
},
images_upload_handler
:
function
(
blobInfo
,
success
,
failure
)
{
const
formData
=
new
FormData
()
formData
.
append
(
'
file
'
,
blobInfo
.
blob
())
createStorage
(
formData
).
then
(
res
=>
{
success
(
res
.
data
.
data
.
url
)
}).
catch
(()
=>
{
failure
(
'
上传失败,请重新上传
'
)
})
}
}
// 整合七牛上传
// 整合七牛上传
// images_dataimg_filter(img) {
// images_dataimg_filter(img) {
...
...
litemall-admin/src/components/Tinymce/plugins.js
View file @
3e672d47
...
@@ -2,6 +2,6 @@
...
@@ -2,6 +2,6 @@
// Detail plugins list see https://www.tinymce.com/docs/plugins/
// Detail plugins list see https://www.tinymce.com/docs/plugins/
// Custom builds see https://www.tinymce.com/download/custom-builds/
// Custom builds see https://www.tinymce.com/download/custom-builds/
const
plugins
=
[
'
advlist anchor autolink autoresize autosave
bbcode
code codesample colorpicker colorpicker contextmenu directionality emoticons
fullpage
fullscreen hr image imagetools importcss insertdatetime legacyoutput link lists media nonbreaking noneditable pagebreak paste preview print save searchreplace spellchecker tabfocus table template textcolor textpattern visualblocks visualchars wordcount
'
]
const
plugins
=
[
'
advlist anchor autolink autoresize autosave code codesample colorpicker colorpicker contextmenu directionality emoticons fullscreen hr image imagetools importcss insertdatetime legacyoutput link lists media nonbreaking noneditable pagebreak paste preview print save searchreplace spellchecker tabfocus table template textcolor textpattern visualblocks visualchars wordcount
'
]
export
default
plugins
export
default
plugins
litemall-admin/src/styles/element-ui.scss
View file @
3e672d47
...
@@ -52,17 +52,6 @@
...
@@ -52,17 +52,6 @@
margin
:
0
auto
;
margin
:
0
auto
;
}
}
//文章页textarea修改样式
.article-textarea
{
textarea
{
padding-right
:
40px
;
resize
:
none
;
border
:
none
;
border-radius
:
0px
;
border-bottom
:
1px
solid
#bfcbd9
;
}
}
//element ui upload
//element ui upload
.upload-container
{
.upload-container
{
.el-upload
{
.el-upload
{
...
...
litemall-admin/src/views/goods/goods.vue
View file @
3e672d47
...
@@ -153,8 +153,8 @@
...
@@ -153,8 +153,8 @@
<el-input
v-model=
"dataForm.goodsBrief"
></el-input>
<el-input
v-model=
"dataForm.goodsBrief"
></el-input>
</el-form-item>
</el-form-item>
<el-form-item
label=
"商品详细介绍"
>
<el-form-item
style=
"width: 700px;"
label=
"商品详细介绍"
>
<
el-input
v-model=
"dataForm.goodsDesc"
></
el-input
>
<
tinymce
v-model=
"dataForm.goodsDesc"
></
tinymce
>
</el-form-item>
</el-form-item>
<el-form-item
label=
"商品主图"
>
<el-form-item
label=
"商品主图"
>
...
@@ -199,16 +199,21 @@
...
@@ -199,16 +199,21 @@
margin-right
:
0
;
margin-right
:
0
;
margin-bottom
:
0
;
margin-bottom
:
0
;
}
}
.el-dialog
{
width
:
800px
;
}
</
style
>
</
style
>
<
script
>
<
script
>
import
{
listGoods
,
createGoods
,
updateGoods
,
deleteGoods
}
from
'
@/api/goods
'
import
{
listGoods
,
createGoods
,
updateGoods
,
deleteGoods
}
from
'
@/api/goods
'
import
waves
from
'
@/directive/waves
'
// 水波纹指令
import
waves
from
'
@/directive/waves
'
// 水波纹指令
import
BackToTop
from
'
@/components/BackToTop
'
import
BackToTop
from
'
@/components/BackToTop
'
import
Tinymce
from
'
@/components/Tinymce
'
export
default
{
export
default
{
name
:
'
Goods
'
,
name
:
'
Goods
'
,
components
:
{
BackToTop
},
components
:
{
BackToTop
,
Tinymce
},
directives
:
{
waves
},
directives
:
{
waves
},
data
()
{
data
()
{
return
{
return
{
...
...
litemall-admin/src/views/layout/components/Sidebar/index.vue
View file @
3e672d47
<
template
>
<
template
>
<scroll-bar>
<scroll-bar>
<el-menu
mode=
"vertical"
unique-opened=
"true"
:default-active=
"$route.path"
:collapse=
"isCollapse"
background-color=
"#304156"
text-color=
"#bfcbd9"
active-text-color=
"#409EFF"
>
<el-menu
mode=
"vertical"
:default-active=
"$route.path"
:collapse=
"isCollapse"
background-color=
"#304156"
text-color=
"#bfcbd9"
active-text-color=
"#409EFF"
>
<sidebar-item
:routes=
"permission_routers"
></sidebar-item>
<sidebar-item
:routes=
"permission_routers"
></sidebar-item>
</el-menu>
</el-menu>
</scroll-bar>
</scroll-bar>
...
...
Write
Preview
Supports
Markdown
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