|
@@ -3,15 +3,16 @@
|
|
|
<el-image style="width: 100%; height: 10rem" :src="url"></el-image>
|
|
|
<el-tabs v-model="activeName" style="padding:10px;" @tab-click="tabClick">
|
|
|
<el-tab-pane v-for="(item, index) in list" :key="index" :name="`${index}`" :label="item.title">
|
|
|
- <item @search="toSearch" :list="item.children" :hasMore="item.hasMore" :index="item.index"></item>
|
|
|
+ <item @search="toSearch" :list="item.children" :hasMore="item.hasMore" :index="index"></item>
|
|
|
</el-tab-pane>
|
|
|
</el-tabs>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { mapActions } from 'vuex';
|
|
|
+import { mapActions, mapMutations } from 'vuex';
|
|
|
import item from './item.vue';
|
|
|
+import _ from 'lodash';
|
|
|
export default {
|
|
|
metaInfo() {
|
|
|
return {
|
|
@@ -42,6 +43,7 @@ export default {
|
|
|
},
|
|
|
},
|
|
|
methods: {
|
|
|
+ ...mapMutations(['setLoading']),
|
|
|
...mapActions(['siteOperation', 'columnOperation', 'newsOperation']),
|
|
|
async getSite() {
|
|
|
let site = sessionStorage.getItem('site');
|
|
@@ -83,6 +85,7 @@ export default {
|
|
|
this.$message.error(res.errmsg ? res.errmsg : 'error');
|
|
|
}
|
|
|
},
|
|
|
+ //查每个栏目下的信息
|
|
|
async toSearch({ index, info }) {
|
|
|
let target = JSON.parse(JSON.stringify(this.list[index]));
|
|
|
if (target.hasMore === false) return;
|
|
@@ -93,23 +96,23 @@ export default {
|
|
|
} else {
|
|
|
target.page = 1;
|
|
|
target.skip = 0;
|
|
|
- target.limit = this.$limit;
|
|
|
+ target.limit = this.$limit || 4;
|
|
|
}
|
|
|
//数据处理
|
|
|
if (target.type === 'bugList' || target.type === 'column') {
|
|
|
let res = await this.getNewsList(target, target.news_type, { skip: target.skip, limit: target.limit });
|
|
|
if (`${res.errcode}` === '0') {
|
|
|
- target.children ? target.children.concat(res.data) : (target.children = res.data);
|
|
|
+ _.get(target, `children`) ? (target.children = [...target.children, ...res.data]) : (target.children = res.data);
|
|
|
target.hasMore = target.children.length < res.total;
|
|
|
}
|
|
|
this.$set(this.list, index, target);
|
|
|
} else if (target.type === 'content') {
|
|
|
target.path = `news.html#/${target.content_id}`;
|
|
|
}
|
|
|
+ this.setLoading(false);
|
|
|
},
|
|
|
tabClick() {
|
|
|
let target = this.list[this.activeName];
|
|
|
- console.log(target);
|
|
|
if (target.type === 'url') {
|
|
|
window.location.href = target.url;
|
|
|
} else if (target.type === 'content') {
|