<template>
	<scroll-view 
	scroll-y="true" 
	:style="{height: height}"
	@scrolltolower="loadMoreData">
		<view class="bossList">
			<view
				@click="$utils.navigateTo('/pages_order/work/userDetail?id=' + item.id)"
				:key="index"
				v-for="(item, index) in list">
				<userItem :item="item"/>
			</view>
		</view>
	</scroll-view>
</template>

<script>
	import userItem from './userItem.vue'
	export default {
		components : {
			userItem,
		},
		props : {
			height : {
				default : 'auto'
			},
			api : {
				default : 'bossQueryJobList'
			}
		},
		data() {
			return {
				queryParams: {
					pageNo: 1,
					pageSize: 10,
				},
				total : 0,
				list : [],
			}
		},
		methods: {
			getData(){
				if(uni.getStorageSync('token')){
					this.queryParams.token = uni.getStorageSync('token')
				}
				
				this.$api(this.api, this.queryParams, res => {
					if(res.code == 200){
						this.list = res.result.records
						this.total = res.result.total
					}
				})
			},
			loadMoreData(){
				if(this.queryParams.pageSize <= this.list.length){
					this.queryParams.pageSize += 10
					this.getData()
				}
			},
		}
	}
</script>

<style scoped lang="scss">
.bossList {
	&>view{
		margin: 20rpx;
	}
}
</style>