<template>
	<view class="page">
		<pyh-nv ref="nv" :config="nvConfig"></pyh-nv>
		<view class="listBox" :style="{'padding-top':(pageTop+'px')}">
		<view class="content">
		<view class="address-list">
			<view class="list" v-for="(item,index) in list" :key="index">
				<view class="name-phone">
					<view class="name">
						<text>{{item.title}}</text>
					</view>
					<view class="edit" @click="tzdetail(item)">
						<image src="../../static/right2.png"></image>
					</view>
				</view>
				<view class="address">
					<text>{{item.absrtact}}</text>
				</view>
			</view>
		</view>
		</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				nvConfig:{
					title:"殡葬文化",
					bgColor:"#ffffff",
					color:"#000000",
					fixedAssist:{
						hide:true,
					},
				},
				page:{
					pageNum:1,
					pageSize:10,
					category:"00"
				},
				total:0,
				list:[],
			};
		},
		onPageScroll(e) {this.$refs.nv.pageScroll(e)},
		computed:{
			pageTop(){return parseInt(88*uni.getSystemInfoSync().windowWidth/750) + uni.getSystemInfoSync().statusBarHeight}
		},
		onShow() {
			this.getfbgl();
		},
		methods: {
			getfbgl(){
				this.API.getfbgl(this.page).then(res=>{
					this.fl(res.rows,"殡葬文化一览")
					console.log('获取发布信息',this.list);
					this.total = res.total
				})
			},
			fl(item,flid){
				var info = []
				for(let i = 0;i < item.length;i++){
					if(item[i].category == flid){
						this.list.push(item[i])
					}
				}
				return info
			},
			tzdetail(item){
				console.log("ress",item);
				uni.navigateTo({
					url:'/pages/xxdetail/xxdetail?info=' + JSON.stringify(item)
				})
			}
		},
		onReachBottom() {
			var page = parseInt(this.total / 10 );
			var s = parseInt(this.total % 10 );
			console.log(page,s);
			if(s > 0){
				page = page + 1
			}
			if(page > 0){
				if(this.page.pageNum < page){
					this.page.pageNum = this.page.pageNum + 1
					this.getfbgl();
				}else{
					console.log("没有了");
				}
			}
		},
	}
</script>

<style scoped lang="scss">
	@import 'funeralculture.scss';
</style>
