Files
dvcp_v2_webapp/project/xiushan/apps/AppNewsCenter/AppNewsCenter.vue

103 lines
2.0 KiB
Vue
Raw Normal View History

2022-02-25 17:27:11 +08:00
<template>
<div class="AppNewsCenter">
<component
:is="currentPage"
:detail="detail"
:instance="instance"
:dict="dict"
:permissions="permissions"
:areaId="areaId"
@goBack="goBack"
@goPage="goPage"
/>
</div>
</template>
<script>
import {mapState} from 'vuex'
2022-08-04 18:03:12 +08:00
import {addArticle, addVideo, newsDetail, newsList, videoDetail, detail} from './components'
2022-02-25 17:27:11 +08:00
export default {
name: 'AppNewsCenter',
label: '新闻中心',
props: {
instance: Function,
dict: Object,
permissions: Function
},
components: {
newsList,
addVideo,
addArticle,
newsDetail,
2022-08-04 18:03:12 +08:00
videoDetail,
detail
2022-02-25 17:27:11 +08:00
},
data() {
return {
areaId: '',
currIndex: '0',
detail: {}
}
},
computed: {
...mapState(['user']),
tabs() {
return [
{
label: '内容管理',
name: 'newsList',
comp: newsList,
addVideo: addVideo,
addArticle: addArticle,
newsDetail: newsDetail,
2022-08-04 18:03:12 +08:00
videoDetail: videoDetail,
detail: detail,
2022-02-25 17:27:11 +08:00
},
]
},
showList() {
return !this.$route.hash
},
hideLevel() {
return this.user.info.areaList?.length - 1
},
currentPage() {
2022-03-22 22:52:01 +08:00
return this.$route.hash == "#video" ? videoDetail :
this.$route.hash == "#news" ? newsDetail :
this.$route.hash?.substring(1) || newsList
2022-02-25 17:27:11 +08:00
}
},
methods: {
changeAreaId() {
this.$nextTick(() => {
this.$refs[this.currIndex][0].getList()
})
},
goBack() {
this.$router.push({})
},
goPage(obj) {
let hash = "#" + obj.key
if (obj.row) {
let {id} = obj.row
this.$router.push({query: {id}, hash})
} else {
this.$router.push({hash})
}
}
},
created() {
this.areaId = this.user.info.areaId
2022-02-28 16:25:36 +08:00
this.dict.load("appNewsType", "appNewsStatus", "appNewsCategory")
2022-02-25 17:27:11 +08:00
}
}
</script>
<style lang="scss" scoped>
.AppNewsCenter {
width: 100%;
height: 100%;
}
</style>