/*
 * @Descripttion: 当前组件信息
 * @version: 1.0.0
 * @Author: 无尘
 * @Date: 2019-10-10 14:44:45
 * @LastEditors: 无尘
 * @LastEditTime: 2020-11-27 11:38:54
 */
/* 后台返回消息提示 */
import { Message } from 'element-ui';

// 后台返回异常提示
export default {
  errorMsg: function(response) {
    let local = window.location.origin;
    /* if (local.indexOf('localhost') != -1) {
      local = 'http://www.gicdev.com';
    } */
    if (response.code != '0000') {
      if (response.code == '0003') {
        window.location.href = local + '/haoban-4/login';
        return false;
      }
      Message.error({
        duration: 1000,
        message: response.code == '0002' ? '数据加载失败' : response.message || '接口异常'
      });
    }
  }
};
