|
|
@@ -59,7 +59,7 @@
|
|
|
import VideoCard from 'components/card/VideoCard'
|
|
|
import Recommend from 'components/recommend/Recommend'
|
|
|
import HotList from 'components/hotlist/HotList'
|
|
|
-import { videoCategory, videoRecommend} from '@/api/video'
|
|
|
+import { videoCategory, videoPage} from '@/api/video'
|
|
|
|
|
|
export default {
|
|
|
name: 'Video',
|
|
|
@@ -72,6 +72,7 @@ export default {
|
|
|
pageSize: 12,
|
|
|
totalPages: 0,
|
|
|
videoList: [],
|
|
|
+ lastId: 0,
|
|
|
currentIndex: 0,
|
|
|
videoCategory: [
|
|
|
{ cname: '全部', cid: 11010 },
|
|
|
@@ -92,7 +93,26 @@ export default {
|
|
|
videoCategory().then(res => {
|
|
|
console.log(res.data)
|
|
|
})
|
|
|
- this.videoRecommendWrapper(this.currentPage)
|
|
|
+
|
|
|
+ const query = this.$route.query
|
|
|
+ var pageNumber = query.pageNumber
|
|
|
+ if (pageNumber !== undefined) {
|
|
|
+ this.currentPage = pageNumber
|
|
|
+ }
|
|
|
+
|
|
|
+ var lastId = query.lastId
|
|
|
+ if (lastId !== undefined) {
|
|
|
+ this.lastId = lastId
|
|
|
+ }
|
|
|
+
|
|
|
+ this.$router.push({
|
|
|
+ path: '/video',
|
|
|
+ query: {
|
|
|
+ pageNumber: this.currentPage,
|
|
|
+ lastId: this.lastId
|
|
|
+ }
|
|
|
+ });
|
|
|
+ this.videoPageWrapper(this.currentPage, this.lastId)
|
|
|
},
|
|
|
mounted() {
|
|
|
// 当窗口宽度改变时获取屏幕宽度
|
|
|
@@ -106,21 +126,25 @@ export default {
|
|
|
methods: {
|
|
|
handleCurrentChange(pageNumber) {
|
|
|
this.currentPage = pageNumber
|
|
|
- console.log('选择分页')
|
|
|
-
|
|
|
this.$router.push({
|
|
|
- path: path
|
|
|
+ path: '/video',
|
|
|
+ query: {
|
|
|
+ pageNumber: this.currentPage,
|
|
|
+ lastId: this.lastId
|
|
|
+ }
|
|
|
});
|
|
|
|
|
|
+ this.videoPageWrapper(this.currentPage, this.lastId)
|
|
|
// 回到顶部
|
|
|
scrollTo(0, 0)
|
|
|
},
|
|
|
- videoRecommendWrapper(pageNumber) {
|
|
|
- videoRecommend(pageNumber).then(res => {
|
|
|
+ videoPageWrapper(pageNumber, lastId) {
|
|
|
+ videoPage(pageNumber, lastId).then(res => {
|
|
|
if (res.code === 0) {
|
|
|
const resData = res.data
|
|
|
this.videoList = resData.list
|
|
|
this.totalPages = resData.totalPages
|
|
|
+ this.lastId = resData.lastId
|
|
|
}
|
|
|
})
|
|
|
},
|