/**
 * 加载
 */
import { Notification } from 'element-ui'

function toasts(message) {
  Notification.error({
    title: '提示',
    message: message,
    duration: 5000
  })
}

const toast = {
  show: function(type, message) {
    console.log('===message==' + message)
    let finalMessage = message
    if (!finalMessage) {
      switch (type) {
        case 1000:
          finalMessage = '没有权限'
          break
        case -201:
          finalMessage = '没有用户'
          break
        case -1:
          finalMessage = '没有权限'
          break
        default:
          finalMessage = '网络错误'
          break
      }
      finalMessage += type
    }
    toasts(finalMessage)
  }
  //
  // showMessage: function(message) {
  //   toasts(message)
  // },
  //
  // showLoading: function(show) {
  //   if (show) {
  //     iView.LoadingBar.start()
  //   } else {
  //     iView.LoadingBar.finish()
  //   }
  // }
}

export default {
  toast
}
