cshenfu
2024-06-27 58aa6e282bb343503be3cb198948328ea3ed7b79
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
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
<template>
    <view class="flex-col group">
        <!-- #ifdef APP-PLUS -->
        <view class="status_bar">
            <view class="top_view"></view>
        </view>
        <!-- #endif -->
        <view class="flex-col">
            <view class="flex-col section_1">
                <view class="flex-row group_1">
                    <image src="/static/local/16403089342852645411.png" class="image_1" @click="pageBack" />
                    <u-tabs-swiper ref="uTabs" active-color="#FF960C" :list="list" :current="current" height="88"
                        @change="tabsChange" :is-scroll="false" :offset="[10,120]" style="flex: 1;">
                    </u-tabs-swiper>
                </view>
            </view>
            <swiper duration="200" class="swiper-item-box" :current="swiperCurrent" @transition="transition"
                @animationfinish="animationfinish">
                <swiper-item class="swiper-item">
                    <z-paging ref="paging" class="z_pag" v-model="comments" @query="getCommentToMe"
                        :empty-view-fixed="true" :fixed="false" :hide-loading-more-when-no-more-by-limit="5">
                        <view class="flex-col group_2" v-for="item in comments" @tap="checkDetail(item)">
                            <view class="justify-between group_3">
                                <view class="flex-row">
                                    <u-image
                                        :src="item.commenterInfo?item.commenterInfo.avatar:'/static/member/avatra.png'"
                                        shape="circle" :lazy-load="true" class="image_2" mode="aspectFill"></u-image>
                                    <view class="flex-col group_5">
                                        <view class="flex-row">
                                            <text
                                                class="text_2">{{item.commenterInfo?item.commenterInfo.nickname:'已注销'}}</text>
                                            <text class="text_3">评论了你的帖子</text>
                                        </view>
                                        <text class="text_4">{{item._add_time_str}}</text>
                                    </view>
                                </view>
                                <image src="/static/remote/59d50f245e774077b29cc12824c65db5.png" class="image_4" />
                            </view>
                        </view>
                    </z-paging>
                </swiper-item>
                <swiper-item class="swiper-item">
                    <z-paging ref="pagingT" class="z_pag" v-model="likes" @query="getLikeToMe" :empty-view-fixed="true"
                        :fixed="false" :hide-loading-more-when-no-more-by-limit="5">
                        <view class="flex-col group_2" v-for="item in likes">
                            <view class="justify-between group_3">
                                <view class="flex-row">
                                    <u-image
                                        :src="item.commenterInfo?item.commenterInfo.avatar:'/static/member/avatra.png'"
                                        shape="circle" :lazy-load="true" class="image_2" mode="aspectFill"></u-image>
                                    <view class="flex-col group_5">
                                        <view class="flex-row">
                                            <text
                                                class="text_2">{{item.commenterInfo?item.commenterInfo.nickname:'已注销'}}</text>
                                            <text class="text_3">赞了你的帖子</text>
                                        </view>
                                        <text class="text_4">{{item._add_time_str}}</text>
                                    </view>
                                </view>
                            </view>
                        </view>
                    </z-paging>
                </swiper-item>
            </swiper>
        </view>
    </view>
</template>
 
<script>
    var that; // 当前页面对象
    var vk; // vk依赖
    export default {
        data() {
            // 页面数据变量
            return {
                list: [
                    { name: '评论' },
                    { name: '点赞', count: 0 }
                ],
                current: 0,
                swiperCurrent: 0,
                comments: [], // 评论列表
                likes: [], // 点赞列表
            }
        },
        // 监听 - 页面每次【加载时】执行(如:前进)
        onLoad(options = {}) {
            that = this;
            vk = that.vk;
            that.init(options)
        },
        // 监听 - 页面【首次渲染完成时】执行。注意如果渲染速度快,会在页面进入动画完成前触发
        onReady() {},
        // 监听 - 页面每次【显示时】执行(如:前进和返回) (页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面)
        onShow() {},
        // 监听 - 页面每次【隐藏时】执行(如:返回)
        onHide() {},
        // 函数
        methods: {
            // 页面数据初始化函数
            init(options) {
                this.list[1].count = vk.getVuex('$app.likeBadge').like
                this.list[0].count = vk.getVuex('$app.likeBadge').talk
            },
            // 获取对我的回复
            getCommentToMe(pageNo, pageSize) {
                vk.callFunction({
                    url: 'client/bbs/pub/getCommentToMe',
                    title: '获取中...',
                    data: { pageNo, pageSize, need_user_info: true },
                    success(data) {
                        that.$refs.paging.complete(data.rows)
                    }
                });
            },
            getLikeToMe(pageNo, pageSize) {
                vk.callFunction({
                    url: 'client/bbs/pub/getLikeToMe',
                    title: '获取中...',
                    data: { pageNo, pageSize, need_user_info: true },
                    success(data) {
                        that.$refs.pagingT.complete(data.rows)
                    }
                });
            },
            pageBack() {
                this.clearBage()
                uni.navigateBack({ delta: 1 })
            },
            // 查看发布详情
            checkDetail(item) {
                this.clearBage()
                uni.vk.navigateTo('/pages/square/detail?id=' + item.aid);
            },
            // tabs通知swiper切换
            tabsChange(index) {
                this.swiperCurrent = index;
            },
            // swiper-item左右移动,通知tabs的滑块跟随移动
            transition(e) {
                let dx = e.detail.dx;
                this.$refs.uTabs.setDx(dx);
            },
            // 由于swiper的内部机制问题,快速切换swiper不会触发dx的连续变化,需要在结束时重置状态
            // swiper滑动结束,分别设置tabs和swiper的状态
            animationfinish(e) {
                let current = e.detail.current;
                this.$refs.uTabs.setFinishCurrent(current);
                this.swiperCurrent = current;
                this.current = current;
            },
            clearBage() {
                if (!vk.getVuex('$app.likeBadge')) return
                // 先清除本地缓存,优化显示效果
                vk.setVuex('$app.likeBadge', false)
                uni.hideTabBarRedDot({ index: 3 })
                that.list[0].count = 0
                that.list[1].count = 0
                // 通知后台已读
                vk.callFunction({
                    url: 'client/angle-mark/kh/clearSquareList',
                    data: { need_user_info: true },
                    success: function(data) {}
                })
            }
        },
    }
