index.js 1.46 KB
import actions from './actions';
import mutations from './mutations';

export default function() {
  return {
    namespaced: true,
    state: {
      fetchArticleList: false,
      articleList: [],
      articleThumbList: [],
      fetchArticleListByTopic: false,
      articleListByTopic: [],
      fetchArticleUserList: false,
      articleUserList: [],
      articleUserThumbList: [],
      fetchArticleDetail: false,
      articleDetail: {},
      articleProductList: [],
      articleLastedTimeByTopic: 0,
      articleStates: {},
      authorStates: {},
      fetchTopicInfo: false,
      topicInfo: {},
      fetchTopicArticles: false,
      articleSingleDetail: {},
      fetchArticleSingleDetail: false,
      fetchDetailRecommendArticles: false,
      articleNiceList: [],
      articleNiceThumbList: [],
      articleLastedTimeByNice: 0,
      fetchArticleNiceList: false,
      topicList: [],
      fetchTopicList: false,
      fetchTopicPage: 1,
      fetchTopicLastedTime: 0,
      comentInputVisable: false,
      fetchNoteProductList: [],

      /**
       * 话题是否上下架状态控制
       * 只有话题处于已上架状态下,才可以存在类似于立即操作这种交互式行为的Action按钮
       */
      shelfStatus: false
    },
    actions,
    mutations,
    getters: {
      getNoteProduct(state) {
        return (skn) => {
          return state.fetchNoteProductList.find(p => p.product.productSkn === (+skn));
        };
      }
    }
  };
}