southnote-mini-sdk 1.0.21 → 1.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app.js +1 -22
- package/assets/file/badwords.js +1 -63008
- package/assets/file/rules.js +1 -38
- package/components/bottomSheet/bottomSheet.js +1 -473
- package/components/experience-item/experience-item.js +1 -105
- package/components/grid-item/grid-item.js +1 -8
- package/components/post-item/post-item.js +1 -1086
- package/components/wiki-renderer/wiki-renderer.js +1 -636
- package/components/wiki-tabs/wiki-tabs.js +1 -52
- package/index.js +1 -49
- package/package.json +2 -22
- package/pages/addGame/addGame.js +1 -454
- package/pages/addSubject/addSubject.js +1 -199
- package/pages/commonLogin/commonLogin.js +1 -269
- package/pages/copyOfficial/copyOfficial.js +1 -25
- package/pages/demo/demo.js +1 -23
- package/pages/game/game.js +1 -1305
- package/pages/home/home.js +1 -665
- package/pages/lottery-winners/lottery-winners.js +1 -60
- package/pages/message/messageCommentsAndAt/messageCommentsAndAt.js +1 -178
- package/pages/message/messageEntire/messageEntire.js +1 -112
- package/pages/message/messageLikeAndCollect/messageLikeAndCollect.js +1 -147
- package/pages/message/messageNewFans/messageNewFans.js +1 -139
- package/pages/officialWebview/officialWebview.js +1 -13
- package/pages/post/post.js +1 -1856
- package/pages/post-editor/post-editor.js +1 -465
- package/pages/postDialog/postDialog.js +1 -560
- package/pages/report-category/report-category.js +1 -29
- package/pages/report-form/report-form.js +1 -65
- package/pages/sevenDaySignDetail/sevenDaySignDetail.js +1 -273
- package/pages/topic/topic.js +1 -266
- package/pages/user/user.js +1 -939
- package/pages/userDatum/userDatum.js +1 -24
- package/pages/userGameLib/userGameLib.js +1 -105
- package/pages/webview/webview.js +1 -25
- package/pages/wheelActivivty/wheelActivivty.js +1 -492
- package/pages/wiki/wiki.js +1 -138
- package/request/JKRequest.js +1 -177
- package/services/home.js +1 -603
- package/utils/auth.js +1 -17
- package/utils/base64.js +1 -67
- package/utils/compressImage.js +1 -41
- package/utils/exp.js +1 -49
- package/utils/formatPost.js +1 -18
- package/utils/parseContent.js +1 -191
- package/utils/query-select.js +1 -9
- package/utils/sensitive.js +1 -82
package/pages/home/home.js
CHANGED
|
@@ -1,665 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getBanner,
|
|
3
|
-
queryPublicPost,
|
|
4
|
-
commentPost,
|
|
5
|
-
queryUserNotRead,
|
|
6
|
-
followUser,
|
|
7
|
-
likePost,
|
|
8
|
-
deleteContent,
|
|
9
|
-
collectPost,
|
|
10
|
-
setUserPostTop
|
|
11
|
-
} from "../../services/home"
|
|
12
|
-
import {
|
|
13
|
-
getLevelByExp,
|
|
14
|
-
getLevelImg
|
|
15
|
-
} from '../../utils/exp';
|
|
16
|
-
import querySelect from "../../utils/query-select"
|
|
17
|
-
import formatUTC from "../../utils/formatPost.js"
|
|
18
|
-
import {
|
|
19
|
-
throttle
|
|
20
|
-
} from "underscore"
|
|
21
|
-
import {
|
|
22
|
-
checkLogin
|
|
23
|
-
} from "../../utils/auth"
|
|
24
|
-
|
|
25
|
-
const throttleQuerySelect = throttle(querySelect, 100)
|
|
26
|
-
|
|
27
|
-
Page({
|
|
28
|
-
data: {
|
|
29
|
-
|
|
30
|
-
statusBarHeight: 0, // 动态计算
|
|
31
|
-
|
|
32
|
-
showMenu: false,
|
|
33
|
-
navTotalHeight: 88,
|
|
34
|
-
|
|
35
|
-
banners: [],
|
|
36
|
-
bannerHeight: 0,
|
|
37
|
-
currentPage: 1,
|
|
38
|
-
posts: [],
|
|
39
|
-
isLoading: false,
|
|
40
|
-
hasMore: true,
|
|
41
|
-
|
|
42
|
-
showSheet: false,
|
|
43
|
-
sheetMode: 'forward',
|
|
44
|
-
originPost: {},
|
|
45
|
-
avatar: '',
|
|
46
|
-
|
|
47
|
-
unreadCount: 0, // 消息角标数量
|
|
48
|
-
|
|
49
|
-
moreSheetVisible: false,
|
|
50
|
-
moreSheetItem: {},
|
|
51
|
-
isOwner: false, //当前cell是否是自己
|
|
52
|
-
loading: true, //骨架屏
|
|
53
|
-
|
|
54
|
-
currentPlayingVideoId: null, //当前播放视频帖子id
|
|
55
|
-
},
|
|
56
|
-
gotoMessagePage() {
|
|
57
|
-
this.pauseCurrentPlayingVideo()
|
|
58
|
-
if (!checkLogin()) return;
|
|
59
|
-
wx.navigateTo({
|
|
60
|
-
url: '/pages/message/messageEntire/messageEntire',
|
|
61
|
-
})
|
|
62
|
-
},
|
|
63
|
-
|
|
64
|
-
gotoUserCenter() {
|
|
65
|
-
this.pauseCurrentPlayingVideo()
|
|
66
|
-
if (!checkLogin()) return;
|
|
67
|
-
const userId = wx.getStorageSync('appuid')
|
|
68
|
-
if (!userId) return;
|
|
69
|
-
wx.navigateTo({
|
|
70
|
-
url: `/pages/user/user?id=${userId}`
|
|
71
|
-
});
|
|
72
|
-
this.setData({
|
|
73
|
-
showMenu: false
|
|
74
|
-
});
|
|
75
|
-
},
|
|
76
|
-
toggleMenu() {
|
|
77
|
-
this.pauseCurrentPlayingVideo()
|
|
78
|
-
if (!checkLogin()) return;
|
|
79
|
-
this.setData({
|
|
80
|
-
showMenu: !this.data.showMenu
|
|
81
|
-
});
|
|
82
|
-
},
|
|
83
|
-
|
|
84
|
-
hideMenu() {
|
|
85
|
-
this.setData({
|
|
86
|
-
showMenu: false
|
|
87
|
-
});
|
|
88
|
-
},
|
|
89
|
-
|
|
90
|
-
logout() {
|
|
91
|
-
wx.clearStorageSync('token');
|
|
92
|
-
wx.clearStorageSync('appuid');
|
|
93
|
-
wx.clearStorageSync('nickname');
|
|
94
|
-
wx.clearStorageSync('avatar');
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
this.setData({
|
|
98
|
-
showMenu: false
|
|
99
|
-
});
|
|
100
|
-
wx.showToast({
|
|
101
|
-
title: '已退出登录',
|
|
102
|
-
icon: 'success'
|
|
103
|
-
});
|
|
104
|
-
wx.startPullDownRefresh();
|
|
105
|
-
},
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
onShowSheet(topic) {
|
|
109
|
-
const sheet = this.selectComponent('#bottomSheet');
|
|
110
|
-
if (sheet) {
|
|
111
|
-
sheet.setData({
|
|
112
|
-
selectedTopic: topic,
|
|
113
|
-
visible: true
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
},
|
|
117
|
-
// 发布按钮点击
|
|
118
|
-
onPublish() {
|
|
119
|
-
const token = wx.getStorageSync('token'); // 读取缓存里的 token
|
|
120
|
-
this.pauseCurrentPlayingVideo()
|
|
121
|
-
if (token) {
|
|
122
|
-
// 已登录,跳转到发布页面
|
|
123
|
-
wx.navigateTo({
|
|
124
|
-
url: '/pages/post-editor/post-editor',
|
|
125
|
-
// url:'/pages/demo/demo'
|
|
126
|
-
});
|
|
127
|
-
} else {
|
|
128
|
-
// 未登录,跳转登录页面
|
|
129
|
-
wx.navigateTo({
|
|
130
|
-
url: '../../pages/commonLogin/commonLogin',
|
|
131
|
-
// url:'/pages/login/login'
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
},
|
|
135
|
-
setNavHeight() {
|
|
136
|
-
const info = wx.getWindowInfo();
|
|
137
|
-
const statusBarHeight = info.statusBarHeight;
|
|
138
|
-
|
|
139
|
-
this.setData({
|
|
140
|
-
statusBarHeight,
|
|
141
|
-
navTotalHeight: statusBarHeight + 44
|
|
142
|
-
});
|
|
143
|
-
},
|
|
144
|
-
onLoad(options) {
|
|
145
|
-
this.setNavHeight()
|
|
146
|
-
// 1️⃣ 优先使用 app 全局参数(从分享打开时)
|
|
147
|
-
const app = getApp();
|
|
148
|
-
const query = app.globalData.launchQuery || options;
|
|
149
|
-
// 游戏社区
|
|
150
|
-
if (query.type === 'game' && query.id) {
|
|
151
|
-
app.globalData.launchQuery = null;
|
|
152
|
-
wx.redirectTo({
|
|
153
|
-
url: `/pages/game/game?id=${query.id}`,
|
|
154
|
-
});
|
|
155
|
-
} else if (query.type === 'user' && query.id) {
|
|
156
|
-
// 用户中心
|
|
157
|
-
app.globalData.launchQuery = null;
|
|
158
|
-
wx.redirectTo({
|
|
159
|
-
url: `/pages/user/user?id=${query.id}`
|
|
160
|
-
});
|
|
161
|
-
} else if (query.type === 'post' && query.id) {
|
|
162
|
-
// 帖子详情
|
|
163
|
-
app.globalData.launchQuery = null;
|
|
164
|
-
wx.redirectTo({
|
|
165
|
-
url: `/pages/post/post?id=${query.id}`,
|
|
166
|
-
});
|
|
167
|
-
} else if (query.type === 'topic' && query.id) {
|
|
168
|
-
// 话题
|
|
169
|
-
app.globalData.launchQuery = null;
|
|
170
|
-
wx.redirectTo({
|
|
171
|
-
url: `/pages/topic/topic?id=${query.id}`,
|
|
172
|
-
});
|
|
173
|
-
} else {
|
|
174
|
-
// console.log('无参数,留在首页');
|
|
175
|
-
this.getData()
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
},
|
|
179
|
-
onShow() {
|
|
180
|
-
this.setData({
|
|
181
|
-
avatar: wx.getStorageSync('avatar'),
|
|
182
|
-
});
|
|
183
|
-
if (!wx.getStorageSync('token')) {
|
|
184
|
-
return;
|
|
185
|
-
}
|
|
186
|
-
queryUserNotRead().then(res => {
|
|
187
|
-
if (!res.count) {
|
|
188
|
-
this.setData({
|
|
189
|
-
unreadCount: 0
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
if (res.count && Array.isArray(res.count)) {
|
|
193
|
-
const topCount = res.count.slice(0, 3).reduce((sum, item) => sum + item, 0);
|
|
194
|
-
this.setData({
|
|
195
|
-
unreadCount: topCount
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
})
|
|
199
|
-
},
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
async getData() {
|
|
204
|
-
try {
|
|
205
|
-
const res = await getBanner()
|
|
206
|
-
this.setData({
|
|
207
|
-
banners: res.data
|
|
208
|
-
})
|
|
209
|
-
const post = await queryPublicPost(1, 2)
|
|
210
|
-
|
|
211
|
-
this.setData({
|
|
212
|
-
posts: this.formatPost(post),
|
|
213
|
-
currentPage: 1,
|
|
214
|
-
hasMore: post.data.length > 0,
|
|
215
|
-
loading: false
|
|
216
|
-
})
|
|
217
|
-
} catch (err) {
|
|
218
|
-
console.error('加载失败', err)
|
|
219
|
-
} finally {
|
|
220
|
-
this.setData({
|
|
221
|
-
loading: false
|
|
222
|
-
})
|
|
223
|
-
wx.stopPullDownRefresh()
|
|
224
|
-
}
|
|
225
|
-
},
|
|
226
|
-
|
|
227
|
-
formatPost(post) {
|
|
228
|
-
// data为空时返回的是空对象{}
|
|
229
|
-
if (!Array.isArray(post.data)) return [];
|
|
230
|
-
const formatPost = post.data.map(item => {
|
|
231
|
-
const user = item.user || {};
|
|
232
|
-
// 处理用户等级
|
|
233
|
-
if (item.game?.exp != null) {
|
|
234
|
-
// user.level = getLevelByExp(item.game.exp);
|
|
235
|
-
// user.levelImg = getLevelImg(user.level)
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
const newItem = {
|
|
239
|
-
...item,
|
|
240
|
-
post: {
|
|
241
|
-
...item.post,
|
|
242
|
-
formatTime: formatUTC(item.post.created_at),
|
|
243
|
-
imageArray: item.post.images ? item.post.images.split(',') : [],
|
|
244
|
-
vote: item.post.vote || null
|
|
245
|
-
}
|
|
246
|
-
};
|
|
247
|
-
|
|
248
|
-
// 处理转发的原始帖
|
|
249
|
-
if (item.shared && item.shared.post) {
|
|
250
|
-
newItem.shared = {
|
|
251
|
-
...item.shared,
|
|
252
|
-
post: {
|
|
253
|
-
...item.shared.post,
|
|
254
|
-
formatTime: formatUTC(item.shared.post.created_at),
|
|
255
|
-
imageArray: item.shared.post.images ? item.shared.post.images.split(',') : [],
|
|
256
|
-
vote: item.shared.post.vote || null
|
|
257
|
-
}
|
|
258
|
-
};
|
|
259
|
-
}
|
|
260
|
-
return newItem;
|
|
261
|
-
});
|
|
262
|
-
|
|
263
|
-
return formatPost;
|
|
264
|
-
},
|
|
265
|
-
|
|
266
|
-
onBannerImageLoad() {
|
|
267
|
-
this.getBannerHeight()
|
|
268
|
-
},
|
|
269
|
-
|
|
270
|
-
getBannerHeight() {
|
|
271
|
-
// querySelect(".cover-image").then(res => {
|
|
272
|
-
// this.setData({
|
|
273
|
-
// bannerHeight: res[0].height
|
|
274
|
-
// });
|
|
275
|
-
// });
|
|
276
|
-
},
|
|
277
|
-
|
|
278
|
-
onPullDownRefresh() {
|
|
279
|
-
this.getData()
|
|
280
|
-
},
|
|
281
|
-
// 页面触底事件
|
|
282
|
-
async onReachBottom() {
|
|
283
|
-
if (this.data.isLoading || !this.data.hasMore) return
|
|
284
|
-
|
|
285
|
-
this.setData({
|
|
286
|
-
isLoading: true
|
|
287
|
-
})
|
|
288
|
-
|
|
289
|
-
const nextPage = this.data.currentPage + 1
|
|
290
|
-
|
|
291
|
-
try {
|
|
292
|
-
const res = await queryPublicPost(nextPage, 2)
|
|
293
|
-
const formatPost = this.formatPost(res)
|
|
294
|
-
const currentLength = this.data.posts.length
|
|
295
|
-
|
|
296
|
-
// 1. 更新 currentPage, hasMore, isLoading
|
|
297
|
-
this.setData({
|
|
298
|
-
currentPage: nextPage,
|
|
299
|
-
hasMore: res.data?.length > 0,
|
|
300
|
-
isLoading: false
|
|
301
|
-
})
|
|
302
|
-
|
|
303
|
-
// 2. 批量新增 posts(只更新新增数据,不替换整个数组)
|
|
304
|
-
let update = {}
|
|
305
|
-
formatPost.forEach((item, index) => {
|
|
306
|
-
update[`posts[${currentLength + index}]`] = item
|
|
307
|
-
})
|
|
308
|
-
this.setData(update)
|
|
309
|
-
|
|
310
|
-
} catch (err) {
|
|
311
|
-
console.error("加载更多失败", err)
|
|
312
|
-
this.setData({
|
|
313
|
-
isLoading: false
|
|
314
|
-
})
|
|
315
|
-
}
|
|
316
|
-
},
|
|
317
|
-
|
|
318
|
-
gotoGameCenter(e) {
|
|
319
|
-
const gameId = e.currentTarget.dataset.id;
|
|
320
|
-
this.pauseCurrentPlayingVideo()
|
|
321
|
-
wx.navigateTo({
|
|
322
|
-
url: `/pages/game/game?id=${gameId}`
|
|
323
|
-
});
|
|
324
|
-
},
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
onFollowChanged(e) {
|
|
328
|
-
const {
|
|
329
|
-
userId,
|
|
330
|
-
isFans
|
|
331
|
-
} = e.detail;
|
|
332
|
-
|
|
333
|
-
const updatedPosts = this.data.posts.map(p => {
|
|
334
|
-
if (p.user.id === userId) {
|
|
335
|
-
p.user.is_fans = isFans;
|
|
336
|
-
}
|
|
337
|
-
return p;
|
|
338
|
-
});
|
|
339
|
-
|
|
340
|
-
this.setData({
|
|
341
|
-
posts: updatedPosts
|
|
342
|
-
});
|
|
343
|
-
|
|
344
|
-
wx.showToast({
|
|
345
|
-
title: isFans ? '关注成功' : '已取消关注',
|
|
346
|
-
icon: 'success'
|
|
347
|
-
});
|
|
348
|
-
},
|
|
349
|
-
onShareTap(e) {
|
|
350
|
-
this.setData({
|
|
351
|
-
sheetMode: 'forward',
|
|
352
|
-
showSheet: true,
|
|
353
|
-
originPost: e.detail.item,
|
|
354
|
-
commentData: null
|
|
355
|
-
}, () => {
|
|
356
|
-
const sheet = this.selectComponent('#bottomSheet');
|
|
357
|
-
if (sheet) {
|
|
358
|
-
if (wx.getStorageSync('height') != 0) {
|
|
359
|
-
sheet.updateSheetPosition(wx.getStorageSync('height'));
|
|
360
|
-
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
});
|
|
364
|
-
},
|
|
365
|
-
onCommentTap(e) {
|
|
366
|
-
// this.setData({
|
|
367
|
-
// sheetMode: 'comment',
|
|
368
|
-
// showSheet: true,
|
|
369
|
-
// originPost: e.detail.item
|
|
370
|
-
// })
|
|
371
|
-
|
|
372
|
-
const postId = e.detail.item.post.id;
|
|
373
|
-
this.pauseCurrentPlayingVideo()
|
|
374
|
-
wx.navigateTo({
|
|
375
|
-
url: `/pages/post/post?id=${postId}&isCommentIn=true`
|
|
376
|
-
});
|
|
377
|
-
},
|
|
378
|
-
|
|
379
|
-
chooseTopic(e) {
|
|
380
|
-
this.pauseCurrentPlayingVideo()
|
|
381
|
-
wx.navigateTo({
|
|
382
|
-
url: '/pages/addSubject/addSubject',
|
|
383
|
-
});
|
|
384
|
-
|
|
385
|
-
},
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
// 底部弹窗
|
|
390
|
-
|
|
391
|
-
onMoreTap(e) {
|
|
392
|
-
const index = e.currentTarget.dataset.index; // 当前帖子的索引
|
|
393
|
-
|
|
394
|
-
const item = e.detail.item;
|
|
395
|
-
const currentUserId = wx.getStorageSync('appuid'); // 当前登录用户id
|
|
396
|
-
const isOwner = item.user.id === currentUserId;
|
|
397
|
-
this.setData({
|
|
398
|
-
isOwner,
|
|
399
|
-
moreSheetVisible: true,
|
|
400
|
-
moreSheetItem: item,
|
|
401
|
-
currentPostIndex: index
|
|
402
|
-
});
|
|
403
|
-
},
|
|
404
|
-
|
|
405
|
-
onPinTap() {
|
|
406
|
-
const post = this.data.moreSheetItem.post;
|
|
407
|
-
const type = this.data.isPinned ? 2 : 1; // 1置顶,2取消置顶
|
|
408
|
-
|
|
409
|
-
wx.showLoading({
|
|
410
|
-
title: '处理中...'
|
|
411
|
-
});
|
|
412
|
-
setUserPostTop(post.id, type).then(res => {
|
|
413
|
-
wx.hideLoading();
|
|
414
|
-
if (res.code === 0) {
|
|
415
|
-
wx.showToast({
|
|
416
|
-
title: type === 1 ? '置顶成功' : '取消置顶成功',
|
|
417
|
-
icon: 'success'
|
|
418
|
-
});
|
|
419
|
-
|
|
420
|
-
// 更新当前组件状态
|
|
421
|
-
this.setData({
|
|
422
|
-
'item.post.is_user_top': type === 1 ? 1 : 0,
|
|
423
|
-
isPinned: type === 1 ? 1 : 0
|
|
424
|
-
});
|
|
425
|
-
|
|
426
|
-
this.onCloseMoreSheet();
|
|
427
|
-
|
|
428
|
-
// 如果置顶,则需要移动帖子到列表第一位,取消其他帖子置顶,并滚动到顶部
|
|
429
|
-
if (type === 1) {
|
|
430
|
-
const pages = getCurrentPages();
|
|
431
|
-
const currentPage = pages[pages.length - 1];
|
|
432
|
-
|
|
433
|
-
if (currentPage.route === 'pages/user/user') {
|
|
434
|
-
let postsData = currentPage.data.posts;
|
|
435
|
-
|
|
436
|
-
if (Array.isArray(postsData)) {
|
|
437
|
-
// 先取消其他帖子置顶
|
|
438
|
-
postsData = postsData.map(p => {
|
|
439
|
-
if (p.post.id !== post.id && p.post.is_user_top === 1) {
|
|
440
|
-
p.post.is_user_top = 0;
|
|
441
|
-
}
|
|
442
|
-
return p;
|
|
443
|
-
});
|
|
444
|
-
|
|
445
|
-
// 找到当前帖子在数组中的索引
|
|
446
|
-
const currentIndex = postsData.findIndex(p => p.post.id === post.id);
|
|
447
|
-
if (currentIndex > -1) {
|
|
448
|
-
const [pinnedPost] = postsData.splice(currentIndex, 1);
|
|
449
|
-
pinnedPost.post.is_user_top = 1
|
|
450
|
-
// 插入到数组第一个位置
|
|
451
|
-
postsData.unshift(pinnedPost);
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
currentPage.setData({
|
|
455
|
-
posts: postsData
|
|
456
|
-
});
|
|
457
|
-
|
|
458
|
-
// 页面滚动到顶部
|
|
459
|
-
wx.pageScrollTo({
|
|
460
|
-
scrollTop: 0,
|
|
461
|
-
duration: 300
|
|
462
|
-
});
|
|
463
|
-
} else if (postsData && typeof postsData === 'object') {
|
|
464
|
-
const newPostsObj = {};
|
|
465
|
-
Object.keys(postsData).forEach(key => {
|
|
466
|
-
if (Array.isArray(postsData[key])) {
|
|
467
|
-
// 取消其他帖子置顶
|
|
468
|
-
let arr = postsData[key].map(p => {
|
|
469
|
-
if (p.post.id !== post.id && p.post.is_user_top === 1) {
|
|
470
|
-
p.post.is_user_top = 0;
|
|
471
|
-
}
|
|
472
|
-
return p;
|
|
473
|
-
});
|
|
474
|
-
|
|
475
|
-
// 将当前帖子移动到第一个
|
|
476
|
-
const currentIndex = arr.findIndex(p => p.post.id === post.id);
|
|
477
|
-
if (currentIndex > -1) {
|
|
478
|
-
const [pinnedPost] = arr.splice(currentIndex, 1);
|
|
479
|
-
pinnedPost.post.is_user_top = 1
|
|
480
|
-
arr.unshift(pinnedPost);
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
newPostsObj[key] = arr;
|
|
484
|
-
} else {
|
|
485
|
-
newPostsObj[key] = postsData[key];
|
|
486
|
-
}
|
|
487
|
-
});
|
|
488
|
-
|
|
489
|
-
currentPage.setData({
|
|
490
|
-
posts: newPostsObj
|
|
491
|
-
});
|
|
492
|
-
|
|
493
|
-
wx.pageScrollTo({
|
|
494
|
-
scrollTop: 0,
|
|
495
|
-
duration: 300
|
|
496
|
-
});
|
|
497
|
-
}
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
} else {
|
|
501
|
-
wx.showToast({
|
|
502
|
-
title: res.msg || '操作失败',
|
|
503
|
-
icon: 'error'
|
|
504
|
-
});
|
|
505
|
-
}
|
|
506
|
-
});
|
|
507
|
-
},
|
|
508
|
-
// 关闭弹窗
|
|
509
|
-
onCloseMoreSheet() {
|
|
510
|
-
this.setData({
|
|
511
|
-
moreSheetVisible: false
|
|
512
|
-
});
|
|
513
|
-
},
|
|
514
|
-
|
|
515
|
-
// 弹窗选项点击
|
|
516
|
-
onDelete() {
|
|
517
|
-
const postId = this.data.moreSheetItem.post.id;
|
|
518
|
-
deleteContent(postId).then(res => {
|
|
519
|
-
if (res.code === 0) {
|
|
520
|
-
wx.showToast({
|
|
521
|
-
title: '删除成功',
|
|
522
|
-
icon: 'success'
|
|
523
|
-
});
|
|
524
|
-
|
|
525
|
-
// 删除父页面列表里的帖子(兼容数组和对象)
|
|
526
|
-
const pages = getCurrentPages();
|
|
527
|
-
const currentPage = pages[pages.length - 1]; // 当前页
|
|
528
|
-
|
|
529
|
-
const postsData = currentPage.data.posts;
|
|
530
|
-
if (Array.isArray(postsData)) {
|
|
531
|
-
// posts 是数组
|
|
532
|
-
currentPage.setData({
|
|
533
|
-
posts: postsData.filter(p => p.post.id !== postId)
|
|
534
|
-
});
|
|
535
|
-
} else if (postsData && typeof postsData === 'object') {
|
|
536
|
-
// posts 是对象,每个 value 都可能是帖子数组
|
|
537
|
-
const newPosts = {};
|
|
538
|
-
Object.keys(postsData).forEach(key => {
|
|
539
|
-
if (Array.isArray(postsData[key])) {
|
|
540
|
-
newPosts[key] = postsData[key].filter(p => p.post.id !== postId);
|
|
541
|
-
} else {
|
|
542
|
-
newPosts[key] = postsData[key]; // 保留原值
|
|
543
|
-
}
|
|
544
|
-
});
|
|
545
|
-
currentPage.setData({
|
|
546
|
-
posts: newPosts
|
|
547
|
-
});
|
|
548
|
-
}
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
this.triggerEvent('deletePost', {
|
|
552
|
-
post: this.data.moreSheetItem.post
|
|
553
|
-
});
|
|
554
|
-
this.onCloseMoreSheet();
|
|
555
|
-
} else {
|
|
556
|
-
wx.showToast({
|
|
557
|
-
title: res.msg || '删除失败',
|
|
558
|
-
icon: 'error'
|
|
559
|
-
});
|
|
560
|
-
}
|
|
561
|
-
});
|
|
562
|
-
},
|
|
563
|
-
|
|
564
|
-
// 举报帖子
|
|
565
|
-
onReport() {
|
|
566
|
-
this.pauseCurrentPlayingVideo()
|
|
567
|
-
wx.navigateTo({
|
|
568
|
-
url: `/pages/report-category/report-category?postId=${this.data.moreSheetItem.post.id}`,
|
|
569
|
-
})
|
|
570
|
-
|
|
571
|
-
this.triggerEvent('reportPost', {
|
|
572
|
-
post: this.data.moreSheetItem.post
|
|
573
|
-
});
|
|
574
|
-
this.onCloseMoreSheet();
|
|
575
|
-
},
|
|
576
|
-
|
|
577
|
-
// 收藏/取消收藏
|
|
578
|
-
onFavorite() {
|
|
579
|
-
const index = this.data.currentPostIndex;
|
|
580
|
-
const post = this.data.posts[index].post;
|
|
581
|
-
const nType = post.is_collect === 1 ? 2 : 1; // 1收藏,2取消收藏
|
|
582
|
-
|
|
583
|
-
collectPost(post.id, nType).then(res => {
|
|
584
|
-
if (res.code === 0) {
|
|
585
|
-
wx.showToast({
|
|
586
|
-
title: nType === 1 ? '已收藏' : '取消收藏',
|
|
587
|
-
icon: 'success'
|
|
588
|
-
});
|
|
589
|
-
|
|
590
|
-
// 更新 posts 列表里的状态
|
|
591
|
-
const key = `posts[${index}].post.is_collect`;
|
|
592
|
-
this.setData({
|
|
593
|
-
[key]: nType === 1 ? 1 : 0
|
|
594
|
-
});
|
|
595
|
-
|
|
596
|
-
this.onCloseMoreSheet();
|
|
597
|
-
} else {
|
|
598
|
-
wx.showToast({
|
|
599
|
-
title: res.msg || (nType === 1 ? '收藏失败' : '取消收藏失败'),
|
|
600
|
-
icon: 'error'
|
|
601
|
-
});
|
|
602
|
-
}
|
|
603
|
-
});
|
|
604
|
-
},
|
|
605
|
-
|
|
606
|
-
onVideoPlay(e) {
|
|
607
|
-
|
|
608
|
-
const postId = e.detail.id;
|
|
609
|
-
const prevId = this.data.currentPlayingVideoId;
|
|
610
|
-
|
|
611
|
-
if (prevId && prevId !== postId) {
|
|
612
|
-
// 1️⃣ 获取上一个视频所在的组件实例
|
|
613
|
-
const prevIndex = this.data.posts.findIndex(p => p.post.id === prevId);
|
|
614
|
-
const prevComponent = this.selectComponent(`#postItem-${prevIndex}`);
|
|
615
|
-
if (prevComponent) {
|
|
616
|
-
prevComponent.pauseVideo();
|
|
617
|
-
}
|
|
618
|
-
}
|
|
619
|
-
|
|
620
|
-
// 更新当前播放视频
|
|
621
|
-
this.setData({
|
|
622
|
-
currentPlayingVideoId: postId
|
|
623
|
-
});
|
|
624
|
-
},
|
|
625
|
-
|
|
626
|
-
onPauseAllVideo() {
|
|
627
|
-
this.pauseCurrentPlayingVideo()
|
|
628
|
-
},
|
|
629
|
-
/**
|
|
630
|
-
* 暂停当前页面正在播放的视频
|
|
631
|
-
*/
|
|
632
|
-
pauseCurrentPlayingVideo() {
|
|
633
|
-
const playingId = this.data.currentPlayingVideoId;
|
|
634
|
-
if (!playingId) return;
|
|
635
|
-
|
|
636
|
-
// 找到该 post 在 posts 中的 index
|
|
637
|
-
const index = this.data.posts.findIndex(
|
|
638
|
-
item => item.post.id === playingId
|
|
639
|
-
);
|
|
640
|
-
|
|
641
|
-
if (index === -1) return;
|
|
642
|
-
|
|
643
|
-
// 拿到对应的 postItem 组件
|
|
644
|
-
const postItem = this.selectComponent(`#postItem-${index}`);
|
|
645
|
-
|
|
646
|
-
if (postItem && typeof postItem.pauseVideo === 'function') {
|
|
647
|
-
postItem.pauseVideo();
|
|
648
|
-
}
|
|
649
|
-
|
|
650
|
-
// 清空当前播放状态
|
|
651
|
-
this.setData({
|
|
652
|
-
currentPlayingVideoId: null
|
|
653
|
-
});
|
|
654
|
-
},
|
|
655
|
-
|
|
656
|
-
gotoTest() {
|
|
657
|
-
wx.navigateTo({
|
|
658
|
-
url: `/pages/officialWebview/officialWebview?url=${encodeURIComponent('https://www.southnote.cn')}`
|
|
659
|
-
});
|
|
660
|
-
}
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
})
|
|
1
|
+
const _0x30bc7c=_0x178a;function _0x178a(_0x3e2b39,_0x3e1e08){_0x3e2b39=_0x3e2b39-0x6a;const _0x3b1584=_0x3b15();let _0x178a16=_0x3b1584[_0x3e2b39];if(_0x178a['sQGUWy']===undefined){var _0x4041da=function(_0x298ac2){const _0x4dbc6e='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x5f0fa1='',_0x33cd52='';for(let _0x529643=0x0,_0x2ff8bc,_0xa50be5,_0x1976d6=0x0;_0xa50be5=_0x298ac2['charAt'](_0x1976d6++);~_0xa50be5&&(_0x2ff8bc=_0x529643%0x4?_0x2ff8bc*0x40+_0xa50be5:_0xa50be5,_0x529643++%0x4)?_0x5f0fa1+=String['fromCharCode'](0xff&_0x2ff8bc>>(-0x2*_0x529643&0x6)):0x0){_0xa50be5=_0x4dbc6e['indexOf'](_0xa50be5);}for(let _0x5a3b6a=0x0,_0x15b7f2=_0x5f0fa1['length'];_0x5a3b6a<_0x15b7f2;_0x5a3b6a++){_0x33cd52+='%'+('00'+_0x5f0fa1['charCodeAt'](_0x5a3b6a)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x33cd52);};_0x178a['vWwqCG']=_0x4041da,_0x178a['dCDUfa']={},_0x178a['sQGUWy']=!![];}const _0x59f7d3=_0x3b1584[0x0],_0x1ded13=_0x3e2b39+_0x59f7d3,_0x3d7220=_0x178a['dCDUfa'][_0x1ded13];return!_0x3d7220?(_0x178a16=_0x178a['vWwqCG'](_0x178a16),_0x178a['dCDUfa'][_0x1ded13]=_0x178a16):_0x178a16=_0x3d7220,_0x178a16;}(function(_0x2b2a2f,_0x1c4779){const _0x2f34bc=_0x178a,_0x445133=_0x2b2a2f();while(!![]){try{const _0x47dacf=parseInt(_0x2f34bc(0x91))/0x1*(-parseInt(_0x2f34bc(0xf6))/0x2)+parseInt(_0x2f34bc(0xc8))/0x3*(-parseInt(_0x2f34bc(0x10d))/0x4)+parseInt(_0x2f34bc(0x7b))/0x5+-parseInt(_0x2f34bc(0x82))/0x6*(parseInt(_0x2f34bc(0x75))/0x7)+parseInt(_0x2f34bc(0x10b))/0x8*(parseInt(_0x2f34bc(0x7e))/0x9)+parseInt(_0x2f34bc(0x81))/0xa*(-parseInt(_0x2f34bc(0xb6))/0xb)+-parseInt(_0x2f34bc(0xda))/0xc*(-parseInt(_0x2f34bc(0x93))/0xd);if(_0x47dacf===_0x1c4779)break;else _0x445133['push'](_0x445133['shift']());}catch(_0x548439){_0x445133['push'](_0x445133['shift']());}}}(_0x3b15,0x96c4e));import{getBanner,queryPublicPost,commentPost,queryUserNotRead,followUser,likePost,deleteContent,collectPost,setUserPostTop}from'../../services/home';import{getLevelByExp,getLevelImg}from'../../utils/exp';function _0x3b15(){const _0x222077=['ndu3mty5mfzzvgHjEq','CgfNzvnJCM9SBfrV','i3bVC3rjDgvTlq','nduWmJK0m1boC3v5yG','CMvWB3j0ug9ZDa','qMDlqNe','nJe1ndGWEvzTrK1K','ndHXyuHOzKq','C2HVD1rVyxn0','DxnLCG','Ahr0Chm6lY93D3CUC291DgHUB3rLlMnU','y0rYvMO','y291BNq','C3vJy2vZCW','B25dBg9Zzu1VCMvtAgvLDa','AxnFzMfUCW','Dg9Rzw4','s2zxq2i','zwXNr2O','5BEY5Ps26jEp','BMf2AwDHDgvuBW','BgvUz3rO','ndq2wLrWCe9K','D3fAzfq','mZLbB1vdvwW','Bffbs0C','zMLUzeLUzgv4','BevgBKG','CMvKAxjLy3ruBW','vhLwwgi','C2HVD01LBNu','5BEY6yca5yE655M75B2v','5Ps26jEp5AsX6lsL','z2v0u3rVCMfNzvn5BMm','zxjYB3i','u1zwDKS','u01wy2u','AgLKzuXVywrPBMC','AxnqAw5Uzwq','wffIrLu','Dvr4yKO','5yIG6zMK5OIq5yQF','C3rVCfb1BgXeB3DUuMvMCMvZAa','5yIG6zMK5AsX6lsL','lI4VlI4VCgfNzxmVy29TBw9Utg9NAw4Vy29TBw9Utg9NAw4','C3rHDhvZqMfYsgvPz2H0','DhLWzq','DhjPz2DLCKv2zw50','zxPRseW','C2HHCMvK','DvLeAuG','C3bSAwnL','5y+w5RAi5Ps26jEp','wuvos2i','Aw5KzxG','sMDmt2m','sunICuK','AgfZtw9Yzq','BwfW','nZDxDurUq0S','AgvPz2H0','B2jQzwn0','zM9YD2fYza','uwXVzLC','CgfNzxmVDxnLCI91C2vY','Bw9YzvnOzwv0sxrLBq','zgf0yq','zgf0yxnLDa','Cg9ZDa','Cg9ZDhnB','zM9YBwf0ug9ZDa','y3vYCMvUDfrHCMDLDa','5yQG6l295AsX6lsL','reLTwKW','y3vLD0S','l3bHz2vZl2DHBwuVz2fTzt9Pzd0','Cgf1C2vwAwrLBW','mJC3nvLbs3jhvW','z2fTzq','BMLJA25HBwu','zM9YrwfJAa','Bgf1BMnOuxvLCNK','C3rHCNrqDwXSrg93BLjLzNjLC2G','AxnFDxnLCL90B3a','swD5ELu','CgvUEhC','s25duxy','jMLZq29TBwvUDeLUpxrYDwu','DNDNvei','l3bHz2vZl3bVC3qVCg9ZDd9Pzd0','z2v0qMfUBMvYsgvPz2H0','l3bHz2vZl21LC3nHz2uVBwvZC2fNzuvUDgLYzs9TzxnZywDLrw50AxjL','C2vSzwn0q29TCg9Uzw50','5y+w5RAi572U6Ag25OIq5yQF','y3jLyxrLzf9HDa','nZqYndqYnef4qLnvrW','yw12rLK','l3bHz2vZl3rVCgLJl3rVCgLJp2LKpq','Effnuey','xs5WB3n0lMLZx2nVBgXLy3q','z0LHBKi','5ywZ5RoO5OIq5yQF','Dw5ZAgLMDa','Cgf1C2vdDxjYzw50ugXHEwLUz1zPzgvV','5Ase55cg5lITlI4U','yxzHDgfY','uLPbs0q','D1jNDfq','uhzst3i','yunZuLa','t2HeywW','yNvuvhe','z1jJu1u','C2v0rgf0yq','txDptKC','z2v0rgf0yq','yxbWDwLK','y2XfBxi','DLf3qvK','z0r4zfC','AxrLBq','BxnN','5BEY5y+w5RAi5ywZ5RoO','mZC0nMXqrujKBa','y29Kzq','l3bHz2vZl3vZzxiVDxnLCJ9Pzd0','zgv0ywLS','Cg9ZDhm','l3bHz2vZl29MzMLJAwfSv2vIDMLLDY9VzMzPy2LHBfDLyNzPzxC/DxjSpq','y3jIt2K','y2XLyxjtDg9YywDLu3LUyW','BNvWDMi','z2XVyMfSrgf0yq','A2v5CW','zKngywm','z2jTwxG','zgvSzxrLug9ZDa','yKPXAK0','DxbKyxrLu2HLzxrqB3nPDgLVBG','zgLjrg0','DM90zq','rMncqKy','Aw1Hz2vZ','DgHLBG','oe5rAK9rzG','z2v0v2LUzg93sw5MBW','mZy3nMHJrNHXtW','5y+w5RAi5Ps26jEp5AsX6lsL','C3bSAxq','zMLSDgvY','qxfsvfm','EMXSC1C','v2r0rwu','rfHHugm','Dg9WAwm','C2XPy2u','AxnbCNjHEq','sKznrum','ndy5odmZD1fxEu9N','s1DoyNu','zNvUy3rPB24','wwrdq1u','B2zLDgG','AxnFy29SBgvJDa'];_0x3b15=function(){return _0x222077;};return _0x3b15();}import _0x225caf from'../../utils/query-select';import _0x19fd7a from'../../utils/formatPost.js';import{throttle}from'underscore';import{checkLogin}from'../../utils/auth';const throttleQuerySelect=throttle(_0x225caf,0x64);Page({'data':{'statusBarHeight':0x0,'showMenu':![],'navTotalHeight':0x58,'banners':[],'bannerHeight':0x0,'currentPage':0x1,'posts':[],'isLoading':![],'hasMore':!![],'showSheet':![],'sheetMode':_0x30bc7c(0xb9),'originPost':{},'avatar':'','unreadCount':0x0,'moreSheetVisible':![],'moreSheetItem':{},'isOwner':![],'loading':!![],'currentPlayingVideoId':null},'gotoMessagePage'(){const _0x30a756=_0x30bc7c,_0xe32158={'THCIH':function(_0x57c3e2){return _0x57c3e2();},'uTxbJ':_0x30a756(0xd6)};this[_0x30a756(0xe2)]();if(!_0xe32158['THCIH'](checkLogin))return;wx[_0x30a756(0x8f)]({'url':_0xe32158[_0x30a756(0xa3)]});},'gotoUserCenter'(){const _0x5b51ed=_0x30bc7c,_0xbcf768={'KnCQv':_0x5b51ed(0xef)};this[_0x5b51ed(0xe2)]();if(!checkLogin())return;const _0x53fb53=wx['getStorageSync'](_0xbcf768[_0x5b51ed(0xd1)]);if(!_0x53fb53)return;wx[_0x5b51ed(0x8f)]({'url':_0x5b51ed(0xf8)+_0x53fb53}),this['setData']({'showMenu':![]});},'toggleMenu'(){const _0x2f518f=_0x30bc7c,_0x36d4a4={'lQAKG':function(_0x1826af){return _0x1826af();}};this[_0x2f518f(0xe2)]();if(!_0x36d4a4[_0x2f518f(0x94)](checkLogin))return;this[_0x2f518f(0xec)]({'showMenu':!this[_0x2f518f(0xbd)][_0x2f518f(0x99)]});},'hideMenu'(){const _0x2a6305=_0x30bc7c;this[_0x2a6305(0xec)]({'showMenu':![]});},'logout'(){const _0x19ae7e=_0x30bc7c,_0x4951ad={'nHvvv':'appuid','clEmr':_0x19ae7e(0xca),'IgyzU':_0x19ae7e(0x9a),'AqRTS':_0x19ae7e(0x88),'gDxdW':_0x19ae7e(0x8b)},_0x1b628f='6|0|1|5|2|3|4'[_0x19ae7e(0x6b)]('|');let _0x3e0ec5=0x0;while(!![]){switch(_0x1b628f[_0x3e0ec5++]){case'0':wx[_0x19ae7e(0xfd)](_0x4951ad['nHvvv']);continue;case'1':wx[_0x19ae7e(0xfd)](_0x4951ad[_0x19ae7e(0xf0)]);continue;case'2':this[_0x19ae7e(0xec)]({'showMenu':![]});continue;case'3':wx[_0x19ae7e(0x83)]({'title':_0x4951ad[_0x19ae7e(0xcf)],'icon':_0x4951ad[_0x19ae7e(0x6d)]});continue;case'4':wx[_0x19ae7e(0xcd)]();continue;case'5':wx[_0x19ae7e(0xfd)]('avatar');continue;case'6':wx['clearStorageSync'](_0x4951ad[_0x19ae7e(0xf2)]);continue;}break;}},'onShowSheet'(_0x380dd5){const _0x260ae7=_0x30bc7c,_0x648279={'OmPXu':'#bottomSheet'},_0x49155f=this['selectComponent'](_0x648279['OmPXu']);_0x49155f&&_0x49155f[_0x260ae7(0xec)]({'selectedTopic':_0x380dd5,'visible':!![]});},'onPublish'(){const _0x4ffd3e=_0x30bc7c,_0x3e15f9={'penxw':_0x4ffd3e(0x8b),'amvFY':'/pages/post-editor/post-editor','ZgtuW':_0x4ffd3e(0xa7)},_0x110adb=wx[_0x4ffd3e(0x9c)](_0x3e15f9[_0x4ffd3e(0xd0)]);this[_0x4ffd3e(0xe2)](),_0x110adb?wx[_0x4ffd3e(0x8f)]({'url':_0x3e15f9[_0x4ffd3e(0xdb)]}):wx[_0x4ffd3e(0x8f)]({'url':_0x3e15f9['ZgtuW']});},'setNavHeight'(){const _0xf60121=_0x30bc7c,_0x25d01c={'KWNbu':function(_0x2844e4,_0x696732){return _0x2844e4+_0x696732;}},_0x43ff5c=wx[_0xf60121(0x10c)](),_0x5b552c=_0x43ff5c[_0xf60121(0xa8)];this[_0xf60121(0xec)]({'statusBarHeight':_0x5b552c,'navTotalHeight':_0x25d01c[_0xf60121(0x76)](_0x5b552c,0x2c)});},'onLoad'(_0x294646){const _0x4a8ebd=_0x30bc7c,_0x132dea={'YdCCU':function(_0x130ab3){return _0x130ab3();},'gIanB':function(_0x4042f0,_0x1259e3){return _0x4042f0===_0x1259e3;},'aCsRP':_0x4a8ebd(0xc9),'lEFnH':_0x4a8ebd(0x84),'vtcmG':_0x4a8ebd(0xbf)};this['setNavHeight']();const _0x1a5180=_0x132dea[_0x4a8ebd(0x78)](getApp),_0x55d740=_0x1a5180['globalData'][_0x4a8ebd(0xcc)]||_0x294646;if(_0x132dea[_0x4a8ebd(0xdf)](_0x55d740[_0x4a8ebd(0xa9)],_0x132dea[_0x4a8ebd(0xe8)])&&_0x55d740['id'])_0x1a5180[_0x4a8ebd(0xff)][_0x4a8ebd(0xcc)]=null,wx['redirectTo']({'url':_0x4a8ebd(0xc6)+_0x55d740['id']});else{if(_0x55d740[_0x4a8ebd(0xa9)]===_0x132dea[_0x4a8ebd(0x96)]&&_0x55d740['id'])_0x1a5180[_0x4a8ebd(0xff)][_0x4a8ebd(0xcc)]=null,wx[_0x4a8ebd(0x97)]({'url':_0x4a8ebd(0xf8)+_0x55d740['id']});else{if(_0x132dea['gIanB'](_0x55d740['type'],_0x132dea['vtcmG'])&&_0x55d740['id'])_0x1a5180[_0x4a8ebd(0xff)][_0x4a8ebd(0xcc)]=null,wx[_0x4a8ebd(0x97)]({'url':_0x4a8ebd(0xd4)+_0x55d740['id']});else _0x132dea[_0x4a8ebd(0xdf)](_0x55d740[_0x4a8ebd(0xa9)],_0x4a8ebd(0x71))&&_0x55d740['id']?(_0x1a5180[_0x4a8ebd(0xff)][_0x4a8ebd(0xcc)]=null,wx['redirectTo']({'url':_0x4a8ebd(0xdc)+_0x55d740['id']})):this[_0x4a8ebd(0xee)]();}}},'onShow'(){const _0xd17ddf=_0x30bc7c,_0x5e42ce={'mlCwV':_0xd17ddf(0xe4),'gRcSU':function(_0x425c92){return _0x425c92();}};this['setData']({'avatar':wx[_0xd17ddf(0x9c)](_0x5e42ce['mlCwV'])});if(!wx[_0xd17ddf(0x9c)](_0xd17ddf(0x8b)))return;_0x5e42ce[_0xd17ddf(0xeb)](queryUserNotRead)[_0xd17ddf(0x10a)](_0x114e50=>{const _0x14f335=_0xd17ddf;!_0x114e50[_0x14f335(0x87)]&&this[_0x14f335(0xec)]({'unreadCount':0x0});if(_0x114e50[_0x14f335(0x87)]&&Array[_0x14f335(0x73)](_0x114e50[_0x14f335(0x87)])){const _0x468a8b=_0x114e50['count'][_0x14f335(0x72)](0x0,0x3)['reduce']((_0x275d06,_0x3860d0)=>_0x275d06+_0x3860d0,0x0);this[_0x14f335(0xec)]({'unreadCount':_0x468a8b});}});},async 'getData'(){const _0x22e2c9=_0x30bc7c,_0x51d488={'MwONG':function(_0x2bd20e,_0x5c9012,_0x518374){return _0x2bd20e(_0x5c9012,_0x518374);},'wqZdT':_0x22e2c9(0xc3)};try{const _0x231b42=await getBanner();this[_0x22e2c9(0xec)]({'banners':_0x231b42[_0x22e2c9(0xbd)]});const _0x4aa4ac=await _0x51d488[_0x22e2c9(0xed)](queryPublicPost,0x1,0x2);this['setData']({'posts':this['formatPost'](_0x4aa4ac),'currentPage':0x1,'hasMore':_0x4aa4ac[_0x22e2c9(0xbd)][_0x22e2c9(0x90)]>0x0,'loading':![]});}catch(_0x34faae){console[_0x22e2c9(0x9d)](_0x51d488[_0x22e2c9(0x92)],_0x34faae);}finally{this[_0x22e2c9(0xec)]({'loading':![]}),wx[_0x22e2c9(0xa5)]();}},'formatPost'(_0x50a157){const _0x9efc26=_0x30bc7c,_0x42b20e={'WEpTT':function(_0x2144eb,_0x3b11e5){return _0x2144eb!=_0x3b11e5;},'YENKb':function(_0x307b2e,_0x5e5e36){return _0x307b2e(_0x5e5e36);}};if(!Array[_0x9efc26(0x73)](_0x50a157[_0x9efc26(0xbd)]))return[];const _0x570830=_0x50a157[_0x9efc26(0xbd)][_0x9efc26(0xb5)](_0x601926=>{const _0x6ed6e4=_0x9efc26,_0x18b499=_0x601926[_0x6ed6e4(0x84)]||{};if(_0x42b20e['WEpTT'](_0x601926[_0x6ed6e4(0xc9)]?.['exp'],null)){}const _0x27757d={..._0x601926,'post':{..._0x601926[_0x6ed6e4(0xbf)],'formatTime':_0x42b20e[_0x6ed6e4(0xb0)](_0x19fd7a,_0x601926[_0x6ed6e4(0xbf)][_0x6ed6e4(0xd9)]),'imageArray':_0x601926[_0x6ed6e4(0xbf)][_0x6ed6e4(0x109)]?_0x601926[_0x6ed6e4(0xbf)]['images'][_0x6ed6e4(0x6b)](','):[],'vote':_0x601926[_0x6ed6e4(0xbf)][_0x6ed6e4(0x107)]||null}};return _0x601926[_0x6ed6e4(0xac)]&&_0x601926[_0x6ed6e4(0xac)]['post']&&(_0x27757d[_0x6ed6e4(0xac)]={..._0x601926[_0x6ed6e4(0xac)],'post':{..._0x601926['shared'][_0x6ed6e4(0xbf)],'formatTime':_0x42b20e[_0x6ed6e4(0xb0)](_0x19fd7a,_0x601926['shared'][_0x6ed6e4(0xbf)][_0x6ed6e4(0xd9)]),'imageArray':_0x601926[_0x6ed6e4(0xac)][_0x6ed6e4(0xbf)][_0x6ed6e4(0x109)]?_0x601926[_0x6ed6e4(0xac)][_0x6ed6e4(0xbf)]['images']['split'](','):[],'vote':_0x601926['shared'][_0x6ed6e4(0xbf)]['vote']||null}}),_0x27757d;});return _0x570830;},'onBannerImageLoad'(){const _0x579d64=_0x30bc7c;this[_0x579d64(0xd5)]();},'getBannerHeight'(){},'onPullDownRefresh'(){const _0x5b9b81=_0x30bc7c;this[_0x5b9b81(0xee)]();},async 'onReachBottom'(){const _0x373ac3=_0x30bc7c,_0x204956={'cuewK':function(_0x301982,_0x11be6b,_0x54a0a6){return _0x301982(_0x11be6b,_0x54a0a6);},'crbOi':function(_0x1fd283,_0x21a423){return _0x1fd283>_0x21a423;},'WdtEe':'加载更多失败'};if(this[_0x373ac3(0xbd)]['isLoading']||!this[_0x373ac3(0xbd)][_0x373ac3(0xb4)])return;this[_0x373ac3(0xec)]({'isLoading':!![]});const _0x1e9a81=this['data']['currentPage']+0x1;try{const _0x40c233=await _0x204956[_0x373ac3(0xc5)](queryPublicPost,_0x1e9a81,0x2),_0x15e879=this[_0x373ac3(0xc1)](_0x40c233),_0x1b642b=this[_0x373ac3(0xbd)]['posts']['length'];this[_0x373ac3(0xec)]({'currentPage':_0x1e9a81,'hasMore':_0x204956[_0x373ac3(0xfc)](_0x40c233[_0x373ac3(0xbd)]?.[_0x373ac3(0x90)],0x0),'isLoading':![]});let _0x4f829b={};_0x15e879['forEach']((_0x35dc59,_0x13a8e2)=>{const _0x5dc0cf=_0x373ac3;_0x4f829b[_0x5dc0cf(0xc0)+(_0x1b642b+_0x13a8e2)+']']=_0x35dc59;}),this['setData'](_0x4f829b);}catch(_0x4c355b){console[_0x373ac3(0x9d)](_0x204956[_0x373ac3(0x6f)],_0x4c355b),this['setData']({'isLoading':![]});}},'gotoGameCenter'(_0x5bb8bf){const _0x2dc36e=_0x30bc7c,_0x274e31=_0x5bb8bf[_0x2dc36e(0xc2)][_0x2dc36e(0xbe)]['id'];this[_0x2dc36e(0xe2)](),wx['navigateTo']({'url':_0x2dc36e(0xc6)+_0x274e31});},'onFollowChanged'(_0x994922){const _0x1ab06c=_0x30bc7c,_0x5ebf19={'rQjEI':_0x1ab06c(0x88)},{userId:_0x1beae4,isFans:_0x33e2ce}=_0x994922['detail'],_0x5ea3ee=this['data'][_0x1ab06c(0xfa)]['map'](_0x4df7d2=>{const _0x350e99=_0x1ab06c;return _0x4df7d2[_0x350e99(0x84)]['id']===_0x1beae4&&(_0x4df7d2[_0x350e99(0x84)][_0x350e99(0x8a)]=_0x33e2ce),_0x4df7d2;});this[_0x1ab06c(0xec)]({'posts':_0x5ea3ee}),wx[_0x1ab06c(0x83)]({'title':_0x33e2ce?_0x1ab06c(0xe0):_0x1ab06c(0xf5),'icon':_0x5ebf19['rQjEI']});},'onShareTap'(_0x2acc60){const _0x22fb99=_0x30bc7c,_0x2dd2a5={'buTTq':'#bottomSheet','vQwAY':_0x22fb99(0xb7),'mkjNP':_0x22fb99(0xb9)};this[_0x22fb99(0xec)]({'sheetMode':_0x2dd2a5['mkjNP'],'showSheet':!![],'originPost':_0x2acc60[_0x22fb99(0xf9)][_0x22fb99(0xf3)],'commentData':null},()=>{const _0x2cb74a=_0x22fb99,_0x2890cc=this['selectComponent'](_0x2dd2a5[_0x2cb74a(0xea)]);_0x2890cc&&(wx[_0x2cb74a(0x9c)](_0x2dd2a5[_0x2cb74a(0xf1)])!=0x0&&_0x2890cc[_0x2cb74a(0x105)](wx[_0x2cb74a(0x9c)](_0x2dd2a5[_0x2cb74a(0xf1)])));});},'onCommentTap'(_0x589417){const _0x341e83=_0x30bc7c,_0x39f48d=_0x589417['detail']['item'][_0x341e83(0xbf)]['id'];this['pauseCurrentPlayingVideo'](),wx[_0x341e83(0x8f)]({'url':_0x341e83(0xd4)+_0x39f48d+_0x341e83(0xd2)});},'chooseTopic'(_0x152e36){const _0x533764=_0x30bc7c,_0x4cee06={'TyVXb':'/pages/addSubject/addSubject'};this['pauseCurrentPlayingVideo'](),wx['navigateTo']({'url':_0x4cee06[_0x533764(0x98)]});},'onMoreTap'(_0x52b0fc){const _0x29fa3b=_0x30bc7c,_0x12b193={'QlofW':_0x29fa3b(0xef)},_0xb6b02d=_0x52b0fc[_0x29fa3b(0xc2)][_0x29fa3b(0xbe)][_0x29fa3b(0xb1)],_0x5c320c=_0x52b0fc[_0x29fa3b(0xf9)][_0x29fa3b(0xf3)],_0x284238=wx[_0x29fa3b(0x9c)](_0x12b193[_0x29fa3b(0xba)]),_0x3f6f0e=_0x5c320c['user']['id']===_0x284238;this[_0x29fa3b(0xec)]({'isOwner':_0x3f6f0e,'moreSheetVisible':!![],'moreSheetItem':_0x5c320c,'currentPostIndex':_0xb6b02d});},'onPinTap'(){const _0x152cff=_0x30bc7c,_0x2e2581={'vwgTB':function(_0x54f85b,_0x3d6947){return _0x54f85b!==_0x3d6947;},'fCFac':function(_0x1a3af8,_0x1fec50){return _0x1a3af8===_0x1fec50;},'xQMPF':function(_0x2e6e36,_0x22a5e7){return _0x2e6e36===_0x22a5e7;},'VPInr':_0x152cff(0xd8),'TkQQz':_0x152cff(0x88),'cDrVj':function(_0x42762e,_0x1a814d){return _0x42762e===_0x1a814d;},'diIDm':function(_0x3dffe0){return _0x3dffe0();},'SMVce':function(_0x4b53ac,_0x61ec74){return _0x4b53ac-_0x61ec74;},'HYUBn':function(_0x40c454,_0x3b56fe){return _0x40c454===_0x3b56fe;},'TpCCu':_0x152cff(0xb8),'bJqjM':_0x152cff(0x9d),'vSWzU':_0x152cff(0xe3),'BgKBq':function(_0x52a007,_0x5dd184,_0x312082){return _0x52a007(_0x5dd184,_0x312082);}},_0x431c02=this[_0x152cff(0xbd)][_0x152cff(0xbc)][_0x152cff(0xbf)],_0x1f6a82=this[_0x152cff(0xbd)][_0x152cff(0xa1)]?0x2:0x1;wx['showLoading']({'title':_0x2e2581['vSWzU']}),_0x2e2581[_0x152cff(0x80)](setUserPostTop,_0x431c02['id'],_0x1f6a82)['then'](_0x1d0cb9=>{const _0x4ec27a=_0x152cff,_0x36a2b9={'XQbFU':function(_0x5d0b55,_0x3aae93){const _0x45059e=_0x178a;return _0x2e2581[_0x45059e(0xd3)](_0x5d0b55,_0x3aae93);},'ezkHL':function(_0x15d1d1,_0x437061){const _0x251307=_0x178a;return _0x2e2581[_0x251307(0x101)](_0x15d1d1,_0x437061);}};wx[_0x4ec27a(0xa0)]();if(_0x2e2581['fCFac'](_0x1d0cb9['code'],0x0)){wx[_0x4ec27a(0x83)]({'title':_0x2e2581[_0x4ec27a(0xdd)](_0x1f6a82,0x1)?'置顶成功':_0x2e2581['VPInr'],'icon':_0x2e2581['TkQQz']}),this['setData']({'item.post.is_user_top':_0x2e2581['xQMPF'](_0x1f6a82,0x1)?0x1:0x0,'isPinned':_0x2e2581[_0x4ec27a(0x86)](_0x1f6a82,0x1)?0x1:0x0}),this[_0x4ec27a(0x89)]();if(_0x2e2581[_0x4ec27a(0xdd)](_0x1f6a82,0x1)){const _0xb5d972=_0x2e2581[_0x4ec27a(0x106)](getCurrentPages),_0x2de6ee=_0xb5d972[_0x2e2581[_0x4ec27a(0x9f)](_0xb5d972[_0x4ec27a(0x90)],0x1)];if(_0x2e2581['HYUBn'](_0x2de6ee['route'],_0x4ec27a(0xbb))){let _0x291765=_0x2de6ee[_0x4ec27a(0xbd)][_0x4ec27a(0xfa)];if(Array[_0x4ec27a(0x73)](_0x291765)){_0x291765=_0x291765[_0x4ec27a(0xb5)](_0x1304f7=>{const _0xe8d700=_0x4ec27a;return _0x36a2b9['XQbFU'](_0x1304f7[_0xe8d700(0xbf)]['id'],_0x431c02['id'])&&_0x1304f7[_0xe8d700(0xbf)][_0xe8d700(0xce)]===0x1&&(_0x1304f7[_0xe8d700(0xbf)][_0xe8d700(0xce)]=0x0),_0x1304f7;});const _0x48f073=_0x291765[_0x4ec27a(0x95)](_0x224647=>_0x224647[_0x4ec27a(0xbf)]['id']===_0x431c02['id']);if(_0x48f073>-0x1){const [_0x84a4e0]=_0x291765[_0x4ec27a(0xae)](_0x48f073,0x1);_0x84a4e0[_0x4ec27a(0xbf)][_0x4ec27a(0xce)]=0x1,_0x291765['unshift'](_0x84a4e0);}_0x2de6ee[_0x4ec27a(0xec)]({'posts':_0x291765}),wx['pageScrollTo']({'scrollTop':0x0,'duration':0x12c});}else{if(_0x291765&&typeof _0x291765===_0x2e2581['TpCCu']){const _0x20f9d3={};Object['keys'](_0x291765)[_0x4ec27a(0xcb)](_0x410d48=>{const _0x9e3350=_0x4ec27a,_0x24bb09={'SVVvK':function(_0x3ddf08,_0x1df904){const _0x13526a=_0x178a;return _0x36a2b9[_0x13526a(0xa2)](_0x3ddf08,_0x1df904);},'FcBBF':function(_0x37db76,_0x277487){const _0x40ff35=_0x178a;return _0x36a2b9[_0x40ff35(0xab)](_0x37db76,_0x277487);}};if(Array[_0x9e3350(0x73)](_0x291765[_0x410d48])){let _0x1a09c2=_0x291765[_0x410d48]['map'](_0xdd3eed=>{const _0x318963=_0x9e3350;return _0x24bb09[_0x318963(0x9e)](_0xdd3eed[_0x318963(0xbf)]['id'],_0x431c02['id'])&&_0x24bb09[_0x318963(0x108)](_0xdd3eed[_0x318963(0xbf)][_0x318963(0xce)],0x1)&&(_0xdd3eed['post'][_0x318963(0xce)]=0x0),_0xdd3eed;});const _0x431084=_0x1a09c2['findIndex'](_0x32c87f=>_0x32c87f[_0x9e3350(0xbf)]['id']===_0x431c02['id']);if(_0x431084>-0x1){const [_0x16b620]=_0x1a09c2[_0x9e3350(0xae)](_0x431084,0x1);_0x16b620[_0x9e3350(0xbf)][_0x9e3350(0xce)]=0x1,_0x1a09c2[_0x9e3350(0xe1)](_0x16b620);}_0x20f9d3[_0x410d48]=_0x1a09c2;}else _0x20f9d3[_0x410d48]=_0x291765[_0x410d48];}),_0x2de6ee[_0x4ec27a(0xec)]({'posts':_0x20f9d3}),wx[_0x4ec27a(0x7c)]({'scrollTop':0x0,'duration':0x12c});}}}}}else wx[_0x4ec27a(0x83)]({'title':_0x1d0cb9['msg']||'操作失败','icon':_0x2e2581[_0x4ec27a(0x104)]});});},'onCloseMoreSheet'(){this['setData']({'moreSheetVisible':![]});},'onDelete'(){const _0x537304=_0x30bc7c,_0x26ad8e={'nupvb':function(_0x6b0e16,_0xcc00a8){return _0x6b0e16===_0xcc00a8;},'JFMEC':_0x537304(0xa4),'gbmYx':function(_0x3767ed,_0x4c7794){return _0x3767ed-_0x4c7794;},'RZAKD':_0x537304(0xb8),'oJVPF':_0x537304(0x103),'KfWCb':_0x537304(0xa6),'tPJQi':'error','DXaPc':function(_0x20f55c,_0x5a0c7b){return _0x20f55c(_0x5a0c7b);}},_0x1f5e8d=this[_0x537304(0xbd)][_0x537304(0xbc)][_0x537304(0xbf)]['id'];_0x26ad8e[_0x537304(0x70)](deleteContent,_0x1f5e8d)[_0x537304(0x10a)](_0x43f5ba=>{const _0x1ebce3=_0x537304;if(_0x26ad8e[_0x1ebce3(0xfe)](_0x43f5ba[_0x1ebce3(0xf7)],0x0)){wx[_0x1ebce3(0x83)]({'title':_0x26ad8e[_0x1ebce3(0x74)],'icon':_0x1ebce3(0x88)});const _0x5db9f6=getCurrentPages(),_0x594870=_0x5db9f6[_0x26ad8e[_0x1ebce3(0x102)](_0x5db9f6['length'],0x1)],_0x192ab2=_0x594870['data'][_0x1ebce3(0xfa)];if(Array[_0x1ebce3(0x73)](_0x192ab2))_0x594870[_0x1ebce3(0xec)]({'posts':_0x192ab2[_0x1ebce3(0x6c)](_0xdd3b57=>_0xdd3b57['post']['id']!==_0x1f5e8d)});else{if(_0x192ab2&&_0x26ad8e['nupvb'](typeof _0x192ab2,_0x26ad8e[_0x1ebce3(0xe5)])){const _0x370016={};Object[_0x1ebce3(0x100)](_0x192ab2)['forEach'](_0xbedf32=>{const _0x292c40=_0x1ebce3;Array[_0x292c40(0x73)](_0x192ab2[_0xbedf32])?_0x370016[_0xbedf32]=_0x192ab2[_0xbedf32][_0x292c40(0x6c)](_0x3301dd=>_0x3301dd[_0x292c40(0xbf)]['id']!==_0x1f5e8d):_0x370016[_0xbedf32]=_0x192ab2[_0xbedf32];}),_0x594870[_0x1ebce3(0xec)]({'posts':_0x370016});}}this[_0x1ebce3(0xaa)](_0x26ad8e['oJVPF'],{'post':this[_0x1ebce3(0xbd)][_0x1ebce3(0xbc)][_0x1ebce3(0xbf)]}),this[_0x1ebce3(0x89)]();}else wx['showToast']({'title':_0x43f5ba[_0x1ebce3(0xf4)]||_0x26ad8e[_0x1ebce3(0x8c)],'icon':_0x26ad8e['tPJQi']});});},'onReport'(){const _0x19ba19=_0x30bc7c;this[_0x19ba19(0xe2)](),wx[_0x19ba19(0x8f)]({'url':'/pages/report-category/report-category?postId='+this[_0x19ba19(0xbd)][_0x19ba19(0xbc)][_0x19ba19(0xbf)]['id']}),this['triggerEvent'](_0x19ba19(0x7f),{'post':this['data'][_0x19ba19(0xbc)]['post']}),this[_0x19ba19(0x89)]();},'onFavorite'(){const _0x119722=_0x30bc7c,_0x305137={'elgGj':function(_0x43c4eb,_0x3e89ba){return _0x43c4eb===_0x3e89ba;},'ofeth':_0x119722(0x8e),'OhDal':_0x119722(0xaf),'zllsW':_0x119722(0x88),'ICbqI':_0x119722(0x9b),'uYDiH':'error','wRgtT':function(_0x301783,_0x36094d){return _0x301783===_0x36094d;},'voXMj':function(_0xeb2322,_0x2bfdd0,_0x1e57ab){return _0xeb2322(_0x2bfdd0,_0x1e57ab);}},_0x483aac=this['data']['currentPostIndex'],_0x1b9dd4=this['data'][_0x119722(0xfa)][_0x483aac][_0x119722(0xbf)],_0x4609a3=_0x305137[_0x119722(0xe6)](_0x1b9dd4[_0x119722(0x7a)],0x1)?0x2:0x1;_0x305137['voXMj'](collectPost,_0x1b9dd4['id'],_0x4609a3)[_0x119722(0x10a)](_0x194975=>{const _0x5690e3=_0x119722;if(_0x305137[_0x5690e3(0x8d)](_0x194975[_0x5690e3(0xf7)],0x0)){wx[_0x5690e3(0x83)]({'title':_0x4609a3===0x1?_0x305137[_0x5690e3(0x79)]:_0x305137[_0x5690e3(0xe9)],'icon':_0x305137[_0x5690e3(0x6e)]});const _0x3a1242=_0x5690e3(0xc0)+_0x483aac+_0x5690e3(0xde);this[_0x5690e3(0xec)]({[_0x3a1242]:_0x4609a3===0x1?0x1:0x0}),this[_0x5690e3(0x89)]();}else wx[_0x5690e3(0x83)]({'title':_0x194975[_0x5690e3(0xf4)]||(_0x305137[_0x5690e3(0x8d)](_0x4609a3,0x1)?_0x305137[_0x5690e3(0xb3)]:_0x5690e3(0x6a)),'icon':_0x305137[_0x5690e3(0xad)]});});},'onVideoPlay'(_0x42d28f){const _0x2bf67c=_0x30bc7c,_0x421eda=_0x42d28f['detail']['id'],_0x3a1675=this[_0x2bf67c(0xbd)]['currentPlayingVideoId'];if(_0x3a1675&&_0x3a1675!==_0x421eda){const _0x434b43=this[_0x2bf67c(0xbd)][_0x2bf67c(0xfa)][_0x2bf67c(0x95)](_0x200a40=>_0x200a40[_0x2bf67c(0xbf)]['id']===_0x3a1675),_0x1f87a9=this['selectComponent']('#postItem-'+_0x434b43);_0x1f87a9&&_0x1f87a9[_0x2bf67c(0xc7)]();}this[_0x2bf67c(0xec)]({'currentPlayingVideoId':_0x421eda});},'onPauseAllVideo'(){const _0x4c271a=_0x30bc7c;this[_0x4c271a(0xe2)]();},'pauseCurrentPlayingVideo'(){const _0x2f5230=_0x30bc7c,_0x38966a={'KZtAD':function(_0x28485f,_0x4e89aa){return _0x28485f===_0x4e89aa;},'DImZL':_0x2f5230(0x77)},_0x592ec0=this[_0x2f5230(0xbd)]['currentPlayingVideoId'];if(!_0x592ec0)return;const _0x744bec=this[_0x2f5230(0xbd)][_0x2f5230(0xfa)]['findIndex'](_0x2538c6=>_0x2538c6[_0x2f5230(0xbf)]['id']===_0x592ec0);if(_0x744bec===-0x1)return;const _0xa096f9=this[_0x2f5230(0xd7)](_0x2f5230(0x7d)+_0x744bec);_0xa096f9&&_0x38966a['KZtAD'](typeof _0xa096f9[_0x2f5230(0xc7)],_0x38966a[_0x2f5230(0xc4)])&&_0xa096f9[_0x2f5230(0xc7)](),this[_0x2f5230(0xec)]({'currentPlayingVideoId':null});},'gotoTest'(){const _0xbcf4e9=_0x30bc7c,_0x3a41e9={'PvROr':function(_0xcd812e,_0x47b1e1){return _0xcd812e(_0x47b1e1);},'JgLOc':_0xbcf4e9(0x85)};wx['navigateTo']({'url':_0xbcf4e9(0xfb)+_0x3a41e9[_0xbcf4e9(0xe7)](encodeURIComponent,_0x3a41e9[_0xbcf4e9(0xb2)])});}});
|