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
33a4369c
Commit
33a4369c
authored
Aug 22, 2017
by
Pan
Committed by
花裤衩
Aug 28, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refine code
parent
8fa2364a
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
40 additions
and
66 deletions
+40
-66
index.js
src/router/index.js
+7
-7
401.vue
src/views/errorPage/401.vue
+0
-1
404.vue
src/views/errorPage/404.vue
+0
-1
tabPane.vue
src/views/example/tab/components/tabPane.vue
+1
-5
index.vue
src/views/example/tab/index.vue
+4
-4
index.vue
src/views/excel/index.vue
+7
-7
selectExcel.vue
src/views/excel/selectExcel.vue
+8
-11
index.vue
src/views/theme/index.vue
+13
-30
No files found.
src/router/index.js
View file @
33a4369c
...
@@ -18,8 +18,8 @@ import Layout from '../views/layout/Layout'
...
@@ -18,8 +18,8 @@ import Layout from '../views/layout/Layout'
export
const
constantRouterMap
=
[
export
const
constantRouterMap
=
[
{
path
:
'/login'
,
component
:
_import
(
'login/index'
),
hidden
:
true
},
{
path
:
'/login'
,
component
:
_import
(
'login/index'
),
hidden
:
true
},
{
path
:
'/authredirect'
,
component
:
_import
(
'login/authredirect'
),
hidden
:
true
},
{
path
:
'/authredirect'
,
component
:
_import
(
'login/authredirect'
),
hidden
:
true
},
{
path
:
'/404'
,
component
:
_import
(
'error/404'
),
hidden
:
true
},
{
path
:
'/404'
,
component
:
_import
(
'error
Page
/404'
),
hidden
:
true
},
{
path
:
'/401'
,
component
:
_import
(
'error/401'
),
hidden
:
true
},
{
path
:
'/401'
,
component
:
_import
(
'error
Page
/401'
),
hidden
:
true
},
{
{
path
:
'/'
,
path
:
'/'
,
component
:
Layout
,
component
:
Layout
,
...
@@ -117,14 +117,14 @@ export const asyncRouterMap = [
...
@@ -117,14 +117,14 @@ export const asyncRouterMap = [
]
]
},
},
{
{
path
:
'/error
page
'
,
path
:
'/error'
,
component
:
Layout
,
component
:
Layout
,
redirect
:
'noredirect'
,
redirect
:
'noredirect'
,
name
:
'错误页面'
,
name
:
'错误页面'
,
icon
:
'404'
,
icon
:
'404'
,
children
:
[
children
:
[
{
path
:
'401'
,
component
:
_import
(
'error/401'
),
name
:
'401'
},
{
path
:
'401'
,
component
:
_import
(
'error
Page
/401'
),
name
:
'401'
},
{
path
:
'404'
,
component
:
_import
(
'error/404'
),
name
:
'404'
}
{
path
:
'404'
,
component
:
_import
(
'error
Page
/404'
),
name
:
'404'
}
]
]
},
},
{
{
...
@@ -139,12 +139,12 @@ export const asyncRouterMap = [
...
@@ -139,12 +139,12 @@ export const asyncRouterMap = [
{
{
path
:
'/excel'
,
path
:
'/excel'
,
component
:
Layout
,
component
:
Layout
,
redirect
:
'
noredirect
'
,
redirect
:
'
/excel/download
'
,
name
:
'excel'
,
name
:
'excel'
,
icon
:
'EXCEL'
,
icon
:
'EXCEL'
,
children
:
[
children
:
[
{
path
:
'download'
,
component
:
_import
(
'excel/index'
),
name
:
'导出excel'
},
{
path
:
'download'
,
component
:
_import
(
'excel/index'
),
name
:
'导出excel'
},
{
path
:
'download2'
,
component
:
_import
(
'excel/selectExcel'
),
name
:
'
选择导出excel
'
}
{
path
:
'download2'
,
component
:
_import
(
'excel/selectExcel'
),
name
:
'
导出已选择项
'
}
]
]
},
},
{
{
...
...
src/views/error/401.vue
→
src/views/error
Page
/401.vue
View file @
33a4369c
...
@@ -20,7 +20,6 @@
...
@@ -20,7 +20,6 @@
<img
:src=
"errGif"
width=
"313"
height=
"428"
alt=
"Girl has dropped her ice cream."
>
<img
:src=
"errGif"
width=
"313"
height=
"428"
alt=
"Girl has dropped her ice cream."
>
</el-col>
</el-col>
</el-row>
</el-row>
<el-dialog
title=
"随便看"
:visible
.
sync=
"dialogVisible"
size=
"large"
>
<el-dialog
title=
"随便看"
:visible
.
sync=
"dialogVisible"
size=
"large"
>
<img
class=
"pan-img"
:src=
"ewizardClap"
>
<img
class=
"pan-img"
:src=
"ewizardClap"
>
</el-dialog>
</el-dialog>
...
...
src/views/error/404.vue
→
src/views/error
Page
/404.vue
View file @
33a4369c
...
@@ -225,5 +225,4 @@ export default {
...
@@ -225,5 +225,4 @@ export default {
}
}
}
}
}
}
</
style
>
</
style
>
src/views/example/tab/components/tabPane.vue
View file @
33a4369c
...
@@ -28,7 +28,7 @@
...
@@ -28,7 +28,7 @@
<
el
-
table
-
column
width
=
"80px"
label
=
"重要性"
>
<
el
-
table
-
column
width
=
"80px"
label
=
"重要性"
>
<
template
scope
=
"scope"
>
<
template
scope
=
"scope"
>
<
icon
-
svg
v
-
for
=
"n in +scope.row.importance"
icon
-
class
=
"wujiaoxing"
class
=
"meta-item__icon"
:
key
=
"n"
><
/icon-svg
>
<
icon
-
svg
v
-
for
=
"n in +scope.row.importance"
icon
-
class
=
"wujiaoxing"
:
key
=
"n"
><
/icon-svg
>
<
/template
>
<
/template
>
<
/el-table-column
>
<
/el-table-column
>
...
@@ -51,7 +51,6 @@
...
@@ -51,7 +51,6 @@
import
{
fetchList
}
from
'api/article_table'
import
{
fetchList
}
from
'api/article_table'
export
default
{
export
default
{
name
:
'articleDetail'
,
props
:
{
props
:
{
type
:
{
type
:
{
type
:
String
,
type
:
String
,
...
@@ -61,7 +60,6 @@ export default {
...
@@ -61,7 +60,6 @@ export default {
data
()
{
data
()
{
return
{
return
{
list
:
null
,
list
:
null
,
total
:
null
,
listQuery
:
{
listQuery
:
{
page
:
1
,
page
:
1
,
limit
:
5
,
limit
:
5
,
...
@@ -86,10 +84,8 @@ export default {
...
@@ -86,10 +84,8 @@ export default {
methods
:
{
methods
:
{
getList
()
{
getList
()
{
this
.
$emit
(
'create'
)
// for test
this
.
$emit
(
'create'
)
// for test
fetchList
(
this
.
listQuery
).
then
(
response
=>
{
fetchList
(
this
.
listQuery
).
then
(
response
=>
{
this
.
list
=
response
.
data
.
items
this
.
list
=
response
.
data
.
items
this
.
total
=
response
.
data
.
total
}
)
}
)
}
}
}
}
...
...
src/views/example/tab/index.vue
View file @
33a4369c
src/views/excel/index.vue
View file @
33a4369c
<
template
>
<
template
>
<div
class=
"app-container"
>
<div
class=
"app-container"
>
<el-button
style=
'margin-bottom:20px;
float:right'
type=
"primary"
icon=
"document"
@
click=
"handleDownload
"
>
导出excel
</el-button>
<el-button
style=
'margin-bottom:20px;
'
type=
"primary"
icon=
"document"
@
click=
"handleDownload"
:loading=
"downloadLoading
"
>
导出excel
</el-button>
<el-table
:data=
"list"
v-loading
.
body=
"listLoading"
element-loading-text=
"拼命加载中"
border
fit
highlight-current-row
>
<el-table
:data=
"list"
v-loading
.
body=
"listLoading"
element-loading-text=
"拼命加载中"
border
fit
highlight-current-row
>
<el-table-column
align=
"center"
label=
'ID'
width=
"95"
>
<el-table-column
align=
"center"
label=
'ID'
width=
"95"
>
<template
scope=
"scope"
>
<template
scope=
"scope"
>
...
@@ -12,7 +12,6 @@
...
@@ -12,7 +12,6 @@
{{
scope
.
row
.
title
}}
{{
scope
.
row
.
title
}}
</
template
>
</
template
>
</el-table-column>
</el-table-column>
<el-table-column
label=
"作者"
width=
"110"
>
<el-table-column
label=
"作者"
width=
"110"
>
<
template
scope=
"scope"
>
<
template
scope=
"scope"
>
<span>
{{
scope
.
row
.
author
}}
</span>
<span>
{{
scope
.
row
.
author
}}
</span>
...
@@ -40,7 +39,8 @@ export default {
...
@@ -40,7 +39,8 @@ export default {
data
()
{
data
()
{
return
{
return
{
list
:
null
,
list
:
null
,
listLoading
:
true
listLoading
:
true
,
downloadLoading
:
false
}
}
},
},
created
()
{
created
()
{
...
@@ -49,21 +49,21 @@ export default {
...
@@ -49,21 +49,21 @@ export default {
methods
:
{
methods
:
{
fetchData
()
{
fetchData
()
{
this
.
listLoading
=
true
this
.
listLoading
=
true
getList
(
this
.
listQuery
).
then
(
response
=>
{
getList
().
then
(
response
=>
{
this
.
list
=
response
.
data
this
.
list
=
response
.
data
this
.
listLoading
=
false
this
.
listLoading
=
false
})
})
},
},
handleDownload
()
{
handleDownload
()
{
this
.
downloadLoading
=
true
require
.
ensure
([],
()
=>
{
require
.
ensure
([],
()
=>
{
const
{
const
{
export_json_to_excel
}
=
require
(
'vendor/Export2Excel'
)
export_json_to_excel
}
=
require
(
'vendor/Export2Excel'
)
const
tHeader
=
[
'序号'
,
'文章标题'
,
'作者'
,
'阅读数'
,
'发布时间'
]
const
tHeader
=
[
'序号'
,
'文章标题'
,
'作者'
,
'阅读数'
,
'发布时间'
]
const
filterVal
=
[
'id'
,
'title'
,
'author'
,
'pageviews'
,
'display_time'
]
const
filterVal
=
[
'id'
,
'title'
,
'author'
,
'pageviews'
,
'display_time'
]
const
list
=
this
.
list
const
list
=
this
.
list
const
data
=
this
.
formatJson
(
filterVal
,
list
)
const
data
=
this
.
formatJson
(
filterVal
,
list
)
export_json_to_excel
(
tHeader
,
data
,
'列表excel'
)
export_json_to_excel
(
tHeader
,
data
,
'列表excel'
)
this
.
downloadLoading
=
false
})
})
},
},
formatJson
(
filterVal
,
jsonData
)
{
formatJson
(
filterVal
,
jsonData
)
{
...
...
src/views/excel/selectExcel.vue
View file @
33a4369c
<
template
>
<
template
>
<div
class=
"app-container"
>
<div
class=
"app-container"
>
<el-button
style=
'margin-bottom:20px
;float:right'
type=
"primary"
icon=
"document"
@
click=
"handleDownload"
>
导出excel
</el-button>
<el-button
style=
'margin-bottom:20px
'
type=
"primary"
icon=
"document"
@
click=
"handleDownload"
:loading=
"downloadLoading"
>
导出已选择项
</el-button>
<el-table
:data=
"list"
v-loading
.
body=
"listLoading"
element-loading-text=
"拼命加载中"
border
fit
highlight-current-row
@
selection-change=
"handleSelectionChange"
<el-table
:data=
"list"
v-loading
.
body=
"listLoading"
element-loading-text=
"拼命加载中"
border
fit
highlight-current-row
@
selection-change=
"handleSelectionChange"
ref=
"multipleTable"
>
ref=
"multipleTable"
>
<el-table-column
type=
"selection"
align=
"center"
></el-table-column>
<el-table-column
type=
"selection"
align=
"center"
></el-table-column>
<el-table-column
align=
"center"
label=
'ID'
width=
"95"
>
<el-table-column
align=
"center"
label=
'ID'
width=
"95"
>
<template
scope=
"scope"
>
<template
scope=
"scope"
>
{{
scope
.
$index
}}
{{
scope
.
$index
}}
</
template
>
</
template
>
</el-table-column>
</el-table-column>
<el-table-column
label=
"文章标题"
>
<el-table-column
label=
"文章标题"
>
<
template
scope=
"scope"
>
<
template
scope=
"scope"
>
{{
scope
.
row
.
title
}}
{{
scope
.
row
.
title
}}
</
template
>
</
template
>
</el-table-column>
</el-table-column>
<el-table-column
label=
"作者"
width=
"110"
>
<el-table-column
label=
"作者"
width=
"110"
>
<
template
scope=
"scope"
>
<
template
scope=
"scope"
>
<span>
{{
scope
.
row
.
author
}}
</span>
<span>
{{
scope
.
row
.
author
}}
</span>
</
template
>
</
template
>
</el-table-column>
</el-table-column>
<el-table-column
label=
"阅读数"
width=
"105"
align=
"center"
>
<el-table-column
label=
"阅读数"
width=
"105"
align=
"center"
>
<
template
scope=
"scope"
>
<
template
scope=
"scope"
>
{{
scope
.
row
.
pageviews
}}
{{
scope
.
row
.
pageviews
}}
</
template
>
</
template
>
</el-table-column>
</el-table-column>
<el-table-column
align=
"center"
prop=
"created_at"
label=
"发布时间"
width=
"200"
>
<el-table-column
align=
"center"
prop=
"created_at"
label=
"发布时间"
width=
"200"
>
<
template
scope=
"scope"
>
<
template
scope=
"scope"
>
<i
class=
"el-icon-time"
></i>
<i
class=
"el-icon-time"
></i>
...
@@ -39,7 +34,6 @@
...
@@ -39,7 +34,6 @@
</div>
</div>
</template>
</template>
<
script
>
<
script
>
import
{
getList
}
from
'api/article'
import
{
getList
}
from
'api/article'
...
@@ -48,7 +42,8 @@ export default {
...
@@ -48,7 +42,8 @@ export default {
return
{
return
{
list
:
null
,
list
:
null
,
listLoading
:
true
,
listLoading
:
true
,
multipleSelection
:
[]
multipleSelection
:
[],
downloadLoading
:
false
}
}
},
},
created
()
{
created
()
{
...
@@ -67,6 +62,7 @@ export default {
...
@@ -67,6 +62,7 @@ export default {
},
},
handleDownload
()
{
handleDownload
()
{
if
(
this
.
multipleSelection
.
length
)
{
if
(
this
.
multipleSelection
.
length
)
{
this
.
downloadLoading
=
true
require
.
ensure
([],
()
=>
{
require
.
ensure
([],
()
=>
{
const
{
export_json_to_excel
}
=
require
(
'vendor/Export2Excel'
)
const
{
export_json_to_excel
}
=
require
(
'vendor/Export2Excel'
)
const
tHeader
=
[
'序号'
,
'文章标题'
,
'作者'
,
'阅读数'
,
'发布时间'
]
const
tHeader
=
[
'序号'
,
'文章标题'
,
'作者'
,
'阅读数'
,
'发布时间'
]
...
@@ -75,10 +71,11 @@ export default {
...
@@ -75,10 +71,11 @@ export default {
const
data
=
this
.
formatJson
(
filterVal
,
list
)
const
data
=
this
.
formatJson
(
filterVal
,
list
)
export_json_to_excel
(
tHeader
,
data
,
'列表excel'
)
export_json_to_excel
(
tHeader
,
data
,
'列表excel'
)
this
.
$refs
.
multipleTable
.
clearSelection
()
this
.
$refs
.
multipleTable
.
clearSelection
()
this
.
downloadLoading
=
false
})
})
}
else
{
}
else
{
this
.
$message
({
this
.
$message
({
message
:
'请
选择一条或多条记录导出
'
,
message
:
'请
至少选择一条记录
'
,
type
:
'warning'
type
:
'warning'
})
})
}
}
...
...
src/views/theme/index.vue
View file @
33a4369c
<
template
>
<
template
>
<div
class=
"app-container"
>
<div
class=
"app-container"
>
<code>
会补动态换肤的教程
</code>
<el-card
class=
"box-card"
>
<el-card
class=
"box-card"
>
<div
slot=
"header"
>
<div
slot=
"header"
>
<span
style=
"line-height: 36px;"
>
偏好设置
</span>
<span
style=
"line-height: 36px;"
>
偏好设置
</span>
<a
class=
'link-type link-title'
target=
"_blank"
href=
'https://segmentfault.com/a/1190000009762198#articleHeader2'
>
态换肤的教程
</a>
</div>
</div>
<div
class=
"box-item"
>
<div
class=
"box-item"
>
<span
class=
"field-label"
>
换肤:
</span>
<span
class=
"field-label"
>
换肤:
</span>
<el-switch
v-model=
"theme"
on-text=
""
off-text=
""
>
<el-switch
v-model=
"theme"
on-text=
""
off-text=
""
>
...
@@ -43,6 +42,7 @@
...
@@ -43,6 +42,7 @@
</div>
</div>
</
template
>
</
template
>
<
script
>
<
script
>
import
{
toggleClass
}
from
'utils'
import
{
toggleClass
}
from
'utils'
import
'@/assets/custom-theme/index.css'
// 换肤版本element-ui css
import
'@/assets/custom-theme/index.css'
// 换肤版本element-ui css
...
@@ -51,39 +51,19 @@ export default {
...
@@ -51,39 +51,19 @@ export default {
data
()
{
data
()
{
return
{
return
{
theme
:
false
,
theme
:
false
,
tags
:
[{
tags
:
[
name
:
'标签一'
,
{
name
:
'标签一'
,
type
:
''
},
type
:
''
{
name
:
'标签二'
,
type
:
'gray'
},
},
{
name
:
'标签三'
,
type
:
'primary'
},
{
{
name
:
'标签四'
,
type
:
'success'
},
name
:
'标签二'
,
{
name
:
'标签五'
,
type
:
'warning'
},
type
:
'gray'
{
name
:
'标签六'
,
type
:
'danger'
}
},
]
{
name
:
'标签三'
,
type
:
'primary'
},
{
name
:
'标签四'
,
type
:
'success'
},
{
name
:
'标签五'
,
type
:
'warning'
},
{
name
:
'标签六'
,
type
:
'danger'
}
],
inputVisible
:
false
,
inputValue
:
''
}
}
},
},
watch
:
{
watch
:
{
theme
()
{
theme
()
{
toggleClass
(
document
.
body
,
'custom-theme'
)
toggleClass
(
document
.
body
,
'custom-theme'
)
// this.$store.dispatch('setTheme', value);
}
}
}
}
}
}
...
@@ -103,4 +83,7 @@ export default {
...
@@ -103,4 +83,7 @@ export default {
.tag-item
{
.tag-item
{
margin-right
:
15px
;
margin-right
:
15px
;
}
}
.link-title
{
margin-left
:
35px
;
}
</
style
>
</
style
>
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