import Vue from 'vue'
import { MessageBox, Message } from 'element-ui'
import { messageDuration } from '@/config/settings'
/* 全局Confirm */
Vue.prototype.$baseConfirm = (content, title, callback1, callback2) => {
  MessageBox.confirm(content, title || '温馨提示', {
    confirmButtonText: '确定',
    cancelButtonText: '取消',
    closeOnClickModal: false,
    type: 'warning'
  })
    .then(() => {
      if (callback1) {
        callback1()
      }
    })
    .catch(() => {
      if (callback2) {
        callback2()
      }
    })
}
/* 全局Message */
Vue.prototype.$baseMessage = (message, type) => {
  Message({
    offset: 60,
    showClose: true,
    message: message,
    type: type,
    dangerouslyUseHTMLString: true,
    duration: messageDuration
  })
}
