#
whycq
2022-08-24 e2b0f4792330661461fbdd18a02df3e4153aa755
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<template>
    <view>
        <!-- 搜索框 -->
        <view class="square-1">
            <view class="searchBox">
                <view class="searchIcon"><uni-icons type="search" size="20" color="#dadada"></uni-icons></view>
                <view class="searchArea"><input type="text" placeholder=" 请输入"></view>
                <view class="closeIcon"><uni-icons type="closeempty" size="20" color="#dadada"></uni-icons></view>
            </view>
        </view>
        <view style="width: 100%;height: 200rpx;background-color: aqua;margin-top: 10rpx;"
            v-for="(item,index) in listData" :key="index">
            <text>{{index}}</text>
        </view>
        <uni-load-more :status="status" :icon-size="16" :content-text="contentText" />
    </view>
</template>
 
<script>
    export default {
        data() {
            return {
                commonUrl:null,
                listData: [],
                reload: false,
                status: 'more',
                contentText: {
                    contentdown: '上拉加载更多',
                    contentrefresh: '加载中',
                    contentnomore: '没有更多'
                }
            };
        },
        onLoad() {
            const UIP = uni.getStorageSync('UIP');
            this.baseIP = UIP;
            const UPORT = uni.getStorageSync('UPORT');
            this.basePORT = UPORT
            const PROJ = uni.getStorageSync('UPROJ');
            this.baseUrl = PROJ
            this.getUrl()
            this.getList()
        },
        onPullDownRefresh() {
            this.reload = true;
            this.getList()
        },
        onReachBottom() {
            this.status = 'more';
            this.getList();
        },
        methods: {
            // 获取url
            getUrl() {
                this.commonUrl = this.baseHttp + this.baseIP + ':' +this.basePORT + "/" +this.baseUrl
            },
            getList() {
                let that = this
                uni.request({
                    url: that.commonUrl + '/waitPakin/list/auth',
                    data:{
                        curr:1,
                        limit:10,
                    },
                    header: {
                        'token':uni.getStorageSync('token')
                    },
                    method:'GET',
                    success: result =>{
                        console.log(result);
                        let res = result.data
                        if (res.code === 200) {
                            if (res.data) {
                                let list = res.data.records
                                that.listData = this.reload ? list : this.listData.concat(list);
                                this.reload = false;
                                
                            }
                        }
                    }
                })
            }
        }
        
    }
</script>
 
<style>
    .searchBox {
        position: absolute;
        width: 94%;
        height: 80%;
        top: 0;
        left: 0;
        bottom: 0;
        right: 0;
        margin: auto;
        background-color: #F9F9F9;
        border-radius: 20rpx;
    }
    .searchIcon {
        display: inline-block;
        float: left;
        width: 10%;
        height: 100%;
        text-align: center;
        line-height: 80rpx;
    }
    
    .searchArea {
        display: inline-block;
        float: left;
        width: 80%;
        height: 100%;
    }
    .searchArea input {
        height: 100%;
        font-size: 14px;
        color: #5f5f5f;
    }
    .closeIcon {
        display: inline-block;
        float: left;
        width: 10%;
        height: 100%;
        text-align: center;
        line-height: 80rpx;
    }
</style>