Add timeline component
This commit is contained in:
parent
8ef35b4f9b
commit
b266dc31eb
7 changed files with 111 additions and 5 deletions
|
@ -42,7 +42,7 @@
|
|||
"driver.js": "0.8.1",
|
||||
"dropzone": "5.2.0",
|
||||
"echarts": "4.1.0",
|
||||
"element-ui": "2.4.11",
|
||||
"element-ui": "^2.7.0",
|
||||
"file-saver": "1.3.8",
|
||||
"fuse.js": "3.4.2",
|
||||
"js-cookie": "2.2.0",
|
||||
|
|
|
@ -199,5 +199,8 @@ export default {
|
|||
byStatus: 'By status',
|
||||
active: 'Active',
|
||||
deactivated: 'Deactivated'
|
||||
},
|
||||
reports: {
|
||||
reports: 'Reports'
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ import Vuex from 'vuex'
|
|||
import app from './modules/app'
|
||||
import errorLog from './modules/errorLog'
|
||||
import permission from './modules/permission'
|
||||
import reports from './modules/reports'
|
||||
import tagsView from './modules/tagsView'
|
||||
import user from './modules/user'
|
||||
import users from './modules/users'
|
||||
|
@ -15,6 +16,7 @@ const store = new Vuex.Store({
|
|||
app,
|
||||
errorLog,
|
||||
permission,
|
||||
reports,
|
||||
tagsView,
|
||||
user,
|
||||
users
|
||||
|
|
37
src/store/modules/reports.js
Normal file
37
src/store/modules/reports.js
Normal file
|
@ -0,0 +1,37 @@
|
|||
const reports = {
|
||||
state: {
|
||||
fetchedReports: [
|
||||
{
|
||||
id: '1',
|
||||
timestamp: '2018/4/12',
|
||||
local: true,
|
||||
from: 'John', // actor nickname
|
||||
object: 'Bob', // user nickname
|
||||
header: 'Report #1', // content
|
||||
content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.'
|
||||
},
|
||||
{
|
||||
id: '2',
|
||||
timestamp: '2018/4/1',
|
||||
local: true,
|
||||
from: 'Max',
|
||||
object: 'Vic',
|
||||
header: 'Report #2',
|
||||
content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.'
|
||||
},
|
||||
{
|
||||
id: '3',
|
||||
timestamp: '2018/2/28',
|
||||
local: true,
|
||||
from: 'Tim',
|
||||
object: 'Jen',
|
||||
header: 'Report #3',
|
||||
content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.'
|
||||
}
|
||||
]
|
||||
},
|
||||
mutations: {},
|
||||
actions: {}
|
||||
}
|
||||
|
||||
export default reports
|
20
src/views/reports/components/TimelineItem.vue
Normal file
20
src/views/reports/components/TimelineItem.vue
Normal file
|
@ -0,0 +1,20 @@
|
|||
<template>
|
||||
<el-timeline-item :timestamp="item.timestamp" placement="top">
|
||||
<el-card>
|
||||
<h4>{{ item.header }}</h4>
|
||||
<p>{{ item.content }}</p>
|
||||
</el-card>
|
||||
</el-timeline-item>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'TimelineItem',
|
||||
props: {
|
||||
item: {
|
||||
type: Object,
|
||||
required: true
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,44 @@
|
|||
<template>
|
||||
<div class="reports-container">
|
||||
<h1>{{ $t('reports.reports') }}</h1>
|
||||
<div class="block">
|
||||
<el-timeline class="timeline">
|
||||
<timeline-item v-for="item in reports" :item="item" :key="item.id"/>
|
||||
</el-timeline>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import TimelineItem from './components/TimelineItem'
|
||||
|
||||
export default {
|
||||
components: { TimelineItem },
|
||||
computed: {
|
||||
reports() {
|
||||
return this.$store.state.reports.fetchedReports
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style rel='stylesheet/scss' lang='scss' scoped>
|
||||
.reports-container {
|
||||
h1 {
|
||||
margin: 22px 0 0 15px;
|
||||
}
|
||||
.el-timeline {
|
||||
margin: 45px;
|
||||
padding: 0px;
|
||||
}
|
||||
}
|
||||
@media
|
||||
only screen and (max-width: 760px),
|
||||
(min-device-width: 768px) and (max-device-width: 1024px) {
|
||||
.reports-container {
|
||||
h1 {
|
||||
margin: 7px 10px 7px 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -3446,10 +3446,10 @@ elegant-spinner@^1.0.1:
|
|||
resolved "https://registry.yarnpkg.com/elegant-spinner/-/elegant-spinner-1.0.1.tgz#db043521c95d7e303fd8f345bedc3349cfb0729e"
|
||||
integrity sha1-2wQ1IcldfjA/2PNFvtwzSc+wcp4=
|
||||
|
||||
element-ui@2.4.11:
|
||||
version "2.4.11"
|
||||
resolved "https://registry.yarnpkg.com/element-ui/-/element-ui-2.4.11.tgz#db6a2d37001b8fe5fff9f176fb58bb3908cfa9c9"
|
||||
integrity sha512-RtgK0t840NAFTajGMWvylzZRSX1EkZ7V4YgAoBxhv4TtkeMscLuk/IdYOzPdlQq6IN0byx1YVBxCX+u4yYkGvw==
|
||||
element-ui@^2.7.0:
|
||||
version "2.7.0"
|
||||
resolved "https://registry.yarnpkg.com/element-ui/-/element-ui-2.7.0.tgz#6bfcdfa5c75bfc4cda835186f2a1f98b93cd5d14"
|
||||
integrity sha512-FalWzOmT/K4w4C/8tw2kGvzzQnRJ5MqEvSL5rEKNa081PFGIcUS9exyVpYrNPKF8ua/W6qaqrXPC6DQ8sNcmOQ==
|
||||
dependencies:
|
||||
async-validator "~1.8.1"
|
||||
babel-helper-vue-jsx-merge-props "^2.0.0"
|
||||
|
|
Loading…
Reference in a new issue