qinxianzhangyao
2024-04-25 74a7a2bbef241a023110ff24c8e7c84025e267f5
src/utils/index.js
@@ -389,3 +389,23 @@
  return /^[+-]?(0|([1-9]\d*))(\.\d+)?$/g.test(str)
}
 
export function getCurrentDomain() {
  // /dev-api
  // /prod-api
  return window.location.protocol + '//' + window.location.host + "/prod-api"
}
export function getQueryString(name) {
  let reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i')
  let r = window.location.search.substr(1).match(reg) // 获取url中"?"符后的字符串并正则匹配
  let context = ''
  if (r != null) context = r[2]
  reg = null
  r = null
  return context == null || context == '' || context == 'undefined' ? '' : context
}
export function removeHtmlTag(str) {
  if (!str) return ''
  return str.replace(/<[^>]+>/g, '').replaceAll('&nbsp;', '')
}