123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162 |
- <template>
- <view>
- <view class="shenbaoList">
- <view class="list_li" v-for="(item,index) in list" :key="index" @click="detail(item)">
- <image :src="item.thumb_resource.url" mode="aspectFit" class="img"></image>
- <view class="title"><text style="margin-right: 5px;">{{item.title}}</text> <text class="tag"
- v-for="item1 in item.labels" :key="item1">{{item1}}</text></view>
- <!-- <view class="tag">类型:英语</view> -->
- <view class="li_bottom">
- <view class="">
- 视频数量:<text style="color: #fc521c;font-weight: 550;">{{item.video_nums}}</text>
- </view>
- <view class="">
- 观看人数:<text style="color: #fc521c;font-weight: 550;">{{item.user_count}}</text>
- </view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- var app = getApp()
- import navBar from '../../components/navBar/navbar.vue';
- export default {
- components: {
- navBar
- },
- data() {
- return {
- list: [],
- page: 1,
- total_pages:''
- };
- },
- onLoad() {
- app.request('/courses/list', 'get').then(res => {
- console.log(res)
- this.list = res.data.data.data
- this.total_pages = res.data.data.meta.pagination.total_pages
- })
- },
- onShow() {
- },
- onReachBottom() {
- console.log('触底时间')
- uni.showLoading()
- if(this.total_pages>this.page){
- this.page++;
- let params = {
- page: this.page
- }
- app.request('/courses/list',params, 'get').then(res => {
- console.log(res)
- this.list = this.list.concat(res.data.data.data)
- })
- }else{
- uni.showToast({
- title: '到底了~',
- icon: 'none'
- })
- }
- uni.hideLoading()
- },
- methods: {
- backLast: function() {
- uni.reLaunch({
- url: './index'
- })
- },
- detail(item) {
- uni.navigateTo({
- url: './detail?slug=' + item.slug
- })
- },
- }
- }
- </script>
- <style lang="scss">
- page {
- background: #f5f5f5;
- padding-bottom: 50upx;
- }
- .title {
- padding: 8px 0;
- font-weight: 550;
- color: #3e3e3e;
- font-size: 16px;
- }
- .shenbaoList {
- display: flex;
- flex-direction: column;
- width: 100%;
- align-items: center;
- .tag {
- display: inline-block;
- border-radius: 3px;
- border: solid 1px #1c85f1;
- color: #1c85f1;
- font-size: 12px;
- padding: 0px 3px;
- margin-right: 5px;
- font-weight: normal;
- }
- .list_li {
- display: flex;
- flex-direction: column;
- width: 90%;
- margin-top: 20upx;
- padding: 20upx;
- font-size: 26upx;
- background: white;
- border-radius: 10upx;
- view {
- // margin-top: 4px;
- }
- .img {
- width: 100%;
- height: 260upx;
- background-color: #f5f5f5;
- }
- .text1 {
- padding-top: 10upx;
- }
- .li_bottom {
- display: flex;
- align-items: center;
- justify-content: space-between;
- // padding-top: 10upx;
- .none {
- background: blue;
- color: white;
- display: flex;
- align-items: center;
- justify-content: center;
- padding: 5upx 10upx;
- }
- .upload {
- background: green;
- color: white;
- display: flex;
- align-items: center;
- justify-content: center;
- padding: 5upx 15upx;
- }
- }
- }
- }
- </style>
|