接口对接
This commit is contained in:
@@ -19,7 +19,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="topic">
|
<div class="topic">
|
||||||
<h3 v-if="!form.themeId" @click="isShow = true">#绑定话题</h3>
|
<h3 v-if="!form.themeId" @click="isShow = true">#绑定话题</h3>
|
||||||
<div class="choosed" v-else>
|
<div class="choosed" v-else @click="isShow = true">
|
||||||
<span>#{{ form.themeTitle }}</span>
|
<span>#{{ form.themeTitle }}</span>
|
||||||
</div>
|
</div>
|
||||||
<p>绑定一个与您发布内容相关很高的话题,会被更多人看到哦。</p>
|
<p>绑定一个与您发布内容相关很高的话题,会被更多人看到哦。</p>
|
||||||
@@ -62,7 +62,7 @@
|
|||||||
themeTitle: '',
|
themeTitle: '',
|
||||||
source: 0,
|
source: 0,
|
||||||
content: '',
|
content: '',
|
||||||
visibleRange: 0
|
visibleRange: 1
|
||||||
},
|
},
|
||||||
topicList: [],
|
topicList: [],
|
||||||
isShow: false
|
isShow: false
|
||||||
@@ -79,6 +79,7 @@
|
|||||||
return this.$toast(`内容不能为空`)
|
return this.$toast(`内容不能为空`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.$loading()
|
||||||
this.$instance.post(`/app/appneighborhoodassistance/addOrUpdate`, {
|
this.$instance.post(`/app/appneighborhoodassistance/addOrUpdate`, {
|
||||||
...this.form
|
...this.form
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
@@ -96,7 +97,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
onSwitchChange (e) {
|
onSwitchChange (e) {
|
||||||
this.form.visibleRange = e.detail.value ? 1 : 0
|
this.form.visibleRange = e.detail.value ? 0 : 1
|
||||||
},
|
},
|
||||||
|
|
||||||
getTopicList () {
|
getTopicList () {
|
||||||
|
|||||||
@@ -90,6 +90,10 @@
|
|||||||
|
|
||||||
onLoad() {
|
onLoad() {
|
||||||
this.getTopicList()
|
this.getTopicList()
|
||||||
|
|
||||||
|
uni.$on('updateList', () => {
|
||||||
|
this.changeTab(this.currIndex)
|
||||||
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
@@ -124,6 +128,7 @@
|
|||||||
this.$loading()
|
this.$loading()
|
||||||
this.$instance.post(`/app/appneighborhoodassistance/list`, null, {
|
this.$instance.post(`/app/appneighborhoodassistance/list`, null, {
|
||||||
params: {
|
params: {
|
||||||
|
withoutToken: this.token ? false : true,
|
||||||
current: this.current,
|
current: this.current,
|
||||||
size: 10,
|
size: 10,
|
||||||
visibleRange: this.currIndex === 0 ? 1 : 0
|
visibleRange: this.currIndex === 0 ? 1 : 0
|
||||||
|
|||||||
@@ -9,15 +9,15 @@
|
|||||||
<div class="add-btn" hover-class="text-hover" @click="$linkTo('./Add')">发贴</div>
|
<div class="add-btn" hover-class="text-hover" @click="$linkTo('./Add')">发贴</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="bottom">
|
<div class="bottom">
|
||||||
<div class="bottom-item" @click="currIndex = 0" :class="[currIndex === 0 ? 'active' : '']">
|
<div class="bottom-item" @click="changeTab(0)" :class="[currIndex === 0 ? 'active' : '']">
|
||||||
<span>发贴</span>
|
<span>发贴</span>
|
||||||
<h2>23</h2>
|
<h2>23</h2>
|
||||||
</div>
|
</div>
|
||||||
<div class="bottom-item" @click="currIndex = 1" :class="[currIndex === 1 ? 'active' : '']">
|
<div class="bottom-item" @click="changeTab(1)" :class="[currIndex === 1 ? 'active' : '']">
|
||||||
<span>点赞</span>
|
<span>点赞</span>
|
||||||
<h2>23</h2>
|
<h2>23</h2>
|
||||||
</div>
|
</div>
|
||||||
<div class="bottom-item" @click="currIndex = 2" :class="[currIndex === 2 ? 'active' : '']">
|
<div class="bottom-item" @click="changeTab(2)" :class="[currIndex === 2 ? 'active' : '']">
|
||||||
<span>评论</span>
|
<span>评论</span>
|
||||||
<h2>23</h2>
|
<h2>23</h2>
|
||||||
</div>
|
</div>
|
||||||
@@ -144,7 +144,7 @@
|
|||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
getTopicList () {
|
getTopicList () {
|
||||||
this.$instance.post(`/api/appneighborhoodassistancetheme/list`, null, {
|
this.$instance.post(`/app/appneighborhoodassistancetheme/list`, null, {
|
||||||
withoutToken: true,
|
withoutToken: true,
|
||||||
params: {
|
params: {
|
||||||
current: 1,
|
current: 1,
|
||||||
@@ -152,28 +152,146 @@
|
|||||||
}
|
}
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
if (res.code === 0) {
|
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
|
if (this.isMore) return
|
||||||
|
|
||||||
this.$loading()
|
this.$loading()
|
||||||
this.$instance.post(`/api/appactivityinfo/list`, null, {
|
this.$instance.post(`/app/appneighborhoodassistance/list`, null, {
|
||||||
withoutToken: true,
|
|
||||||
params: {
|
params: {
|
||||||
|
withoutToken: this.token ? false : true,
|
||||||
current: this.current,
|
current: this.current,
|
||||||
size: 10
|
size: 10,
|
||||||
|
visibleRange: this.currIndex === 0 ? 1 : 0
|
||||||
}
|
}
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
if (res.code === 0) {
|
if (res.code === 0) {
|
||||||
this.$hideLoading()
|
this.$hideLoading()
|
||||||
if (this.current > 1) {
|
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 {
|
} 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) {
|
if (res.data.records.length < 10) {
|
||||||
@@ -193,7 +311,13 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
onReachBottom () {
|
onReachBottom () {
|
||||||
this.getList()
|
if (this.currIndex === 0) {
|
||||||
|
this.getMyPublish()
|
||||||
|
} else if (this.currIndex === 1) {
|
||||||
|
this.myPraiseList()
|
||||||
|
} else {
|
||||||
|
this.getMyCommentList()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user