mutations.js 789 Bytes
import * as Types from './types';

export default {
[Types.FETCH_NOTICE_LIST_REQUEST](state, { page }) {

    state.fetchNoticeList = false;
    if (page === 1) {
      state.fetchNoticeLastedTime = 0;
      state.fetchNoticePage = 1;
    }
  },
  [Types.FETCH_NOTICE_LIST_SUCCESS](state, { data }) {
    state.fetchNoticeList = false;
    state.fetchNoticePage = data.page +1;
    state.fetchNoticeLastedTime = data.lastedTime;

    if(data.page < data.totalPage){
      state.isMore = true;
    }else {
      state.isMore = false;
    }

    const noticeList = data.list || [];
    
    if (noticeList.length) {
      noticeList.forEach(val => {
        state.noticeList.push(val);
      });
    }
  },
  [Types.FETCH_NOTICE_LIST_FAILD](state) {
    state.fetchNoticeList = false;
  },
}