/*
 * @Descripttion: 当前组件信息
 * @version: 1.0.0
 * @Author: 无尘
 * @Date: 2019-11-12 10:18:29
 * @LastEditors  : 无尘
 * @LastEditTime : 2019-12-24 14:25:47
 */
/* 后台返回消息提示 */
import {
  Message
} from 'element-ui';

// 后台返回异常提示

export default {
  errorMsg: function (response) {
    let local = window.location.origin;
    if (local.indexOf('localhost')) {
      local = 'http://www.gicdev.com';
    }
    if (response.errorCode != 1) {
      if (response.errorCode == 4) {
        Message.error({
          duration: 2500,
          message: response.message
        });
        setTimeout(() => {
          window.location.href = local + '/gic-web/#/login';
        }, 1000);
        return false;
      }
      Message.error({
        duration: 2500,
        message: response.message
      });
    }
  }
};
