|
|
@@ -65,35 +65,23 @@
|
|
|
</v-slide-group>
|
|
|
</v-sheet>
|
|
|
</v-col>
|
|
|
- <v-col cols="12">
|
|
|
- <!--<v-card
|
|
|
- color="#385F73"
|
|
|
- dark
|
|
|
- >
|
|
|
- <v-card-actions>
|
|
|
- <v-btn text @click="selectFollowingStatus">
|
|
|
- 状态
|
|
|
- </v-btn>
|
|
|
- <v-btn text @click="selectFollowingVideos">
|
|
|
- 视频
|
|
|
- </v-btn>
|
|
|
- <v-btn text @click="selectFollowingAnswers">
|
|
|
- 回答
|
|
|
- </v-btn>
|
|
|
- </v-card-actions>
|
|
|
- </v-card>-->
|
|
|
- <v-tabs>
|
|
|
- <v-tab @click="setType(0)">状态</v-tab>
|
|
|
- <v-tab @click="setType(1)">视频</v-tab>
|
|
|
- <v-tab @click="setType(2)">回答</v-tab>
|
|
|
- </v-tabs>
|
|
|
- </v-col>
|
|
|
- <v-col
|
|
|
- v-for="item in list"
|
|
|
- :key="item.statusId"
|
|
|
- >
|
|
|
- <status-card :item="item" />
|
|
|
- </v-col>
|
|
|
+ <div v-infinite-scroll="loadMore" infinite-scroll-disabled="true" infinite-scroll-distance="10">
|
|
|
+ <v-col cols="12">
|
|
|
+ <v-tabs>
|
|
|
+ <v-tab @click="setType(0)">状态</v-tab>
|
|
|
+ <v-tab @click="setType(1)">视频</v-tab>
|
|
|
+ <v-tab @click="setType(2)">回答</v-tab>
|
|
|
+ </v-tabs>
|
|
|
+
|
|
|
+ <v-row
|
|
|
+ v-for="item in cardList"
|
|
|
+ :key="item.statusId"
|
|
|
+ >
|
|
|
+ <status-card v-if="cardType === 'status'" :item="item" />
|
|
|
+ <item-card v-if="cardType === 'video'" :video="item" />
|
|
|
+ </v-row>
|
|
|
+ </v-col>
|
|
|
+ </div>
|
|
|
</v-row>
|
|
|
</v-col>
|
|
|
<v-col md="4">
|
|
|
@@ -187,12 +175,14 @@ import { mapActions, mapGetters } from 'vuex'
|
|
|
import { pubStatus, statusRecommend } from '@/api/mblog/status'
|
|
|
import { videoTimeline } from '@/api/media/video'
|
|
|
import StatusCard from '@/components/card/status-card'
|
|
|
+import ItemCard from '@/components/card/item-card'
|
|
|
import FilePondUploadImage from '@/components/upload/filepond-image.vue'
|
|
|
|
|
|
export default {
|
|
|
name: 'Home',
|
|
|
components: {
|
|
|
StatusCard,
|
|
|
+ ItemCard,
|
|
|
FilePondUploadImage
|
|
|
},
|
|
|
data() {
|
|
|
@@ -201,16 +191,14 @@ export default {
|
|
|
uploadIds: [],
|
|
|
content: ''
|
|
|
},
|
|
|
- list: [],
|
|
|
+ cardType: null,
|
|
|
+ cardList: [],
|
|
|
busy: false,
|
|
|
page: 1,
|
|
|
- model: null,
|
|
|
followingUser: [
|
|
|
{ username: 'haha', avatar: '', userId: 10000 },
|
|
|
{ username: 'haha', avatar: '', userId: 10001 },
|
|
|
- { username: 'haha', avatar: '', userId: 10002 },
|
|
|
- { username: 'haha', avatar: '', userId: 10003 },
|
|
|
- { username: 'haha', avatar: '', userId: 10004 }
|
|
|
+ { username: 'haha', avatar: '', userId: 10002 }
|
|
|
],
|
|
|
showMessage: false,
|
|
|
message: ''
|
|
|
@@ -227,7 +215,7 @@ export default {
|
|
|
option: {
|
|
|
handler: function(val, oldVal) {
|
|
|
if (val && val.page === 1) {
|
|
|
- this.list = []
|
|
|
+ this.cardList = []
|
|
|
}
|
|
|
},
|
|
|
deep: true
|
|
|
@@ -235,9 +223,9 @@ export default {
|
|
|
statuses: function(val, oldVal) {
|
|
|
if (val) {
|
|
|
if (this.option.page === 1) {
|
|
|
- this.list = val
|
|
|
+ this.cardList = val
|
|
|
} else {
|
|
|
- this.list = [...this.list, ...val]
|
|
|
+ this.cardList = [...this.cardList, ...val]
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -251,18 +239,48 @@ export default {
|
|
|
...mapActions([
|
|
|
'getMyContent'
|
|
|
]),
|
|
|
+ setType(type) {
|
|
|
+ if (type === this.type) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ this.type = type
|
|
|
+ this.page = 1
|
|
|
+ if (type === 0) {
|
|
|
+ this.getFollowingStatus(this.page)
|
|
|
+ this.$vuetify.goTo(type)
|
|
|
+ } else if (type === 1) {
|
|
|
+ this.getFollowingVideos(this.page)
|
|
|
+ this.$vuetify.goTo(type)
|
|
|
+ } else if (type === 2) {
|
|
|
+ this.getFollowingAnswers(this.page)
|
|
|
+ this.$vuetify.goTo(type)
|
|
|
+ }
|
|
|
+ },
|
|
|
loadMore: function() {
|
|
|
this.busy = true
|
|
|
setTimeout(() => {
|
|
|
- this.getFollowingStatus(this.page)
|
|
|
+ if (this.cardType === 'status') {
|
|
|
+ this.getFollowingStatus(this.page)
|
|
|
+ } else if (this.cardType === 'video') {
|
|
|
+ this.getFollowingVideos(this.page)
|
|
|
+ } else if (this.cardType === 'answer') {
|
|
|
+ this.getFollowingAnswers(this.page)
|
|
|
+ }
|
|
|
}, 1000)
|
|
|
},
|
|
|
- getFollowingVideos(page) {
|
|
|
- videoTimeline(page)
|
|
|
+ getFollowingStatus(page) {
|
|
|
+ statusRecommend(page)
|
|
|
.then(res => {
|
|
|
if (res.code === 0) {
|
|
|
+ this.cardType = 'status'
|
|
|
+
|
|
|
+ if (page === 1) {
|
|
|
+ this.cardList = []
|
|
|
+ }
|
|
|
+
|
|
|
for (const item of res.data.list) {
|
|
|
- console.log(item)
|
|
|
+ this.cardList.push(item)
|
|
|
}
|
|
|
this.page += 1
|
|
|
this.busy = false
|
|
|
@@ -276,12 +294,18 @@ export default {
|
|
|
this.showMessage = true
|
|
|
})
|
|
|
},
|
|
|
- getFollowingStatus(page) {
|
|
|
- statusRecommend(page)
|
|
|
+ getFollowingVideos(page) {
|
|
|
+ videoTimeline(page)
|
|
|
.then(res => {
|
|
|
if (res.code === 0) {
|
|
|
+ this.cardType = 'video'
|
|
|
+
|
|
|
+ if (page === 1) {
|
|
|
+ this.cardList = []
|
|
|
+ }
|
|
|
+
|
|
|
for (const item of res.data.list) {
|
|
|
- this.list.push(item)
|
|
|
+ this.cardList.push(item)
|
|
|
}
|
|
|
this.page += 1
|
|
|
this.busy = false
|
|
|
@@ -295,18 +319,13 @@ export default {
|
|
|
this.showMessage = true
|
|
|
})
|
|
|
},
|
|
|
+ getFollowingAnswers(page) {
|
|
|
+ this.cardType = 'answer'
|
|
|
+ console.log('获取关注的用户回答')
|
|
|
+ },
|
|
|
selectFollowingUser() {
|
|
|
console.log('加载选中用户的状态...')
|
|
|
},
|
|
|
- selectFollowingStatus() {
|
|
|
- this.getFollowingStatus(1)
|
|
|
- },
|
|
|
- selectFollowingVideos() {
|
|
|
- this.getFollowingVideos(1)
|
|
|
- },
|
|
|
- selectFollowingAnswers() {
|
|
|
- console.log('获取用户回答')
|
|
|
- },
|
|
|
uploadCallback(resp) {
|
|
|
if (resp.code === 0) {
|
|
|
this.statusPost.uploadIds.push(resp.data.uploadId)
|