/*
 * @Descripttion: 当前组件信息
 * @version: 1.0.0
 * @Author: 无尘
 * @Date: 2018-10-10 14:44:45
 * @LastEditors: 无尘
 * @LastEditTime: 2020-08-14 14:55:11
 */
/* 后台返回消息提示 */
import { Message } from 'element-ui';
const userInfos = JSON.parse(sessionStorage.getItem('userInfos') || '{}');
const gicHost = typeof userInfos.gicHost == 'string' ? userInfos.gicHost.replace(/\/$/, '') : '';

// 后台返回异常提示
export default {
  errorMsg: function(response) {
    if (response.errorCode != 1) {
      if (response.errorCode == 4) {
        window.location.href = gicHost + '/gic-web/#/login?ishb=1';
        return false;
      }
      if (response.errorCode == 10) {
        window.location.href = gicHost + '/haoban-3/#/index';
        return false;
      }
      Message.error({
        duration: 2000,
        message: response.message || '接口异常'
      });
    }
  }
};
