refine code
This commit is contained in:
parent
8fa2364a3b
commit
33a4369cd7
|
@ -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('errorPage/404'), hidden: true },
|
||||||
{ path: '/401', component: _import('error/401'), hidden: true },
|
{ path: '/401', component: _import('errorPage/401'), hidden: true },
|
||||||
{
|
{
|
||||||
path: '/',
|
path: '/',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
|
@ -117,14 +117,14 @@ export const asyncRouterMap = [
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/errorpage',
|
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('errorPage/401'), name: '401' },
|
||||||
{ path: '404', component: _import('error/404'), name: '404' }
|
{ path: '404', component: _import('errorPage/404'), name: '404' }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -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: '导出已选择项' }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -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>
|
|
@ -225,5 +225,4 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
|
@ -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 @@
|
||||||
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 {
|
||||||
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 {
|
||||||
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
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,10 +20,10 @@ export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
tabMapOptions: [
|
tabMapOptions: [
|
||||||
{ label: '中国', key: 'CN' },
|
{ label: '中国', key: 'CN' },
|
||||||
{ label: '美国', key: 'US' },
|
{ label: '美国', key: 'US' },
|
||||||
{ label: '日本', key: 'JP' },
|
{ label: '日本', key: 'JP' },
|
||||||
{ label: '欧元区', key: 'EU' }
|
{ label: '欧元区', key: 'EU' }
|
||||||
],
|
],
|
||||||
activeName: 'CN',
|
activeName: 'CN',
|
||||||
createdTimes: 0
|
createdTimes: 0
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<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 @@
|
||||||
{{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 {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
list: null,
|
list: null,
|
||||||
listLoading: true
|
listLoading: true,
|
||||||
|
downloadLoading: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
@ -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) {
|
||||||
|
|
|
@ -1,34 +1,29 @@
|
||||||
<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 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getList } from 'api/article'
|
import { getList } from 'api/article'
|
||||||
|
|
||||||
|
@ -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 {
|
||||||
},
|
},
|
||||||
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 {
|
||||||
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'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
<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 @@
|
||||||
</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 {
|
||||||
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 {
|
||||||
.tag-item{
|
.tag-item{
|
||||||
margin-right: 15px;
|
margin-right: 15px;
|
||||||
}
|
}
|
||||||
|
.link-title{
|
||||||
|
margin-left:35px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in New Issue