<template>
	<view>
		<!-- 列表 -->
		<view class="mbox">
			<meet-list :datalist="list" :wtdt="wtdt" :fylxlist='fylxlist'  :type='tabidx' @getDetail="getDetail" @getReadFn="getReadFn" @getTuiFn="getTuiFn"></meet-list>
		</view>
		<!-- 弹窗 -->
		<pop-up :type='ptype' @getClose="getClose" @getupSubmit="getupSubmit" :qjlxlist="qjlxlist"></pop-up>
	</view>
</template>

<script>
	import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
	import {getSpeakListFn} from "@/api/mine/meeting.js"
	import popUp from "@/work/components/popup/popup.vue"
	import meetList from "@/work/components/meeting/list.vue"
	import {getDictionaryFn} from "@/api/mine/register.js"
	export default{
		components:{meetList,popUp},
		data(){
			return{
				searchimg: require("@/work/static/images/search.png"),
				ccicoimg:require("@/work/static/images/ccico.png"),
				lbicoimg:require("@/work/static/images/lbico.png"),
				backimg:require("@/work/static/images/back.png"),
				upimg:require("@/work/static/images/up.png"),
				backgroundColor:"#1D64E2",
				tabidx:'wdfy',
				nvaHeight:44,
				talbList:[{},],
				taztList:[{label:'是',value:'0'},{label:'否',value:'1'}],
				talbidx:'',
				datainfo:{
					talb:'',
				},
				ptype:'',//弹窗类型
				list:[],
				pageSize: 10,
				pageNum: 1,
				reachflag: true,
				wtdt:'',
				qjlxlist:[],
				fylxlist:[],
				userId:this.$store.state.user.userId,
				id:'',
				title:'',//关键词
			}
		},
		onUnload(){
			uni.$off('refreshlist')
		},
		onLoad(e) {
			this.id=e.id;
			this.getDataFn()
			this.init()
			uni.$on('refreshlist', (e) => {
				this.getDataFn()
			})
		},
		mounted() {
		},
		methods:{
			checkPermi, checkRole,
			init(){

				// 发言类型
				getDictionaryFn('speak_type').then(res=>{
					if(res.code==200&&res.data.length){
						this.fylxlist = res.data.map(v => {
							return {
								label: v.dictLabel,
								value: v.dictValue
							}
						})
					}
				})
			},
			getClose(){
				this.ptype=""
			},
			getupSubmit(e){
				var that=this;
				var type=this.type;
				var params=JSON.parse(JSON.stringify(e))
				params.conferenceId=this.id;
				params.userId=this.userId;
				getupdateReplyFn(params).then(res=>{
					if(res.code==200){
						this.$toast("答复成功");
						setTimeout(function(){
							that.ptype='';
							that.pageNum=1;
							that.list=[];
							that.reachflag=true;
							that.getDataFn()
						},1200)
						
					}
				})
			},
			getDataFn(){
				var params={
					pageSize:this.pageSize,
					pageNum: this.pageNum,
					conferenceId:this.id
				}
				getSpeakListFn(params).then(res=>{
					if(res.code==200){
						if (res.rows.length < this.pageSize) {
							this.reachflag = false
							this.wtdt = '到底了~';
						} else {
							var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum -	1)
							if (num < res.total) {
								this.reachflag = true
								this.wtdt = '上拉加载更多'
							} else {
								this.reachflag = false
								this.wtdt = '到底了~';
							}
						}
						if (this.pageNum == 1) {
							this.list = res.rows;
						} else {
							this.list = this.list.concat(res.rows)
						}
					}else{
						this.$toast(res.msg)
					}
				})
				
			},
		}
	}
</script>

<style scoped lang="scss">
.navbox{position: fixed;left: 0;right: 0;top: 0;z-index: 4;background-color: $com-cd3;
	.topl{width: 60rpx;height: 60rpx;display: flex;align-items: center;justify-content: center;
		image{width: 40rpx;height: 30rpx;}
	}
	.topr{display: flex;align-items: center;
		image{width: 26rpx;height: 26rpx;margin-right: 12rpx;}
		view{font-weight: 500;font-size: 26rpx;color: #FFFFFF;}
	}
	.tablists{
		overflow: auto;flex-wrap: nowrap;
		view{font-weight: bold;font-size: 26rpx;color: #FFFFFF;position: relative;flex: 1 0 auto;padding: 22rpx 24rpx;margin-right: 6rpx;box-sizing: border-box;text-align: center;
			&:last-child{margin-right: 0;}
			&.act{font-size: 30rpx;
				&::after{content: '';width: 62rpx;height: 10rpx;background: #FFFFFF;border-radius: 4rpx;left: 50%;margin-left: -31rpx;bottom: 0rpx;position: absolute;}
			}
		}
	}
	.lbtab{height: 114rpx;background: #FFFFFF;border-radius: 30rpx;padding-left: 24rpx;position: absolute;left:24rpx;right: 24rpx;bottom: -58rpx;
		.limg{width: 40rpx;height: 34rpx;margin-right: 10rpx;flex:0 0 auto;}
		.lbtabs{overflow: auto;flex-wrap: nowrap;
			.lbtabp{display: flex;align-items: center;flex: 0 0 auto;margin-right: 24rpx;}
			.upimg{width: 18rpx;height: 10rpx;}
			
		}
	}
}
.mbox{padding:2rpx 24rpx 28rpx;}
.lbtabs /deep/ picker{padding: 0 18rpx;}
</style>