+
评论
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()
+ }
}
}