<template>
    <!-- pages/fuwu/fuwu.wxml -->
    <view class="container">
        <view class="rnwdList" @tap="goDetails(item)" v-for="(item, index) in wb" :key="index">
            <span class="lb">{{ item.popular == '1' ? '热门' : '非热门' }}</span>

            <view class="list">
                <span class="listTitle">{{ item.titleName }}</span>
                <view class="jlSj">
                    <span class="jf">
                        {{ item.updateTime || item.createTime }}
                    </span>
                    <view class="ck">
                       <span class="jf">
                           {{ item.integral }}
                           <em class="iconfont icon-jifen"></em>
                       </span>
                        <span>
                            <em class="iconfont icon-chakan"></em>
                            {{ item.watchNum }}
                        </span>
                        <span>
                            <em class="iconfont icon-shoucang"></em>
                            {{ item.likeNum }}
                        </span>
                    </view>
                </view>
            </view>
        </view>
    </view>
</template>

<script>
	import {myPayKnow} from '@/api/me/me.js'

export default {
    data() {
        return {
			query:{
				pageSize:10,
				pageNum:1,
				createId:null
			},
            wb: [],
			total:0
        };
    }
    /**
     * 生命周期函数--监听页面加载
     */,
	 onReachBottom(){
	 	let pageNum = this.query.pageNum
	 	let pageSize = this.query.pageSize
	 	let total = this.total
	 	if(pageNum*pageSize >= total){
	 		uni.showToast({
	 			title:'暂无更多数据'
	 		})
	 		return
	 	} else {
	 		this.query.pageNum += 1;
	 		this.getlist()
	 	}
	 },

	 // 下拉刷新
	 onPullDownRefresh() {
	 	setTimeout(() => {
	 		this.query.pageNum = 1;
	 		this.wb = [];this.getlist()
	 	},500)
	 },
    onLoad(options) {
		this.query.createId = getApp().globalData.userId
		// this.query.createId = '1763382026214764546'
		this.getlist()
    },
    methods: {
		getlist(){
			myPayKnow(this.query).then(res=>{
				this.wb = [...this.wb,...res.rows]
				this.total = res.total
				uni.showToast({
					title:`加载成功`
				})
			})
		},
        goSanNong() {
            uni.navigateTo({
                url: '/pages/demo/sannong/sannong'
            });
        },

        goDetails(item) {
			if(item==null) return;
            uni.navigateTo({
                url: '/pages/me/myPayKnow/informationDetail?obj='+ encodeURIComponent(JSON.stringify(item))
            });
        }
    }
};
</script>
<style>
@import 'myPayKnow.css';
</style>
