|
@@ -9,23 +9,26 @@
|
|
|
<section class="content w1200">
|
|
<section class="content w1200">
|
|
|
<div class="aside">
|
|
<div class="aside">
|
|
|
<ul class="news-cate-list">
|
|
<ul class="news-cate-list">
|
|
|
- <li v-for="(item, index) in newsNav" :key="index" class="news-cate-item">
|
|
|
|
|
|
|
+ <li v-for="(item, index) in $store.state.newsNav" :key="index" class="news-cate-item">
|
|
|
<div class="icon"><img :src="item.icon" alt="" srcset=""></div>
|
|
<div class="icon"><img :src="item.icon" alt="" srcset=""></div>
|
|
|
<div :class="['title', cateId == item.id ? 'active' : '']" @click="changeCate(item, index)">{{ item.type }}</div>
|
|
<div :class="['title', cateId == item.id ? 'active' : '']" @click="changeCate(item, index)">{{ item.type }}</div>
|
|
|
</li>
|
|
</li>
|
|
|
</ul>
|
|
</ul>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="news-main">
|
|
<div class="news-main">
|
|
|
- <section class="news-list">
|
|
|
|
|
|
|
+ <section class="empty-content" v-if="isEmpty">
|
|
|
|
|
+ <p>暂无新闻~</p>
|
|
|
|
|
+ </section>
|
|
|
|
|
+ <section class="news-list" v-else>
|
|
|
<div class="news-list-item" v-for="(item, index) in newsList" :key="index">
|
|
<div class="news-list-item" v-for="(item, index) in newsList" :key="index">
|
|
|
<div class="news-list-left">
|
|
<div class="news-list-left">
|
|
|
- <nuxt-link :to="{ name: 'news-newsView-id', params: { id: cateId }, query: { cateId: cateId } }">
|
|
|
|
|
|
|
+ <nuxt-link :to="{ name: 'news-newsView-id', params: { id: item.id }, query: { cateId: item.typeId } }">
|
|
|
<img :src="item.articleImg" alt="">
|
|
<img :src="item.articleImg" alt="">
|
|
|
</nuxt-link>
|
|
</nuxt-link>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="news-list-right">
|
|
<div class="news-list-right">
|
|
|
<div class="news-list-title">
|
|
<div class="news-list-title">
|
|
|
- <nuxt-link :to="{ name: 'news-newsView-id', params: { id: cateId }, query: { cateId: cateId } }">
|
|
|
|
|
|
|
+ <nuxt-link :to="{ name: 'news-newsView-id', params: { id: item.id }, query: { cateId: item.typeId } }">
|
|
|
{{ item.articleTitle }}
|
|
{{ item.articleTitle }}
|
|
|
</nuxt-link>
|
|
</nuxt-link>
|
|
|
</div>
|
|
</div>
|
|
@@ -61,38 +64,11 @@ export default {
|
|
|
name: 'news',
|
|
name: 'news',
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
|
|
+ isEmpty: false,
|
|
|
currentPage: 1,
|
|
currentPage: 1,
|
|
|
total: 0,
|
|
total: 0,
|
|
|
|
|
+ cateId: '',
|
|
|
newsList: [
|
|
newsList: [
|
|
|
- {
|
|
|
|
|
- title: '中德智慧乔迁逻辑狗智慧乔迁智慧乔迁标题中德智 迁标题中德智迁标题中德智慧乔迁……..',
|
|
|
|
|
- time: '2020-6-29',
|
|
|
|
|
- content: '个人的何时去个人的何时去个人的何时去个人的何时去个人的何时去个人的何时去个人 的人的何时去个人的何时去…… ',
|
|
|
|
|
- imgUrl: require('~/assets/images/news/img.png'),
|
|
|
|
|
- id: '1',
|
|
|
|
|
- cateId: '1',
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- title: '中德智慧乔迁逻辑狗智慧乔迁智慧乔迁标题中德智 慧乔迁……..',
|
|
|
|
|
- time: '2020-6-29',
|
|
|
|
|
- content: '个人的何时去个人的何时去个人的何时去个人的何时去个人的何时去个人的何时去个人 的人的何时去个人的何时去…… ',
|
|
|
|
|
- imgUrl: require('~/assets/images/news/img.png'),
|
|
|
|
|
- id: '1'
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- title: '中德智慧乔迁逻辑狗智慧乔迁智慧乔迁标题中德智 慧乔迁……..',
|
|
|
|
|
- time: '2020-6-29',
|
|
|
|
|
- content: '个人的何时去个人的何时去个人的何时去个人的何时去个人的何时去个人的何时去个人 的人的何时去个人的何时去…… ',
|
|
|
|
|
- imgUrl: require('~/assets/images/news/img.png'),
|
|
|
|
|
- id: '1'
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- title: '中德智慧乔迁逻辑狗智慧乔迁智慧乔迁标题中德智 慧乔迁……..',
|
|
|
|
|
- time: '2020-6-29',
|
|
|
|
|
- content: '个人的何时去个人的何时去个人的何时去个人的何时去个人的何时去个人的何时去个人 的人的何时去个人的何时去…… ',
|
|
|
|
|
- imgUrl: require('~/assets/images/news/img.png'),
|
|
|
|
|
- id: '1'
|
|
|
|
|
- }
|
|
|
|
|
]
|
|
]
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
@@ -103,19 +79,21 @@ export default {
|
|
|
},
|
|
},
|
|
|
async asyncData({ params, query, store }) {
|
|
async asyncData({ params, query, store }) {
|
|
|
// 获取分类列表
|
|
// 获取分类列表
|
|
|
- let newsNav = [];
|
|
|
|
|
- const { data } = await axios(`${store.state.wordpressAPI}/official-api/article/type`);
|
|
|
|
|
- if(data.status === 200) {
|
|
|
|
|
- newsNav = data.data;
|
|
|
|
|
- }
|
|
|
|
|
- console.log(newsNav);
|
|
|
|
|
- let cateId = query.cateId || newsNav[0].id;
|
|
|
|
|
- return {
|
|
|
|
|
- cateId,
|
|
|
|
|
- newsNav
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // let newsNav = [];
|
|
|
|
|
+ // const { data } = await axios(`${store.state.wordpressAPI}/official-api/article/type`);
|
|
|
|
|
+ // if(data.status === 200) {
|
|
|
|
|
+ // newsNav = data.data;
|
|
|
|
|
+ // }
|
|
|
|
|
+ // console.log(newsNav);
|
|
|
|
|
+ // let cateId = query.cateId || newsNav[0].id;
|
|
|
|
|
+ // return {
|
|
|
|
|
+ // cateId,
|
|
|
|
|
+ // newsNav
|
|
|
|
|
+ // }
|
|
|
},
|
|
},
|
|
|
created() {
|
|
created() {
|
|
|
|
|
+ let cateId = this.$route.query.cateId || this.$store.state.newsNav[0].id;
|
|
|
|
|
+ this.cateId = cateId;
|
|
|
},
|
|
},
|
|
|
mounted() {
|
|
mounted() {
|
|
|
if (process.browser) {
|
|
if (process.browser) {
|
|
@@ -137,6 +115,11 @@ export default {
|
|
|
if(data.status === 200) {
|
|
if(data.status === 200) {
|
|
|
this.total = data.data.total;
|
|
this.total = data.data.total;
|
|
|
this.newsList = data.data.entityList || [];
|
|
this.newsList = data.data.entityList || [];
|
|
|
|
|
+ if(this.newsList.length <= 0) {
|
|
|
|
|
+ this.isEmpty = true;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.isEmpty = false;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
handleSizeChange() {
|
|
handleSizeChange() {
|
|
@@ -280,6 +263,15 @@ export default {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ .empty-content {
|
|
|
|
|
+ font-size: 28px;
|
|
|
|
|
+ font-family: PingFangSC-Regular, PingFang SC;
|
|
|
|
|
+ font-weight: 400;
|
|
|
|
|
+ color: #797979;
|
|
|
|
|
+ line-height: 26px;
|
|
|
|
|
+ margin-bottom: 300px;
|
|
|
|
|
+ padding: 40px 0 0 90px;
|
|
|
|
|
+ }
|
|
|
.news-pagination {
|
|
.news-pagination {
|
|
|
margin-top: 80px;
|
|
margin-top: 80px;
|
|
|
.el-pagination.is-background {
|
|
.el-pagination.is-background {
|