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
黄瑜
VueElementTemplate
Commits
551e911e
Commit
551e911e
authored
Aug 22, 2017
by
Pan
Committed by
花裤衩
Aug 28, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
全局lint优化
parent
b8ecda19
Changes
104
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
104 changed files
with
3417 additions
and
3602 deletions
+3417
-3602
.eslintrc.js
.eslintrc.js
+117
-291
webpack.base.conf.js
build/webpack.base.conf.js
+9
-9
App.vue
src/App.vue
+2
-2
article.js
src/api/article.js
+5
-5
article_table.js
src/api/article_table.js
+5
-5
login.js
src/api/login.js
+3
-3
qiniu.js
src/api/qiniu.js
+3
-3
remoteSearch.js
src/api/remoteSearch.js
+3
-3
index.vue
src/components/BackToTop/index.vue
+60
-60
keyboard.vue
src/components/Charts/keyboard.vue
+104
-104
keyboard2.vue
src/components/Charts/keyboard2.vue
+129
-129
lineMarker.vue
src/components/Charts/lineMarker.vue
+199
-199
mixChart.vue
src/components/Charts/mixChart.vue
+234
-235
index.vue
src/components/Dropzone/index.vue
+173
-175
index.vue
src/components/ErrLog/index.vue
+11
-11
index.vue
src/components/Hamburger/index.vue
+11
-11
index.vue
src/components/Icon-svg/index.vue
+12
-12
lang.js
src/components/ImageCropper/lang.js
+2
-2
index.vue
src/components/MDinput/index.vue
+28
-28
index.vue
src/components/MdEditor/index.vue
+63
-63
index.vue
src/components/PanThumb/index.vue
+20
-20
index.vue
src/components/Screenfull/index.vue
+30
-30
Pane.vue
src/components/SplitPane/Pane.vue
+7
-7
Resizer.vue
src/components/SplitPane/Resizer.vue
+16
-16
index.vue
src/components/SplitPane/index.vue
+69
-69
index.vue
src/components/Sticky/index.vue
+56
-56
index.vue
src/components/Tinymce/index.vue
+108
-109
index.vue
src/components/TodoList/index.vue
+0
-2
singleImage.vue
src/components/Upload/singleImage.vue
+37
-36
singleImage2.vue
src/components/Upload/singleImage2.vue
+18
-19
singleImage3.vue
src/components/Upload/singleImage3.vue
+18
-18
index.vue
src/components/jsonEditor/index.vue
+41
-41
index.vue
src/components/twoDndList/index.vue
+60
-60
sticky.js
src/directive/sticky.js
+37
-37
waves.js
src/directive/waves.js
+25
-27
errorLog.js
src/errorLog.js
+2
-2
index.js
src/filters/index.js
+25
-25
main.js
src/main.js
+0
-2
article.js
src/mock/article.js
+5
-7
article_table.js
src/mock/article_table.js
+13
-13
login.js
src/mock/login.js
+7
-7
remoteSearch.js
src/mock/remoteSearch.js
+10
-10
permission.js
src/permission.js
+1
-1
index.js
src/router/index.js
+9
-9
errLog.js
src/store/errLog.js
+3
-3
getters.js
src/store/getters.js
+1
-1
index.js
src/store/index.js
+8
-8
app.js
src/store/modules/app.js
+6
-6
permission.js
src/store/modules/permission.js
+4
-4
user.js
src/store/modules/user.js
+56
-56
createUniqueString.js
src/utils/createUniqueString.js
+3
-3
fetch.js
src/utils/fetch.js
+13
-13
index.js
src/utils/index.js
+102
-105
openWindow.js
src/utils/openWindow.js
+8
-9
validate.js
src/utils/validate.js
+9
-10
keyboard.vue
src/views/charts/keyboard.vue
+4
-4
keyboard2.vue
src/views/charts/keyboard2.vue
+4
-4
line.vue
src/views/charts/line.vue
+4
-4
mixChart.vue
src/views/charts/mixChart.vue
+4
-4
avatarUpload.vue
src/views/components/avatarUpload.vue
+20
-20
backToTop.vue
src/views/components/backToTop.vue
+15
-14
countTo.vue
src/views/components/countTo.vue
+60
-59
dndlist.vue
src/views/components/dndlist.vue
+23
-23
dropzone.vue
src/views/components/dropzone.vue
+13
-13
jsoneditor.vue
src/views/components/jsoneditor.vue
+9
-9
markdown.vue
src/views/components/markdown.vue
+17
-17
mixin.vue
src/views/components/mixin.vue
+13
-13
splitpane.vue
src/views/components/splitpane.vue
+8
-8
sticky.vue
src/views/components/sticky.vue
+15
-15
tinymce.vue
src/views/components/tinymce.vue
+8
-8
index.vue
src/views/dashboard/default/index.vue
+16
-16
barChart.vue
src/views/dashboard/editor/barChart.vue
+82
-81
index.vue
src/views/dashboard/editor/index.vue
+24
-23
lineChart.vue
src/views/dashboard/editor/lineChart.vue
+101
-101
pieChart.vue
src/views/dashboard/editor/pieChart.vue
+61
-61
index.vue
src/views/dashboard/index.vue
+24
-24
index.vue
src/views/errlog/index.vue
+4
-4
401.vue
src/views/error/401.vue
+18
-17
404.vue
src/views/error/404.vue
+13
-13
form.vue
src/views/example/form.vue
+120
-120
tabPane.vue
src/views/example/tab/components/tabPane.vue
+40
-40
index.vue
src/views/example/tab/index.vue
+16
-16
dragTable.vue
src/views/example/table/dragTable.vue
+52
-52
dynamictable.vue
src/views/example/table/dynamictable.vue
+5
-5
fixedThead.vue
src/views/example/table/dynamictable/fixedThead.vue
+31
-30
unfixedThead.vue
src/views/example/table/dynamictable/unfixedThead.vue
+20
-20
inlineEditTable.vue
src/views/example/table/inlineEditTable.vue
+34
-34
table.vue
src/views/example/table/table.vue
+182
-182
index.vue
src/views/excel/index.vue
+33
-33
selectExcel.vue
src/views/excel/selectExcel.vue
+41
-41
AppMain.vue
src/views/layout/AppMain.vue
+1
-1
Layout.vue
src/views/layout/Layout.vue
+12
-12
Levelbar.vue
src/views/layout/Levelbar.vue
+22
-22
Navbar.vue
src/views/layout/Navbar.vue
+35
-35
Sidebar.vue
src/views/layout/Sidebar.vue
+12
-12
SidebarItem.vue
src/views/layout/SidebarItem.vue
+6
-6
TabsView.vue
src/views/layout/TabsView.vue
+26
-26
index.js
src/views/layout/index.js
+4
-4
authredirect.vue
src/views/login/authredirect.vue
+4
-4
index.vue
src/views/login/index.vue
+60
-60
socialsignin.vue
src/views/login/socialsignin.vue
+18
-18
index.vue
src/views/permission/index.vue
+19
-18
upload.vue
src/views/qiniu/upload.vue
+25
-25
index.vue
src/views/theme/index.vue
+39
-40
No files found.
.eslintrc.js
View file @
551e911e
This diff is collapsed.
Click to expand it.
build/webpack.base.conf.js
View file @
551e911e
...
...
@@ -37,15 +37,15 @@ module.exports = {
},
module
:
{
rules
:
[
//
{
//
test: /\.(js|vue)$/,
//
loader: 'eslint-loader',
//
enforce: "pre",
//
include: [resolve('src'), resolve('test')],
//
options: {
//
formatter: require('eslint-friendly-formatter')
//
}
//
},
{
test
:
/
\.(
js|vue
)
$/
,
loader
:
'eslint-loader'
,
enforce
:
"pre"
,
include
:
[
resolve
(
'src'
),
resolve
(
'test'
)],
options
:
{
formatter
:
require
(
'eslint-friendly-formatter'
)
}
},
{
test
:
/
\.
vue$/
,
loader
:
'vue-loader'
,
...
...
src/App.vue
View file @
551e911e
...
...
@@ -11,6 +11,6 @@
</
script
>
<
style
lang=
"scss"
>
@import
'~normalize.css/normalize.css'
;
// normalize.css 样式格式化
@import
'./styles/index.scss'
;
// 全局自定义的css样式
@import
'~normalize.css/normalize.css'
;
// normalize.css 样式格式化
@import
'./styles/index.scss'
;
// 全局自定义的css样式
</
style
>
src/api/article.js
View file @
551e911e
import
fetch
from
'utils/fetch'
;
import
fetch
from
'utils/fetch'
export
function
getList
()
{
export
function
getList
()
{
return
fetch
({
url
:
'/article/list'
,
method
:
'get'
})
;
})
}
export
function
getArticle
()
{
export
function
getArticle
()
{
return
fetch
({
url
:
'/article/detail'
,
method
:
'get'
})
;
})
}
src/api/article_table.js
View file @
551e911e
import
fetch
from
'utils/fetch'
;
import
fetch
from
'utils/fetch'
export
function
fetchList
(
query
)
{
export
function
fetchList
(
query
)
{
return
fetch
({
url
:
'/article_table/list'
,
method
:
'get'
,
params
:
query
})
;
})
}
export
function
fetchPv
(
pv
)
{
export
function
fetchPv
(
pv
)
{
return
fetch
({
url
:
'/article_table/pv'
,
method
:
'get'
,
params
:
{
pv
}
})
;
})
}
src/api/login.js
View file @
551e911e
import
fetch
from
'utils/fetch'
export
function
loginByUsername
(
username
,
password
)
{
export
function
loginByUsername
(
username
,
password
)
{
const
data
=
{
username
,
password
...
...
@@ -12,14 +12,14 @@ export function loginByUsername(username, password) {
})
}
export
function
logout
()
{
export
function
logout
()
{
return
fetch
({
url
:
'/login/logout'
,
method
:
'post'
})
}
export
function
getInfo
(
token
)
{
export
function
getInfo
(
token
)
{
return
fetch
({
url
:
'/user/info'
,
method
:
'get'
,
...
...
src/api/qiniu.js
View file @
551e911e
import
fetch
from
'utils/fetch'
;
import
fetch
from
'utils/fetch'
export
function
getToken
()
{
export
function
getToken
()
{
return
fetch
({
url
:
'/qiniu/upload/token'
,
// 假地址 自行替换
method
:
'get'
})
;
})
}
src/api/remoteSearch.js
View file @
551e911e
import
fetch
from
'utils/fetch'
;
import
fetch
from
'utils/fetch'
export
function
userSearch
(
name
)
{
export
function
userSearch
(
name
)
{
return
fetch
({
url
:
'/search/user'
,
method
:
'get'
,
params
:
{
name
}
})
;
})
}
src/components/BackToTop/index.vue
View file @
551e911e
...
...
@@ -12,7 +12,7 @@
</
template
>
<
script
>
export
default
{
export
default
{
name
:
'BackToTop'
,
props
:
{
visibilityHeight
:
{
...
...
@@ -47,38 +47,38 @@
}
},
mounted
()
{
window
.
addEventListener
(
'scroll'
,
this
.
handleScroll
);
window
.
addEventListener
(
'scroll'
,
this
.
handleScroll
)
},
beforeDestroy
()
{
window
.
removeEventListener
(
'scroll'
,
this
.
handleScroll
);
window
.
removeEventListener
(
'scroll'
,
this
.
handleScroll
)
if
(
this
.
interval
)
{
clearInterval
(
this
.
interval
);
clearInterval
(
this
.
interval
)
}
},
methods
:
{
handleScroll
()
{
this
.
visible
=
window
.
pageYOffset
>
this
.
visibilityHeight
;
this
.
visible
=
window
.
pageYOffset
>
this
.
visibilityHeight
},
backToTop
()
{
const
start
=
window
.
pageYOffset
;
let
i
=
0
;
const
start
=
window
.
pageYOffset
let
i
=
0
this
.
interval
=
setInterval
(()
=>
{
const
next
=
Math
.
floor
(
this
.
easeInOutQuad
(
10
*
i
,
start
,
-
start
,
500
));
const
next
=
Math
.
floor
(
this
.
easeInOutQuad
(
10
*
i
,
start
,
-
start
,
500
))
if
(
next
<=
this
.
backPosition
)
{
window
.
scrollTo
(
0
,
this
.
backPosition
);
window
.
scrollTo
(
0
,
this
.
backPosition
)
clearInterval
(
this
.
interval
)
}
else
{
window
.
scrollTo
(
0
,
next
);
window
.
scrollTo
(
0
,
next
)
}
i
++
;
i
++
},
16.7
)
},
easeInOutQuad
(
t
,
b
,
c
,
d
)
{
if
((
t
/=
d
/
2
)
<
1
)
return
c
/
2
*
t
*
t
+
b
;
return
-
c
/
2
*
(
--
t
*
(
t
-
2
)
-
1
)
+
b
;
}
if
((
t
/=
d
/
2
)
<
1
)
return
c
/
2
*
t
*
t
+
b
return
-
c
/
2
*
(
--
t
*
(
t
-
2
)
-
1
)
+
b
}
}
}
</
script
>
<
style
scoped
>
...
...
src/components/Charts/keyboard.vue
View file @
551e911e
...
...
@@ -3,9 +3,9 @@
</
template
>
<
script
>
import
echarts
from
'echarts'
;
import
echarts
from
'echarts'
export
default
{
export
default
{
props
:
{
className
:
{
type
:
String
,
...
...
@@ -27,26 +27,26 @@
data
()
{
return
{
chart
:
null
};
}
},
mounted
()
{
this
.
initChart
();
this
.
initChart
()
},
beforeDestroy
()
{
if
(
!
this
.
chart
)
{
return
}
this
.
chart
.
dispose
();
this
.
chart
=
null
;
this
.
chart
.
dispose
()
this
.
chart
=
null
},
methods
:
{
initChart
()
{
this
.
chart
=
echarts
.
init
(
document
.
getElementById
(
this
.
id
));
this
.
chart
=
echarts
.
init
(
document
.
getElementById
(
this
.
id
))
const
xAxisData
=
[];
const
data
=
[];
const
xAxisData
=
[]
const
data
=
[]
for
(
let
i
=
0
;
i
<
30
;
i
++
)
{
xAxisData
.
push
(
i
+
'号'
);
xAxisData
.
push
(
i
+
'号'
)
data
.
push
(
Math
.
round
(
Math
.
random
()
*
2
+
3
))
}
...
...
@@ -100,14 +100,14 @@
animationEasing
:
'elasticOut'
,
animationEasingUpdate
:
'elasticOut'
,
animationDelay
(
idx
)
{
return
idx
*
20
;
return
idx
*
20
},
animationDelayUpdate
(
idx
)
{
return
idx
*
20
;
return
idx
*
20
}
}]
})
}
}
}
}
</
script
>
src/components/Charts/keyboard2.vue
View file @
551e911e
...
...
@@ -3,9 +3,9 @@
</
template
>
<
script
>
import
echarts
from
'echarts'
;
import
echarts
from
'echarts'
export
default
{
export
default
{
props
:
{
className
:
{
type
:
String
,
...
...
@@ -27,29 +27,29 @@
data
()
{
return
{
chart
:
null
};
}
},
mounted
()
{
this
.
initChart
();
this
.
initChart
()
},
beforeDestroy
()
{
if
(
!
this
.
chart
)
{
return
}
this
.
chart
.
dispose
();
this
.
chart
=
null
;
this
.
chart
.
dispose
()
this
.
chart
=
null
},
methods
:
{
initChart
()
{
this
.
chart
=
echarts
.
init
(
document
.
getElementById
(
this
.
id
));
this
.
chart
=
echarts
.
init
(
document
.
getElementById
(
this
.
id
))
const
xAxisData
=
[];
const
data
=
[];
const
data2
=
[];
const
xAxisData
=
[]
const
data
=
[]
const
data2
=
[]
for
(
let
i
=
0
;
i
<
50
;
i
++
)
{
xAxisData
.
push
(
i
);
data
.
push
((
Math
.
sin
(
i
/
5
)
*
(
i
/
5
-
10
)
+
i
/
6
)
*
5
);
data2
.
push
((
Math
.
sin
(
i
/
5
)
*
(
i
/
5
+
10
)
+
i
/
6
)
*
3
);
xAxisData
.
push
(
i
)
data
.
push
((
Math
.
sin
(
i
/
5
)
*
(
i
/
5
-
10
)
+
i
/
6
)
*
5
)
data2
.
push
((
Math
.
sin
(
i
/
5
)
*
(
i
/
5
+
10
)
+
i
/
6
)
*
3
)
}
this
.
chart
.
setOption
(
{
...
...
@@ -138,13 +138,13 @@
animationEasing
:
'elasticOut'
,
animationEasingUpdate
:
'elasticOut'
,
animationDelay
(
idx
)
{
return
idx
*
20
;
return
idx
*
20
},
animationDelayUpdate
(
idx
)
{
return
idx
*
20
;
return
idx
*
20
}
})
}
}
}
}
</
script
>
src/components/Charts/lineMarker.vue
View file @
551e911e
...
...
@@ -3,9 +3,9 @@
</
template
>
<
script
>
import
echarts
from
'echarts'
;
import
echarts
from
'echarts'
export
default
{
export
default
{
props
:
{
className
:
{
type
:
String
,
...
...
@@ -27,21 +27,21 @@
data
()
{
return
{
chart
:
null
};
}
},
mounted
()
{
this
.
initChart
();
this
.
initChart
()
},
beforeDestroy
()
{
if
(
!
this
.
chart
)
{
return
}
this
.
chart
.
dispose
();
this
.
chart
=
null
;
this
.
chart
.
dispose
()
this
.
chart
=
null
},
methods
:
{
initChart
()
{
this
.
chart
=
echarts
.
init
(
document
.
getElementById
(
this
.
id
));
this
.
chart
=
echarts
.
init
(
document
.
getElementById
(
this
.
id
))
this
.
chart
.
setOption
({
backgroundColor
:
'#394056'
,
...
...
src/components/Charts/mixChart.vue
View file @
551e911e
...
...
@@ -3,9 +3,9 @@
</
template
>
<
script
>
import
echarts
from
'echarts'
;
import
echarts
from
'echarts'
export
default
{
export
default
{
props
:
{
className
:
{
type
:
String
,
...
...
@@ -27,29 +27,29 @@
data
()
{
return
{
chart
:
null
};
}
},
mounted
()
{
this
.
initChart
();
this
.
chart
=
null
;
this
.
initChart
()
this
.
chart
=
null
},
beforeDestroy
()
{
if
(
!
this
.
chart
)
{
return
}
this
.
chart
.
dispose
();
this
.
chart
=
null
;
this
.
chart
.
dispose
()
this
.
chart
=
null
},
methods
:
{
initChart
()
{
this
.
chart
=
echarts
.
init
(
document
.
getElementById
(
this
.
id
));
this
.
chart
=
echarts
.
init
(
document
.
getElementById
(
this
.
id
))
const
xData
=
(
function
()
{
const
data
=
[];
const
data
=
[]
for
(
let
i
=
1
;
i
<
13
;
i
++
)
{
data
.
push
(
i
+
'月份'
);
data
.
push
(
i
+
'月份'
)
}
return
data
;
}());
return
data
}())
this
.
chart
.
setOption
({
backgroundColor
:
'#344b58'
,
title
:
{
...
...
@@ -150,7 +150,6 @@
color
:
'#fff'
},
borderColor
:
'#90979c'
},
{
type
:
'inside'
,
show
:
true
,
...
...
@@ -174,7 +173,7 @@
},
position
:
'insideTop'
,
formatter
(
p
)
{
return
p
.
value
>
0
?
p
.
value
:
''
;
return
p
.
value
>
0
?
p
.
value
:
''
}
}
}
...
...
@@ -207,7 +206,7 @@
show
:
true
,
position
:
'top'
,
formatter
(
p
)
{
return
p
.
value
>
0
?
p
.
value
:
''
;
return
p
.
value
>
0
?
p
.
value
:
''
}
}
}
...
...
@@ -240,7 +239,7 @@
show
:
true
,
position
:
'top'
,
formatter
(
p
)
{
return
p
.
value
>
0
?
p
.
value
:
''
;
return
p
.
value
>
0
?
p
.
value
:
''
}
}
}
...
...
@@ -264,5 +263,5 @@
})
}
}
}
}
</
script
>
src/components/Dropzone/index.vue
View file @
551e911e
...
...
@@ -5,13 +5,13 @@
</
template
>
<
script
>
import
Dropzone
from
'dropzone'
;
import
'dropzone/dist/dropzone.css'
;
import
Dropzone
from
'dropzone'
import
'dropzone/dist/dropzone.css'
// import { getToken } from 'api/qiniu';
Dropzone
.
autoDiscover
=
false
;
Dropzone
.
autoDiscover
=
false
export
default
{
export
default
{
data
()
{
return
{
dropzone
:
''
,
...
...
@@ -19,8 +19,8 @@
}
},
mounted
()
{
const
element
=
document
.
getElementById
(
this
.
id
);
const
vm
=
this
;
const
element
=
document
.
getElementById
(
this
.
id
)
const
vm
=
this
this
.
dropzone
=
new
Dropzone
(
element
,
{
clickable
:
this
.
clickable
,
thumbnailWidth
:
this
.
thumbnailWidth
,
...
...
@@ -35,26 +35,26 @@
dictMaxFilesExceeded
:
'只能一个图'
,
previewTemplate
:
'<div class="dz-preview dz-file-preview"> <div class="dz-image" style="width:'
+
this
.
thumbnailWidth
+
'px;height:'
+
this
.
thumbnailHeight
+
'px" ><img style="width:'
+
this
.
thumbnailWidth
+
'px;height:'
+
this
.
thumbnailHeight
+
'px" data-dz-thumbnail /></div> <div class="dz-details"><div class="dz-size"><span data-dz-size></span></div> <div class="dz-progress"><span class="dz-upload" data-dz-uploadprogress></span></div> <div class="dz-error-message"><span data-dz-errormessage></span></div> <div class="dz-success-mark"> <i class="material-icons">done</i> </div> <div class="dz-error-mark"><i class="material-icons">error</i></div></div>'
,
init
()
{
const
val
=
vm
.
defaultImg
;
if
(
!
val
)
return
;
const
val
=
vm
.
defaultImg
if
(
!
val
)
return
if
(
Array
.
isArray
(
val
))
{
if
(
val
.
length
===
0
)
return
;
if
(
val
.
length
===
0
)
return
val
.
map
((
v
,
i
)
=>
{
const
mockFile
=
{
name
:
'name'
+
i
,
size
:
12345
,
url
:
v
};
this
.
options
.
addedfile
.
call
(
this
,
mockFile
);
this
.
options
.
thumbnail
.
call
(
this
,
mockFile
,
v
);
mockFile
.
previewElement
.
classList
.
add
(
'dz-success'
);
mockFile
.
previewElement
.
classList
.
add
(
'dz-complete'
);
vm
.
initOnce
=
false
;
return
true
;
const
mockFile
=
{
name
:
'name'
+
i
,
size
:
12345
,
url
:
v
}
this
.
options
.
addedfile
.
call
(
this
,
mockFile
)
this
.
options
.
thumbnail
.
call
(
this
,
mockFile
,
v
)
mockFile
.
previewElement
.
classList
.
add
(
'dz-success'
)
mockFile
.
previewElement
.
classList
.
add
(
'dz-complete'
)
vm
.
initOnce
=
false
return
true
})
}
else
{
const
mockFile
=
{
name
:
'name'
,
size
:
12345
,
url
:
val
};
this
.
options
.
addedfile
.
call
(
this
,
mockFile
);
this
.
options
.
thumbnail
.
call
(
this
,
mockFile
,
val
);
mockFile
.
previewElement
.
classList
.
add
(
'dz-success'
);
mockFile
.
previewElement
.
classList
.
add
(
'dz-complete'
);
vm
.
initOnce
=
false
;
const
mockFile
=
{
name
:
'name'
,
size
:
12345
,
url
:
val
}
this
.
options
.
addedfile
.
call
(
this
,
mockFile
)
this
.
options
.
thumbnail
.
call
(
this
,
mockFile
,
val
)
mockFile
.
previewElement
.
classList
.
add
(
'dz-success'
)
mockFile
.
previewElement
.
classList
.
add
(
'dz-complete'
)
vm
.
initOnce
=
false
}
},
accept
:
(
file
,
done
)
=>
{
...
...
@@ -66,16 +66,14 @@
// file.url = response.data.qiniu_url;
// done();
// })
done
();
done
()
},
sending
:
(
file
,
xhr
,
formData
)
=>
{
/* 七牛*/
console
.
log
(
file
,
xhr
,
formData
)
// formData.append('token', file.token);
// formData.append('key', file.key);
vm
.
initOnce
=
false
;
vm
.
initOnce
=
false
}
});
})
if
(
this
.
couldPaste
)
{
document
.
addEventListener
(
'paste'
,
this
.
pasteImg
)
...
...
@@ -83,19 +81,19 @@
this
.
dropzone
.
on
(
'success'
,
file
=>
{
vm
.
$emit
(
'dropzone-success'
,
file
,
vm
.
dropzone
.
element
)
});
})
this
.
dropzone
.
on
(
'addedfile'
,
file
=>
{
vm
.
$emit
(
'dropzone-fileAdded'
,
file
)
});
})
this
.
dropzone
.
on
(
'removedfile'
,
file
=>
{
vm
.
$emit
(
'dropzone-removedFile'
,
file
)
});
})
this
.
dropzone
.
on
(
'error'
,
(
file
,
error
,
xhr
)
=>
{
vm
.
$emit
(
'dropzone-error'
,
file
,
error
,
xhr
)
});
})
this
.
dropzone
.
on
(
'successmultiple'
,
(
file
,
error
,
xhr
)
=>
{
vm
.
$emit
(
'dropzone-successmultiple'
,
file
,
error
,
xhr
)
});
})
},
methods
:
{
removeAllFiles
()
{
...
...
@@ -105,45 +103,45 @@
this
.
dropzone
.
processQueue
()
},
pasteImg
(
event
)
{
const
items
=
(
event
.
clipboardData
||
event
.
originalEvent
.
clipboardData
).
items
;
const
items
=
(
event
.
clipboardData
||
event
.
originalEvent
.
clipboardData
).
items
if
(
items
[
0
].
kind
===
'file'
)
{
this
.
dropzone
.
addFile
(
items
[
0
].
getAsFile
())
}
},
initImages
(
val
)
{
if
(
!
val
)
return
;
if
(
!
val
)
return
if
(
Array
.
isArray
(
val
))
{
val
.
map
((
v
,
i
)
=>
{
const
mockFile
=
{
name
:
'name'
+
i
,
size
:
12345
,
url
:
v
};
this
.
dropzone
.
options
.
addedfile
.
call
(
this
.
dropzone
,
mockFile
);
this
.
dropzone
.
options
.
thumbnail
.
call
(
this
.
dropzone
,
mockFile
,
v
);
mockFile
.
previewElement
.
classList
.
add
(
'dz-success'
);
mockFile
.
previewElement
.
classList
.
add
(
'dz-complete'
);
const
mockFile
=
{
name
:
'name'
+
i
,
size
:
12345
,
url
:
v
}
this
.
dropzone
.
options
.
addedfile
.
call
(
this
.
dropzone
,
mockFile
)
this
.
dropzone
.
options
.
thumbnail
.
call
(
this
.
dropzone
,
mockFile
,
v
)
mockFile
.
previewElement
.
classList
.
add
(
'dz-success'
)
mockFile
.
previewElement
.
classList
.
add
(
'dz-complete'
)
return
true
})
}
else
{
const
mockFile
=
{
name
:
'name'
,
size
:
12345
,
url
:
val
};
this
.
dropzone
.
options
.
addedfile
.
call
(
this
.
dropzone
,
mockFile
);
this
.
dropzone
.
options
.
thumbnail
.
call
(
this
.
dropzone
,
mockFile
,
val
);
mockFile
.
previewElement
.
classList
.
add
(
'dz-success'
);
mockFile
.
previewElement
.
classList
.
add
(
'dz-complete'
);
const
mockFile
=
{
name
:
'name'
,
size
:
12345
,
url
:
val
}
this
.
dropzone
.
options
.
addedfile
.
call
(
this
.
dropzone
,
mockFile
)
this
.
dropzone
.
options
.
thumbnail
.
call
(
this
.
dropzone
,
mockFile
,
val
)
mockFile
.
previewElement
.
classList
.
add
(
'dz-success'
)
mockFile
.
previewElement
.
classList
.
add
(
'dz-complete'
)
}
}
},
destroyed
()
{
document
.
removeEventListener
(
'paste'
,
this
.
pasteImg
);
this
.
dropzone
.
destroy
();
document
.
removeEventListener
(
'paste'
,
this
.
pasteImg
)
this
.
dropzone
.
destroy
()
},
watch
:
{
defaultImg
(
val
)
{
if
(
val
.
length
===
0
)
{
this
.
initOnce
=
false
;
return
;
this
.
initOnce
=
false
return
}
if
(
!
this
.
initOnce
)
return
;
this
.
initImages
(
val
);
this
.
initOnce
=
false
;
if
(
!
this
.
initOnce
)
return
this
.
initImages
(
val
)
this
.
initOnce
=
false
}
},
props
:
{
...
...
@@ -201,7 +199,7 @@
default
:
false
}
}
}
}
</
script
>
<
style
scoped
>
...
...
src/components/ErrLog/index.vue
View file @
551e911e
...
...
@@ -30,7 +30,7 @@
</template>
<
script
>
export
default
{
export
default
{
name
:
'errLog'
,
props
:
{
logsList
:
{
...
...
@@ -42,7 +42,7 @@
dialogTableVisible
:
false
}
}
}
}
</
script
>
<
style
scoped
>
...
...
src/components/Hamburger/index.vue
View file @
551e911e
...
...
@@ -13,7 +13,7 @@
</
template
>
<
script
>
export
default
{
export
default
{
name
:
'hamburger'
,
props
:
{
isActive
:
{
...
...
@@ -25,7 +25,7 @@
default
:
null
}
}
}
}
</
script
>
<
style
scoped
>
...
...
src/components/Icon-svg/index.vue
View file @
551e911e
...
...
@@ -5,7 +5,7 @@
</
template
>
<
script
>
export
default
{
export
default
{
name
:
'icon-svg'
,
props
:
{
iconClass
:
{
...
...
@@ -18,5 +18,5 @@
return
`#icon-
${
this
.
iconClass
}
`
}
}
}
}
</
script
>
src/components/ImageCropper/lang.js
View file @
551e911e
...
...
@@ -37,5 +37,5 @@ const langBag = {
lowestPx
:
'The lowest pixel in the image: '
}
}
}
;
export
default
langBag
;
}
export
default
langBag
src/components/MDinput/index.vue
View file @
551e911e
...
...
@@ -16,8 +16,8 @@
: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"
>
: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>
...
...
@@ -34,7 +34,7 @@
<
script
>
// source:https://github.com/wemake-services/vue-material-input/blob/master/src/components/MaterialInput.vue
export
default
{
export
default
{
name
:
'material-input'
,
computed
:
{
computedErrors
()
{
...
...
src/components/MdEditor/index.vue
View file @
551e911e
...
...
@@ -6,10 +6,10 @@
</
template
>
<
script
>
import
'simplemde/dist/simplemde.min.css'
;
import
SimpleMDE
from
'simplemde'
;
import
'simplemde/dist/simplemde.min.css'
import
SimpleMDE
from
'simplemde'
export
default
{
export
default
{
name
:
'simplemde-md'
,
props
:
{
value
:
String
,
...
...
@@ -41,12 +41,12 @@
return
{
simplemde
:
null
,
hasChange
:
false
};
}
},
watch
:
{
value
(
val
)
{
if
(
val
===
this
.
simplemde
.
value
()
&&
!
this
.
hasChange
)
return
;
this
.
simplemde
.
value
(
val
);
if
(
val
===
this
.
simplemde
.
value
()
&&
!
this
.
hasChange
)
return
this
.
simplemde
.
value
(
val
)
}
},
mounted
()
{
...
...
@@ -60,21 +60,21 @@
},
// hideIcons: ['guide', 'heading', 'quote', 'image', 'preview', 'side-by-side', 'fullscreen'],
placeholder
:
this
.
placeholder
});
})
if
(
this
.
value
)
{
this
.
simplemde
.
value
(
this
.
value
);
this
.
simplemde
.
value
(
this
.
value
)
}
this
.
simplemde
.
codemirror
.
on
(
'change'
,
()
=>
{
if
(
this
.
hasChange
)
{
this
.
hasChange
=
true
}
this
.
$emit
(
'input'
,
this
.
simplemde
.
value
());
});
this
.
$emit
(
'input'
,
this
.
simplemde
.
value
())
})
},
destroyed
()
{
this
.
simplemde
=
null
;
this
.
simplemde
=
null
}
}
;
}
</
script
>
<
style
>
...
...
src/components/PanThumb/index.vue
View file @
551e911e
...
...
@@ -10,7 +10,7 @@
</
template
>
<
script
>
export
default
{
export
default
{
name
:
'PanThumb'
,
props
:
{
image
:
{
...
...
@@ -30,7 +30,7 @@
default
:
'150px'
}
}
};
}
</
script
>
<
style
scoped
>
...
...
src/components/Screenfull/index.vue
View file @
551e911e
...
...
@@ -7,8 +7,8 @@
</
template
>
<
script
>
import
screenfull
from
'screenfull'
;
export
default
{
import
screenfull
from
'screenfull'
export
default
{
name
:
'hamburger'
,
props
:
{
width
:
{
...
...
@@ -35,13 +35,13 @@
this
.
$message
({
message
:
'you browser can not work'
,
type
:
'warning'
});
return
false
;
}
screenfull
.
toggle
();
})
return
false
}
screenfull
.
toggle
()
}
}
}
</
script
>
<
style
scoped
>
...
...
src/components/SplitPane/Pane.vue
View file @
551e911e
...
...
@@ -5,16 +5,16 @@
</
template
>
<
script
>
export
default
{
export
default
{
name
:
'Pane'
,
data
()
{
const
classes
=
[
'Pane'
,
this
.
$parent
.
split
,
'className'
];
const
classes
=
[
'Pane'
,
this
.
$parent
.
split
,
'className'
]
return
{
classes
:
classes
.
join
(
' '
),
percent
:
50
}
}
}
}
</
script
>
<
style
scoped
>
...
...
src/components/SplitPane/Resizer.vue
View file @
551e911e
...
...
@@ -3,7 +3,7 @@
</
template
>
<
script
>
export
default
{
export
default
{
props
:
{
split
:
{
validator
(
value
)
{
...
...
@@ -17,12 +17,12 @@
}
},
data
()
{
const
classes
=
[
'Resizer'
,
this
.
split
,
'className'
];
const
classes
=
[
'Resizer'
,
this
.
split
,
'className'
]
return
{
classes
:
classes
.
join
(
' '
)
}
}
}
}
</
script
>
<
style
scoped
>
...
...
src/components/SplitPane/index.vue
View file @
551e911e
...
...
@@ -11,9 +11,9 @@
</
template
>
<
script
>
import
Resizer
from
'./Resizer'
;
import
Pane
from
'./Pane'
;
export
default
{
import
Resizer
from
'./Resizer'
import
Pane
from
'./Pane'
export
default
{
name
:
'splitPane'
,
components
:
{
Resizer
,
Pane
},
props
:
{
...
...
@@ -49,48 +49,48 @@
methods
:
{
onClick
()
{
if
(
!
this
.
hasMoved
)
{
this
.
percent
=
50
;
this
.
$emit
(
'resize'
);
this
.
percent
=
50
this
.
$emit
(
'resize'
)
}
},
onMouseDown
()
{
this
.
active
=
true
;
this
.
hasMoved
=
false
;
this
.
active
=
true
this
.
hasMoved
=
false
},
onMouseUp
()
{
this
.
active
=
false
;
this
.
active
=
false
},
onMouseMove
(
e
)
{
if
(
e
.
buttons
===
0
||
e
.
which
===
0
)
{
this
.
active
=
false
;
this
.
active
=
false
}
if
(
this
.
active
)
{
let
offset
=
0
;
let
target
=
e
.
currentTarget
;
let
offset
=
0
let
target
=
e
.
currentTarget
if
(
this
.
split
===
'vertical'
)
{
while
(
target
)
{
offset
+=
target
.
offsetLeft
;
target
=
target
.
offsetParent
;
offset
+=
target
.
offsetLeft
target
=
target
.
offsetParent
}
}
else
{
while
(
target
)
{
offset
+=
target
.
offsetTop
;
target
=
target
.
offsetParent
;
offset
+=
target
.
offsetTop
target
=
target
.
offsetParent
}
}
const
currentPage
=
this
.
split
===
'vertical'
?
e
.
pageX
:
e
.
pageY
;
const
targetOffset
=
this
.
split
===
'vertical'
?
e
.
currentTarget
.
offsetWidth
:
e
.
currentTarget
.
offsetHeight
;
const
percent
=
Math
.
floor
(((
currentPage
-
offset
)
/
targetOffset
)
*
10000
)
/
100
;
const
currentPage
=
this
.
split
===
'vertical'
?
e
.
pageX
:
e
.
pageY
const
targetOffset
=
this
.
split
===
'vertical'
?
e
.
currentTarget
.
offsetWidth
:
e
.
currentTarget
.
offsetHeight
const
percent
=
Math
.
floor
(((
currentPage
-
offset
)
/
targetOffset
)
*
10000
)
/
100
if
(
percent
>
this
.
margin
&&
percent
<
100
-
this
.
margin
)
{
this
.
percent
=
percent
;
}
this
.
$emit
(
'resize'
);
this
.
hasMoved
=
true
;
this
.
percent
=
percent
}
this
.
$emit
(
'resize'
)
this
.
hasMoved
=
true
}
}
}
}
</
script
>
<
style
scoped
>
...
...
src/components/Sticky/index.vue
View file @
551e911e
...
...
@@ -9,7 +9,7 @@
</
template
>
<
script
>
export
default
{
export
default
{
name
:
'Sticky'
,
props
:
{
stickyTop
:
{
...
...
@@ -34,41 +34,41 @@
child
:
null
,
stickyHeight
:
0
};
}
},
methods
:
{
sticky
()
{
if
(
this
.
active
)
{
return
}
this
.
position
=
'fixed'
;
this
.
active
=
true
;
this
.
width
=
this
.
width
+
'px'
;
this
.
position
=
'fixed'
this
.
active
=
true
this
.
width
=
this
.
width
+
'px'
},
reset
()
{
if
(
!
this
.
active
)
{
return
}
this
.
position
=
''
;
this
.
position
=
''
this
.
width
=
'auto'
this
.
active
=
false
},
handleScroll
()
{
this
.
width
=
this
.
$el
.
getBoundingClientRect
().
width
;
const
offsetTop
=
this
.
$el
.
getBoundingClientRect
().
top
;
this
.
width
=
this
.
$el
.
getBoundingClientRect
().
width
const
offsetTop
=
this
.
$el
.
getBoundingClientRect
().
top
if
(
offsetTop
<=
this
.
stickyTop
)
{
this
.
sticky
();
this
.
sticky
()
return
}
this
.
reset
()
}
},
mounted
()
{
this
.
height
=
this
.
$el
.
getBoundingClientRect
().
height
;
window
.
addEventListener
(
'scroll'
,
this
.
handleScroll
);
this
.
height
=
this
.
$el
.
getBoundingClientRect
().
height
window
.
addEventListener
(
'scroll'
,
this
.
handleScroll
)
},
destroyed
()
{
window
.
removeEventListener
(
'scroll'
,
this
.
handleScroll
);
window
.
removeEventListener
(
'scroll'
,
this
.
handleScroll
)
}
};
}
</
script
>
src/components/Tinymce/index.vue
View file @
551e911e
...
...
@@ -5,8 +5,7 @@
</
template
>
<
script
>
// import { getToken, upload } from 'api/qiniu'; // 七牛
export
default
{
export
default
{
name
:
'tinymce'
,
props
:
{
id
:
{
...
...
@@ -42,13 +41,13 @@
watch
:
{
value
(
val
)
{
if
(
!
this
.
hasChange
&&
this
.
hasInit
)
{
this
.
$nextTick
(()
=>
tinymce
.
get
(
this
.
id
).
setContent
(
val
))
this
.
$nextTick
(()
=>
window
.
tinymce
.
get
(
this
.
id
).
setContent
(
val
))
}
}
},
mounted
()
{
const
_this
=
this
;
tinymce
.
init
({
const
_this
=
this
window
.
tinymce
.
init
({
selector
:
`#
${
this
.
id
}
`
,
height
:
this
.
height
,
body_class
:
'panel-body '
,
...
...
@@ -73,11 +72,11 @@
if
(
_this
.
value
)
{
editor
.
setContent
(
_this
.
value
)
}
_this
.
hasInit
=
true
;
_this
.
hasInit
=
true
editor
.
on
(
'NodeChange Change KeyUp'
,
()
=>
{
this
.
hasChange
=
true
;
this
.
$emit
(
'input'
,
editor
.
getContent
({
format
:
'raw'
}));
});
this
.
hasChange
=
true
this
.
$emit
(
'input'
,
editor
.
getContent
({
format
:
'raw'
}))
})
},
// 整合七牛上传
// images_dataimg_filter(img) {
...
...
@@ -117,39 +116,39 @@
title
:
'小标题'
,
// tooltip text seen on mouseover
text
:
'小标题'
,
onclick
()
{
editor
.
execCommand
(
'mceToggleFormat'
,
false
,
'h2'
);
editor
.
execCommand
(
'mceToggleFormat'
,
false
,
'h2'
)
},
onPostRender
()
{
const
btn
=
this
;
const
btn
=
this
editor
.
on
(
'init'
,
()
=>
{
editor
.
formatter
.
formatChanged
(
'h2'
,
state
=>
{
btn
.
active
(
state
);
});
});
btn
.
active
(
state
)
})
})
}
});
})
editor
.
addButton
(
'p'
,
{
title
:
'正文'
,
text
:
'正文'
,
onclick
()
{
editor
.
execCommand
(
'mceToggleFormat'
,
false
,
'p'
);
editor
.
execCommand
(
'mceToggleFormat'
,
false
,
'p'
)
},
onPostRender
()
{
const
btn
=
this
;
const
btn
=
this
editor
.
on
(
'init'
,
()
=>
{
editor
.
formatter
.
formatChanged
(
'p'
,
state
=>
{
btn
.
active
(
state
);
});
});
btn
.
active
(
state
)
})
})
}
});
})
}
});
})
},
destroyed
()
{
tinymce
.
get
(
this
.
id
).
destroy
();
}
window
.
tinymce
.
get
(
this
.
id
).
destroy
()
}
}
</
script
>
<
style
scoped
>
...
...
src/components/TodoList/index.vue
View file @
551e911e
...
...
@@ -84,12 +84,10 @@ export default {
this
.
setLocalStorgae
()
},
deleteTodo
(
todo
)
{
console
.
log
(
todo
)
this
.
todos
.
splice
(
this
.
todos
.
indexOf
(
todo
),
1
)
this
.
setLocalStorgae
()
},
editTodo
({
todo
,
value
})
{
console
.
log
(
todo
,
value
)
todo
.
text
=
value
this
.
setLocalStorgae
()
},
...
...
src/components/Upload/singleImage.vue
View file @
551e911e
...
...
@@ -17,9 +17,10 @@
</
template
>
<
script
>
// 预览效果见付费文章
import
{
getToken
}
from
'api/qiniu'
;
export
default
{
// 预览效果见付费文章
import
{
getToken
}
from
'api/qiniu'
export
default
{
name
:
'singleImageUpload'
,
props
:
{
value
:
String
...
...
@@ -33,36 +34,36 @@
return
{
tempUrl
:
''
,
dataObj
:
{
token
:
''
,
key
:
''
}
}
;
}
},
methods
:
{
rmImage
()
{
this
.
emitInput
(
''
);
this
.
emitInput
(
''
)
},
emitInput
(
val
)
{
this
.
$emit
(
'input'
,
val
);
this
.
$emit
(
'input'
,
val
)
},
handleImageScucess
()
{
this
.
emitInput
(
this
.
tempUrl
)
},
beforeUpload
()
{
const
_self
=
this
;
const
_self
=
this
return
new
Promise
((
resolve
,
reject
)
=>
{
getToken
().
then
(
response
=>
{
const
key
=
response
.
data
.
qiniu_key
;
const
token
=
response
.
data
.
qiniu_token
;
_self
.
_data
.
dataObj
.
token
=
token
;
_self
.
_data
.
dataObj
.
key
=
key
;
this
.
tempUrl
=
response
.
data
.
qiniu_url
;
resolve
(
true
);
const
key
=
response
.
data
.
qiniu_key
const
token
=
response
.
data
.
qiniu_token
_self
.
_data
.
dataObj
.
token
=
token
_self
.
_data
.
dataObj
.
key
=
key
this
.
tempUrl
=
response
.
data
.
qiniu_url
resolve
(
true
)
}).
catch
(
err
=>
{
console
.
log
(
err
);
console
.
log
(
err
)
reject
(
false
)
})
;
})
;
})
})
}
}
};
}
</
script
>
<
style
rel=
"stylesheet/scss"
lang=
"scss"
scoped
>
...
...
src/components/Upload/singleImage2.vue
View file @
551e911e
...
...
@@ -18,8 +18,8 @@
<
script
>
// 预览效果见专题
import
{
getToken
}
from
'api/qiniu'
;
export
default
{
import
{
getToken
}
from
'api/qiniu'
export
default
{
name
:
'singleImageUpload2'
,
props
:
{
value
:
String
...
...
@@ -33,36 +33,35 @@
return
{
tempUrl
:
''
,
dataObj
:
{
token
:
''
,
key
:
''
}
}
;
}
},
methods
:
{
rmImage
()
{
this
.
emitInput
(
''
)
;
this
.
emitInput
(
''
)
},
emitInput
(
val
)
{
this
.
$emit
(
'input'
,
val
)
;
this
.
$emit
(
'input'
,
val
)
},
handleImageScucess
()
{
this
.
emitInput
(
this
.
tempUrl
)
},
beforeUpload
()
{
const
_self
=
this
;
const
_self
=
this
return
new
Promise
((
resolve
,
reject
)
=>
{
getToken
().
then
(
response
=>
{
const
key
=
response
.
data
.
qiniu_key
;
const
token
=
response
.
data
.
qiniu_token
;
_self
.
_data
.
dataObj
.
token
=
token
;
_self
.
_data
.
dataObj
.
key
=
key
;
this
.
tempUrl
=
response
.
data
.
qiniu_url
;
resolve
(
true
);
}).
catch
(
err
=>
{
console
.
log
(
err
);
const
key
=
response
.
data
.
qiniu_key
const
token
=
response
.
data
.
qiniu_token
_self
.
_data
.
dataObj
.
token
=
token
_self
.
_data
.
dataObj
.
key
=
key
this
.
tempUrl
=
response
.
data
.
qiniu_url
resolve
(
true
)
}).
catch
(()
=>
{
reject
(
false
)
});
});
})
})
}
}
}
};
</
script
>
<
style
rel=
"stylesheet/scss"
lang=
"scss"
scoped
>
...
...
src/components/Upload/singleImage3.vue
View file @
551e911e
...
...
@@ -27,8 +27,8 @@
<
script
>
// 预览效果见文章
import
{
getToken
}
from
'api/qiniu'
;
export
default
{
import
{
getToken
}
from
'api/qiniu'
export
default
{
name
:
'singleImageUpload'
,
props
:
{
value
:
String
...
...
@@ -42,36 +42,36 @@
return
{
tempUrl
:
''
,
dataObj
:
{
token
:
''
,
key
:
''
}
}
;
}
},
methods
:
{
rmImage
()
{
this
.
emitInput
(
''
)
;
this
.
emitInput
(
''
)
},
emitInput
(
val
)
{
this
.
$emit
(
'input'
,
val
)
;
this
.
$emit
(
'input'
,
val
)
},
handleImageScucess
(
file
)
{
this
.
emitInput
(
file
.
files
.
file
)
},
beforeUpload
()
{
const
_self
=
this
;
const
_self
=
this
return
new
Promise
((
resolve
,
reject
)
=>
{
getToken
().
then
(
response
=>
{
const
key
=
response
.
data
.
qiniu_key
;
const
token
=
response
.
data
.
qiniu_token
;
_self
.
_data
.
dataObj
.
token
=
token
;
_self
.
_data
.
dataObj
.
key
=
key
;
this
.
tempUrl
=
response
.
data
.
qiniu_url
;
resolve
(
true
);
const
key
=
response
.
data
.
qiniu_key
const
token
=
response
.
data
.
qiniu_token
_self
.
_data
.
dataObj
.
token
=
token
_self
.
_data
.
dataObj
.
key
=
key
this
.
tempUrl
=
response
.
data
.
qiniu_url
resolve
(
true
)
}).
catch
(
err
=>
{
console
.
log
(
err
)
;
console
.
log
(
err
)
reject
(
false
)
});
});
})
})
}
}
}
};
</
script
>
<
style
rel=
"stylesheet/scss"
lang=
"scss"
scoped
>
...
...
src/components/jsonEditor/index.vue
View file @
551e911e
...
...
@@ -5,16 +5,16 @@
</
template
>
<
script
>
import
CodeMirror
from
'codemirror'
;
import
'codemirror/addon/lint/lint.css'
;
import
'codemirror/lib/codemirror.css'
;
import
'codemirror/theme/rubyblue.css'
;
require
(
'script-loader!jsonlint'
);
import
'codemirror/mode/javascript/javascript'
import
'codemirror/addon/lint/lint'
import
'codemirror/addon/lint/json-lint'
;
import
CodeMirror
from
'codemirror'
import
'codemirror/addon/lint/lint.css'
import
'codemirror/lib/codemirror.css'
import
'codemirror/theme/rubyblue.css'
require
(
'script-loader!jsonlint'
)
import
'codemirror/mode/javascript/javascript'
import
'codemirror/addon/lint/lint'
import
'codemirror/addon/lint/json-lint'
export
default
{
export
default
{
name
:
'jsonEditor'
,
data
()
{
return
{
...
...
@@ -24,9 +24,9 @@
props
:
[
'value'
],
watch
:
{
value
(
value
)
{
const
editor_value
=
this
.
jsonEditor
.
getValue
();
const
editor_value
=
this
.
jsonEditor
.
getValue
()
if
(
value
!==
editor_value
)
{
this
.
jsonEditor
.
setValue
(
JSON
.
stringify
(
this
.
value
,
null
,
2
));
this
.
jsonEditor
.
setValue
(
JSON
.
stringify
(
this
.
value
,
null
,
2
))
}
}
},
...
...
@@ -37,9 +37,9 @@
gutters
:
[
'CodeMirror-lint-markers'
],
theme
:
'rubyblue'
,
lint
:
true
});
})
this
.
jsonEditor
.
setValue
(
JSON
.
stringify
(
this
.
value
,
null
,
2
));
this
.
jsonEditor
.
setValue
(
JSON
.
stringify
(
this
.
value
,
null
,
2
))
this
.
jsonEditor
.
on
(
'change'
,
cm
=>
{
this
.
$emit
(
'changed'
,
cm
.
getValue
())
this
.
$emit
(
'input'
,
cm
.
getValue
())
...
...
@@ -50,7 +50,7 @@
return
this
.
jsonEditor
.
getValue
()
}
}
}
}
</
script
>
<
style
>
...
...
src/components/twoDndList/index.vue
View file @
551e911e
...
...
@@ -26,8 +26,8 @@
</
template
>
<
script
>
import
draggable
from
'vuedraggable'
export
default
{
import
draggable
from
'vuedraggable'
export
default
{
name
:
'twoDndList'
,
components
:
{
draggable
},
computed
:
{
...
...
@@ -36,7 +36,7 @@
if
(
this
.
isNotInList1
(
v
))
{
return
v
}
return
false
;
return
false
})
}
},
...
...
@@ -80,7 +80,7 @@
deleteEle
(
ele
)
{
for
(
const
item
of
this
.
list1
)
{
if
(
item
.
id
===
ele
.
id
)
{
const
index
=
this
.
list1
.
indexOf
(
item
);
const
index
=
this
.
list1
.
indexOf
(
item
)
this
.
list1
.
splice
(
index
,
1
)
break
}
...
...
@@ -93,7 +93,7 @@
this
.
list1
.
push
(
ele
)
}
}
}
}
</
script
>
<
style
rel=
"stylesheet/scss"
lang=
"scss"
scoped
>
...
...
src/directive/sticky.js
View file @
551e911e
const
vueSticky
=
{}
;
let
listenAction
;
const
vueSticky
=
{}
let
listenAction
vueSticky
.
install
=
Vue
=>
{
Vue
.
directive
(
'sticky'
,
{
inserted
(
el
,
binding
)
{
const
params
=
binding
.
value
||
{}
,
stickyTop
=
params
.
stickyTop
||
0
,
zIndex
=
params
.
zIndex
||
1000
,
elStyle
=
el
.
style
;
const
params
=
binding
.
value
||
{}
const
stickyTop
=
params
.
stickyTop
||
0
const
zIndex
=
params
.
zIndex
||
1000
const
elStyle
=
el
.
style
elStyle
.
position
=
'-webkit-sticky'
;
elStyle
.
position
=
'sticky'
;
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
}
`
;
const
elHeight
=
el
.
getBoundingClientRect
().
height
const
elWidth
=
el
.
getBoundingClientRect
().
width
elStyle
.
cssText
=
`top:
${
stickyTop
}
px; z-index:
${
zIndex
}
`
const
parentElm
=
el
.
parentNode
||
document
.
documentElement
;
const
placeholder
=
document
.
createElement
(
'div'
)
;
placeholder
.
style
.
display
=
'none'
;
placeholder
.
style
.
width
=
`
${
elWidth
}
px`
;
placeholder
.
style
.
height
=
`
${
elHeight
}
px`
;
const
parentElm
=
el
.
parentNode
||
document
.
documentElement
const
placeholder
=
document
.
createElement
(
'div'
)
placeholder
.
style
.
display
=
'none'
placeholder
.
style
.
width
=
`
${
elWidth
}
px`
placeholder
.
style
.
height
=
`
${
elHeight
}
px`
parentElm
.
insertBefore
(
placeholder
,
el
)
let
active
=
false
;
let
active
=
false
const
getScroll
=
(
target
,
top
)
=>
{
const
prop
=
top
?
'pageYOffset'
:
'pageXOffset'
;
const
method
=
top
?
'scrollTop'
:
'scrollLeft'
;
let
ret
=
target
[
prop
]
;
const
prop
=
top
?
'pageYOffset'
:
'pageXOffset'
const
method
=
top
?
'scrollTop'
:
'scrollLeft'
let
ret
=
target
[
prop
]
if
(
typeof
ret
!==
'number'
)
{
ret
=
window
.
document
.
documentElement
[
method
];
ret
=
window
.
document
.
documentElement
[
method
]
}
return
ret
}
return
ret
;
};
const
sticky
=
()
=>
{
if
(
active
)
{
...
...
@@ -47,36 +47,36 @@ vueSticky.install = Vue => {
elStyle
.
height
=
`
${
el
.
offsetHeight
}
px`
}
elStyle
.
position
=
'fixed'
;
elStyle
.
width
=
`
${
elWidth
}
px`
;
placeholder
.
style
.
display
=
'inline-block'
;
elStyle
.
position
=
'fixed'
elStyle
.
width
=
`
${
elWidth
}
px`
placeholder
.
style
.
display
=
'inline-block'
active
=
true
}
;
}
const
reset
=
()
=>
{
if
(
!
active
)
{
return
}
elStyle
.
position
=
''
;
placeholder
.
style
.
display
=
'none'
;
active
=
false
;
}
;
elStyle
.
position
=
''
placeholder
.
style
.
display
=
'none'
active
=
false
}
const
check
=
()
=>
{
const
scrollTop
=
getScroll
(
window
,
true
)
;
const
offsetTop
=
el
.
getBoundingClientRect
().
top
;
const
scrollTop
=
getScroll
(
window
,
true
)
const
offsetTop
=
el
.
getBoundingClientRect
().
top
if
(
offsetTop
<
stickyTop
)
{
sticky
()
;
sticky
()
}
else
{
if
(
scrollTop
<
elHeight
+
stickyTop
)
{
reset
()
}
}
}
;
}
listenAction
=
()
=>
{
check
()
}
;
}
window
.
addEventListener
(
'scroll'
,
listenAction
)
},
...
...
@@ -85,7 +85,7 @@ vueSticky.install = Vue => {
window
.
removeEventListener
(
'scroll'
,
listenAction
)
}
})
}
;
}
export
default
vueSticky
src/directive/waves.js
View file @
551e911e
import
'./waves.css'
;
import
'./waves.css'
export
default
{
bind
(
el
,
binding
)
{
el
.
addEventListener
(
'click'
,
e
=>
{
const
customOpts
=
Object
.
assign
({},
binding
.
value
)
;
const
customOpts
=
Object
.
assign
({},
binding
.
value
)
const
opts
=
Object
.
assign
({
ele
:
el
,
// 波纹作用元素
type
:
'hit'
,
// hit点击位置扩散center中心点扩展
color
:
'rgba(0, 0, 0, 0.15)'
// 波纹颜色
},
customOpts
),
target
=
opts
.
ele
;
},
customOpts
)
const
target
=
opts
.
ele
if
(
target
)
{
target
.
style
.
position
=
'relative'
;
target
.
style
.
overflow
=
'hidden'
;
const
rect
=
target
.
getBoundingClientRect
()
;
let
ripple
=
target
.
querySelector
(
'.waves-ripple'
)
;
target
.
style
.
position
=
'relative'
target
.
style
.
overflow
=
'hidden'
const
rect
=
target
.
getBoundingClientRect
()
let
ripple
=
target
.
querySelector
(
'.waves-ripple'
)
if
(
!
ripple
)
{
ripple
=
document
.
createElement
(
'span'
)
;
ripple
.
className
=
'waves-ripple'
;
ripple
.
style
.
height
=
ripple
.
style
.
width
=
Math
.
max
(
rect
.
width
,
rect
.
height
)
+
'px'
;
target
.
appendChild
(
ripple
)
;
ripple
=
document
.
createElement
(
'span'
)
ripple
.
className
=
'waves-ripple'
ripple
.
style
.
height
=
ripple
.
style
.
width
=
Math
.
max
(
rect
.
width
,
rect
.
height
)
+
'px'
target
.
appendChild
(
ripple
)
}
else
{
ripple
.
className
=
'waves-ripple'
;
ripple
.
className
=
'waves-ripple'
}
switch
(
opts
.
type
)
{
case
'center'
:
ripple
.
style
.
top
=
(
rect
.
height
/
2
-
ripple
.
offsetHeight
/
2
)
+
'px'
;
ripple
.
style
.
left
=
(
rect
.
width
/
2
-
ripple
.
offsetWidth
/
2
)
+
'px'
;
break
;
ripple
.
style
.
top
=
(
rect
.
height
/
2
-
ripple
.
offsetHeight
/
2
)
+
'px'
ripple
.
style
.
left
=
(
rect
.
width
/
2
-
ripple
.
offsetWidth
/
2
)
+
'px'
break
default
:
ripple
.
style
.
top
=
(
e
.
pageY
-
rect
.
top
-
ripple
.
offsetHeight
/
2
-
document
.
body
.
scrollTop
)
+
'px'
;
ripple
.
style
.
left
=
(
e
.
pageX
-
rect
.
left
-
ripple
.
offsetWidth
/
2
-
document
.
body
.
scrollLeft
)
+
'px'
;
ripple
.
style
.
top
=
(
e
.
pageY
-
rect
.
top
-
ripple
.
offsetHeight
/
2
-
document
.
body
.
scrollTop
)
+
'px'
ripple
.
style
.
left
=
(
e
.
pageX
-
rect
.
left
-
ripple
.
offsetWidth
/
2
-
document
.
body
.
scrollLeft
)
+
'px'
}
ripple
.
style
.
backgroundColor
=
opts
.
color
;
ripple
.
className
=
'waves-ripple z-active'
;
return
false
;
ripple
.
style
.
backgroundColor
=
opts
.
color
ripple
.
className
=
'waves-ripple z-active'
return
false
}
},
false
)
;
},
false
)
}
}
src/errorLog.js
View file @
551e911e
...
...
@@ -4,11 +4,11 @@ import errLog from '@/store/errLog'
// 生产环境错误日志
if
(
process
.
env
.
NODE_ENV
===
'production'
)
{
Vue
.
config
.
errorHandler
=
function
(
err
,
vm
)
{
console
.
log
(
err
,
window
.
location
.
href
)
;
console
.
log
(
err
,
window
.
location
.
href
)
errLog
.
pushLog
({
err
,
url
:
window
.
location
.
href
,
vm
})
}
;
}
}
src/filters/index.js
View file @
551e911e
...
...
@@ -5,7 +5,7 @@ function pluralize(time, label) {
return
time
+
label
+
's'
}
export
function
timeAgo
(
time
)
{
const
between
=
Date
.
now
()
/
1000
-
Number
(
time
)
;
const
between
=
Date
.
now
()
/
1000
-
Number
(
time
)
if
(
between
<
3600
)
{
return
pluralize
(
~~
(
between
/
60
),
' minute'
)
}
else
if
(
between
<
86400
)
{
...
...
@@ -17,19 +17,19 @@ export function timeAgo(time) {
export
function
parseTime
(
time
,
cFormat
)
{
if
(
arguments
.
length
===
0
)
{
return
null
;
return
null
}
if
((
time
+
''
).
length
===
10
)
{
time
=
+
time
*
1000
}
const
format
=
cFormat
||
'{y}-{m}-{d} {h}:{i}:{s}'
;
let
date
;
if
(
typeof
time
==
'object'
)
{
date
=
time
;
const
format
=
cFormat
||
'{y}-{m}-{d} {h}:{i}:{s}'
let
date
if
(
typeof
time
==
=
'object'
)
{
date
=
time
}
else
{
date
=
new
Date
(
parseInt
(
time
))
;
date
=
new
Date
(
parseInt
(
time
))
}
const
formatObj
=
{
y
:
date
.
getFullYear
(),
...
...
@@ -39,24 +39,24 @@ export function parseTime(time, cFormat) {
i
:
date
.
getMinutes
(),
s
:
date
.
getSeconds
(),
a
:
date
.
getDay
()
}
;
}
const
time_str
=
format
.
replace
(
/{
(
y|m|d|h|i|s|a
)
+}/g
,
(
result
,
key
)
=>
{
let
value
=
formatObj
[
key
]
;
if
(
key
===
'a'
)
return
[
'一'
,
'二'
,
'三'
,
'四'
,
'五'
,
'六'
,
'日'
][
value
-
1
]
;
let
value
=
formatObj
[
key
]
if
(
key
===
'a'
)
return
[
'一'
,
'二'
,
'三'
,
'四'
,
'五'
,
'六'
,
'日'
][
value
-
1
]
if
(
result
.
length
>
0
&&
value
<
10
)
{
value
=
'0'
+
value
;
value
=
'0'
+
value
}
return
value
||
0
;
})
;
return
time_str
;
return
value
||
0
})
return
time_str
}
export
function
formatTime
(
time
,
option
)
{
time
=
+
time
*
1000
;
const
d
=
new
Date
(
time
)
;
const
now
=
Date
.
now
()
;
time
=
+
time
*
1000
const
d
=
new
Date
(
time
)
const
now
=
Date
.
now
()
const
diff
=
(
now
-
d
)
/
1000
;
const
diff
=
(
now
-
d
)
/
1000
if
(
diff
<
30
)
{
return
'刚刚'
...
...
@@ -83,21 +83,21 @@ export function nFormatter(num, digits) {
{
value
:
1
E9
,
symbol
:
'G'
},
{
value
:
1
E6
,
symbol
:
'M'
},
{
value
:
1
E3
,
symbol
:
'k'
}
]
;
]
for
(
let
i
=
0
;
i
<
si
.
length
;
i
++
)
{
if
(
num
>=
si
[
i
].
value
)
{
return
(
num
/
si
[
i
].
value
+
0.1
).
toFixed
(
digits
).
replace
(
/
\.
0+$|
(\.[
0-9
]
*
[
1-9
])
0+$/
,
'$1'
)
+
si
[
i
].
symbol
;
return
(
num
/
si
[
i
].
value
+
0.1
).
toFixed
(
digits
).
replace
(
/
\.
0+$|
(\.[
0-9
]
*
[
1-9
])
0+$/
,
'$1'
)
+
si
[
i
].
symbol
}
}
return
num
.
toString
()
;
return
num
.
toString
()
}
export
function
html2Text
(
val
)
{
const
div
=
document
.
createElement
(
'div'
)
;
div
.
innerHTML
=
val
;
return
div
.
textContent
||
div
.
innerText
;
const
div
=
document
.
createElement
(
'div'
)
div
.
innerHTML
=
val
return
div
.
textContent
||
div
.
innerText
}
export
function
toThousandslsFilter
(
num
)
{
return
(
+
num
||
0
).
toString
().
replace
(
/^-
?\d
+/g
,
m
=>
m
.
replace
(
/
(?=(?!\b)(\d{3})
+$
)
/g
,
','
))
;
return
(
+
num
||
0
).
toString
().
replace
(
/^-
?\d
+/g
,
m
=>
m
.
replace
(
/
(?=(?!\b)(\d{3})
+$
)
/g
,
','
))
}
src/main.js
View file @
551e911e
...
...
@@ -29,5 +29,3 @@ new Vue({
template
:
'<App/>'
,
components
:
{
App
}
})
src/mock/article.js
View file @
551e911e
import
Mock
from
'mockjs'
;
const
List
=
[];
const
count
=
20
;
import
Mock
from
'mockjs'
const
List
=
[]
const
count
=
20
for
(
let
i
=
0
;
i
<
count
;
i
++
)
{
List
.
push
(
Mock
.
mock
({
...
...
@@ -13,7 +11,7 @@ for (let i = 0; i < count; i++) {
author
:
'@cname'
,
display_time
:
'@datetime'
,
pageviews
:
'@integer(300, 5000)'
}))
;
}))
}
export
default
{
...
...
@@ -34,4 +32,4 @@ export default {
tags
:
[],
title
:
''
})
}
;
}
src/mock/article_table.js
View file @
551e911e
import
Mock
from
'mockjs'
;
import
{
param2Obj
}
from
'utils'
;
import
Mock
from
'mockjs'
import
{
param2Obj
}
from
'utils'
const
List
=
[]
;
const
count
=
100
;
const
List
=
[]
const
count
=
100
for
(
let
i
=
0
;
i
<
count
;
i
++
)
{
List
.
push
(
Mock
.
mock
({
...
...
@@ -16,23 +16,23 @@ for (let i = 0; i < count; i++) {
'type|1'
:
[
'CN'
,
'US'
,
'JP'
,
'EU'
],
'status|1'
:
[
'published'
,
'draft'
,
'deleted'
],
pageviews
:
'@integer(300, 5000)'
}))
;
}))
}
export
default
{
getList
:
config
=>
{
const
{
importance
,
type
,
title
,
page
,
limit
,
sort
}
=
param2Obj
(
config
.
url
)
;
const
{
importance
,
type
,
title
,
page
,
limit
,
sort
}
=
param2Obj
(
config
.
url
)
let
mockList
=
List
.
filter
(
item
=>
{
if
(
importance
&&
item
.
importance
!==
+
importance
)
return
false
;
if
(
type
&&
item
.
type
!==
type
)
return
false
;
if
(
title
&&
item
.
title
.
indexOf
(
title
)
<
0
)
return
false
;
return
true
;
})
;
if
(
importance
&&
item
.
importance
!==
+
importance
)
return
false
if
(
type
&&
item
.
type
!==
type
)
return
false
if
(
title
&&
item
.
title
.
indexOf
(
title
)
<
0
)
return
false
return
true
})
if
(
sort
===
'-id'
)
{
mockList
=
mockList
.
reverse
()
}
const
pageList
=
mockList
.
filter
((
item
,
index
)
=>
index
<
limit
*
page
&&
index
>=
limit
*
(
page
-
1
))
;
const
pageList
=
mockList
.
filter
((
item
,
index
)
=>
index
<
limit
*
page
&&
index
>=
limit
*
(
page
-
1
))
return
{
total
:
mockList
.
length
,
items
:
pageList
...
...
@@ -41,4 +41,4 @@ export default {
getPv
:
()
=>
({
pvData
:
[{
key
:
'PC网站'
,
pv
:
1024
},
{
key
:
'mobile网站'
,
pv
:
1024
},
{
key
:
'ios'
,
pv
:
1024
},
{
key
:
'android'
,
pv
:
1024
}]
})
}
;
}
src/mock/login.js
View file @
551e911e
import
{
param2Obj
}
from
'utils'
;
import
{
param2Obj
}
from
'utils'
const
userMap
=
{
admin
:
{
...
...
@@ -26,16 +26,16 @@ const userMap = {
export
default
{
loginByUsername
:
config
=>
{
const
{
username
}
=
JSON
.
parse
(
config
.
body
)
;
return
userMap
[
username
]
;
const
{
username
}
=
JSON
.
parse
(
config
.
body
)
return
userMap
[
username
]
},
getInfo
:
config
=>
{
const
{
token
}
=
param2Obj
(
config
.
url
)
;
const
{
token
}
=
param2Obj
(
config
.
url
)
if
(
userMap
[
token
])
{
return
userMap
[
token
]
;
return
userMap
[
token
]
}
else
{
return
Promise
.
reject
(
'error'
)
;
return
Promise
.
reject
(
'error'
)
}
},
logout
:
()
=>
'success'
}
;
}
src/mock/remoteSearch.js
View file @
551e911e
import
Mock
from
'mockjs'
;
import
{
param2Obj
}
from
'utils'
;
import
Mock
from
'mockjs'
import
{
param2Obj
}
from
'utils'
const
NameList
=
[]
;
const
count
=
100
;
const
NameList
=
[]
const
count
=
100
for
(
let
i
=
0
;
i
<
count
;
i
++
)
{
NameList
.
push
(
Mock
.
mock
({
name
:
'@first'
}))
;
}))
}
NameList
.
push
({
name
:
'mockPan'
})
export
default
{
searchUser
:
config
=>
{
const
{
name
}
=
param2Obj
(
config
.
url
)
;
const
{
name
}
=
param2Obj
(
config
.
url
)
const
mockNameList
=
NameList
.
filter
(
item
=>
{
const
lowerCaseName
=
item
.
name
.
toLowerCase
()
if
(
name
&&
lowerCaseName
.
indexOf
(
name
.
toLowerCase
())
<
0
)
return
false
;
return
true
;
})
;
if
(
name
&&
lowerCaseName
.
indexOf
(
name
.
toLowerCase
())
<
0
)
return
false
return
true
})
return
{
items
:
mockNameList
}
}
}
;
}
src/permission.js
View file @
551e911e
...
...
@@ -36,7 +36,7 @@ router.beforeEach((to, from, next) => {
if
(
hasPermission
(
store
.
getters
.
roles
,
to
.
meta
.
role
))
{
next
()
//
}
else
{
next
({
path
:
'/401'
,
query
:
{
noGoBack
:
true
}
})
next
({
path
:
'/401'
,
query
:
{
noGoBack
:
true
}})
}
// 可删 ↑
}
...
...
src/router/index.js
View file @
551e911e
import
Vue
from
'vue'
;
import
Router
from
'vue-router'
;
const
_import
=
require
(
'./_import_'
+
process
.
env
.
NODE_ENV
)
;
import
Vue
from
'vue'
import
Router
from
'vue-router'
const
_import
=
require
(
'./_import_'
+
process
.
env
.
NODE_ENV
)
// in development env not use Lazy Loading,because Lazy Loading large page will cause webpack hot update too slow.so only in production use Lazy Loading
Vue
.
use
(
Router
)
;
Vue
.
use
(
Router
)
/* layout */
import
Layout
from
'../views/layout/Layout'
;
import
Layout
from
'../views/layout/Layout'
/**
* icon : the icon show in the sidebar
...
...
@@ -42,7 +42,7 @@ export default new Router({
// mode: 'history', //后端支持可开
scrollBehavior
:
()
=>
({
y
:
0
}),
routes
:
constantRouterMap
})
;
})
export
const
asyncRouterMap
=
[
{
...
...
@@ -53,7 +53,7 @@ export const asyncRouterMap = [
icon
:
'quanxian'
,
meta
:
{
role
:
[
'admin'
]
},
noDropdown
:
true
,
children
:
[{
path
:
'index'
,
component
:
_import
(
'permission/index'
),
name
:
'权限测试页'
,
meta
:
{
role
:
[
'admin'
]
}
}]
children
:
[{
path
:
'index'
,
component
:
_import
(
'permission/index'
),
name
:
'权限测试页'
,
meta
:
{
role
:
[
'admin'
]
}}]
},
{
path
:
'/components'
,
...
...
@@ -110,7 +110,7 @@ export const asyncRouterMap = [
{
path
:
'table'
,
component
:
_import
(
'example/table/table'
),
name
:
'综合table'
}
]
},
{
path
:
'form/edit'
,
icon
:
'ziliaoshouce'
,
component
:
_import
(
'example/form'
),
name
:
'编辑Form'
,
meta
:
{
isEdit
:
true
}
},
{
path
:
'form/edit'
,
icon
:
'ziliaoshouce'
,
component
:
_import
(
'example/form'
),
name
:
'编辑Form'
,
meta
:
{
isEdit
:
true
}},
{
path
:
'form/create'
,
icon
:
'yinhangqia'
,
component
:
_import
(
'example/form'
),
name
:
'创建Form'
},
{
path
:
'tab/index'
,
icon
:
'mobankuangjia'
,
component
:
_import
(
'example/tab/index'
),
name
:
'Tab'
}
...
...
@@ -158,4 +158,4 @@ export const asyncRouterMap = [
},
{
path
:
'*'
,
redirect
:
'/404'
,
hidden
:
true
}
]
;
]
src/store/errLog.js
View file @
551e911e
...
...
@@ -6,8 +6,8 @@ const errLog = {
this
.
state
.
errLog
.
unshift
(
log
)
},
clearLog
()
{
this
.
state
.
errLog
=
[]
;
this
.
state
.
errLog
=
[]
}
}
;
}
export
default
errLog
;
export
default
errLog
src/store/getters.js
View file @
551e911e
...
...
@@ -10,5 +10,5 @@ const getters = {
setting
:
state
=>
state
.
user
.
setting
,
permission_routers
:
state
=>
state
.
permission
.
routers
,
addRouters
:
state
=>
state
.
permission
.
addRouters
}
;
}
export
default
getters
src/store/index.js
View file @
551e911e
import
Vue
from
'vue'
;
import
Vuex
from
'vuex'
;
import
app
from
'./modules/app'
;
import
user
from
'./modules/user'
;
import
permission
from
'./modules/permission'
;
import
getters
from
'./getters'
;
import
Vue
from
'vue'
import
Vuex
from
'vuex'
import
app
from
'./modules/app'
import
user
from
'./modules/user'
import
permission
from
'./modules/permission'
import
getters
from
'./getters'
Vue
.
use
(
Vuex
)
;
Vue
.
use
(
Vuex
)
const
store
=
new
Vuex
.
Store
({
modules
:
{
...
...
@@ -14,6 +14,6 @@ const store = new Vuex.Store({
permission
},
getters
})
;
})
export
default
store
src/store/modules/app.js
View file @
551e911e
import
Cookies
from
'js-cookie'
;
import
Cookies
from
'js-cookie'
const
app
=
{
state
:
{
...
...
@@ -12,11 +12,11 @@ const app = {
mutations
:
{
TOGGLE_SIDEBAR
:
state
=>
{
if
(
state
.
sidebar
.
opened
)
{
Cookies
.
set
(
'sidebarStatus'
,
1
)
;
Cookies
.
set
(
'sidebarStatus'
,
1
)
}
else
{
Cookies
.
set
(
'sidebarStatus'
,
0
)
;
Cookies
.
set
(
'sidebarStatus'
,
0
)
}
state
.
sidebar
.
opened
=
!
state
.
sidebar
.
opened
;
state
.
sidebar
.
opened
=
!
state
.
sidebar
.
opened
},
ADD_VISITED_VIEWS
:
(
state
,
view
)
=>
{
if
(
state
.
visitedViews
.
some
(
v
=>
v
.
path
===
view
.
path
))
return
...
...
@@ -44,6 +44,6 @@ const app = {
commit
(
'DEL_VISITED_VIEWS'
,
view
)
}
}
}
;
}
export
default
app
;
export
default
app
src/store/modules/permission.js
View file @
551e911e
...
...
@@ -52,11 +52,11 @@ const permission = {
}
else
{
accessedRouters
=
filterAsyncRouter
(
asyncRouterMap
,
roles
)
}
commit
(
'SET_ROUTERS'
,
accessedRouters
)
;
resolve
()
;
commit
(
'SET_ROUTERS'
,
accessedRouters
)
resolve
()
})
}
}
}
;
}
export
default
permission
;
export
default
permission
src/store/modules/user.js
View file @
551e911e
import
{
loginByUsername
,
logout
,
getInfo
}
from
'api/login'
;
import
{
getToken
,
setToken
,
removeToken
}
from
'utils/auth'
;
import
{
loginByUsername
,
logout
,
getInfo
}
from
'api/login'
import
{
getToken
,
setToken
,
removeToken
}
from
'utils/auth'
const
user
=
{
state
:
{
...
...
@@ -18,110 +18,110 @@ const user = {
mutations
:
{
SET_CODE
:
(
state
,
code
)
=>
{
state
.
code
=
code
;
state
.
code
=
code
},
SET_TOKEN
:
(
state
,
token
)
=>
{
state
.
token
=
token
;
state
.
token
=
token
},
SET_INTRODUCTION
:
(
state
,
introduction
)
=>
{
state
.
introduction
=
introduction
;
state
.
introduction
=
introduction
},
SET_SETTING
:
(
state
,
setting
)
=>
{
state
.
setting
=
setting
;
state
.
setting
=
setting
},
SET_STATUS
:
(
state
,
status
)
=>
{
state
.
status
=
status
;
state
.
status
=
status
},
SET_NAME
:
(
state
,
name
)
=>
{
state
.
name
=
name
;
state
.
name
=
name
},
SET_AVATAR
:
(
state
,
avatar
)
=>
{
state
.
avatar
=
avatar
;
state
.
avatar
=
avatar
},
SET_ROLES
:
(
state
,
roles
)
=>
{
state
.
roles
=
roles
;
state
.
roles
=
roles
}
},
actions
:
{
// 用户名登录
LoginByUsername
({
commit
},
userInfo
)
{
const
username
=
userInfo
.
username
.
trim
()
;
const
username
=
userInfo
.
username
.
trim
()
return
new
Promise
((
resolve
,
reject
)
=>
{
loginByUsername
(
username
,
userInfo
.
password
).
then
(
response
=>
{
const
data
=
response
.
data
;
setToken
(
response
.
data
.
token
)
;
commit
(
'SET_TOKEN'
,
data
.
token
)
;
resolve
()
;
const
data
=
response
.
data
setToken
(
response
.
data
.
token
)
commit
(
'SET_TOKEN'
,
data
.
token
)
resolve
()
}).
catch
(
error
=>
{
reject
(
error
)
;
})
;
})
;
reject
(
error
)
})
})
},
// 获取用户信息
GetInfo
({
commit
,
state
})
{
return
new
Promise
((
resolve
,
reject
)
=>
{
getInfo
(
state
.
token
).
then
(
response
=>
{
const
data
=
response
.
data
;
commit
(
'SET_ROLES'
,
data
.
role
)
;
commit
(
'SET_NAME'
,
data
.
name
)
;
commit
(
'SET_AVATAR'
,
data
.
avatar
)
;
commit
(
'SET_INTRODUCTION'
,
data
.
introduction
)
;
resolve
(
response
)
;
const
data
=
response
.
data
commit
(
'SET_ROLES'
,
data
.
role
)
commit
(
'SET_NAME'
,
data
.
name
)
commit
(
'SET_AVATAR'
,
data
.
avatar
)
commit
(
'SET_INTRODUCTION'
,
data
.
introduction
)
resolve
(
response
)
}).
catch
(
error
=>
{
reject
(
error
)
;
})
;
})
;
reject
(
error
)
})
})
},
// 第三方验证登录
LoginByThirdparty
({
commit
,
state
},
code
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
commit
(
'SET_CODE'
,
code
);
loginByThirdparty
(
state
.
status
,
state
.
email
,
state
.
code
).
then
(
response
=>
{
commit
(
'SET_TOKEN'
,
response
.
data
.
token
);
setToken
(
response
.
data
.
token
);
resolve
();
}).
catch
(
error
=>
{
reject
(
error
);
});
});
},
//
LoginByThirdparty({ commit, state }, code) {
//
return new Promise((resolve, reject) => {
// commit('SET_CODE', code)
//
loginByThirdparty(state.status, state.email, state.code).then(response => {
// commit('SET_TOKEN', response.data.token)
// setToken(response.data.token)
// resolve()
//
}).catch(error => {
// reject(error)
// })
// })
//
},
// 登出
LogOut
({
commit
,
state
})
{
return
new
Promise
((
resolve
,
reject
)
=>
{
logout
(
state
.
token
).
then
(()
=>
{
commit
(
'SET_TOKEN'
,
''
)
;
commit
(
'SET_ROLES'
,
[])
;
removeToken
()
;
resolve
()
;
commit
(
'SET_TOKEN'
,
''
)
commit
(
'SET_ROLES'
,
[])
removeToken
()
resolve
()
}).
catch
(
error
=>
{
reject
(
error
)
;
})
;
})
;
reject
(
error
)
})
})
},
// 前端 登出
FedLogOut
({
commit
})
{
return
new
Promise
(
resolve
=>
{
commit
(
'SET_TOKEN'
,
''
)
;
removeToken
()
;
resolve
()
;
})
;
commit
(
'SET_TOKEN'
,
''
)
removeToken
()
resolve
()
})
},
// 动态修改权限
ChangeRole
({
commit
},
role
)
{
return
new
Promise
(
resolve
=>
{
commit
(
'SET_ROLES'
,
[
role
])
;
commit
(
'SET_TOKEN'
,
role
)
;
setToken
(
role
)
;
resolve
()
;
commit
(
'SET_ROLES'
,
[
role
])
commit
(
'SET_TOKEN'
,
role
)
setToken
(
role
)
resolve
()
})
}
}
}
;
}
export
default
user
;
export
default
user
src/utils/createUniqueString.js
View file @
551e911e
...
...
@@ -2,7 +2,7 @@
* Created by jiachenpan on 17/3/8.
*/
export
default
function
createUniqueString
()
{
const
timestamp
=
+
new
Date
()
+
''
;
const
randomNum
=
parseInt
((
1
+
Math
.
random
())
*
65536
)
+
''
;
return
(
+
(
randomNum
+
timestamp
)).
toString
(
32
)
;
const
timestamp
=
+
new
Date
()
+
''
const
randomNum
=
parseInt
((
1
+
Math
.
random
())
*
65536
)
+
''
return
(
+
(
randomNum
+
timestamp
)).
toString
(
32
)
}
src/utils/fetch.js
View file @
551e911e
import
axios
from
'axios'
;
import
{
Message
}
from
'element-ui'
;
import
store
from
'../store'
;
import
{
getToken
}
from
'utils/auth'
;
import
axios
from
'axios'
import
{
Message
}
from
'element-ui'
import
store
from
'../store'
import
{
getToken
}
from
'utils/auth'
// 创建axios实例
const
service
=
axios
.
create
({
baseURL
:
process
.
env
.
BASE_API
,
// api的base_url
timeout
:
5000
// 请求超时时间
})
;
})
// request拦截器
service
.
interceptors
.
request
.
use
(
config
=>
{
// Do something before request is sent
if
(
store
.
getters
.
token
)
{
config
.
headers
[
'X-Token'
]
=
getToken
()
;
// 让每个请求携带token--['X-Token']为自定义key 请根据实际情况自行修改
config
.
headers
[
'X-Token'
]
=
getToken
()
// 让每个请求携带token--['X-Token']为自定义key 请根据实际情况自行修改
}
return
config
;
return
config
},
error
=>
{
// Do something with request error
console
.
log
(
error
)
;
// for debug
Promise
.
reject
(
error
)
;
console
.
log
(
error
)
// for debug
Promise
.
reject
(
error
)
})
// respone拦截器
...
...
@@ -53,14 +53,14 @@ service.interceptors.response.use(
// return response.data;
// }
error
=>
{
console
.
log
(
'err'
+
error
)
;
// for debug
console
.
log
(
'err'
+
error
)
// for debug
Message
({
message
:
error
.
message
,
type
:
'error'
,
duration
:
5
*
1000
})
;
return
Promise
.
reject
(
error
)
;
})
return
Promise
.
reject
(
error
)
}
)
export
default
service
;
export
default
service
src/utils/index.js
View file @
551e911e
This diff is collapsed.
Click to expand it.
src/utils/openWindow.js
View file @
551e911e
...
...
@@ -8,20 +8,19 @@
export
default
function
openWindow
(
url
,
title
,
w
,
h
)
{
// Fixes dual-screen position Most browsers Firefox
const
dualScreenLeft
=
window
.
screenLeft
!==
undefined
?
window
.
screenLeft
:
screen
.
left
;
const
dualScreenTop
=
window
.
screenTop
!==
undefined
?
window
.
screenTop
:
screen
.
top
;
const
dualScreenLeft
=
window
.
screenLeft
!==
undefined
?
window
.
screenLeft
:
screen
.
left
const
dualScreenTop
=
window
.
screenTop
!==
undefined
?
window
.
screenTop
:
screen
.
top
const
width
=
window
.
innerWidth
?
window
.
innerWidth
:
document
.
documentElement
.
clientWidth
?
document
.
documentElement
.
clientWidth
:
screen
.
width
;
const
height
=
window
.
innerHeight
?
window
.
innerHeight
:
document
.
documentElement
.
clientHeight
?
document
.
documentElement
.
clientHeight
:
screen
.
height
;
const
width
=
window
.
innerWidth
?
window
.
innerWidth
:
document
.
documentElement
.
clientWidth
?
document
.
documentElement
.
clientWidth
:
screen
.
width
const
height
=
window
.
innerHeight
?
window
.
innerHeight
:
document
.
documentElement
.
clientHeight
?
document
.
documentElement
.
clientHeight
:
screen
.
height
const
left
=
((
width
/
2
)
-
(
w
/
2
))
+
dualScreenLeft
;
const
top
=
((
height
/
2
)
-
(
h
/
2
))
+
dualScreenTop
;
const
newWindow
=
window
.
open
(
url
,
title
,
'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, copyhistory=no, width='
+
w
+
', height='
+
h
+
', top='
+
top
+
', left='
+
left
)
;
const
left
=
((
width
/
2
)
-
(
w
/
2
))
+
dualScreenLeft
const
top
=
((
height
/
2
)
-
(
h
/
2
))
+
dualScreenTop
const
newWindow
=
window
.
open
(
url
,
title
,
'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, copyhistory=no, width='
+
w
+
', height='
+
h
+
', top='
+
top
+
', left='
+
left
)
// Puts focus on the newWindow
if
(
window
.
focus
)
{
newWindow
.
focus
()
;
newWindow
.
focus
()
}
}
src/utils/validate.js
View file @
551e911e
...
...
@@ -5,19 +5,19 @@
/* 是否是公司邮箱*/
export
function
isvalidUsername
(
str
)
{
const
valid_map
=
[
'admin'
,
'editor'
]
return
valid_map
.
indexOf
(
str
.
trim
())
>=
0
;
return
valid_map
.
indexOf
(
str
.
trim
())
>=
0
}
/* 合法uri*/
export
function
validateURL
(
textval
)
{
const
urlregex
=
/^
(
https
?
|ftp
)
:
\/\/([
a-zA-Z0-9.-
]
+
(
:
[
a-zA-Z0-9.&%$-
]
+
)
*@
)
*
((
25
[
0-5
]
|2
[
0-4
][
0-9
]
|1
[
0-9
]{2}
|
[
1-9
][
0-9
]?)(\.(
25
[
0-5
]
|2
[
0-4
][
0-9
]
|1
[
0-9
]{2}
|
[
1-9
]?[
0-9
])){3}
|
([
a-zA-Z0-9-
]
+
\.)
*
[
a-zA-Z0-9-
]
+
\.(
com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|
[
a-zA-Z
]{2}))(
:
[
0-9
]
+
)
*
(\/(
$|
[
a-zA-Z0-9.,?'
\\
+&%$#=~_-
]
+
))
*$/
;
return
urlregex
.
test
(
textval
)
;
const
urlregex
=
/^
(
https
?
|ftp
)
:
\/\/([
a-zA-Z0-9.-
]
+
(
:
[
a-zA-Z0-9.&%$-
]
+
)
*@
)
*
((
25
[
0-5
]
|2
[
0-4
][
0-9
]
|1
[
0-9
]{2}
|
[
1-9
][
0-9
]?)(\.(
25
[
0-5
]
|2
[
0-4
][
0-9
]
|1
[
0-9
]{2}
|
[
1-9
]?[
0-9
])){3}
|
([
a-zA-Z0-9-
]
+
\.)
*
[
a-zA-Z0-9-
]
+
\.(
com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|
[
a-zA-Z
]{2}))(
:
[
0-9
]
+
)
*
(\/(
$|
[
a-zA-Z0-9.,?'
\\
+&%$#=~_-
]
+
))
*$/
return
urlregex
.
test
(
textval
)
}
/* 小写字母*/
export
function
validateLowerCase
(
str
)
{
const
reg
=
/^
[
a-z
]
+$/
;
return
reg
.
test
(
str
)
;
const
reg
=
/^
[
a-z
]
+$/
return
reg
.
test
(
str
)
}
/* 验证key*/
...
...
@@ -28,14 +28,13 @@ export function validateLowerCase(str) {
/* 大写字母*/
export
function
validateUpperCase
(
str
)
{
const
reg
=
/^
[
A-Z
]
+$/
;
return
reg
.
test
(
str
)
;
const
reg
=
/^
[
A-Z
]
+$/
return
reg
.
test
(
str
)
}
/* 大小写字母*/
export
function
validatAlphabets
(
str
)
{
const
reg
=
/^
[
A-Za-z
]
+$/
;
return
reg
.
test
(
str
)
;
const
reg
=
/^
[
A-Za-z
]
+$/
return
reg
.
test
(
str
)
}
src/views/charts/keyboard.vue
View file @
551e911e
...
...
@@ -7,11 +7,11 @@
</
template
>
<
script
>
import
keyboardChart
from
'components/Charts/keyboard'
;
import
keyboardChart
from
'components/Charts/keyboard'
export
default
{
export
default
{
components
:
{
keyboardChart
}
};
}
</
script
>
<
style
scoped
>
...
...
src/views/charts/keyboard2.vue
View file @
551e911e
...
...
@@ -7,11 +7,11 @@
</
template
>
<
script
>
import
keyboardChart2
from
'components/Charts/keyboard2'
;
import
keyboardChart2
from
'components/Charts/keyboard2'
export
default
{
export
default
{
components
:
{
keyboardChart2
}
};
}
</
script
>
<
style
scoped
>
...
...
src/views/charts/line.vue
View file @
551e911e
...
...
@@ -7,11 +7,11 @@
</
template
>
<
script
>
import
lineMarker
from
'components/Charts/lineMarker'
;
import
lineMarker
from
'components/Charts/lineMarker'
export
default
{
export
default
{
components
:
{
lineMarker
}
};
}
</
script
>
<
style
scoped
>
...
...
src/views/charts/mixChart.vue
View file @
551e911e
...
...
@@ -7,11 +7,11 @@
</
template
>
<
script
>
import
mixChart
from
'components/Charts/mixChart'
;
import
mixChart
from
'components/Charts/mixChart'
export
default
{
export
default
{
components
:
{
mixChart
}
};
}
</
script
>
<
style
scoped
>
...
...
src/views/components/avatarUpload.vue
View file @
551e911e
...
...
@@ -14,10 +14,10 @@
</
template
>
<
script
>
import
ImageCropper
from
'components/ImageCropper'
;
import
PanThumb
from
'components/PanThumb'
;
import
ImageCropper
from
'components/ImageCropper'
import
PanThumb
from
'components/PanThumb'
export
default
{
export
default
{
components
:
{
ImageCropper
,
PanThumb
},
data
()
{
return
{
...
...
@@ -28,15 +28,15 @@
},
methods
:
{
cropSuccess
(
resData
)
{
this
.
imagecropperShow
=
false
;
this
.
imagecropperKey
=
this
.
imagecropperKey
+
1
;
this
.
image
=
resData
.
files
.
avatar
;
this
.
imagecropperShow
=
false
this
.
imagecropperKey
=
this
.
imagecropperKey
+
1
this
.
image
=
resData
.
files
.
avatar
},
close
()
{
this
.
imagecropperShow
=
false
;
this
.
imagecropperShow
=
false
}
}
};
}
</
script
>
<
style
scoped
>
...
...
src/views/components/backToTop.vue
View file @
551e911e
...
...
@@ -135,8 +135,9 @@
</
template
>
<
script
>
import
BackToTop
from
'components/BackToTop'
;
export
default
{
import
BackToTop
from
'components/BackToTop'
export
default
{
components
:
{
BackToTop
},
data
()
{
return
{
...
...
@@ -151,5 +152,5 @@
}
}
}
}
}
</
script
>
src/views/components/countTo.vue
View file @
551e911e
...
...
@@ -22,8 +22,9 @@
</
template
>
<
script
>
import
countTo
from
'vue-count-to'
;
export
default
{
import
countTo
from
'vue-count-to'
export
default
{
components
:
{
countTo
},
data
()
{
return
{
...
...
@@ -81,13 +82,13 @@
},
methods
:
{
start
()
{
this
.
$refs
.
example
.
start
();
this
.
$refs
.
example
.
start
()
},
pauseResume
()
{
this
.
$refs
.
example
.
pauseResume
();
this
.
$refs
.
example
.
pauseResume
()
}
}
};
}
</
script
>
<
style
scoped
>
...
...
src/views/components/dndlist.vue
View file @
551e911e
...
...
@@ -8,10 +8,10 @@
</
template
>
<
script
>
import
DndList
from
'components/twoDndList'
import
{
getList
}
from
'api/article'
;
import
DndList
from
'components/twoDndList'
import
{
getList
}
from
'api/article'
export
default
{
export
default
{
components
:
{
DndList
},
data
()
{
return
{
...
...
@@ -20,19 +20,19 @@
}
},
created
()
{
this
.
fetchData
();
this
.
fetchData
()
},
methods
:
{
fetchData
()
{
this
.
listLoading
=
true
;
this
.
listLoading
=
true
getList
(
this
.
listQuery
).
then
(
response
=>
{
this
.
list1
=
response
.
data
.
splice
(
0
,
5
);
this
.
list2
=
response
.
data
;
this
.
list1
=
response
.
data
.
splice
(
0
,
5
)
this
.
list2
=
response
.
data
console
.
log
(
this
.
list1
,
this
.
list2
)
})
}
}
};
}
</
script
>
src/views/components/dropzone.vue
View file @
551e911e
...
...
@@ -10,21 +10,21 @@
</
template
>
<
script
>
import
Dropzone
from
'components/Dropzone'
;
import
Dropzone
from
'components/Dropzone'
export
default
{
export
default
{
components
:
{
Dropzone
},
methods
:
{
dropzoneS
(
file
)
{
console
.
log
(
file
)
this
.
$message
({
message
:
'上传成功'
,
type
:
'success'
});
this
.
$message
({
message
:
'上传成功'
,
type
:
'success'
})
},
dropzoneR
(
file
)
{
console
.
log
(
file
)
this
.
$message
({
message
:
'删除成功'
,
type
:
'success'
});
this
.
$message
({
message
:
'删除成功'
,
type
:
'success'
})
}
}
};
}
</
script
>
src/views/components/jsoneditor.vue
View file @
551e911e
...
...
@@ -8,17 +8,17 @@
</
template
>
<
script
>
import
jsonEditor
from
'components/jsonEditor'
;
const
jsonData
=
'[{"items":[{"market_type":"forexdata","symbol":"XAUUSD"},{"market_type":"forexdata","symbol":"UKOIL"},{"market_type":"forexdata","symbol":"CORN"}],"name":""},{"items":[{"market_type":"forexdata","symbol":"XAUUSD"},{"market_type":"forexdata","symbol":"XAGUSD"},{"market_type":"forexdata","symbol":"AUTD"},{"market_type":"forexdata","symbol":"AGTD"}],"name":"贵金属"},{"items":[{"market_type":"forexdata","symbol":"CORN"},{"market_type":"forexdata","symbol":"WHEAT"},{"market_type":"forexdata","symbol":"SOYBEAN"},{"market_type":"forexdata","symbol":"SUGAR"}],"name":"农产品"},{"items":[{"market_type":"forexdata","symbol":"UKOIL"},{"market_type":"forexdata","symbol":"USOIL"},{"market_type":"forexdata","symbol":"NGAS"}],"name":"能源化工"}]'
;
import
jsonEditor
from
'components/jsonEditor'
const
jsonData
=
'[{"items":[{"market_type":"forexdata","symbol":"XAUUSD"},{"market_type":"forexdata","symbol":"UKOIL"},{"market_type":"forexdata","symbol":"CORN"}],"name":""},{"items":[{"market_type":"forexdata","symbol":"XAUUSD"},{"market_type":"forexdata","symbol":"XAGUSD"},{"market_type":"forexdata","symbol":"AUTD"},{"market_type":"forexdata","symbol":"AGTD"}],"name":"贵金属"},{"items":[{"market_type":"forexdata","symbol":"CORN"},{"market_type":"forexdata","symbol":"WHEAT"},{"market_type":"forexdata","symbol":"SOYBEAN"},{"market_type":"forexdata","symbol":"SUGAR"}],"name":"农产品"},{"items":[{"market_type":"forexdata","symbol":"UKOIL"},{"market_type":"forexdata","symbol":"USOIL"},{"market_type":"forexdata","symbol":"NGAS"}],"name":"能源化工"}]'
export
default
{
export
default
{
components
:
{
jsonEditor
},
data
()
{
return
{
value
:
JSON
.
parse
(
jsonData
)
}
}
};
}
</
script
>
<
style
scoped
>
...
...
src/views/components/markdown.vue
View file @
551e911e
...
...
@@ -10,8 +10,8 @@
</
template
>
<
script
>
import
MdEditor
from
'components/MdEditor'
;
export
default
{
import
MdEditor
from
'components/MdEditor'
export
default
{
components
:
{
MdEditor
},
data
()
{
return
{
...
...
@@ -22,12 +22,12 @@
methods
:
{
markdown2Html
()
{
import
(
'showdown'
).
then
(
showdown
=>
{
const
converter
=
new
showdown
.
Converter
();
const
converter
=
new
showdown
.
Converter
()
this
.
html
=
converter
.
makeHtml
(
this
.
content
)
})
}
}
};
}
</
script
>
src/views/components/mixin.vue
View file @
551e911e
...
...
@@ -22,11 +22,11 @@
</
template
>
<
script
>
import
MdInput
from
'components/MDinput'
;
import
PanThumb
from
'components/PanThumb'
;
import
waves
from
'@/directive/waves.js'
;
// 水波纹指令
import
MdInput
from
'components/MDinput'
import
PanThumb
from
'components/PanThumb'
import
waves
from
'@/directive/waves.js'
// 水波纹指令
export
default
{
export
default
{
components
:
{
MdInput
,
PanThumb
},
directives
:
{
waves
...
...
@@ -36,7 +36,7 @@
title
:
''
}
}
};
}
</
script
>
<
style
scoped
>
...
...
src/views/components/splitpane.vue
View file @
551e911e
...
...
@@ -23,16 +23,16 @@
</template>
<
script
>
import
splitPane
from
'components/SplitPane'
import
splitPane
from
'components/SplitPane'
export
default
{
export
default
{
components
:
{
splitPane
},
methods
:
{
resize
()
{
console
.
log
(
'resize'
)
}
}
};
}
</
script
>
<
style
scoped
>
...
...
src/views/components/sticky.vue
View file @
551e911e
...
...
@@ -94,9 +94,9 @@
<
script
>
import
Sticky
from
'components/Sticky'
;
import
Sticky
from
'components/Sticky'
export
default
{
export
default
{
components
:
{
Sticky
},
data
()
{
return
{
...
...
@@ -110,12 +110,12 @@
],
pickerOptions
:
{
disabledDate
(
time
)
{
return
time
.
getTime
()
>
Date
.
now
();
return
time
.
getTime
()
>
Date
.
now
()
}
}
}
}
};
}
</
script
>
<
style
scoped
>
...
...
src/views/components/tinymce.vue
View file @
551e911e
...
...
@@ -9,16 +9,16 @@
</
template
>
<
script
>
import
Tinymce
from
'components/Tinymce'
;
import
Tinymce
from
'components/Tinymce'
export
default
{
export
default
{
components
:
{
Tinymce
},
data
()
{
return
{
content
:
'Tinymce'
}
}
};
}
</
script
>
<
style
scoped
>
...
...
src/views/dashboard/default/index.vue
View file @
551e911e
...
...
@@ -26,10 +26,10 @@
</
template
>
<
script
>
import
{
mapGetters
}
from
'vuex'
;
import
PanThumb
from
'components/PanThumb'
;
import
{
mapGetters
}
from
'vuex'
import
PanThumb
from
'components/PanThumb'
export
default
{
export
default
{
name
:
'dashboard-default'
,
components
:
{
PanThumb
},
data
()
{
...
...
@@ -44,7 +44,7 @@
'roles'
])
}
}
}
</
script
>
<
style
rel=
"stylesheet/scss"
lang=
"scss"
scoped
>
...
...
src/views/dashboard/editor/barChart.vue
View file @
551e911e
...
...
@@ -3,10 +3,11 @@
</
template
>
<
script
>
import
echarts
from
'echarts'
;
require
(
'echarts/theme/macarons'
);
// echarts 主题
const
animationDuration
=
3000
;
export
default
{
import
echarts
from
'echarts'
require
(
'echarts/theme/macarons'
)
// echarts 主题
const
animationDuration
=
3000
export
default
{
props
:
{
className
:
{
type
:
String
,
...
...
@@ -24,21 +25,21 @@
data
()
{
return
{
chart
:
null
};
}
},
mounted
()
{
this
.
initChart
();
this
.
initChart
()
},
beforeDestroy
()
{
if
(
!
this
.
chart
)
{
return
}
this
.
chart
.
dispose
();
this
.
chart
=
null
;
this
.
chart
.
dispose
()
this
.
chart
=
null
},
methods
:
{
initChart
()
{
this
.
chart
=
echarts
.
init
(
this
.
$el
,
'macarons'
);
this
.
chart
=
echarts
.
init
(
this
.
$el
,
'macarons'
)
this
.
chart
.
setOption
({
tooltip
:
{
...
...
src/views/dashboard/editor/index.vue
View file @
551e911e
...
...
@@ -75,14 +75,15 @@
</
template
>
<
script
>
import
{
mapGetters
}
from
'vuex'
;
import
panThumb
from
'components/PanThumb'
;
import
pieChart
from
'./pieChart'
;
import
barChart
from
'./barChart'
;
import
lineChart
from
'./lineChart'
;
import
countTo
from
'vue-count-to'
;
import
todoList
from
'components/TodoList'
;
export
default
{
import
{
mapGetters
}
from
'vuex'
import
panThumb
from
'components/PanThumb'
import
pieChart
from
'./pieChart'
import
barChart
from
'./barChart'
import
lineChart
from
'./lineChart'
import
countTo
from
'vue-count-to'
import
todoList
from
'components/TodoList'
export
default
{
name
:
'dashboard-editor'
,
components
:
{
panThumb
,
countTo
,
pieChart
,
lineChart
,
barChart
,
todoList
},
data
()
{
...
...
@@ -103,7 +104,7 @@
'roles'
])
}
}
}
</
script
>
<
style
rel=
"stylesheet/scss"
lang=
"scss"
scoped
>
...
...
src/views/dashboard/editor/lineChart.vue
View file @
551e911e
...
...
@@ -3,11 +3,11 @@
</
template
>
<
script
>
import
echarts
from
'echarts'
;
require
(
'echarts/theme/macarons'
);
// echarts 主题
import
{
debounce
}
from
'utils'
;
import
echarts
from
'echarts'
require
(
'echarts/theme/macarons'
)
// echarts 主题
import
{
debounce
}
from
'utils'
export
default
{
export
default
{
props
:
{
className
:
{
type
:
String
,
...
...
@@ -29,10 +29,10 @@
data
()
{
return
{
chart
:
null
};
}
},
mounted
()
{
this
.
initChart
();
this
.
initChart
()
if
(
this
.
autoResize
)
{
this
.
__resizeHanlder
=
debounce
(()
=>
{
if
(
this
.
chart
)
{
...
...
@@ -62,7 +62,7 @@
},
methods
:
{
initChart
()
{
this
.
chart
=
echarts
.
init
(
this
.
$el
,
'macarons'
);
this
.
chart
=
echarts
.
init
(
this
.
$el
,
'macarons'
)
this
.
chart
.
setOption
({
xAxis
:
{
...
...
src/views/dashboard/editor/pieChart.vue
View file @
551e911e
...
...
@@ -3,10 +3,10 @@
</
template
>
<
script
>
import
echarts
from
'echarts'
;
require
(
'echarts/theme/macarons'
);
// echarts 主题
import
echarts
from
'echarts'
require
(
'echarts/theme/macarons'
)
// echarts 主题
export
default
{
export
default
{
props
:
{
className
:
{
type
:
String
,
...
...
@@ -24,21 +24,21 @@
data
()
{
return
{
chart
:
null
};
}
},
mounted
()
{
this
.
initChart
();
this
.
initChart
()
},
beforeDestroy
()
{
if
(
!
this
.
chart
)
{
return
}
this
.
chart
.
dispose
();
this
.
chart
=
null
;
this
.
chart
.
dispose
()
this
.
chart
=
null
},
methods
:
{
initChart
()
{
this
.
chart
=
echarts
.
init
(
this
.
$el
,
'macarons'
);
this
.
chart
=
echarts
.
init
(
this
.
$el
,
'macarons'
)
this
.
chart
.
setOption
({
title
:
{
...
...
src/views/dashboard/index.vue
View file @
551e911e
...
...
@@ -5,11 +5,11 @@
</
template
>
<
script
>
import
{
mapGetters
}
from
'vuex'
;
import
EditorDashboard
from
'./editor/index'
;
import
DefaultDashboard
from
'./default/index'
;
import
{
mapGetters
}
from
'vuex'
import
EditorDashboard
from
'./editor/index'
import
DefaultDashboard
from
'./default/index'
export
default
{
export
default
{
name
:
'dashboard'
,
components
:
{
EditorDashboard
,
DefaultDashboard
},
data
()
{
...
...
@@ -27,9 +27,9 @@
},
created
()
{
if
(
this
.
roles
.
indexOf
(
'admin'
)
>=
0
)
{
return
;
}
this
.
currentRole
=
'DefaultDashboard'
;
return
}
this
.
currentRole
=
'DefaultDashboard'
}
}
</
script
>
src/views/errlog/index.vue
View file @
551e911e
...
...
@@ -11,11 +11,11 @@
</
template
>
<
script
>
import
errCode
from
'./errcode'
;
import
errCode
from
'./errcode'
export
default
{
export
default
{
components
:
{
errCode
}
};
}
</
script
>
<
style
scoped
>
...
...
src/views/error/401.vue
View file @
551e911e
...
...
@@ -28,8 +28,9 @@
</
template
>
<
script
>
import
errGif
from
'assets/401_images/401.gif'
;
export
default
{
import
errGif
from
'assets/401_images/401.gif'
export
default
{
data
()
{
return
{
errGif
:
errGif
+
'?'
+
+
new
Date
(),
...
...
@@ -40,13 +41,13 @@
methods
:
{
back
()
{
if
(
this
.
$route
.
query
.
noGoBack
)
{
this
.
$router
.
push
({
path
:
'/dashboard'
});
this
.
$router
.
push
({
path
:
'/dashboard'
})
}
else
{
this
.
$router
.
go
(
-
1
);
this
.
$router
.
go
(
-
1
)
}
}
}
};
}
</
script
>
<
style
rel=
"stylesheet/scss"
lang=
"scss"
scoped
>
...
...
src/views/error/404.vue
View file @
551e911e
...
...
@@ -19,10 +19,10 @@
</
template
>
<
script
>
import
img_404
from
'@/assets/404_images/404.png'
import
img_404_cloud
from
'@/assets/404_images/404_cloud.png'
import
img_404
from
'@/assets/404_images/404.png'
import
img_404_cloud
from
'@/assets/404_images/404_cloud.png'
export
default
{
export
default
{
data
()
{
return
{
img_404
,
...
...
@@ -34,7 +34,7 @@
return
'特朗普说这个页面你不能进......'
}
}
}
}
</
script
>
<
style
rel=
"stylesheet/scss"
lang=
"scss"
scoped
>
...
...
src/views/example/form.vue
View file @
551e911e
...
...
@@ -120,17 +120,17 @@
</template>
<
script
>
import
Tinymce
from
'components/Tinymce'
import
Upload
from
'components/Upload/singleImage3'
import
MDinput
from
'components/MDinput'
import
Multiselect
from
'vue-multiselect'
// 使用的一个多选框组件,element-ui的select不能满足所有需求
import
'vue-multiselect/dist/vue-multiselect.min.css'
// 多选框组件css
import
Sticky
from
'components/Sticky'
// 粘性header组件
import
{
validateURL
}
from
'utils/validate'
import
{
getArticle
}
from
'api/article'
import
{
userSearch
}
from
'api/remoteSearch'
import
Tinymce
from
'components/Tinymce'
import
Upload
from
'components/Upload/singleImage3'
import
MDinput
from
'components/MDinput'
import
Multiselect
from
'vue-multiselect'
// 使用的一个多选框组件,element-ui的select不能满足所有需求
import
'vue-multiselect/dist/vue-multiselect.min.css'
// 多选框组件css
import
Sticky
from
'components/Sticky'
// 粘性header组件
import
{
validateURL
}
from
'utils/validate'
import
{
getArticle
}
from
'api/article'
import
{
userSearch
}
from
'api/remoteSearch'
export
default
{
export
default
{
name
:
'articleDetail'
,
components
:
{
Tinymce
,
MDinput
,
Upload
,
Multiselect
,
Sticky
},
data
()
{
...
...
@@ -139,12 +139,12 @@
this
.
$message
({
message
:
rule
.
field
+
'为必传项'
,
type
:
'error'
});
})
callback
(
null
)
}
else
{
callback
()
}
};
}
const
validateSourceUri
=
(
rule
,
value
,
callback
)
=>
{
if
(
value
)
{
if
(
validateURL
(
value
))
{
...
...
@@ -153,13 +153,13 @@
this
.
$message
({
message
:
'外链url填写不正确'
,
type
:
'error'
});
})
callback
(
null
)
}
}
else
{
callback
()
}
};
}
return
{
postForm
:
{
title
:
''
,
// 文章题目
...
...
@@ -199,65 +199,65 @@
},
created
()
{
if
(
this
.
isEdit
)
{
this
.
fetchData
();
this
.
fetchData
()
}
},
methods
:
{
fetchData
()
{
getArticle
().
then
(
response
=>
{
this
.
postForm
=
response
.
data
;
this
.
postForm
=
response
.
data
}).
catch
(
err
=>
{
this
.
fetchSuccess
=
false
;
console
.
log
(
err
);
});
this
.
fetchSuccess
=
false
console
.
log
(
err
)
})
},
submitForm
()
{
this
.
postForm
.
display_time
=
parseInt
(
this
.
display_time
/
1000
);
this
.
postForm
.
display_time
=
parseInt
(
this
.
display_time
/
1000
)
console
.
log
(
this
.
postForm
)
this
.
$refs
.
postForm
.
validate
(
valid
=>
{
if
(
valid
)
{
this
.
loading
=
true
;
this
.
loading
=
true
this
.
$notify
({
title
:
'成功'
,
message
:
'发布文章成功'
,
type
:
'success'
,
duration
:
2000
});
this
.
postForm
.
status
=
'published'
;
this
.
loading
=
false
;
})
this
.
postForm
.
status
=
'published'
this
.
loading
=
false
}
else
{
console
.
log
(
'error submit!!'
);
return
false
;
console
.
log
(
'error submit!!'
)
return
false
}
});
})
},
draftForm
()
{
if
(
this
.
postForm
.
content
.
length
===
0
||
this
.
postForm
.
title
.
length
===
0
)
{
this
.
$message
({
message
:
'请填写必要的标题和内容'
,
type
:
'warning'
});
return
;
})
return
}
this
.
$message
({
message
:
'保存成功'
,
type
:
'success'
,
showClose
:
true
,
duration
:
1000
});
this
.
postForm
.
status
=
'draft'
;
})
this
.
postForm
.
status
=
'draft'
},
getRemoteUserList
(
query
)
{
userSearch
(
query
).
then
(
response
=>
{
if
(
!
response
.
data
.
items
)
return
;
if
(
!
response
.
data
.
items
)
return
console
.
log
(
response
)
this
.
userLIstOptions
=
response
.
data
.
items
.
map
(
v
=>
({
key
:
v
.
name
}));
}))
})
}
}
}
}
</
script
>
<
style
rel=
"stylesheet/scss"
lang=
"scss"
scoped
>
@import
"src/styles/mixin.scss"
;
...
...
src/views/example/tab/components/tabPane.vue
View file @
551e911e
...
...
@@ -48,9 +48,9 @@
<
/template
>
<
script
>
import
{
fetchList
}
from
'api/article_table'
;
import
{
fetchList
}
from
'api/article_table'
export
default
{
export
default
{
name
:
'articleDetail'
,
props
:
{
type
:
{
...
...
@@ -76,23 +76,23 @@
published
:
'success'
,
draft
:
'gray'
,
deleted
:
'danger'
}
;
}
return
statusMap
[
status
]
}
}
,
created
()
{
this
.
getList
();
this
.
getList
()
}
,
methods
:
{
getList
()
{
this
.
$emit
(
'create'
);
// for test
this
.
$emit
(
'create'
)
// for test
fetchList
(
this
.
listQuery
).
then
(
response
=>
{
this
.
list
=
response
.
data
.
items
;
this
.
total
=
response
.
data
.
total
;
this
.
list
=
response
.
data
.
items
this
.
total
=
response
.
data
.
total
}
)
}
}
}
}
<
/script
>
src/views/example/tab/index.vue
View file @
551e911e
...
...
@@ -12,9 +12,9 @@
</
template
>
<
script
>
import
tabPane
from
'./components/tabPane'
import
tabPane
from
'./components/tabPane'
export
default
{
export
default
{
name
:
'tabDemo'
,
components
:
{
tabPane
},
data
()
{
...
...
@@ -31,10 +31,10 @@
},
methods
:
{
showCreatedTimes
()
{
this
.
createdTimes
=
this
.
createdTimes
+
1
;
}
this
.
createdTimes
=
this
.
createdTimes
+
1
}
}
}
</
script
>
<
style
scoped
>
...
...
src/views/example/table/dragTable.vue
View file @
551e911e
...
...
@@ -60,10 +60,10 @@
<
/template
>
<
script
>
import
{
fetchList
}
from
'api/article_table'
;
import
Sortable
from
'sortablejs'
import
{
fetchList
}
from
'api/article_table'
import
Sortable
from
'sortablejs'
export
default
{
export
default
{
name
:
'drag-table_demo'
,
data
()
{
return
{
...
...
@@ -80,7 +80,7 @@
}
}
,
created
()
{
this
.
getList
();
this
.
getList
()
}
,
filters
:
{
statusFilter
(
status
)
{
...
...
@@ -88,36 +88,36 @@
published
:
'success'
,
draft
:
'gray'
,
deleted
:
'danger'
}
;
}
return
statusMap
[
status
]
}
}
,
methods
:
{
getList
()
{
this
.
listLoading
=
true
;
this
.
listLoading
=
true
fetchList
(
this
.
listQuery
).
then
(
response
=>
{
this
.
list
=
response
.
data
.
items
;
this
.
total
=
response
.
data
.
total
;
this
.
listLoading
=
false
;
this
.
olderList
=
this
.
list
.
map
(
v
=>
v
.
id
);
this
.
newList
=
this
.
olderList
.
slice
();
this
.
list
=
response
.
data
.
items
this
.
total
=
response
.
data
.
total
this
.
listLoading
=
false
this
.
olderList
=
this
.
list
.
map
(
v
=>
v
.
id
)
this
.
newList
=
this
.
olderList
.
slice
()
this
.
$nextTick
(()
=>
{
this
.
setSort
()
}
)
}
)
}
,
setSort
()
{
const
el
=
document
.
querySelectorAll
(
'.el-table__body-wrapper > table > tbody'
)[
0
];
const
el
=
document
.
querySelectorAll
(
'.el-table__body-wrapper > table > tbody'
)[
0
]
this
.
sortable
=
Sortable
.
create
(
el
,
{
// handle: '.drag-handler',
onEnd
:
evt
=>
{
const
tempIndex
=
this
.
newList
.
splice
(
evt
.
oldIndex
,
1
)[
0
];
this
.
newList
.
splice
(
evt
.
newIndex
,
0
,
tempIndex
);
}
}
);
const
tempIndex
=
this
.
newList
.
splice
(
evt
.
oldIndex
,
1
)[
0
]
this
.
newList
.
splice
(
evt
.
newIndex
,
0
,
tempIndex
)
}
}
)
}
}
}
<
/script
>
<
style
>
...
...
src/views/example/table/dynamictable.vue
View file @
551e911e
...
...
@@ -9,11 +9,11 @@
</
template
>
<
script
>
import
fixedThead
from
'./dynamictable/fixedThead'
import
unfixedThead
from
'./dynamictable/unfixedThead'
import
fixedThead
from
'./dynamictable/fixedThead'
import
unfixedThead
from
'./dynamictable/unfixedThead'
export
default
{
export
default
{
components
:
{
fixedThead
,
unfixedThead
}
};
}
</
script
>
src/views/example/table/dynamictable/fixedThead.vue
View file @
551e911e
...
...
@@ -22,8 +22,9 @@
</template>
<
script
>
const
defaultFormThead
=
[
'apple'
,
'banana'
];
// 默认选中项
export
default
{
const
defaultFormThead
=
[
'apple'
,
'banana'
]
// 默认选中项
export
default
{
data
()
{
return
{
tableData
:
[
...
...
@@ -48,10 +49,10 @@
},
watch
:
{
checkboxVal
(
valArr
)
{
this
.
formThead
=
this
.
formTheadOptions
.
filter
(
i
=>
valArr
.
indexOf
(
i
)
>=
0
);
this
.
key
=
this
.
key
+
1
;
// 为了保证table 每次都会重渲 (牺牲性能保证效果,当然也可以不用)
this
.
formThead
=
this
.
formTheadOptions
.
filter
(
i
=>
valArr
.
indexOf
(
i
)
>=
0
)
this
.
key
=
this
.
key
+
1
// 为了保证table 每次都会重渲 (牺牲性能保证效果,当然也可以不用)
}
}
};
}
</
script
>
src/views/example/table/dynamictable/unfixedThead.vue
View file @
551e911e
...
...
@@ -23,7 +23,7 @@
</template>
<
script
>
export
default
{
export
default
{
data
()
{
return
{
tableData
:
[
...
...
@@ -43,5 +43,5 @@
formThead
:
[
'apple'
,
'banana'
]
}
}
};
}
</
script
>
src/views/example/table/inlineEditTable.vue
View file @
551e911e
...
...
@@ -52,9 +52,9 @@
<
/template
>
<
script
>
import
{
fetchList
}
from
'api/article_table'
;
import
{
fetchList
}
from
'api/article_table'
export
default
{
export
default
{
name
:
'inline_edit-table_demo'
,
data
()
{
return
{
...
...
@@ -67,7 +67,7 @@
}
}
,
created
()
{
this
.
getList
();
this
.
getList
()
}
,
filters
:
{
statusFilter
(
status
)
{
...
...
@@ -75,21 +75,21 @@
published
:
'success'
,
draft
:
'gray'
,
deleted
:
'danger'
}
;
}
return
statusMap
[
status
]
}
}
,
methods
:
{
getList
()
{
this
.
listLoading
=
true
;
this
.
listLoading
=
true
fetchList
(
this
.
listQuery
).
then
(
response
=>
{
this
.
list
=
response
.
data
.
items
.
map
(
v
=>
{
v
.
edit
=
false
;
v
.
edit
=
false
return
v
}
);
this
.
listLoading
=
false
;
}
)
this
.
listLoading
=
false
}
)
}
}
}
}
<
/script
>
src/views/example/table/table.vue
View file @
551e911e
...
...
@@ -150,24 +150,24 @@
<
/template
>
<
script
>
import
{
fetchList
,
fetchPv
}
from
'api/article_table'
;
import
waves
from
'@/directive/waves.js'
;
// 水波纹指令
import
{
parseTime
}
from
'utils'
;
import
{
fetchList
,
fetchPv
}
from
'api/article_table'
import
waves
from
'@/directive/waves.js'
// 水波纹指令
import
{
parseTime
}
from
'utils'
const
calendarTypeOptions
=
[
const
calendarTypeOptions
=
[
{
key
:
'CN'
,
display_name
:
'中国'
}
,
{
key
:
'US'
,
display_name
:
'美国'
}
,
{
key
:
'JP'
,
display_name
:
'日本'
}
,
{
key
:
'EU'
,
display_name
:
'欧元区'
}
];
]
// arr to obj
const
calendarTypeKeyValue
=
calendarTypeOptions
.
reduce
((
acc
,
cur
)
=>
{
acc
[
cur
.
key
]
=
cur
.
display_name
;
const
calendarTypeKeyValue
=
calendarTypeOptions
.
reduce
((
acc
,
cur
)
=>
{
acc
[
cur
.
key
]
=
cur
.
display_name
return
acc
}
,
{
}
);
}
,
{
}
)
export
default
{
export
default
{
name
:
'table_demo'
,
directives
:
{
waves
...
...
@@ -211,7 +211,7 @@
}
}
,
created
()
{
this
.
getList
();
this
.
getList
()
}
,
filters
:
{
statusFilter
(
status
)
{
...
...
@@ -219,7 +219,7 @@
published
:
'success'
,
draft
:
'gray'
,
deleted
:
'danger'
}
;
}
return
statusMap
[
status
]
}
,
typeFilter
(
type
)
{
...
...
@@ -228,49 +228,49 @@
}
,
methods
:
{
getList
()
{
this
.
listLoading
=
true
;
this
.
listLoading
=
true
fetchList
(
this
.
listQuery
).
then
(
response
=>
{
this
.
list
=
response
.
data
.
items
;
this
.
total
=
response
.
data
.
total
;
this
.
listLoading
=
false
;
this
.
list
=
response
.
data
.
items
this
.
total
=
response
.
data
.
total
this
.
listLoading
=
false
}
)
}
,
handleFilter
()
{
this
.
getList
();
this
.
getList
()
}
,
handleSizeChange
(
val
)
{
this
.
listQuery
.
limit
=
val
;
this
.
getList
();
this
.
listQuery
.
limit
=
val
this
.
getList
()
}
,
handleCurrentChange
(
val
)
{
this
.
listQuery
.
page
=
val
;
this
.
getList
();
this
.
listQuery
.
page
=
val
this
.
getList
()
}
,
timeFilter
(
time
)
{
if
(
!
time
[
0
])
{
this
.
listQuery
.
start
=
undefined
;
this
.
listQuery
.
end
=
undefined
;
return
;
this
.
listQuery
.
start
=
undefined
this
.
listQuery
.
end
=
undefined
return
}
this
.
listQuery
.
start
=
parseInt
(
+
time
[
0
]
/
1000
);
this
.
listQuery
.
end
=
parseInt
((
+
time
[
1
]
+
3600
*
1000
*
24
)
/
1000
);
this
.
listQuery
.
start
=
parseInt
(
+
time
[
0
]
/
1000
)
this
.
listQuery
.
end
=
parseInt
((
+
time
[
1
]
+
3600
*
1000
*
24
)
/
1000
)
}
,
handleModifyStatus
(
row
,
status
)
{
this
.
$message
({
message
:
'操作成功'
,
type
:
'success'
}
);
row
.
status
=
status
;
}
)
row
.
status
=
status
}
,
handleCreate
()
{
this
.
resetTemp
();
this
.
dialogStatus
=
'create'
;
this
.
dialogFormVisible
=
true
;
this
.
resetTemp
()
this
.
dialogStatus
=
'create'
this
.
dialogFormVisible
=
true
}
,
handleUpdate
(
row
)
{
this
.
temp
=
Object
.
assign
({
}
,
row
);
this
.
dialogStatus
=
'update'
;
this
.
dialogFormVisible
=
true
;
this
.
temp
=
Object
.
assign
({
}
,
row
)
this
.
dialogStatus
=
'update'
this
.
dialogFormVisible
=
true
}
,
handleDelete
(
row
)
{
this
.
$notify
({
...
...
@@ -278,39 +278,39 @@
message
:
'删除成功'
,
type
:
'success'
,
duration
:
2000
}
);
const
index
=
this
.
list
.
indexOf
(
row
);
this
.
list
.
splice
(
index
,
1
);
}
)
const
index
=
this
.
list
.
indexOf
(
row
)
this
.
list
.
splice
(
index
,
1
)
}
,
create
()
{
this
.
temp
.
id
=
parseInt
(
Math
.
random
()
*
100
)
+
1024
;
this
.
temp
.
timestamp
=
+
new
Date
();
this
.
temp
.
author
=
'原创作者'
;
this
.
list
.
unshift
(
this
.
temp
);
this
.
dialogFormVisible
=
false
;
this
.
temp
.
id
=
parseInt
(
Math
.
random
()
*
100
)
+
1024
this
.
temp
.
timestamp
=
+
new
Date
()
this
.
temp
.
author
=
'原创作者'
this
.
list
.
unshift
(
this
.
temp
)
this
.
dialogFormVisible
=
false
this
.
$notify
({
title
:
'成功'
,
message
:
'创建成功'
,
type
:
'success'
,
duration
:
2000
}
);
}
)
}
,
update
()
{
this
.
temp
.
timestamp
=
+
this
.
temp
.
timestamp
;
this
.
temp
.
timestamp
=
+
this
.
temp
.
timestamp
for
(
const
v
of
this
.
list
)
{
if
(
v
.
id
===
this
.
temp
.
id
)
{
const
index
=
this
.
list
.
indexOf
(
v
);
this
.
list
.
splice
(
index
,
1
,
this
.
temp
);
break
;
const
index
=
this
.
list
.
indexOf
(
v
)
this
.
list
.
splice
(
index
,
1
,
this
.
temp
)
break
}
}
this
.
dialogFormVisible
=
false
;
this
.
dialogFormVisible
=
false
this
.
$notify
({
title
:
'成功'
,
message
:
'更新成功'
,
type
:
'success'
,
duration
:
2000
}
);
}
)
}
,
resetTemp
()
{
this
.
temp
=
{
...
...
@@ -321,21 +321,21 @@
title
:
''
,
status
:
'published'
,
type
:
''
}
;
}
}
,
handleFetchPv
(
pv
)
{
fetchPv
(
pv
).
then
(
response
=>
{
this
.
pvData
=
response
.
data
.
pvData
;
this
.
dialogPvVisible
=
true
;
this
.
pvData
=
response
.
data
.
pvData
this
.
dialogPvVisible
=
true
}
)
}
,
handleDownload
()
{
require
.
ensure
([],
()
=>
{
const
{
export_json_to_excel
}
=
require
(
'vendor/Export2Excel'
);
const
tHeader
=
[
'时间'
,
'地区'
,
'类型'
,
'标题'
,
'重要性'
];
const
filterVal
=
[
'timestamp'
,
'province'
,
'type'
,
'title'
,
'importance'
];
const
data
=
this
.
formatJson
(
filterVal
,
this
.
list
);
export_json_to_excel
(
tHeader
,
data
,
'table数据'
);
const
{
export_json_to_excel
}
=
require
(
'vendor/Export2Excel'
)
const
tHeader
=
[
'时间'
,
'地区'
,
'类型'
,
'标题'
,
'重要性'
]
const
filterVal
=
[
'timestamp'
,
'province'
,
'type'
,
'title'
,
'importance'
]
const
data
=
this
.
formatJson
(
filterVal
,
this
.
list
)
export_json_to_excel
(
tHeader
,
data
,
'table数据'
)
}
)
}
,
formatJson
(
filterVal
,
jsonData
)
{
...
...
@@ -348,5 +348,5 @@
}
))
}
}
}
}
<
/script
>
src/views/excel/index.vue
View file @
551e911e
...
...
@@ -34,9 +34,9 @@
</template>
<
script
>
import
{
getList
}
from
'api/article'
;
import
{
getList
}
from
'api/article'
export
default
{
export
default
{
data
()
{
return
{
list
:
null
,
...
...
@@ -44,31 +44,31 @@
}
},
created
()
{
this
.
fetchData
();
this
.
fetchData
()
},
methods
:
{
fetchData
()
{
this
.
listLoading
=
true
;
this
.
listLoading
=
true
getList
(
this
.
listQuery
).
then
(
response
=>
{
this
.
list
=
response
.
data
;
this
.
listLoading
=
false
;
this
.
list
=
response
.
data
this
.
listLoading
=
false
})
},
handleDownload
()
{
require
.
ensure
([],
()
=>
{
const
{
export_json_to_excel
}
=
require
(
'vendor/Export2Excel'
)
;
const
tHeader
=
[
'序号'
,
'文章标题'
,
'作者'
,
'阅读数'
,
'发布时间'
];
const
filterVal
=
[
'id'
,
'title'
,
'author'
,
'pageviews'
,
'display_time'
];
const
list
=
this
.
list
;
const
data
=
this
.
formatJson
(
filterVal
,
list
);
export_json_to_excel
(
tHeader
,
data
,
'列表excel'
);
}
=
require
(
'vendor/Export2Excel'
)
const
tHeader
=
[
'序号'
,
'文章标题'
,
'作者'
,
'阅读数'
,
'发布时间'
]
const
filterVal
=
[
'id'
,
'title'
,
'author'
,
'pageviews'
,
'display_time'
]
const
list
=
this
.
list
const
data
=
this
.
formatJson
(
filterVal
,
list
)
export_json_to_excel
(
tHeader
,
data
,
'列表excel'
)
})
},
formatJson
(
filterVal
,
jsonData
)
{
return
jsonData
.
map
(
v
=>
filterVal
.
map
(
j
=>
v
[
j
]))
}
}
};
}
</
script
>
src/views/excel/selectExcel.vue
View file @
551e911e
...
...
@@ -41,9 +41,9 @@
<
script
>
import
{
getList
}
from
'api/article'
;
import
{
getList
}
from
'api/article'
export
default
{
export
default
{
data
()
{
return
{
list
:
null
,
...
...
@@ -52,40 +52,40 @@
}
},
created
()
{
this
.
fetchData
();
this
.
fetchData
()
},
methods
:
{
fetchData
()
{
this
.
listLoading
=
true
;
this
.
listLoading
=
true
getList
(
this
.
listQuery
).
then
(
response
=>
{
this
.
list
=
response
.
data
;
this
.
listLoading
=
false
;
this
.
list
=
response
.
data
this
.
listLoading
=
false
})
},
handleSelectionChange
(
val
)
{
this
.
multipleSelection
=
val
;
this
.
multipleSelection
=
val
},
handleDownload
()
{
if
(
this
.
multipleSelection
.
length
)
{
require
.
ensure
([],
()
=>
{
const
{
export_json_to_excel
}
=
require
(
'vendor/Export2Excel'
);
const
tHeader
=
[
'序号'
,
'文章标题'
,
'作者'
,
'阅读数'
,
'发布时间'
];
const
filterVal
=
[
'id'
,
'title'
,
'author'
,
'pageviews'
,
'display_time'
];
const
list
=
this
.
multipleSelection
;
const
data
=
this
.
formatJson
(
filterVal
,
list
);
export_json_to_excel
(
tHeader
,
data
,
'列表excel'
);
this
.
$refs
.
multipleTable
.
clearSelection
();
const
{
export_json_to_excel
}
=
require
(
'vendor/Export2Excel'
)
const
tHeader
=
[
'序号'
,
'文章标题'
,
'作者'
,
'阅读数'
,
'发布时间'
]
const
filterVal
=
[
'id'
,
'title'
,
'author'
,
'pageviews'
,
'display_time'
]
const
list
=
this
.
multipleSelection
const
data
=
this
.
formatJson
(
filterVal
,
list
)
export_json_to_excel
(
tHeader
,
data
,
'列表excel'
)
this
.
$refs
.
multipleTable
.
clearSelection
()
})
}
else
{
this
.
$message
({
message
:
'请选择一条或多条记录导出'
,
type
:
'warning'
});
})
}
},
formatJson
(
filterVal
,
jsonData
)
{
return
jsonData
.
map
(
v
=>
filterVal
.
map
(
j
=>
v
[
j
]))
}
}
};
}
</
script
>
src/views/layout/AppMain.vue
View file @
551e911e
...
...
@@ -7,7 +7,7 @@
</
template
>
<
script
>
export
default
{
export
default
{
name
:
'AppMain'
,
computed
:
{
key
()
{
...
...
src/views/layout/Layout.vue
View file @
551e911e
...
...
@@ -9,9 +9,9 @@
</
template
>
<
script
>
import
{
Navbar
,
Sidebar
,
AppMain
}
from
'views/layout'
;
import
{
Navbar
,
Sidebar
,
AppMain
}
from
'views/layout'
export
default
{
export
default
{
name
:
'layout'
,
components
:
{
Navbar
,
...
...
@@ -20,10 +20,10 @@
},
computed
:
{
sidebar
()
{
return
this
.
$store
.
state
.
app
.
sidebar
;
}
return
this
.
$store
.
state
.
app
.
sidebar
}
}
}
</
script
>
<
style
rel=
"stylesheet/scss"
lang=
"scss"
scoped
>
...
...
src/views/layout/Levelbar.vue
View file @
551e911e
...
...
@@ -8,7 +8,7 @@
</
template
>
<
script
>
export
default
{
export
default
{
created
()
{
this
.
getBreadcrumb
()
},
...
...
@@ -19,20 +19,20 @@
},
methods
:
{
getBreadcrumb
()
{
let
matched
=
this
.
$route
.
matched
.
filter
(
item
=>
item
.
name
);
const
first
=
matched
[
0
];
let
matched
=
this
.
$route
.
matched
.
filter
(
item
=>
item
.
name
)
const
first
=
matched
[
0
]
if
(
first
&&
(
first
.
name
!==
'首页'
||
first
.
path
!==
''
))
{
matched
=
[{
name
:
'首页'
,
path
:
'/'
}].
concat
(
matched
)
}
this
.
levelList
=
matched
;
this
.
levelList
=
matched
}
},
watch
:
{
$route
()
{
this
.
getBreadcrumb
();
}
this
.
getBreadcrumb
()
}
}
}
</
script
>
<
style
rel=
"stylesheet/scss"
lang=
"scss"
scoped
>
...
...
src/views/layout/Navbar.vue
View file @
551e911e
...
...
@@ -28,15 +28,15 @@
</
template
>
<
script
>
import
{
mapGetters
}
from
'vuex'
;
import
Levelbar
from
'./Levelbar'
;
import
TabsView
from
'./TabsView'
;
import
Hamburger
from
'components/Hamburger'
;
import
Screenfull
from
'components/Screenfull'
;
import
ErrorLog
from
'components/ErrLog'
;
import
errLogStore
from
'store/errLog'
;
import
{
mapGetters
}
from
'vuex'
import
Levelbar
from
'./Levelbar'
import
TabsView
from
'./TabsView'
import
Hamburger
from
'components/Hamburger'
import
Screenfull
from
'components/Screenfull'
import
ErrorLog
from
'components/ErrLog'
import
errLogStore
from
'store/errLog'
export
default
{
export
default
{
components
:
{
Levelbar
,
TabsView
,
...
...
@@ -62,11 +62,11 @@
},
logout
()
{
this
.
$store
.
dispatch
(
'LogOut'
).
then
(()
=>
{
location
.
reload
();
// 为了重新实例化vue-router对象 避免bug
});
}
location
.
reload
()
// 为了重新实例化vue-router对象 避免bug
})
}
}
}
</
script
>
<
style
rel=
"stylesheet/scss"
lang=
"scss"
scoped
>
...
...
src/views/layout/Sidebar.vue
View file @
551e911e
...
...
@@ -6,9 +6,9 @@
<
script
>
import
{
mapGetters
}
from
'vuex'
;
import
SidebarItem
from
'./SidebarItem'
;
export
default
{
import
{
mapGetters
}
from
'vuex'
import
SidebarItem
from
'./SidebarItem'
export
default
{
components
:
{
SidebarItem
},
computed
:
{
...
mapGetters
([
...
...
@@ -19,5 +19,5 @@
return
!
this
.
sidebar
.
opened
}
}
}
}
</
script
>
src/views/layout/SidebarItem.vue
View file @
551e911e
...
...
@@ -31,13 +31,13 @@
</template>
<
script
>
export
default
{
export
default
{
name
:
'SidebarItem'
,
props
:
{
routes
:
{
type
:
Array
}
}
}
}
</
script
>
src/views/layout/TabsView.vue
View file @
551e911e
...
...
@@ -9,7 +9,7 @@
</
template
>
<
script
>
export
default
{
export
default
{
computed
:
{
visitedViews
()
{
return
this
.
$store
.
state
.
app
.
visitedViews
.
slice
(
-
6
)
...
...
@@ -39,7 +39,7 @@
this
.
addViewTabs
()
}
}
}
}
</
script
>
<
style
rel=
"stylesheet/scss"
lang=
"scss"
scoped
>
...
...
src/views/layout/index.js
View file @
551e911e
export
{
default
as
Navbar
}
from
'./Navbar'
;
export
{
default
as
Navbar
}
from
'./Navbar'
export
{
default
as
Sidebar
}
from
'./Sidebar'
;
export
{
default
as
Sidebar
}
from
'./Sidebar'
export
{
default
as
Levelbar
}
from
'./Levelbar'
;
export
{
default
as
Levelbar
}
from
'./Levelbar'
export
{
default
as
AppMain
}
from
'./AppMain'
;
export
{
default
as
AppMain
}
from
'./AppMain'
src/views/login/authredirect.vue
View file @
551e911e
...
...
@@ -2,9 +2,9 @@
export
default
{
name
:
'authredirect'
,
created
()
{
const
hash
=
window
.
location
.
search
.
slice
(
1
)
;
window
.
opener
.
location
.
href
=
window
.
location
.
origin
+
'/login#'
+
hash
;
window
.
close
()
;
const
hash
=
window
.
location
.
search
.
slice
(
1
)
window
.
opener
.
location
.
href
=
window
.
location
.
origin
+
'/login#'
+
hash
window
.
close
()
}
}
</
script
>
src/views/login/index.vue
View file @
551e911e
...
...
@@ -37,10 +37,10 @@
</
template
>
<
script
>
import
{
isvalidUsername
}
from
'utils/validate'
import
socialSign
from
'./socialsignin'
import
{
isvalidUsername
}
from
'utils/validate'
import
socialSign
from
'./socialsignin'
export
default
{
export
default
{
components
:
{
socialSign
},
name
:
'login'
,
data
()
{
...
...
@@ -122,7 +122,7 @@
destroyed
()
{
// window.removeEventListener('hashchange', this.afterQRScan)
}
}
}
</
script
>
<
style
rel=
"stylesheet/scss"
lang=
"scss"
>
...
...
src/views/login/socialsignin.vue
View file @
551e911e
This diff is collapsed.
Click to expand it.
src/views/permission/index.vue
View file @
551e911e
This diff is collapsed.
Click to expand it.
src/views/qiniu/upload.vue
View file @
551e911e
This diff is collapsed.
Click to expand it.
src/views/theme/index.vue
View file @
551e911e
This diff is collapsed.
Click to expand it.
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