1
fei.wang
2025-03-07 1b6a3e58e8d3f9a4a56810b5433e28230fe8f3bb
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
<template>
 
    <view class="template-job tn-safe-area-inset-bottom tn-skeleton">
 
        <!-- 顶部自定义导航 -->
        <!-- <view style="height: 100%;"> -->
            
            <tn-nav-bar fixed     style="position: absolute;z-index: 999999999;">
                <text class="page-title">信息</text>
            </tn-nav-bar>
        <u-search class="searchbg" shape="true" bg-color="rgba(255, 255, 255, 0.5)" placeholder="请输入名称" :show-action="false" v-model="keyword" @search="searchxinxi"
            :style="{top: topheight+'px',position: 'absolute',width: '50%',left: '25%'}"></u-search>
                
    <z-paging  ref="paging" v-model="dataList" @query="queryList">
            <!-- 需要固定在顶部不滚动的view放在slot="top"的view中,如果需要跟着滚动,则不要设置slot="top" -->
            <!-- 注意!此处的z-tabs为独立的组件,可替换为第三方的tabs,若需要使用z-tabs,请在插件市场搜索z-tabs并引入,否则会报插件找不到的错误 -->
        <!--     <template #top>
                <z-tabs :list="tabList" @change="tabsChange" />
            </template> -->
            
            <!-- 自定义下拉刷新view(如果use-custom-refresher为true且不设置下面的slot="refresher",此时不用获取refresherStatus,会自动使用z-paging自带的下拉刷新view) -->
 
            <!-- 注意注意注意!!字节跳动小程序中自定义下拉刷新不支持slot-scope,将导致custom-refresher无法显示 -->
            <!-- 如果是字节跳动小程序,请参照sticky-demo.vue中的写法,此处使用slot-scope是为了减少data中无关变量声明,降低依赖 -->
            <template #refresher="{refresherStatus}">
                <!-- 此处的custom-refresh为demo中自定义的组件,非z-paging的内置组件,请在实际项目中自行创建。这里插入什么view,下拉刷新就显示什么view -->
                <custom-refresher :status="refresherStatus" />
            </template>
            <!-- 自定义没有更多数据view -->
            <template #loadingMoreNoMore>
                <!-- 此处的custom-nomore为demo中自定义的组件,非z-paging的内置组件,请在实际项目中自行创建。这里插入什么view,没有更多数据就显示什么view -->
                <custom-nomore />
            </template>
            
            <!-- 如果希望其他view跟着页面滚动,可以放在z-paging标签内 -->
            <view class="item" v-for="(item,index) in dataList" :key="index" @click="itemClick(item)">
                <view class="item-title">{{item.title}}</view>
                <view class="item-detail">{{item.detail}}</view>
                <view class="item-line"></view>
            </view>
        </z-paging>
 
        
        <tn-skeleton :show="showSkeleton"></tn-skeleton>
        <successCom ref="refSuccess"></successCom>
            <!-- <u-empty text="暂未开放" mode="list" style="width: 90%; top: 30%;left: 5%; position: absolute; "></u-empty> -->
</view>
    <!-- </view> -->
 
    <!-- <u-empty text="所谓伊人,在水一方" mode="list"></u-empty> -->
</template>
 
