myupdate
This commit is contained in:
parent
ab33328874
commit
7d563ef954
@ -1,78 +1,78 @@
|
|||||||
<template>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
<post-list :list="postList" :loadStatus="loadStatus"></post-list>
|
<post-list :list="postList" :loadStatus="loadStatus"></post-list>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import postList from '../../components/post-list/post-list.vue';
|
import postList from '../../components/post-list/post-list.vue';
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
postList
|
postList
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
postList: [],
|
postList: [],
|
||||||
loadStatus: "loading",
|
loadStatus: "loading",
|
||||||
page: 1,
|
page: 1,
|
||||||
type: 1, //1 点赞帖子 2 我的帖子
|
type: 1, //1 点赞帖子 2 我的帖子
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
this.type = options.type
|
this.type = options.type
|
||||||
if (options.type == 1) {
|
if (options.type == 1) {
|
||||||
this.getCollectPostList();
|
this.getCollectPostList();
|
||||||
} else if (options.type == 2) {
|
} else if (options.type == 2) {
|
||||||
this.getMyPostList();
|
this.getMyPostList();
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
onReachBottom() {
|
onReachBottom() {
|
||||||
if (this.type == 1) {
|
if (this.type == 1) {
|
||||||
this.page++;
|
this.page++;
|
||||||
this.getCollectPostList();
|
this.getCollectPostList();
|
||||||
} else if (this.type == 2) {
|
} else if (this.type == 2) {
|
||||||
this.page++;
|
this.page++;
|
||||||
this.getMyPostList();
|
this.getMyPostList();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getCollectPostList() {
|
getCollectPostList() {
|
||||||
this.loadStatus = "loading";
|
this.loadStatus = "loading";
|
||||||
this.$H.get('post/myCollectPost', {
|
this.$H.get('post/myCollectPost', {
|
||||||
page: this.page
|
page: this.page
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
if (res.result.data) {
|
if (res.result.data) {
|
||||||
this.postList = this.postList.concat(res.result.data);
|
this.postList = this.postList.concat(res.result.data);
|
||||||
if (res.result.current_page >= res.result.total || res.result.last_page === 0) {
|
if (res.result.current_page >= res.result.total || res.result.last_page === 0) {
|
||||||
this.loadStatus = "nomore";
|
this.loadStatus = "nomore";
|
||||||
} else {
|
} else {
|
||||||
this.loadStatus = "loadmore"
|
this.loadStatus = "loadmore"
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.loadStatus = "nomore";
|
this.loadStatus = "nomore";
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getMyPostList() {
|
getMyPostList() {
|
||||||
this.loadStatus = "loading";
|
this.loadStatus = "loading";
|
||||||
this.$H.get('post/myPost', {
|
this.$H.get('post/myPost', {
|
||||||
page: this.page
|
page: this.page
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
this.postList = this.postList.concat(res.result.data);
|
this.postList = this.postList.concat(res.result.data);
|
||||||
if (res.result.current_page >= res.result.total || res.result.last_page === 0) {
|
if (res.result.current_page >= res.result.total || res.result.last_page === 0) {
|
||||||
this.loadStatus = "nomore";
|
this.loadStatus = "nomore";
|
||||||
} else {
|
} else {
|
||||||
this.loadStatus = "loadmore"
|
this.loadStatus = "loadmore"
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
page {
|
page {
|
||||||
background-color: #f5f5f5;
|
background-color: #f5f5f5;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
Loading…
Reference in New Issue
Block a user