Commit 386cdac8 by yanju

Merge branch 'yoona' into 'master'

资讯列表页对接完成

See merge request !25
parents 969158ed d49584ce
<template> <template>
<yun-div> <yun-div>
<Nav :path="path" :nav-list="navList"></Nav> <Nav :show-right="false" :path="path" :nav-list="navList"></Nav>
<project-card></project-card> <project-card v-for="(val,index) in newsList" :info="val" :key="val.contentId"></project-card>
<project-card></project-card> <scroll-loading ref="pagination" :pages="pages" v-on:changePage="changePage"></scroll-loading>
<project-card></project-card>
<project-card></project-card>
<project-card></project-card>
<project-card></project-card>
<project-card></project-card>
<project-card></project-card>
<project-card></project-card>
<project-card></project-card>
</yun-div> </yun-div>
</template> </template>
<script> <script>
import Nav from "../../components/moblie/nav"; import Nav from "../../components/moblie/nav";
import ProjectCard from "../../components/moblie/projectCard"; import ProjectCard from "../../components/moblie/projectCard";
import ScrollLoading from "../../components/moblie/scrollLoading";
import config from "../../action/config";
export default { export default {
components: {ProjectCard, Nav}, components: {ProjectCard, Nav, ScrollLoading},
data() { data() {
return { return {
path: '/news', path: '/news',
navList: [ navList: [
{ {
label: '新闻速递', label: '新闻速递',
id: 'all' id: '13'
}, },
{ {
label: '行业资讯', label: '行业资讯',
id: '10' id: '14'
}, },
{ {
label: '软件更新', label: '软件更新',
id: '11' id: '17'
} }
] ],
newsList:[],
pages:1,
} }
}, },
watch: {
$route(val){
this.restartPagination();
},
},
created() { created() {
if (this.$route.query.type) { if (this.$route.query.type) {
return return
...@@ -46,9 +48,52 @@ export default { ...@@ -46,9 +48,52 @@ export default {
this.$router.replace({ this.$router.replace({
path: '/news', path: '/news',
query: { query: {
type: 'all' type: '13'
} }
}) })
},
methods: {
restartPagination(){
if(process.browser){
this.newsList = [];
this.pages = 1 ;
this.$refs.pagination.setCurrentPage(1)
}
},
handleResponse(currentPage,response){
if(currentPage===1){
this.newsList=response.data.dataList;
this.pages = response.data.totalPage;
}else{
response.data.dataList.map((val,index)=>{
this.newsList.push(val)
});
this.pages = response.data.totalPage;
}
},
dataGetNewsList(currentPage){
let params={
page:currentPage,
size:12,
type: 1
};
if(this.$route.query.type){
let id = this.$route.query.type
this.$axios.$get(config.api.get.Content.list + `${id}/contents`, {params:params})
.then((response)=>{
console.log(response);
this.handleResponse(currentPage,response)
})
}
},
changePage(currentPage){
//返回页数 请求新的数据
this.dataGetNewsList(currentPage)
},
} }
} }
</script> </script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment