派生自 wuyushui/SewerAndRainNetwork

陈泽平
2021-05-30 e3608132cc667c16ea10f450807e0feddaf55d1f
src/utils/tools.js
@@ -1,9 +1,9 @@
import * as $CONST from './constant'
import { Message } from 'element-ui'
// import { notify } from '@nutui/nutui'
export const _ = require('lodash')
const notify = window.vm.$notify
/**
 * 集合转换为JSON
 * @param obj collection数据
@@ -25,7 +25,16 @@
  })
  return arr
}
/**
 * 根据不同的协议,替换env配置文件中的URL协议
 *
 * @return {String}
 */
export function getSchemeHost () {
  const protocol = window.location.protocol
  const host = process.env.VUE_APP_API_HOST
  return host.replace(/scheme/g, protocol)
}
/**
 * collection数据转换为标准JSON
 * @param obj collection数据
@@ -993,23 +1002,38 @@
}
export function success (msg = $CONST.MSG_SYS_SUCCESS) {
  notify.success(msg)
  Message({
    message: msg,
    type: 'success'
  })
}
export function fail (msg = $CONST.MSG_SYS_FAIL) {
  notify.warn(msg)
  Message({
    message: msg,
    type: 'error'
  })
}
export function error (msg = $CONST.MSG_SYS_ERR) {
  notify.danger(msg)
  Message({
    message: msg,
    type: 'error'
  })
}
export function warning (msg = $CONST.MSG_SYS_WARNING) {
  notify.warn(msg)
  Message({
    message: msg,
    type: 'warning'
  })
}
export function info (msg = $CONST.MSG_SYS_CANCELED) {
  notify.primary(msg)
  Message({
    message: msg,
    type: 'info'
  })
}
/**