Authored by Tao

modify news pages

@@ -53,7 +53,12 @@ export default { @@ -53,7 +53,12 @@ export default {
53 methods: { 53 methods: {
54 ...mapActions(['fetchNewsList', 'fetchNewsTabList']), 54 ...mapActions(['fetchNewsList', 'fetchNewsTabList']),
55 async onPullingUp() { 55 async onPullingUp() {
56 - await this.fetchNewsList(); 56 + if (!this.newsList.isMoreData ) return false;
  57 + let params = {
  58 + type: '',
  59 + isPage: false
  60 + };
  61 + await this.fetchNewsList(params);
57 this.$refs.scroll.forceUpdate(); 62 this.$refs.scroll.forceUpdate();
58 } 63 }
59 }, 64 },
@@ -55,6 +55,7 @@ export default { @@ -55,6 +55,7 @@ export default {
55 methods: { 55 methods: {
56 ...mapActions(['fetchNewsList']), 56 ...mapActions(['fetchNewsList']),
57 async onPullingUp() { 57 async onPullingUp() {
  58 + if (!this.newsDeatilList.isMoreData ) return false;
58 let params = { 59 let params = {
59 type: this.type, 60 type: this.type,
60 isPage: false 61 isPage: false
@@ -11,6 +11,7 @@ export default function() { @@ -11,6 +11,7 @@ export default function() {
11 page: 0, 11 page: 0,
12 limit: 10, 12 limit: 10,
13 totalPage: 0, 13 totalPage: 0,
  14 + isMoreData: true,
14 }, 15 },
15 newsDeatilList: { 16 newsDeatilList: {
16 list: [], 17 list: [],
@@ -18,6 +19,7 @@ export default function() { @@ -18,6 +19,7 @@ export default function() {
18 page: 0, 19 page: 0,
19 limit: 10, 20 limit: 10,
20 totalPage: 0, 21 totalPage: 0,
  22 + isMoreData: true,
21 } 23 }
22 }, 24 },
23 mutations: { 25 mutations: {
@@ -25,12 +27,14 @@ export default function() { @@ -25,12 +27,14 @@ export default function() {
25 state.newsList.list = state.newsList.list.concat(list.list); 27 state.newsList.list = state.newsList.list.concat(list.list);
26 state.newsList.page = list.page; 28 state.newsList.page = list.page;
27 state.newsList.totalPage = list.totalPage; 29 state.newsList.totalPage = list.totalPage;
  30 + list.page < list.totalPage ? state.newsList.isMoreData = true : state.newsList.isMoreData = false;
28 }, 31 },
29 32
30 [Types.FETCH_NEWSDETAIL_LIST](state, { list }) { 33 [Types.FETCH_NEWSDETAIL_LIST](state, { list }) {
31 state.newsDeatilList.list = list.page > 1 ? state.newsDeatilList.list.concat(list.list) : list.list; 34 state.newsDeatilList.list = list.page > 1 ? state.newsDeatilList.list.concat(list.list) : list.list;
32 state.newsDeatilList.page = list.page; 35 state.newsDeatilList.page = list.page;
33 state.newsDeatilList.totalPage = list.totalPage; 36 state.newsDeatilList.totalPage = list.totalPage;
  37 + list.page < list.totalPage ? state.newsDeatilList.isMoreData = true : state.newsDeatilList.isMoreData = false;
34 }, 38 },
35 39
36 [Types.FETCH_NEWS_TAB_LIST](state, { list }) { 40 [Types.FETCH_NEWS_TAB_LIST](state, { list }) {
@@ -39,7 +43,6 @@ export default function() { @@ -39,7 +43,6 @@ export default function() {
39 }, 43 },
40 actions: { 44 actions: {
41 async fetchNewsList({ commit, state }, obj) { 45 async fetchNewsList({ commit, state }, obj) {
42 - console.log(obj);  
43 let page = state.newsList.page + 1; 46 let page = state.newsList.page + 1;
44 let limit = state.newsList.limit; 47 let limit = state.newsList.limit;
45 let totalPage = state.newsList.totalPage; 48 let totalPage = state.newsList.totalPage;
@@ -49,7 +52,7 @@ export default function() { @@ -49,7 +52,7 @@ export default function() {
49 // 页面跳转重置page页码 52 // 页面跳转重置page页码
50 isPage ? page = 1 : state.newsList.page + 1; 53 isPage ? page = 1 : state.newsList.page + 1;
51 const result = await this.$api.post('/api/ufo/home/newsList', { 54 const result = await this.$api.post('/api/ufo/home/newsList', {
52 - page, type, limit, uid: 500031928 55 + page, type: type || '', limit, uid: 500031928
53 }); 56 });
54 57
55 if (result.code === 200) { 58 if (result.code === 200) {