You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
102 lines
3.9 KiB
102 lines
3.9 KiB
<template>
|
|
|
|
<BaseContainer class="search-page">
|
|
<NavBar :title="title" />
|
|
<view class="course-list index" id="app" v-cloak ref="index" style="-webkit-overflow-scrolling: touch;">
|
|
<view class="nav" v-if="category.length">
|
|
<view class="item" :class="where.cid==0 ? 'on':''" @click="where.cid=0">全部</view>
|
|
<view class="item" v-for="item in category" :class="where.cid==item.id ? 'on':''"
|
|
@click="where.cid=item.id">
|
|
{{item.title}}</view>
|
|
</view>
|
|
<view class="studyCourse" ref="list">
|
|
<!--小图-->
|
|
<view v-if="List.length" class="swiper-list2">
|
|
<a class="item acea-row" v-for="vo in List" :href="getDetails(vo.id)">
|
|
<view class="pictrue">
|
|
<image :src="vo.image_input">
|
|
</view>
|
|
<view class="underline text-pic acea-row row-column row-between">
|
|
<view class="name line1" v-text="vo.title"></view>
|
|
<view class="acea-row row-between-wrapper info" v-text="vo.synopsis"></view>
|
|
<view class="acea-row row-between-wrapper">
|
|
<view class="info">访问量:{{vo.visit ? vo.visit : '0'}}</view>
|
|
<view class="info">{{vo.add_time}}</view>
|
|
</view>
|
|
</view>
|
|
</a>
|
|
</view>
|
|
</view>
|
|
<view v-show="loading" class="loading">
|
|
<text class="fa fa-spinner"></text>
|
|
</view>
|
|
<view v-if="where.page > 2 && loadend" class="loaded">已全部加载</view>
|
|
<view v-if="!List.length && !loading" class="nothing"></view>
|
|
<quick-menu></quick-menu>
|
|
</view>
|
|
</BaseContainer>
|
|
</template>
|
|
|
|
<script>
|
|
import {
|
|
getArticleDetails
|
|
} from "@/api/article";
|
|
export default {
|
|
data() {
|
|
return {
|
|
where: {
|
|
page: 1,
|
|
limit: 10,
|
|
cid: 0,
|
|
},
|
|
category: category,
|
|
loading: false,
|
|
loadend: false,
|
|
List: [],
|
|
title: ''
|
|
};
|
|
},
|
|
|
|
|
|
watch: {
|
|
'where.cid': function (n) {
|
|
this.where.page = 1;
|
|
this.loadend = false;
|
|
this.$set(this, 'List', []);
|
|
this.get_unifiend_list();
|
|
}
|
|
},
|
|
onLoad() {
|
|
this.get_unifiend_list();
|
|
},
|
|
methods: {
|
|
getDetails: function (id) {
|
|
return $h.U({ c: 'article', a: 'details', q: { id: id } });
|
|
},
|
|
get_unifiend_list: function () {
|
|
if (this.loading) return;
|
|
if (this.loadend) return;
|
|
this.loading = true;
|
|
storeApi.baseGet($h.U({ c: 'article', a: 'get_unifiend_list', q: this.where }), function (res) {
|
|
var list = res.data.data;
|
|
var List = $h.SplitArray(list, this.List);
|
|
this.loading = false;
|
|
this.where.page = this.where.page + 1;
|
|
this.loadend = list.length < this.where.limit;
|
|
this.$set(this, 'List', List);
|
|
this.$nextTick(function () {
|
|
this.EventUtil();
|
|
}.bind(this))
|
|
}.bind(this), function (res) {
|
|
this.loading = false;
|
|
}.bind(this));
|
|
},
|
|
EventUtil: function () {
|
|
var that = this;
|
|
$h.EventUtil.listenTouchDirection(document, function () {
|
|
that.loading == false && that.get_unifiend_list();
|
|
}, false);
|
|
}
|
|
},
|
|
};
|
|
</script> |