<script>
    import successCom from '@/components/success.vue'
    import {
        findwarning
    } from '@/config/api.js';
    import {
        minLogin
    } from '@/js/minLogin.js'
    import {
        pagesAlarm
    } from '@/js/pages/alarm.js'
    export default {
        mixins: [minLogin, pagesAlarm],
        components: {
            successCom
        },
        data() {
            return {
                dataList: [],
                tabList: ['测试1','测试2','测试3','测试4'],
                tabIndex: 0,
                      imgStyle: {
                        width: '100px',
                        height: '1000px',
                        borderRadius: '50%'
                      },
                showSkeleton: true,
                options: [{
                    text: '删除',
                    style: {
                        backgroundColor: '#F93737',
                    }
                }, ],
                boxKey: 0,
                scrollHeight: 500,
                paddingTop: 60,
                emitDate: 'indexHome',
                show: false,
                time: '',
                list: [],
                total: 0,
                options1: [{
                    text: '删除',
                    style: {
                        backgroundColor: '#F93737'
                    }
                }]
            }
        },
        computed:{
            countList(){
                let num = 0;
                for (let i in this.list) {
                    num += this.list[i].fQty;
                }
                return num;
            }
        },
        mounted() {
            
            setTimeout(() => {
                this.showSkeleton = false
            }, 1000)
            
            // this.$refs.refSuccess.showBox({
            //     type:'error',//success/error/warning,
            //     txt:'操作失败,请重试!'
            // })
            
            this.scrollHeight = this.screenHeight - 282;
 
            setTimeout(() => {
                this.paddingTop = this.vuex_padding_top
                this.paddingTop += 5
            }, 400)
            
        },
        methods: {
            tabsChange(index) {
                console.log(2222222);
                console.log(index);
                this.tabIndex = index;
                //当切换tab或搜索时请调用组件的reload方法,请勿直接调用:queryList方法!!
                //调用reload时参数传true则代表reload时触发下拉刷新效果,不传或false则代表取消此效果
                this.$refs.paging.reload(true);
            },
            queryList(pageNo, pageSize) {
                console.log(1111);
                // 组件加载时会自动触发此方法,因此默认页面加载时会自动触发,无需手动调用
                // 这里的pageNo和pageSize会自动计算好,直接传给服务器即可
                // 模拟请求服务器获取分页数据,请替换成自己的网络请求
                const params = {
                    page: pageNo,
                    limit: pageSize,
                    company: this.company,
                    // type: this.tabIndex + 1
                }
                console.log(params);
                findwarning(params).then((res) => {
                    console.log(res);
                    
                    if (res.code == 0) {
                        this.$refs.paging.complete(res.data.records);
                    } else {
                        this.$refs.paging.complete(false);
                        this.$refs.refSuccess.showBox({
                            type: 'error',
                            txt: res.msg
                        });
                    }
                })
                // this.$request.queryList(params).then(res => {
                //     // 将请求的结果数组传递给z-paging
                //     this.$refs.paging.complete(res.data.list);
                // }).catch(res => {
                //     // 如果请求失败写this.$refs.paging.complete(false);
                //     // 注意,每次都需要在catch中写这句话很麻烦,z-paging提供了方案可以全局统一处理
                //     // 在底层的网络请求抛出异常时,写uni.$emit('z-paging-error-emit');即可
                //     this.$refs.paging.complete(false);
                // })
            },
            itemClick(item) {
                console.log('点击了', item.title);
            },
// 模拟请求加载数据
        handleLoad(data, callback) {
            console.log(data);
            
            console.log(1111111111111);
            setTimeout(() => {
                let list = [];
                for (var i = 0; i < 3; i++) {
                    list.push(i);
                }
                this.list = [...this.list, ...list];
                callback({ list: this.list, total: 30 });
            }, 1500);
            console.log(this.list);
        },
        // 模拟请求数据刷新
        handleRefresh(data, callback) {
            console.log(2222222222);
            setTimeout(() => {
                this.list = [];
                for (var i = 0; i < 3; i++) {
                    this.list.push(i);
                }
                callback({ list: this.list, total: 30 });
            }, 1500);
        }
        }
    }
</script>
 
<style lang="scss" scoped>
    .item {
        position: relative;
        height: 150rpx;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0rpx 30rpx;
    }
    
    .item-detail {
        padding: 5rpx 15rpx;
        border-radius: 10rpx;
        font-size: 28rpx;
        color: white;
        background-color: #007AFF;
    }
    
    .item-line {
        position: absolute;
        bottom: 0rpx;
        left: 0rpx;
        height: 1px;
        width: 100%;
        background-color: #eeeeee;
    }
    .modal-btn {
        position: absolute;
        
        left: 80%;
        margin-top: 40px;
        // display: flex;
        // align-items: center;
        // justify-content: center;
        // box-sizing: border-box;
        // width: 120rpx;
        // height: 40rpx;
        // background: rgba(103, 149, 255, 0.2);
      }
    .page-wrap {
        height: 100%;
        padding-top: 45px;
        padding-left: 30rpx;
        padding-right: 30rpx;
        .test-view {
            height: 300rpx;
        }
        .navbar-content {
            width: 100%;
            display: flex;
            padding: 30rpx;
            align-items: center;
            justify-content: space-between;
        }
        .u-icon {
            margin-left: 30rpx;
        }
        .item-wrap {
            display: flex;
            margin: 10rpx;
            padding: 30rpx;
            align-items: center;
            border-radius: 16rpx;
            box-shadow: 0rpx 8rpx 16rpx rgba(0, 0, 0, 0.11);
            .avatar {
                width: 150rpx;
                height: 150rpx;
                margin-right: 30rpx;
                border-radius: 16rpx;
                background-color: #c0c0c0;
            }
            .item {
                // width: 100rpx;
                height: 30rpx;
                margin-bottom: 10rpx;
                border-radius: 16rpx;
                background-color: #c8c7cc;
            }
            
        }
    }
</style>