nebula/pages/admin/topics.vue

87 lines
2.3 KiB
Vue
Raw Normal View History

2020-08-11 22:39:59 +08:00
<template>
2024-01-03 18:26:23 +08:00
<div>
2024-02-18 10:57:49 +08:00
<el-row style="margin-top: 20px;">
<el-col style="margin-bottom: 1rem;">
<el-breadcrumb separator-class="el-icon-arrow-right">
<el-breadcrumb-item :to="{ path: '/admin/dashboard' }">首页</el-breadcrumb-item>
2024-02-18 10:57:49 +08:00
<el-breadcrumb-item>专题管理</el-breadcrumb-item>
</el-breadcrumb>
</el-col>
<el-col style="margin: .5rem;">
<el-button size="small" @click="createTopic" plain>创建专题</el-button>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="8" style="margin-bottom: .5rem;" v-for="topic in topics.list" :key="topic.idTopic">
<el-card shadow="never">
<div class="card-body d-flex flex-column">
<el-row :gutter="20">
<el-col :span="5" style="text-align: right;">
<img :src="topic.topicIconPath" :alt="topic.topicTitle"
style="display: block;width:60px;height: 60px" class="topic-brand-img">
2024-02-18 10:57:49 +08:00
</el-col>
<el-col :span="18">
2024-02-18 10:57:49 +08:00
<el-link rel="nofollow" @click="onRouter('admin-topic-detail',topic.topicUri)" :underline="false">
<span style="font-size: 18px;font-weight: bold"> {{ topic.topicTitle }}</span>
2024-01-03 18:26:23 +08:00
</el-link>
<div class="text-muted article-summary-md text-content">{{ topic.topicDescription }}</div>
2020-08-11 22:39:59 +08:00
</el-col>
2024-01-03 18:26:23 +08:00
</el-row>
</div>
</el-card>
</el-col>
</el-row>
</div>
2020-08-11 22:39:59 +08:00
</template>
<script>
2024-01-03 18:26:23 +08:00
import {mapState} from 'vuex';
2020-08-11 22:39:59 +08:00
2024-01-03 18:26:23 +08:00
export default {
name: "topics",
middleware: 'auth',
fetch() {
let {store, params, error} = this.$nuxt.context
return Promise.all([
store
.dispatch('topic/fetchList', params)
.catch(err => error({statusCode: 404}))
])
},
computed: {
...mapState({
topics: state => state.topic.list.data
})
},
methods: {
onRouter(item, data) {
this.$router.push({
path: '/admin/topic/' + data
2020-08-11 22:39:59 +08:00
})
},
2024-01-03 18:26:23 +08:00
createTopic() {
let _ts = this;
_ts.$router.push({
path: '/admin/topic/post'
})
2020-08-11 22:39:59 +08:00
}
}
2024-01-03 18:26:23 +08:00
}
2020-08-11 22:39:59 +08:00
</script>
<style scoped>
2024-01-03 18:26:23 +08:00
.topic-brand-img {
/*margin-top: 40%;*/
2024-01-03 18:26:23 +08:00
}
2020-08-11 22:39:59 +08:00
2024-01-03 18:26:23 +08:00
.text-content {
height: 70px;
overflow: hidden;
text-overflow: ellipsis;
-webkit-line-clamp: 3;
display: -webkit-box;
-webkit-box-orient: vertical;
}
2020-08-11 22:39:59 +08:00
</style>