diff --git a/src/project/fengdu/AppVote/AppVote.vue b/src/project/fengdu/AppVote/AppVote.vue index 888e6f9e..5851a30d 100644 --- a/src/project/fengdu/AppVote/AppVote.vue +++ b/src/project/fengdu/AppVote/AppVote.vue @@ -28,37 +28,44 @@ import WeixinLogin from "./component/weixinLogin"; export default { name: "AppVote", components: {WeixinLogin}, - appName: "公众投票", + appName: "微视频", data() { return { detail: {}, list: [], - wxLogin: 0 + wxLogin: 0, + current: 1, + total: 0 } }, computed: { ...mapState(['user']), }, methods: { - getDetail() { + getDetail(retry = false) { this.$http.post("/app/appvideovoteconfig/queryDetailByCorpId", null, { - withoutToken: true + withoutToken: !this.user.token || retry }).then(res => { if (res?.data) { this.detail = res.data } - }) - }, - getList(retry = false) { - this.$http.post("/app/appvideoinfo/list", null, { - withoutToken: !this.user.token || retry, - params: {size: 20} - }).then(res => { - if (res?.data) { - this.list = res.data.records - } }).catch(() => !retry && this.getList(true)) }, + getList() { + const {current, total, list} = this + if (current == 1 || list.length < total) { + current == 1 && (this.list = []) + this.$http.post("/app/appvideoinfo/list", null, { + withoutToken: true, + params: {current} + }).then(res => { + if (res?.data) { + this.list = [this.list, res.data.records].flat().filter(Boolean) + this.total = res.data.total + } + }) + } + }, handleDetail(id) { if (!this.user.token) this.wxLogin++ else uni.navigateTo({url: './voteDetail?id=' + id}) @@ -68,6 +75,10 @@ export default { this.getDetail() this.getList() }, + onReachBottom() { + this.current++ + this.getList() + } }