diff --git a/src/project/fengdu/AppCircle/Add.vue b/src/project/fengdu/AppCircle/Add.vue index c74134d..1d44bd4 100644 --- a/src/project/fengdu/AppCircle/Add.vue +++ b/src/project/fengdu/AppCircle/Add.vue @@ -19,7 +19,7 @@

#绑定话题

-
+
#{{ form.themeTitle }}

绑定一个与您发布内容相关很高的话题,会被更多人看到哦。

@@ -62,7 +62,7 @@ themeTitle: '', source: 0, content: '', - visibleRange: 0 + visibleRange: 1 }, topicList: [], isShow: false @@ -79,6 +79,7 @@ return this.$toast(`内容不能为空`) } + this.$loading() this.$instance.post(`/app/appneighborhoodassistance/addOrUpdate`, { ...this.form }).then(res => { @@ -96,7 +97,7 @@ }, onSwitchChange (e) { - this.form.visibleRange = e.detail.value ? 1 : 0 + this.form.visibleRange = e.detail.value ? 0 : 1 }, getTopicList () { diff --git a/src/project/fengdu/AppCircle/AppCircle.vue b/src/project/fengdu/AppCircle/AppCircle.vue index b716d37..a490ea0 100644 --- a/src/project/fengdu/AppCircle/AppCircle.vue +++ b/src/project/fengdu/AppCircle/AppCircle.vue @@ -90,6 +90,10 @@ onLoad() { this.getTopicList() + + uni.$on('updateList', () => { + this.changeTab(this.currIndex) + }) }, methods: { @@ -124,6 +128,7 @@ this.$loading() this.$instance.post(`/app/appneighborhoodassistance/list`, null, { params: { + withoutToken: this.token ? false : true, current: this.current, size: 10, visibleRange: this.currIndex === 0 ? 1 : 0 diff --git a/src/project/fengdu/AppCircle/MyPostList.vue b/src/project/fengdu/AppCircle/MyPostList.vue index 526dc3b..733b9f9 100644 --- a/src/project/fengdu/AppCircle/MyPostList.vue +++ b/src/project/fengdu/AppCircle/MyPostList.vue @@ -9,15 +9,15 @@
发贴
-
+
发贴

23

-
+
点赞

23

-
+
评论

23

@@ -144,7 +144,7 @@ methods: { getTopicList () { - this.$instance.post(`/api/appneighborhoodassistancetheme/list`, null, { + this.$instance.post(`/app/appneighborhoodassistancetheme/list`, null, { withoutToken: true, params: { current: 1, @@ -152,28 +152,146 @@ } }).then(res => { if (res.code === 0) { - + this.topicList = res.data.records + this.getMyPublish() } }) }, - getList () { + changeTab (index) { + this.currIndex = index + this.isMore = false + this.current = 1 + + this.$nextTick(() => { + if (this.currIndex === 0) { + this.getMyPublish() + } else if (this.currIndex === 1) { + this.myPraiseList() + } else { + this.getMyCommentList() + } + }) + }, + + getMyPublish () { if (this.isMore) return this.$loading() - this.$instance.post(`/api/appactivityinfo/list`, null, { - withoutToken: true, + this.$instance.post(`/app/appneighborhoodassistance/list`, null, { params: { + withoutToken: this.token ? false : true, current: this.current, - size: 10 + size: 10, + visibleRange: this.currIndex === 0 ? 1 : 0 } }).then(res => { if (res.code === 0) { this.$hideLoading() if (this.current > 1) { - this.list = [...this.list, ...res.data.records] + this.list = [...this.list, ...res.data.records.map(e => { + return { + ...e, + topicName: this.topicList.filter(v => v.id === e.themeId).length ? this.topicList.filter(v => v.id === e.themeId)[0].title : '' + } + })] } else { - this.list = res.data.records + this.list = res.data.records.map(e => { + return { + ...e, + topicName: this.topicList.filter(v => v.id === e.themeId).length ? this.topicList.filter(v => v.id === e.themeId)[0].title : '' + } + }) + } + + if (res.data.records.length < 10) { + this.isMore = true + + return false + } + + this.current = this.current + 1 + } else { + this.isMore = true + } + }).catch(() => { + this.$hideLoading() + }) + }, + + getMyCommentList () { + if (this.isMore) return + + this.$loading() + this.$instance.post(`/app/appneighborhoodassistance/list`, null, { + params: { + withoutToken: this.token ? false : true, + current: this.current, + size: 10, + visibleRange: this.currIndex === 0 ? 1 : 0 + } + }).then(res => { + if (res.code === 0) { + this.$hideLoading() + if (this.current > 1) { + this.list = [...this.list, ...res.data.records.map(e => { + return { + ...e, + topicName: this.topicList.filter(v => v.id === e.themeId).length ? this.topicList.filter(v => v.id === e.themeId)[0].title : '' + } + })] + } else { + this.list = res.data.records.map(e => { + return { + ...e, + topicName: this.topicList.filter(v => v.id === e.themeId).length ? this.topicList.filter(v => v.id === e.themeId)[0].title : '' + } + }) + } + + if (res.data.records.length < 10) { + this.isMore = true + + return false + } + + this.current = this.current + 1 + } else { + this.isMore = true + } + }).catch(() => { + this.$hideLoading() + }) + }, + + myPraiseList () { + if (this.isMore) return + + this.$loading() + this.$instance.post(`/app/appneighborhoodassistance/list`, null, { + params: { + withoutToken: this.token ? false : true, + current: this.current, + size: 10, + visibleRange: this.currIndex === 0 ? 1 : 0 + } + }).then(res => { + if (res.code === 0) { + this.$hideLoading() + if (this.current > 1) { + this.list = [...this.list, ...res.data.records.map(e => { + return { + ...e, + topicName: this.topicList.filter(v => v.id === e.themeId).length ? this.topicList.filter(v => v.id === e.themeId)[0].title : '' + } + })] + } else { + this.list = res.data.records.map(e => { + return { + ...e, + topicName: this.topicList.filter(v => v.id === e.themeId).length ? this.topicList.filter(v => v.id === e.themeId)[0].title : '' + } + }) } if (res.data.records.length < 10) { @@ -193,7 +311,13 @@ }, onReachBottom () { - this.getList() + if (this.currIndex === 0) { + this.getMyPublish() + } else if (this.currIndex === 1) { + this.myPraiseList() + } else { + this.getMyCommentList() + } } }