|
@@ -6,7 +6,7 @@
|
|
|
<top topType="1" @search="search"></top>
|
|
|
</el-col>
|
|
|
<el-col :span="24" class="info" :style="{ height: clientHeight + 'px' }">
|
|
|
- <van-tabs v-model="active">
|
|
|
+ <van-tabs v-model="active" @click="changeActive">
|
|
|
<van-tab title="文字">
|
|
|
<list type="1" :list="oneList" @detailBtn="detailBtn"></list>
|
|
|
</van-tab>
|
|
@@ -34,6 +34,8 @@ import list from './parts/list.vue';
|
|
|
import top from '@/layout/common/top.vue';
|
|
|
import page from '@/layout/common/page.vue';
|
|
|
import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
+const { mapActions: mapService } = createNamespacedHelpers('service');
|
|
|
+
|
|
|
export default {
|
|
|
name: 'index',
|
|
|
props: {},
|
|
@@ -47,69 +49,50 @@ export default {
|
|
|
clientHeight: '',
|
|
|
// 文章菜单
|
|
|
active: 0,
|
|
|
+ type: 0,
|
|
|
// 文字
|
|
|
- oneList: [
|
|
|
- {
|
|
|
- title: '信息标题信息标题信息标题信息标题信息标题信息标题信息标题信息标题信息标题信息标题信息标题信息标题信息标题',
|
|
|
- origin: '信息来源',
|
|
|
- renew_time: '2021-03-30 10:00:00',
|
|
|
- read: 10000,
|
|
|
- },
|
|
|
- {
|
|
|
- title: '信息标题',
|
|
|
- origin: '信息来源',
|
|
|
- renew_time: '2021-03-30 10:00:00',
|
|
|
- read: 10,
|
|
|
- },
|
|
|
- ],
|
|
|
+ oneList: [],
|
|
|
// 图片
|
|
|
- twoList: [
|
|
|
- {
|
|
|
- title: '信息标题',
|
|
|
- origin: '信息来源',
|
|
|
- read: 10,
|
|
|
- imgUrl: require('@a/news1.jpg'),
|
|
|
- },
|
|
|
- {
|
|
|
- title: '信息标题',
|
|
|
- origin: '信息来源',
|
|
|
- read: 10,
|
|
|
- },
|
|
|
- ],
|
|
|
+ twoList: [],
|
|
|
// 科普
|
|
|
- thrList: [
|
|
|
- {
|
|
|
- title: '全球粮价波动将影响国内?商务部食用农产品间隔难以大幅度',
|
|
|
- fileUrl: require('@a/video1.mp4'),
|
|
|
- origin: '不知道',
|
|
|
- renew_time: '2021-03-25 21:12:44',
|
|
|
- read: 10000,
|
|
|
- },
|
|
|
- ],
|
|
|
+ thrList: [],
|
|
|
// 培训
|
|
|
- fourList: [
|
|
|
- {
|
|
|
- title: '全球粮价波动将影响国内?商务部食用农产品间隔难以大幅度',
|
|
|
- fileUrl: require('@a/video1.mp4'),
|
|
|
- origin: '不知道',
|
|
|
- renew_time: '2021-03-25 21:12:44',
|
|
|
- read: 10000,
|
|
|
- },
|
|
|
- ],
|
|
|
+ fourList: [],
|
|
|
// 总数
|
|
|
total: 0,
|
|
|
};
|
|
|
},
|
|
|
async created() {
|
|
|
- await this.search();
|
|
|
+ await this.changeActive();
|
|
|
},
|
|
|
mounted() {
|
|
|
let clientHeight = (document.documentElement.clientHeight || document.body.clientHeight) - 80;
|
|
|
this.$set(this, `clientHeight`, clientHeight);
|
|
|
},
|
|
|
methods: {
|
|
|
- search({ skip = 0, limit = 10, searchName, ...info } = {}) {
|
|
|
- console.log();
|
|
|
+ ...mapService(['query']),
|
|
|
+ async search({ skip = 0, limit = 5, searchName, ...info } = {}) {
|
|
|
+ if (searchName) info.title = searchName;
|
|
|
+ let res = await this.query({ skip, limit, type: this.type, ...info });
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ if (this.type == '0') {
|
|
|
+ this.$set(this, `oneList`, res.data);
|
|
|
+ this.$set(this, `total`, res.total);
|
|
|
+ } else if (this.type == '1') {
|
|
|
+ this.$set(this, `twoList`, res.data);
|
|
|
+ this.$set(this, `total`, res.total);
|
|
|
+ } else if (this.type == '2') {
|
|
|
+ this.$set(this, `thrList`, res.data);
|
|
|
+ this.$set(this, `total`, res.total);
|
|
|
+ } else if (this.type == '3') {
|
|
|
+ this.$set(this, `fourList`, res.data);
|
|
|
+ this.$set(this, `total`, res.total);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ changeActive(name) {
|
|
|
+ this.$set(this, `type`, name || 0);
|
|
|
+ this.search();
|
|
|
},
|
|
|
// 文章正文
|
|
|
detailBtn(data) {
|