diff --git a/src/views/home/logDialog.vue b/src/views/home/logDialog.vue index 8a85272..97c61fa 100644 --- a/src/views/home/logDialog.vue +++ b/src/views/home/logDialog.vue @@ -75,29 +75,34 @@ export default { // } // ], invitationList: [], + token: '' }; }, computed: { // 计算我的助力分页 logCurrentPageItems() { - if(this.invitationList.length == 0){ + if(this.invitationList !== undefined && this.invitationList.length > 0){ + let start = (this.logCurrentPage - 1) * this.logPageSize; + let end = start + this.logPageSize; + return this.invitationList.slice(start, end) + } else { return this.invitationList } - let start = (this.logCurrentPage - 1) * this.logPageSize; - let end = start + this.logPageSize; - return this.invitationList.slice(start, end) + }, }, mounted() { - this.getMyInvitationData(); + this.token = getToken(); + if(this.token) { + this.getMyInvitationData(); + } }, methods: { // 我的邀请列表 async getMyInvitationData() { - let token = getToken(); let res = await this.$axios.get(process.env.VUE_APP_API_URL+"/api/activity/invite_list", { params: "", - headers: { Authorization: `Bearer ${token}` } + headers: { Authorization: `Bearer ${this.token}` } }); // ToDo this.invitationList = res.data.data