</script>
 
<style lang="scss" scoped>
    .group {
        flex: 1 1 auto;
        overflow-y: auto;
 
        .section_1 {
            padding: 0 20rpx;
            background-color: rgb(255, 255, 255);
            box-shadow: 0px 6rpx 12rpx 0px rgba(0, 0, 0, 0.1);
            border-radius: 0px 0px 30rpx 30rpx;
            position: relative;
 
            .group_1 {
                align-items: center;
 
                .image_1 {
                    width: 20rpx;
                    height: 36rpx;
                }
 
                /deep/ .u-scroll-bar {
                    bottom: 0 !important;
                }
            }
        }
 
        .swiper-item-box {
            height: calc(100vh - 100rpx);
 
            scroll-view {
                height: 100% !important;
            }
        }
 
        .group_2 {
            padding-left: 30rpx;
            position: relative;
 
            .group_3 {
                padding: 34rpx 0 33rpx;
 
                .group_5 {
                    margin-left: 20rpx;
                    font-size: 28rpx;
 
                    .text_4 {
                        margin-top: 10rpx;
                        color: rgb(153, 153, 153);
                        font-size: 24rpx;
                        line-height: 29rpx;
                        white-space: nowrap;
                    }
 
                    .text_2 {
                        color: rgb(255, 150, 12);
                        line-height: 38rpx;
                        white-space: nowrap;
                        margin-right: 4rpx;
                    }
 
                    .text_3 {
                        color: rgb(51, 51, 51);
                        line-height: 38rpx;
                        white-space: nowrap;
                    }
                }
            }
 
            .image_6 {
                align-self: flex-end;
                width: 624rpx;
                height: 3rpx;
            }
 
            .top-group {
                padding: 32rpx 0 33rpx;
 
                .right-group {
                    margin-left: 20rpx;
 
                    .group_9 {
                        padding-top: 2rpx;
                        position: relative;
 
                        .text_8 {
                            position: absolute;
                            right: 0;
                            top: 0;
                        }
                    }
 
                    .text_9 {
                        margin-top: 6rpx;
                        color: rgb(153, 153, 153);
                        font-size: 24rpx;
                        line-height: 29rpx;
                        white-space: nowrap;
                    }
 
                    .text_10 {
                        margin-top: 4rpx;
                    }
 
                    .text_5 {
                        color: rgb(255, 150, 12);
                        font-size: 32rpx;
                        line-height: 38rpx;
                        white-space: nowrap;
                    }
 
                    .text_7 {
                        color: rgb(51, 51, 51);
                        font-size: 32rpx;
                        line-height: 38rpx;
                        white-space: nowrap;
                    }
                }
 
                .view_1 {
                    width: 352rpx;
                }
            }
 
            .image_4 {
                margin-right: 20rpx;
                align-self: center;
                width: 16rpx;
                height: 28rpx;
            }
 
            .image_2 {
                width: 76rpx !important;
                height: 76rpx !important;
            }
        }
 
        .group_2::after {
            content: '';
            position: absolute;
            width: calc(100% - 126rpx);
            right: 0;
            bottom: 0;
            border-bottom: 1px solid #F0F0F0;
        }
    }
 
    /deep/ .u-badge {
        color: #fa3534 !important;
        top: 16rpx !important;
        right: 124rpx !important;
        width: 20rpx !important;
        height: 20rpx !important;
    }
</style>