import { createStore } from "vuex";

const store = createStore({
  state:{
    playcount:99999,  //当前播放index
    isplaying:false,  //播放状态
    audiolist:[],   //播放文件
    isshowplay:false,  //是否显示全局底部导航
  },
  mutations:{
    setplaycount(state,i){  //设置当前播放的index
      state.playcount=i;
    },
    setplaystate(state,s){  //设置播放状态
      state.isplaying=s;
    },
    setaudiolist(state,audioarr){  //存储播放队列
      if( audioarr ){
        state.audiolist=audioarr;
      }else{
        state.audiolist=[];
      }
    },
    setshowplay(state,s){  //设置播放弹窗的显示隐藏
      state.isshowplay=s;
    },
  },
  actions: {
    // 统计音频pv
    audioPv({commit},id) {
      getPV({
        ReportId:id
      }).then(res => {
      })
    }
  }
});

export default store;
