分页加改标题
This commit is contained in:
@@ -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()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user