<template>
	<view>
		<view v-if="listData.data.length>0">
			<view class="top">
				<image class="top-img" mode="scaleToFill" src="@/static/icon/index/phb_bg.png"></image>
			</view>
			<view class="wrapper" v-if="listData.data.length>0">
				<view v-for="(value,key) in listData.data" :key="key" class="wrapper-inner" @click="detail(value)">
					<view class="box flex" style="width:30%; border-radius:20rpx;">
						<image class="integral-mall-goods" mode="aspectFill" :src="value.cover_image"></image>
					</view>
					<view class="text-wrapper">
						<view class="text-rank  plr10 ft20 ftw600  text-over cl-main">TOP{{key+1}}</view>
						<view class="text-name  plr10 ft16 ftw600  text-over cl-main">{{value.name}}</view>
						<view class="text-dec  plr10 ft14 ftw400  text-over4 cl-main">
							{{value.note}}
						</view>
					</view>
				</view>
			</view>
		</view>
		<view class="empty-box" v-else>
			<image src="/static/img/orders/emty.png" mode=""></image>
			<p class="ft14 line-1-txt">暂无数据</p>
		</view>
	</view>
</template>

<script>
	import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
	import {
		getMiniprogramRank
	} from '@/common/apis/index.js'
	import cellGroup from '../../../uni_modules/uview-ui/libs/config/props/cellGroup';
	export default {
		components: {
			uniLoadMore
		},
		data() {
			return {
				banners: [],
				searchValue: '',
				total: 0,
				selectIndex: 0,
				scrollTop: 0,
				keytext: '',
				listData: {
					data: []
				},
				last_id: 0,
				reload: true,
				status: 'more',
				contentText: {
					contentdown: '上拉加载更多',
					contentrefresh: '加载中',
					contentnomore: '没有数据了'
				}
			}
		},
		onLoad(e) {
			if (e.selectIndex) {
				this.selectIndex = e.selectIndex * 1
			}
			this.status = 'more';
			this.getList();
			this.banners = uni.getStorageSync("config").banner
		},
		onPageScroll(e) {
			this.scrollTop = e.scrollTop;
		},
		onReachBottom() {
			this.status = 'more';
			// this.getList();
		},
		methods: {
			detail(value) {
				uni.navigateTo({
					url: '/pages/video/index?video_id=' + value.video_id
				})
			},
			getList() {
				getMiniprogramRank().then(res => {
					console.log(res, 'getMiniprogramRecentvideogetMiniprogramRecentvideogetMiniprogramRecentvideo')
					this.listData = res.data
				})
			},
			getdata() {
				this.last_id = 0
				this.reload = true
				this.getList()
			},
			search(res) {
				this.listData = [];
				this.last_id = 0;
				this.keytext = res.value;
				this.type = '';
				this.getList(0)
			},
			cancel(res) {
				this.keytext = '';
				this.type = '';
				this.getList(0)
			}
		}
	}
</script>

<style lang="scss" scoped>
	@import "./style/index.scss"
</style>