分页加改标题
This commit is contained in:
@@ -28,37 +28,44 @@ import WeixinLogin from "./component/weixinLogin";
|
|||||||
export default {
|
export default {
|
||||||
name: "AppVote",
|
name: "AppVote",
|
||||||
components: {WeixinLogin},
|
components: {WeixinLogin},
|
||||||
appName: "公众投票",
|
appName: "微视频",
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
detail: {},
|
detail: {},
|
||||||
list: [],
|
list: [],
|
||||||
wxLogin: 0
|
wxLogin: 0,
|
||||||
|
current: 1,
|
||||||
|
total: 0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(['user']),
|
...mapState(['user']),
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getDetail() {
|
getDetail(retry = false) {
|
||||||
this.$http.post("/app/appvideovoteconfig/queryDetailByCorpId", null, {
|
this.$http.post("/app/appvideovoteconfig/queryDetailByCorpId", null, {
|
||||||
withoutToken: true
|
withoutToken: !this.user.token || retry
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
if (res?.data) {
|
if (res?.data) {
|
||||||
this.detail = 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))
|
}).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) {
|
handleDetail(id) {
|
||||||
if (!this.user.token) this.wxLogin++
|
if (!this.user.token) this.wxLogin++
|
||||||
else uni.navigateTo({url: './voteDetail?id=' + id})
|
else uni.navigateTo({url: './voteDetail?id=' + id})
|
||||||
@@ -68,6 +75,10 @@ export default {
|
|||||||
this.getDetail()
|
this.getDetail()
|
||||||
this.getList()
|
this.getList()
|
||||||
},
|
},
|
||||||
|
onReachBottom() {
|
||||||
|
this.current++
|
||||||
|
this.getList()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user