nebula/pages/admin/topics.vue

77 lines
2.1 KiB
Vue
Raw Normal View History

2020-08-11 22:39:59 +08:00
<template>
<el-row :gutter="8">
<el-col style="margin-bottom: 1rem;">
<el-breadcrumb separator-class="el-icon-arrow-right">
<el-breadcrumb-item :to="{ path: '/admin' }">首页</el-breadcrumb-item>
<el-breadcrumb-item>专题管理</el-breadcrumb-item>
</el-breadcrumb>
</el-col>
<el-col style="margin: .5rem;">
<el-button size="small" @click="createTopic">创建专题</el-button>
</el-col>
<el-col :span="8" style="margin-bottom: .5rem;" v-for="topic in topics" :key="topic.idTopic">
<el-card>
<div class="card-body d-flex flex-column">
<el-col :span="4" style="text-align: right;">
<img :src="topic.topicIconPath" :alt="topic.topicTitle" class="topic-brand-img">
</el-col>
<el-col :span="20">
<el-col>
<el-col>
2020-09-08 07:59:55 +08:00
<el-link rel="nofollow" @click="onRouter('admin-topic-detail',topic.topicUri)" :underline="false"><h4>{{
topic.topicTitle
}}</h4>
2020-08-11 22:39:59 +08:00
</el-link>
</el-col>
<el-col>
<div class="text-muted article-summary-md">{{ topic.topicDescription }}</div>
</el-col>
</el-col>
</el-col>
</div>
</el-card>
</el-col>
</el-row>
</template>
<script>
import {mapState} from 'vuex';
export default {
2020-09-08 07:59:55 +08:00
name: "topics",
2020-08-11 22:39:59 +08:00
fetch({store, params, error}) {
return Promise.all([
store
.dispatch('topic/fetchList', params)
.catch(err => error({statusCode: 404}))
])
},
computed: {
...mapState({
topics: state => state.topic.list.data.topics,
pagination: state => state.topic.list.data.pagination
})
},
methods: {
onRouter(item, data) {
this.$router.push({
2020-09-08 07:59:55 +08:00
path: '/admin/topic/' + data
2020-08-11 22:39:59 +08:00
})
},
createTopic() {
let _ts = this;
_ts.$router.push({
path: '/admin/topic/post'
})
}
},
mounted() {
2020-09-08 07:59:55 +08:00
this.$store.commit("setActiveMenu", "admin-topics");
2020-08-11 22:39:59 +08:00
}
}
</script>
<style scoped>
</style>