const mutations = {
  set_nowDate(state) {
    state.nowDate = Date.now();
  },
  set_status(state, status) {
    state.status = status;
  },
  set_drainage(state, info) {
    state.drainage = info;
  },
  set_uuid(state, info) {
    state.uuid = info;
  },
  set_caseInfo(state, info) {
    state.caseInfo = info;
  },
  set_giftAni(state) {
    state.giftAni = !state.giftAni;
  },
  set_drainage_state(state, info) {
    state.drainage['drainage_status'] = info;
  },
  set_welcomeInfo(state, info) {
    state.welcomeInfo = info;
  },
  set_channelInfo(state, info) {
    state.channelInfo = info;
    if (state.encrypt === null) {
      state.encrypt = info.needPassword === 1;
    }
  },
  set_channelConfig(state, info) {
    const oldInfo = JSON.parse(JSON.stringify(state.channelConfig));
    for (const key in info) {
      if (info.hasOwnProperty(key)) {
        oldInfo[key] = info[key];
        if (key === 'watchWhiteList' && state.white === null) {
          state.white = info[key].isEnable === 1;
        }
      }
    }
    state.channelConfig = oldInfo;
  },
  set_encrypt(state, boll) {
    state.encrypt = boll;
  },
  set_white(state, boll) {
    state.white = boll;
  },
  set_menuList(state, list) {
    state.menuList = list;
  },
  set_advertTop(state, info) {
    state.advertTop = info;
  },
  set_advertMiddle(state, info) {
    state.advertMiddle = info;
  },
  set_advertText(state, info) {
    state.advertText = info;
  },
  set_playerInfo(state, info) {
    state.playerInfo = info;
  },
  set_userInfo(state, info) {
    if (info.status === 2) {
      state.status = 401;
    }
    state.userInfo = info;
  },
  set_showRed(state, boll) {
    state.showRed = boll;
  },
  set_showRedInfo(state, obj) {
    const info = {
      type: obj.type ? obj.type : '',
      id: obj.id ? obj.id : ''
    };
    state.showRedInfo = info;
    state.showRed = true;
  },
  set_onlySeeRed(state, boll) {
    state.onlySeeRed = boll;
  }
};
export default mutations;
