Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
VueElementTemplate
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
JIRA
JIRA
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
HireTest
VueElementTemplate
Commits
168150ff
Commit
168150ff
authored
Apr 26, 2017
by
Pan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refine code
parent
db83dd50
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
54 additions
and
157 deletions
+54
-157
keyboard.vue
src/components/Charts/keyboard.vue
+1
-2
index.vue
src/components/MDinput/index.vue
+24
-134
index.vue
src/components/MdEditor/index.vue
+10
-7
index.vue
src/components/PanThumb/index.vue
+1
-1
index.vue
src/components/Tinymce/index.vue
+11
-3
sticky.js
src/directive/sticky.js
+6
-8
index.js
src/router/index.js
+0
-1
markdown.vue
src/views/components/markdown.vue
+1
-1
No files found.
src/components/Charts/keyboard.vue
View file @
168150ff
...
...
@@ -105,8 +105,7 @@
return
idx
*
20
;
}
}]
}
)
})
}
}
}
...
...
src/components/MDinput/index.vue
View file @
168150ff
<
template
>
<div
class=
"material-input__component"
:class=
"computedClasses"
>
<input
v-if=
"type === 'email'"
type=
"email"
class=
"material-input"
:name=
"name"
:id=
"id"
:placeholder=
"placeholder"
v-model=
"valueCopy"
:readonly=
"readonly"
:disabled=
"disabled"
:autocomplete=
"autocomplete"
:required=
"required"
@
focus=
"handleFocus(true)"
@
blur=
"handleFocus(false)"
@
input=
"handleModelInput"
>
<input
v-if=
"type === 'url'"
type=
"url"
class=
"material-input"
:name=
"name"
:id=
"id"
:placeholder=
"placeholder"
v-model=
"valueCopy"
:readonly=
"readonly"
:disabled=
"disabled"
:autocomplete=
"autocomplete"
:required=
"required"
@
focus=
"handleFocus(true)"
@
blur=
"handleFocus(false)"
@
input=
"handleModelInput"
>
<input
v-if=
"type === 'number'"
type=
"number"
class=
"material-input"
:name=
"name"
:id=
"id"
:placeholder=
"placeholder"
v-model=
"valueCopy"
:readonly=
"readonly"
:disabled=
"disabled"
:autocomplete=
"autocomplete"
:max=
"max"
:min=
"min"
:minlength=
"minlength"
:maxlength=
"maxlength"
:required=
"required"
@
focus=
"handleFocus(true)"
@
blur=
"handleFocus(false)"
@
input=
"handleModelInput"
>
<input
v-if=
"type === 'password'"
type=
"password"
class=
"material-input"
:name=
"name"
:id=
"id"
:placeholder=
"placeholder"
v-model=
"valueCopy"
:readonly=
"readonly"
:disabled=
"disabled"
:autocomplete=
"autocomplete"
:max=
"max"
:min=
"min"
:required=
"required"
@
focus=
"handleFocus(true)"
@
blur=
"handleFocus(false)"
@
input=
"handleModelInput"
>
<input
v-if=
"type === 'tel'"
type=
"tel"
class=
"material-input"
:name=
"name"
:id=
"id"
:placeholder=
"placeholder"
v-model=
"valueCopy"
:readonly=
"readonly"
:disabled=
"disabled"
:autocomplete=
"autocomplete"
:required=
"required"
@
focus=
"handleFocus(true)"
@
blur=
"handleFocus(false)"
@
input=
"handleModelInput"
>
<input
v-if=
"type === 'text'"
type=
"text"
class=
"material-input"
:name=
"name"
:id=
"id"
:placeholder=
"placeholder"
v-model=
"valueCopy"
:readonly=
"readonly"
:disabled=
"disabled"
:autocomplete=
"autocomplete"
:minlength=
"minlength"
:maxlength=
"maxlength"
:required=
"required"
@
focus=
"handleFocus(true)"
@
blur=
"handleFocus(false)"
@
input=
"handleModelInput"
>
<input
v-if=
"type === 'email'"
type=
"email"
class=
"material-input"
:name=
"name"
:id=
"id"
:placeholder=
"placeholder"
v-model=
"valueCopy"
:readonly=
"readonly"
:disabled=
"disabled"
:autocomplete=
"autocomplete"
:required=
"required"
@
focus=
"handleFocus(true)"
@
blur=
"handleFocus(false)"
@
input=
"handleModelInput"
>
<input
v-if=
"type === 'url'"
type=
"url"
class=
"material-input"
:name=
"name"
:id=
"id"
:placeholder=
"placeholder"
v-model=
"valueCopy"
:readonly=
"readonly"
:disabled=
"disabled"
:autocomplete=
"autocomplete"
:required=
"required"
@
focus=
"handleFocus(true)"
@
blur=
"handleFocus(false)"
@
input=
"handleModelInput"
>
<input
v-if=
"type === 'number'"
type=
"number"
class=
"material-input"
:name=
"name"
:id=
"id"
:placeholder=
"placeholder"
v-model=
"valueCopy"
:readonly=
"readonly"
:disabled=
"disabled"
:autocomplete=
"autocomplete"
:max=
"max"
:min=
"min"
:minlength=
"minlength"
:maxlength=
"maxlength"
:required=
"required"
@
focus=
"handleFocus(true)"
@
blur=
"handleFocus(false)"
@
input=
"handleModelInput"
>
<input
v-if=
"type === 'password'"
type=
"password"
class=
"material-input"
:name=
"name"
:id=
"id"
:placeholder=
"placeholder"
v-model=
"valueCopy"
:readonly=
"readonly"
:disabled=
"disabled"
:autocomplete=
"autocomplete"
:max=
"max"
:min=
"min"
:required=
"required"
@
focus=
"handleFocus(true)"
@
blur=
"handleFocus(false)"
@
input=
"handleModelInput"
>
<input
v-if=
"type === 'tel'"
type=
"tel"
class=
"material-input"
:name=
"name"
:id=
"id"
:placeholder=
"placeholder"
v-model=
"valueCopy"
:readonly=
"readonly"
:disabled=
"disabled"
:autocomplete=
"autocomplete"
:required=
"required"
@
focus=
"handleFocus(true)"
@
blur=
"handleFocus(false)"
@
input=
"handleModelInput"
>
<input
v-if=
"type === 'text'"
type=
"text"
class=
"material-input"
:name=
"name"
:id=
"id"
:placeholder=
"placeholder"
v-model=
"valueCopy"
:readonly=
"readonly"
:disabled=
"disabled"
:autocomplete=
"autocomplete"
:minlength=
"minlength"
:maxlength=
"maxlength"
:required=
"required"
@
focus=
"handleFocus(true)"
@
blur=
"handleFocus(false)"
@
input=
"handleModelInput"
>
<span
class=
"material-input-bar"
></span>
...
...
@@ -137,6 +33,7 @@
</
template
>
<
script
>
// source:https://github.com/wemake-services/vue-material-input/blob/master/src/components/MaterialInput.vue
export
default
{
name
:
'material-input'
,
computed
:
{
...
...
@@ -148,12 +45,8 @@
return
{
'material--active'
:
this
.
focus
,
'material--disabled'
:
this
.
disabled
,
'material--has-errors'
:
Boolean
(
!
this
.
valid
||
(
this
.
errorMessages
&&
this
.
errorMessages
.
length
)),
'material--raised'
:
Boolean
(
this
.
focus
||
this
.
valueCopy
||
// has value
'material--has-errors'
:
Boolean
(
!
this
.
valid
||
(
this
.
errorMessages
&&
this
.
errorMessages
.
length
)),
'material--raised'
:
Boolean
(
this
.
focus
||
this
.
valueCopy
||
// has value
(
this
.
placeholder
&&
!
this
.
valueCopy
))
// has placeholder
}
}
...
...
@@ -179,8 +72,7 @@
this
.
focus
=
focused
},
handleValidation
()
{
this
.
valid
=
this
.
$el
?
this
.
$el
.
querySelector
(
'.material-input'
).
validity
.
valid
:
this
.
valid
this
.
valid
=
this
.
$el
?
this
.
$el
.
querySelector
(
'.material-input'
).
validity
.
valid
:
this
.
valid
},
copyValue
(
value
)
{
this
.
valueCopy
=
value
...
...
@@ -388,8 +280,6 @@
}
// Errors:
&
.material--has-errors
{
// These styles are required
// for custom validation:
&
.material--active
.material-label
{
color
:
$color-red
;
}
...
...
src/components/MdEditor/index.vue
View file @
168150ff
<
template
>
<div
class=
'simplemde-container'
>
<div
class=
'simplemde-container'
:style=
"
{height:height+'px',zIndex:zIndex}"
>
<textarea
:id=
'id'
>
</textarea>
</div>
...
...
@@ -24,11 +24,16 @@ export default {
type
:
String
,
default
:
''
},
height
:
{
type
:
Number
,
default
:
150
},
zIndex
:
{
type
:
Number
,
default
:
10
},
toolbar
:
{
type
:
Array
// default() {
// return ['bold', '|', 'link']
// }
}
},
data
()
{
...
...
@@ -58,7 +63,6 @@ export default {
if
(
this
.
value
)
{
this
.
simplemde
.
value
(
this
.
value
);
}
this
.
simplemde
.
codemirror
.
on
(
'change'
,
()
=>
{
if
(
this
.
hasChange
)
{
this
.
hasChange
=
true
...
...
@@ -74,7 +78,7 @@ export default {
<
style
>
.simplemde-container
.CodeMirror
{
height
:
150px
;
/*height: 150px;*/
min-height
:
150px
;
}
.simplemde-container
.CodeMirror-scroll
{
...
...
@@ -102,7 +106,6 @@ export default {
font-weight
:
bold
;
color
:
#E61E1E
;
}
</
style
>
src/components/PanThumb/index.vue
View file @
168150ff
...
...
@@ -2,7 +2,7 @@
<div
class=
"pan-item"
:style=
"
{zIndex:zIndex,height:height,width:width}">
<div
class=
"pan-info"
>
<div
class=
"pan-info-roles-container"
>
<slot>
pan
</slot>
<slot></slot>
</div>
</div>
<img
class=
"pan-thumb"
:src=
"image"
>
...
...
src/components/Tinymce/index.vue
View file @
168150ff
<
template
>
<div
class=
'tinymce-container editor-container'
>
<textarea
class=
'tinymce-textarea'
:id=
"id"
></textarea>
<!--业务需求可删除-->
<div
class=
"editor-custom-btn-container"
>
<editorSlide
v-if=
"customButton.indexOf('editorSlide')>=0"
color=
"#3A71A8"
class=
"editor-upload-btn"
@
successCBK=
"slideSuccessCBK"
></editorSlide>
<editorAudio
v-if=
"customButton.indexOf('editorAudio')>=0"
color=
"#30B08F"
class=
"editor-upload-btn"
@
successCBK=
"aduioSuccessCBK"
></editorAudio>
<editorVideo
v-if=
"customButton.indexOf('editorVideo')>=0"
color=
"#E65D6E"
class=
"editor-upload-btn"
@
successCBK=
"videoSuccessCBK"
></editorVideo>
<editorImage
v-if=
"customButton.indexOf('editorImage')>=0"
color=
"#20a0ff"
class=
"editor-upload-btn"
@
successCBK=
"imageSuccessCBK"
></editorImage>
<!--业务需求可删除-->
</div>
</div>
</
template
>
<
script
>
// tinymce 在最外层目录static下 ,由index.html直接引入,挂载在window下。不通过impot,不打包
// 业务需求可删除
import
editorAudio
from
'./components/editorAudio'
;
import
editorVideo
from
'./components/editorVideo'
;
import
editorSlide
from
'./components/editorSlide'
;
import
editorImage
from
'./components/editorImage'
;
import
{
getToken
,
upload
}
from
'api/qiniu'
;
import
{
getToken
,
upload
}
from
'api/qiniu'
;
// 七牛
// 业务需求可删除
export
default
{
name
:
'tinymce'
,
components
:
{
editorImage
,
editorAudio
,
editorSlide
,
editorVideo
},
components
:
{
editorImage
,
editorAudio
,
editorSlide
,
editorVideo
},
// 业务需求可删除
props
:
{
id
:
{
type
:
String
,
...
...
@@ -100,6 +105,7 @@
this
.
$emit
(
'input'
,
editor
.
getContent
({
format
:
'raw'
}));
});
},
// 整合七牛上传
// images_dataimg_filter(img) {
// setTimeout(() => {
// const $image = $(img);
...
...
@@ -149,7 +155,7 @@
}
});
editor
.
addButton
(
'p'
,
{
title
:
'正文'
,
// tooltip text seen on mouseover
title
:
'正文'
,
text
:
'正文'
,
onclick
()
{
editor
.
execCommand
(
'mceToggleFormat'
,
false
,
'p'
);
...
...
@@ -167,6 +173,7 @@
});
},
methods
:
{
/* 业务代码可删除 start*/
imageSuccessCBK
(
arr
)
{
console
.
log
(
arr
)
const
_this
=
this
;
...
...
@@ -212,6 +219,7 @@
node
.
className
=
'wscnph editor-placeholder'
;
tinymce
.
get
(
this
.
id
).
insertContent
(
node
.
outerHTML
)
}
/* 业务代码可删除 end*/
},
destroyed
()
{
tinymce
.
get
(
this
.
id
).
destroy
();
...
...
src/directive/sticky.js
View file @
168150ff
...
...
@@ -11,14 +11,12 @@
elStyle
.
position
=
'-webkit-sticky'
;
elStyle
.
position
=
'sticky'
;
// if the browser support css sticky(Currently Safari, Firefox and Chrome Canary)
// if (~elStyle.position.indexOf('sticky')) {
// elStyle.top = `${stickyTop}px`;
// elStyle.zIndex = zIndex;
// return
// }
const
elHeight
=
el
.
getBoundingClientRect
().
height
;
const
elWidth
=
el
.
getBoundingClientRect
().
width
;
elStyle
.
cssText
=
`top:
${
stickyTop
}
px; z-index:
${
zIndex
}
`
;
...
...
src/router/index.js
View file @
168150ff
...
...
@@ -5,7 +5,6 @@ import Router from 'vue-router';
import
Layout
from
'../views/layout/Layout'
;
// dashboard
// import dashboard from '../views/dashboard/index';
const
dashboard
=
resolve
=>
require
([
'../views/dashboard/index'
],
resolve
);
/* error page*/
...
...
src/views/components/markdown.vue
View file @
168150ff
...
...
@@ -2,7 +2,7 @@
<div
class=
"components-container"
>
<code>
公司做的后台主要是一个cms系统,公司也是已自媒体为核心的,所以富文本是后台很核心的功能。在选择富文本的过程中也走了不少的弯路,市面上常见的富文本都基本用过了,最终选择了tinymce
</code>
<div
class=
"editor-container"
>
<MdEditor
id=
'contentEditor'
ref=
"contentEditor"
v-model=
'content'
:height=
"
150"
></MdEditor>
<MdEditor
id=
'contentEditor'
ref=
"contentEditor"
v-model=
'content'
:height=
"
300"
:zIndex=
'20'
></MdEditor>
</div>
</div>
</
template
>
...
...
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