|
|
@@ -23,7 +23,7 @@
|
|
|
<!--电影列表,与推荐列表-->
|
|
|
<el-row id="movie-list">
|
|
|
<!--电影列表-->
|
|
|
- <el-col :md="24">
|
|
|
+ <el-col :md="18">
|
|
|
<el-col v-for="(video, index) in videoList" :key="index" :md="6" :sm="12" :xs="12">
|
|
|
<video-card :video="video" />
|
|
|
</el-col>
|
|
|
@@ -40,17 +40,17 @@
|
|
|
hide-on-single-page
|
|
|
layout="prev, pager, next"
|
|
|
:page-size="pageSize"
|
|
|
- :current-page="$store.state.activePage"
|
|
|
- :total="$store.state.pageBean.totalCount"
|
|
|
+ :current-page="currentPage"
|
|
|
+ :total="totalPages"
|
|
|
@current-change="handleCurrentChange"
|
|
|
/>
|
|
|
</el-col>
|
|
|
</el-col>
|
|
|
|
|
|
<!--热播列表-->
|
|
|
- <!-- <el-col :md="6">
|
|
|
+ <el-col :md="6">
|
|
|
<hot-list />
|
|
|
- </el-col>-->
|
|
|
+ </el-col>
|
|
|
</el-row>
|
|
|
</div>
|
|
|
</template>
|
|
|
@@ -58,24 +58,32 @@
|
|
|
<script>
|
|
|
import VideoCard from 'components/card/VideoCard'
|
|
|
import Recommend from 'components/recommend/Recommend'
|
|
|
+import HotList from 'components/hotlist/HotList'
|
|
|
import { videoCategory, videoRecommend} from '@/api/video'
|
|
|
|
|
|
export default {
|
|
|
name: 'Video',
|
|
|
- components: { VideoCard, Recommend },
|
|
|
+ components: { VideoCard, Recommend, HotList },
|
|
|
data() {
|
|
|
return {
|
|
|
// 屏幕宽度, 为了控制分页条的大小
|
|
|
screenWidth: document.body.clientWidth,
|
|
|
currentPage: 1,
|
|
|
pageSize: 12,
|
|
|
+ totalPages: 0,
|
|
|
videoList: [],
|
|
|
currentIndex: 0,
|
|
|
videoCategory: [
|
|
|
{ cname: '全部', cid: 11010 },
|
|
|
{ cname: '电影', cid: 11011 },
|
|
|
{ cname: '音乐', cid: 11012 },
|
|
|
- { cname: '新闻', cid: 11013 }
|
|
|
+ { cname: '新闻', cid: 11013 },
|
|
|
+ { cname: '教育', cid: 11014 },
|
|
|
+ { cname: '科技', cid: 11015 },
|
|
|
+ { cname: '体育', cid: 11016 },
|
|
|
+ { cname: '军事', cid: 11017 },
|
|
|
+ { cname: '社会', cid: 11018 },
|
|
|
+ { cname: '生活', cid: 11019 }
|
|
|
]
|
|
|
}
|
|
|
},
|
|
|
@@ -84,16 +92,7 @@ export default {
|
|
|
videoCategory().then(res => {
|
|
|
console.log(res.data)
|
|
|
})
|
|
|
-
|
|
|
- videoRecommend(this.currentPage).then(res => {
|
|
|
- if (res.code === 0) {
|
|
|
- const resData = res.data
|
|
|
- this.videoList = resData.list
|
|
|
- }
|
|
|
- })
|
|
|
- // console.log(this.$store.state.videos);
|
|
|
- // 当页面挂载时,页码变为1
|
|
|
- // this.$store.commit('updatePage', 1)
|
|
|
+ this.videoRecommendWrapper(this.currentPage)
|
|
|
},
|
|
|
mounted() {
|
|
|
// 当窗口宽度改变时获取屏幕宽度
|
|
|
@@ -108,9 +107,23 @@ export default {
|
|
|
handleCurrentChange(pageNumber) {
|
|
|
this.currentPage = pageNumber
|
|
|
console.log('选择分页')
|
|
|
+
|
|
|
+ this.$router.push({
|
|
|
+ path: path
|
|
|
+ });
|
|
|
+
|
|
|
// 回到顶部
|
|
|
scrollTo(0, 0)
|
|
|
},
|
|
|
+ videoRecommendWrapper(pageNumber) {
|
|
|
+ videoRecommend(pageNumber).then(res => {
|
|
|
+ if (res.code === 0) {
|
|
|
+ const resData = res.data
|
|
|
+ this.videoList = resData.list
|
|
|
+ this.totalPages = resData.totalPages
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
btnClick(cid, index) {
|
|
|
this.currentIndex = index
|
|
|
// 页码变为1
|