|
|
- <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="keyName ? item[keyName] : item"/>
- </view>
- </view>
- </scroll-view>
- </template>
-
- <script>
- import userItem from './userItem.vue'
- export default {
- components : {
- userItem,
- },
- props : {
- height : {
- default : 'auto'
- },
- api : {
- default : 'bossQueryJobList'
- },
- handleData : {},
- keyName : {}
- },
- 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 || res.result
- this.total = res.result.total || res.result.length
- this.handleData && this.handleData(this)
- }
- })
- },
- loadMoreData(){
- if(this.queryParams.pageSize <= this.list.length){
- this.queryParams.pageSize += 10
- this.getData()
- }
- },
- }
- }
- </script>
-
- <style scoped lang="scss">
- .bossList {
- &>view{
- margin: 20rpx;
- }
- }
- </style>
|