nebula/pages/portfolio/manager/bind/_portfolio_id.vue

92 lines
2.5 KiB
Vue
Raw Permalink Normal View History

2020-08-02 19:23:32 +08:00
<template>
<el-row class="wrapper">
<el-col style="margin-bottom: 1rem;">
<el-breadcrumb separator-class="el-icon-arrow-right">
<el-breadcrumb-item :to="{ path: '/portfolio/manager/' + idPortfolio }">返回上一级</el-breadcrumb-item>
<el-breadcrumb-item>关联文章</el-breadcrumb-item>
</el-breadcrumb>
</el-col>
<el-col>
2021-04-27 21:40:22 +08:00
<el-divider></el-divider>
2020-08-02 19:23:32 +08:00
</el-col>
<el-col>
<el-input v-model="searchText" @input="searchUnbindArticle" placeholder="输入帖子标题,回车检索"></el-input>
</el-col>
2021-04-27 21:40:22 +08:00
<el-col style="padding-top: 10px;">
2020-08-02 19:23:32 +08:00
<portfolio-manager-bind-list :idPortfolio="idPortfolio" :articles="articles"
@currentChange="currentChangeArticle"></portfolio-manager-bind-list>
</el-col>
</el-row>
</template>
<script>
import {mapState} from 'vuex';
import PortfolioManagerBindList from "~/components/common/portfolio/manager/bind/list";
export default {
name: "PortfolioManagerBind",
components: {
PortfolioManagerBindList
},
validate({params, store}) {
return params.portfolio_id && !isNaN(Number(params.portfolio_id))
},
fetch() {
let {store, params, error} = this.$nuxt.context
2020-08-02 19:23:32 +08:00
return Promise.all([
store
.dispatch('portfolio/fetchUnBindArticleList', params)
.catch(err => error({statusCode: 404}))
])
},
computed: {
...mapState({
articles: state => state.portfolio.unbindArticles,
}),
idPortfolio() {
return Number(this.$route.params.portfolio_id)
}
},
data() {
return {
searchText: ''
}
},
methods: {
currentChangeArticle(page) {
this.$store.dispatch('portfolio/fetchUnBindArticleList', {
page: page,
portfolio_id: this.$route.params.portfolio_id
})
},
searchUnbindArticle() {
this.$store.dispatch('portfolio/fetchUnBindArticleList', {
page: 1,
portfolio_id: this.$route.params.portfolio_id,
searchText: this.searchText
})
},
onRouter(name, data) {
if (name === 'article') {
this.$router.push({
path: data
})
} else {
this.$router.push(
{
path: '/portfolio/post/' + data
}
)
}
}
2022-08-27 16:05:43 +08:00
},
mounted() {
this.$store.commit('setActiveMenu', 'portfolioBind');
2020-08-02 19:23:32 +08:00
}
}
</script>
<style scoped>
</style>