refactor(utils): 将工具类文件从Cs前缀重命名为Kit前缀
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { FormatDateTimeShortStr } from '@/utils/CsUtil'
|
||||
import { FormatDateTimeShortStr } from '@/utils/KitUtil'
|
||||
import { getToken } from '@/utils/auth'
|
||||
import axios from 'axios'
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import JSEncrypt from 'jsencrypt/bin/jsencrypt.min'
|
||||
|
||||
// 密钥对生成 http://web.chacuo.net/netrsakeypair
|
||||
|
||||
const publicKey = 'MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAg975XAOL1zg5EOcSSGPIcxwx5DxcvPD2rBRQa0/o1HTF25cnsU9uSHfzP+qohkDG76kDk+1FA/cuQda4CDAmK2fWW' +
|
||||
'q7KgglKd08hRkByjLuRsXu5WVApAAG15ItNM0CrXI7P47aOan+6YPU0Ni1+4WYQnwxfRYdUaKgY5G5gb3S+hx6VO1iN1KuRMBJ7y5FMh1WNJOM9bQb3X1pvaJ73drTpy1wJHAvfP80iG2+sSh0FfcOxCoRNEff' +
|
||||
'CUsU2bYNH6dG6mXIDvo6XZStspwUfSitfgOER207uvBCCVyFlas+2Xs09yyAoJNjaWmeCPfA7uJvJrXUft/SMy8JNIXBY40vlwk4d4FE6OKOG9Wn0oRlofRKZ7NGvpUxEA5zOW6g2LsHKUUXpgOfu59M6ZHxviGM' +
|
||||
't26WxJiq/ifVKJE3yVgx0MVIGEFTrG+spOCVsDYMSHnVsPEUdL6g5FV2YLyqNHljBqUqwyOEfUinp7hPRxrLJDMyX6GWy7y48Djg0wyh2hXro/ygVrZ6jcSd7MUAd2lYueUKK8Bey7OzIcOJ6GveHdLzGrspbbkn' +
|
||||
'DuRsbcInR5bD6l7YA4vpnLsbiOH2wbKJWXNnxRwN5KuWSpwHDHhARB8f4wWrewUKIOxcFI/eJ6ke6D52JMOKhiGeZKn+2/giHwrPGkTREe47Ose6UvTMCAwEAAQ=='
|
||||
|
||||
// 加密
|
||||
export function encrypt(txt) {
|
||||
const encryptor = new JSEncrypt()
|
||||
encryptor.setPublicKey(publicKey) // 设置公钥
|
||||
return encryptor.encrypt(txt) // 对需要加密的数据进行加密
|
||||
}
|
||||
|
||||
import JSEncrypt from 'jsencrypt/bin/jsencrypt.min'
|
||||
|
||||
// 密钥对生成 http://web.chacuo.net/netrsakeypair
|
||||
|
||||
const publicKey = 'MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAg975XAOL1zg5EOcSSGPIcxwx5DxcvPD2rBRQa0/o1HTF25cnsU9uSHfzP+qohkDG76kDk+1FA/cuQda4CDAmK2fWW' +
|
||||
'q7KgglKd08hRkByjLuRsXu5WVApAAG15ItNM0CrXI7P47aOan+6YPU0Ni1+4WYQnwxfRYdUaKgY5G5gb3S+hx6VO1iN1KuRMBJ7y5FMh1WNJOM9bQb3X1pvaJ73drTpy1wJHAvfP80iG2+sSh0FfcOxCoRNEff' +
|
||||
'CUsU2bYNH6dG6mXIDvo6XZStspwUfSitfgOER207uvBCCVyFlas+2Xs09yyAoJNjaWmeCPfA7uJvJrXUft/SMy8JNIXBY40vlwk4d4FE6OKOG9Wn0oRlofRKZ7NGvpUxEA5zOW6g2LsHKUUXpgOfu59M6ZHxviGM' +
|
||||
't26WxJiq/ifVKJE3yVgx0MVIGEFTrG+spOCVsDYMSHnVsPEUdL6g5FV2YLyqNHljBqUqwyOEfUinp7hPRxrLJDMyX6GWy7y48Djg0wyh2hXro/ygVrZ6jcSd7MUAd2lYueUKK8Bey7OzIcOJ6GveHdLzGrspbbkn' +
|
||||
'DuRsbcInR5bD6l7YA4vpnLsbiOH2wbKJWXNnxRwN5KuWSpwHDHhARB8f4wWrewUKIOxcFI/eJ6ke6D52JMOKhiGeZKn+2/giHwrPGkTREe47Ose6UvTMCAwEAAQ=='
|
||||
|
||||
// 加密
|
||||
export function encrypt(txt) {
|
||||
const encryptor = new JSEncrypt()
|
||||
encryptor.setPublicKey(publicKey) // 设置公钥
|
||||
return encryptor.encrypt(txt) // 对需要加密的数据进行加密
|
||||
}
|
||||
|
||||
@@ -1,387 +1,387 @@
|
||||
import store from '@/store'
|
||||
import dayjs from 'dayjs'
|
||||
|
||||
/**
|
||||
* 权限校验
|
||||
* @param value
|
||||
* @returns {boolean|*}
|
||||
*/
|
||||
export function CheckPermissions(value) {
|
||||
if (value && value instanceof Array && value.length > 0) {
|
||||
// 拥有的权限
|
||||
const roles = store.getters && store.getters.roles
|
||||
// 需要的权限
|
||||
const permissionRoles = value
|
||||
return roles.some(role => {
|
||||
return permissionRoles.includes(role)
|
||||
})
|
||||
} else {
|
||||
console.error(`need roles! Like v-permission="['admin','editor']"`)
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 字符串转数字
|
||||
* @param value
|
||||
* @returns {Number|*}
|
||||
*/
|
||||
export function StringToNumber(value) {
|
||||
try {
|
||||
return value ? Number(value) : value
|
||||
} catch (e) {
|
||||
return value
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 保留几位小数
|
||||
* @param num Number
|
||||
* @param accuracy 精度
|
||||
* @returns {string|number}
|
||||
*/
|
||||
export function NumberToFixed(num, accuracy) {
|
||||
return num instanceof Number ? num.toFixed(accuracy) : num
|
||||
}
|
||||
|
||||
/**
|
||||
* 浅拷贝
|
||||
* @param source 源对象
|
||||
* @param target 目标对象
|
||||
* @returns {*}
|
||||
*/
|
||||
export function CopyObject(source, target) {
|
||||
return Object.assign(target, source)
|
||||
}
|
||||
|
||||
/**
|
||||
* 深拷贝对象
|
||||
* @param obj
|
||||
*/
|
||||
export function DeepCopyObject(obj) {
|
||||
return JSON.parse(JSON.stringify(obj))
|
||||
}
|
||||
|
||||
/**
|
||||
* 统计对象属性等于targetValue的数量
|
||||
* @param arr 对象数组
|
||||
* @param propKey 属性名称
|
||||
* @param targetValue 目标值
|
||||
* @returns {*|number}
|
||||
*/
|
||||
export function CountArraysObjectByPropKey(arr, propKey, targetValue) {
|
||||
if (!Array.isArray(arr)) {
|
||||
return 0
|
||||
}
|
||||
let cnt = 0
|
||||
for (const element of arr) {
|
||||
if (element.hasOwnProperty(propKey)) {
|
||||
// console.error('that.pipelineInstance.propKey', propKey)
|
||||
// console.error('that.pipelineInstance.element[propKey]', element[propKey])
|
||||
// console.error('that.pipelineInstance.targetValue', targetValue)
|
||||
if (element[propKey] === targetValue) {
|
||||
cnt = cnt + 1
|
||||
}
|
||||
}
|
||||
}
|
||||
return cnt
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据value获取label
|
||||
* @param options /
|
||||
* @param value /
|
||||
* @returns {*}
|
||||
*/
|
||||
export function GetOptionLabelByValue(options, value) {
|
||||
if (options instanceof Array) {
|
||||
const find = options.find(f => f.value === value)
|
||||
if (find) {
|
||||
return find.label
|
||||
}
|
||||
return ''
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化字节数字符串
|
||||
* @param value
|
||||
* @returns {string}
|
||||
* @constructor
|
||||
*/
|
||||
export function FormatBytesStr(value) {
|
||||
if (typeof value !== 'number' || isNaN(value) || value <= 0) {
|
||||
return '0 Bytes'
|
||||
}
|
||||
const units = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
|
||||
const index = Math.floor(Math.log(value) / Math.log(1024))
|
||||
const unit = units[Math.min(index, units.length - 1)]
|
||||
const result = (value / Math.pow(1024, index)).toFixed(2)
|
||||
return `${result} ${unit}`
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化日期字符串
|
||||
* @param originVal
|
||||
* @returns {string}
|
||||
* @constructor
|
||||
*/
|
||||
export function FormatDateStr(originVal) {
|
||||
if (originVal === undefined) {
|
||||
return ''
|
||||
}
|
||||
const dt = new Date(originVal)
|
||||
const y = dt.getFullYear()
|
||||
const m = (dt.getMonth() + 1 + '').padStart(2, '0')
|
||||
const d = (dt.getDate() + '').padStart(2, '0')
|
||||
return `${y}-${m}-${d}`
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化日期时间字符串
|
||||
* @param originVal
|
||||
* @returns {string}
|
||||
* @constructor
|
||||
*/
|
||||
export function FormatDateTimeStr(originVal) {
|
||||
if (originVal) {
|
||||
return dayjs(originVal).format('YYYY-MM-DD HH:mm:ss')
|
||||
}
|
||||
return ''
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化日期时间字符串,不带分割符号
|
||||
* @param originVal
|
||||
* @returns {string}
|
||||
* @constructor
|
||||
*/
|
||||
export function FormatDateTimeShortStr(originVal) {
|
||||
if (originVal) {
|
||||
return dayjs(originVal).format('YYYYMMDDHHmmss')
|
||||
}
|
||||
return ''
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化表格行列中的日期时间字符串
|
||||
* @param row
|
||||
* @param column
|
||||
* @param cellValue
|
||||
* @param index
|
||||
* @returns {string}
|
||||
* @constructor
|
||||
*/
|
||||
export function FormatRowDateTimeStr(row, column, cellValue, index) {
|
||||
if (cellValue === undefined) {
|
||||
return ''
|
||||
}
|
||||
const dt = new Date(cellValue)
|
||||
const y = dt.getFullYear()
|
||||
const m = (dt.getMonth() + 1 + '').padStart(2, '0')
|
||||
const d = (dt.getDate() + '').padStart(2, '0')
|
||||
const hh = (dt.getHours() + '').padStart(2, '0')
|
||||
const mm = (dt.getMinutes() + '').padStart(2, '0')
|
||||
const ss = (dt.getSeconds() + '').padStart(2, '0')
|
||||
return `${y}-${m}-${d} ${hh}:${mm}:${ss}`
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取变量类型
|
||||
* @param value
|
||||
* @returns {string}
|
||||
* @constructor
|
||||
*/
|
||||
export function GetValueType(value) {
|
||||
return Object.prototype.toString.call(value).slice(8, -1).toLowerCase()
|
||||
}
|
||||
|
||||
/**
|
||||
* 数组去重
|
||||
* @param arr
|
||||
* @returns {any[]}
|
||||
* @constructor
|
||||
*/
|
||||
export function UniqueArrays(arr) {
|
||||
return [...new Set(arr)]
|
||||
}
|
||||
|
||||
/**
|
||||
* 手机号掩码
|
||||
* @param mobile
|
||||
* @returns {*|string}
|
||||
* @constructor
|
||||
*/
|
||||
export function MaskMobile(mobile) {
|
||||
if (mobile.length > 7) {
|
||||
return mobile.substr(0, 3) + '****' + mobile.substr(7)
|
||||
}
|
||||
return mobile
|
||||
}
|
||||
|
||||
/**
|
||||
* 邮箱掩码
|
||||
* @param email
|
||||
* @returns {string}
|
||||
* @constructor
|
||||
*/
|
||||
export function MaskEmail(email) {
|
||||
if (String(email).indexOf('@') > 0) {
|
||||
const str = email.split('@')
|
||||
let _s = ''
|
||||
if (str[0].length > 3) {
|
||||
for (let i = 0; i < str[0].length - 3; i++) {
|
||||
_s += '*'
|
||||
}
|
||||
}
|
||||
return str[0].substr(0, 3) + _s + '@' + str[1]
|
||||
}
|
||||
return email
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取Url中的查询参数
|
||||
* @param {string} url
|
||||
* @returns {Object}
|
||||
*/
|
||||
export function GetUrlQueryArgs(url) {
|
||||
url = url == null ? window.location.href : url
|
||||
const search = url.substring(url.lastIndexOf('?') + 1)
|
||||
const obj = {}
|
||||
const reg = /([^?&=]+)=([^?&=]*)/g
|
||||
search.replace(reg, (rs, $1, $2) => {
|
||||
const name = decodeURIComponent($1)
|
||||
let val = decodeURIComponent($2)
|
||||
val = String(val)
|
||||
obj[name] = val
|
||||
return rs
|
||||
})
|
||||
return obj
|
||||
}
|
||||
|
||||
/**
|
||||
* 将Url中的查询参数转成对象
|
||||
* @param {string} url
|
||||
* @returns {Object}
|
||||
*/
|
||||
export function ParseUrlQueryArgsToObject(url) {
|
||||
const search = url.split('?')[1]
|
||||
if (!search) {
|
||||
return {}
|
||||
}
|
||||
return JSON.parse(
|
||||
'{"' +
|
||||
decodeURIComponent(search)
|
||||
.replace(/"/g, '\\"')
|
||||
.replace(/&/g, '","')
|
||||
.replace(/=/g, '":"')
|
||||
.replace(/\+/g, ' ') +
|
||||
'"}'
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 合并两个属性不一致的对象
|
||||
* @param {Object} target
|
||||
* @param {(Object|Array)} source
|
||||
* @returns {Object}
|
||||
*/
|
||||
export function MergeObject(target, source) {
|
||||
if (typeof target !== 'object') {
|
||||
target = {}
|
||||
}
|
||||
if (Array.isArray(source)) {
|
||||
return source.slice()
|
||||
}
|
||||
Object.keys(source).forEach(property => {
|
||||
const sourceProperty = source[property]
|
||||
if (typeof sourceProperty === 'object') {
|
||||
target[property] = MergeObject(target[property], sourceProperty)
|
||||
} else {
|
||||
target[property] = sourceProperty
|
||||
}
|
||||
})
|
||||
return target
|
||||
}
|
||||
|
||||
/**
|
||||
* 防抖动
|
||||
* @param {Function} func
|
||||
* @param {number} wait
|
||||
* @param {boolean} immediate
|
||||
* @return {*}
|
||||
*/
|
||||
export function DeBounce(func, wait, immediate = false) {
|
||||
let timeout, args, context, timestamp, result
|
||||
const later = function() {
|
||||
// 据上一次触发时间间隔
|
||||
const last = +new Date() - timestamp
|
||||
// 上次被包装函数被调用时间间隔 last 小于设定时间间隔 wait
|
||||
if (last < wait && last > 0) {
|
||||
timeout = setTimeout(later, wait - last)
|
||||
} else {
|
||||
timeout = null
|
||||
// 如果设定为immediate===true,因为开始边界已经调用过了此处无需调用
|
||||
if (!immediate) {
|
||||
result = func.apply(context, args)
|
||||
context = args = null
|
||||
}
|
||||
}
|
||||
}
|
||||
return function(...args) {
|
||||
context = this
|
||||
timestamp = +new Date()
|
||||
const callNow = immediate && !timeout
|
||||
// 如果延时不存在,重新设定延时
|
||||
if (!timeout) timeout = setTimeout(later, wait)
|
||||
if (callNow) {
|
||||
result = func.apply(context, args)
|
||||
context = args = null
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化表格行列中的环境字符串
|
||||
* @param row
|
||||
* @param column
|
||||
* @param cellValue
|
||||
* @param index
|
||||
* @returns {string}
|
||||
* @constructor
|
||||
*/
|
||||
export function FormatRowEnvStr(row, column, cellValue, index) {
|
||||
if (cellValue === undefined) {
|
||||
return ''
|
||||
}
|
||||
const data = {
|
||||
daily: '日常环境',
|
||||
stage: '预发环境',
|
||||
gray: '灰度环境',
|
||||
production: '生产环境'
|
||||
}
|
||||
const title = data[cellValue]
|
||||
if (title) {
|
||||
return title
|
||||
}
|
||||
return ''
|
||||
}
|
||||
|
||||
export function IsEmpty(obj) {
|
||||
if (obj === undefined) {
|
||||
// console.error('is undefined')
|
||||
return true
|
||||
}
|
||||
if (obj === '') {
|
||||
// console.error('is ""')
|
||||
return true
|
||||
}
|
||||
if (obj === 'undefined') {
|
||||
// console.error('is "undefined"')
|
||||
return true
|
||||
}
|
||||
// console.error('is null')
|
||||
return obj === null
|
||||
}
|
||||
import store from '@/store'
|
||||
import dayjs from 'dayjs'
|
||||
|
||||
/**
|
||||
* 权限校验
|
||||
* @param value
|
||||
* @returns {boolean|*}
|
||||
*/
|
||||
export function CheckPermissions(value) {
|
||||
if (value && value instanceof Array && value.length > 0) {
|
||||
// 拥有的权限
|
||||
const roles = store.getters && store.getters.roles
|
||||
// 需要的权限
|
||||
const permissionRoles = value
|
||||
return roles.some(role => {
|
||||
return permissionRoles.includes(role)
|
||||
})
|
||||
} else {
|
||||
console.error(`need roles! Like v-permission="['admin','editor']"`)
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 字符串转数字
|
||||
* @param value
|
||||
* @returns {Number|*}
|
||||
*/
|
||||
export function StringToNumber(value) {
|
||||
try {
|
||||
return value ? Number(value) : value
|
||||
} catch (e) {
|
||||
return value
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 保留几位小数
|
||||
* @param num Number
|
||||
* @param accuracy 精度
|
||||
* @returns {string|number}
|
||||
*/
|
||||
export function NumberToFixed(num, accuracy) {
|
||||
return num instanceof Number ? num.toFixed(accuracy) : num
|
||||
}
|
||||
|
||||
/**
|
||||
* 浅拷贝
|
||||
* @param source 源对象
|
||||
* @param target 目标对象
|
||||
* @returns {*}
|
||||
*/
|
||||
export function CopyObject(source, target) {
|
||||
return Object.assign(target, source)
|
||||
}
|
||||
|
||||
/**
|
||||
* 深拷贝对象
|
||||
* @param obj
|
||||
*/
|
||||
export function DeepCopyObject(obj) {
|
||||
return JSON.parse(JSON.stringify(obj))
|
||||
}
|
||||
|
||||
/**
|
||||
* 统计对象属性等于targetValue的数量
|
||||
* @param arr 对象数组
|
||||
* @param propKey 属性名称
|
||||
* @param targetValue 目标值
|
||||
* @returns {*|number}
|
||||
*/
|
||||
export function CountArraysObjectByPropKey(arr, propKey, targetValue) {
|
||||
if (!Array.isArray(arr)) {
|
||||
return 0
|
||||
}
|
||||
let cnt = 0
|
||||
for (const element of arr) {
|
||||
if (element.hasOwnProperty(propKey)) {
|
||||
// console.error('that.pipelineInstance.propKey', propKey)
|
||||
// console.error('that.pipelineInstance.element[propKey]', element[propKey])
|
||||
// console.error('that.pipelineInstance.targetValue', targetValue)
|
||||
if (element[propKey] === targetValue) {
|
||||
cnt = cnt + 1
|
||||
}
|
||||
}
|
||||
}
|
||||
return cnt
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据value获取label
|
||||
* @param options /
|
||||
* @param value /
|
||||
* @returns {*}
|
||||
*/
|
||||
export function GetOptionLabelByValue(options, value) {
|
||||
if (options instanceof Array) {
|
||||
const find = options.find(f => f.value === value)
|
||||
if (find) {
|
||||
return find.label
|
||||
}
|
||||
return ''
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化字节数字符串
|
||||
* @param value
|
||||
* @returns {string}
|
||||
* @constructor
|
||||
*/
|
||||
export function FormatBytesStr(value) {
|
||||
if (typeof value !== 'number' || isNaN(value) || value <= 0) {
|
||||
return '0 Bytes'
|
||||
}
|
||||
const units = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
|
||||
const index = Math.floor(Math.log(value) / Math.log(1024))
|
||||
const unit = units[Math.min(index, units.length - 1)]
|
||||
const result = (value / Math.pow(1024, index)).toFixed(2)
|
||||
return `${result} ${unit}`
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化日期字符串
|
||||
* @param originVal
|
||||
* @returns {string}
|
||||
* @constructor
|
||||
*/
|
||||
export function FormatDateStr(originVal) {
|
||||
if (originVal === undefined) {
|
||||
return ''
|
||||
}
|
||||
const dt = new Date(originVal)
|
||||
const y = dt.getFullYear()
|
||||
const m = (dt.getMonth() + 1 + '').padStart(2, '0')
|
||||
const d = (dt.getDate() + '').padStart(2, '0')
|
||||
return `${y}-${m}-${d}`
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化日期时间字符串
|
||||
* @param originVal
|
||||
* @returns {string}
|
||||
* @constructor
|
||||
*/
|
||||
export function FormatDateTimeStr(originVal) {
|
||||
if (originVal) {
|
||||
return dayjs(originVal).format('YYYY-MM-DD HH:mm:ss')
|
||||
}
|
||||
return ''
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化日期时间字符串,不带分割符号
|
||||
* @param originVal
|
||||
* @returns {string}
|
||||
* @constructor
|
||||
*/
|
||||
export function FormatDateTimeShortStr(originVal) {
|
||||
if (originVal) {
|
||||
return dayjs(originVal).format('YYYYMMDDHHmmss')
|
||||
}
|
||||
return ''
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化表格行列中的日期时间字符串
|
||||
* @param row
|
||||
* @param column
|
||||
* @param cellValue
|
||||
* @param index
|
||||
* @returns {string}
|
||||
* @constructor
|
||||
*/
|
||||
export function FormatRowDateTimeStr(row, column, cellValue, index) {
|
||||
if (cellValue === undefined) {
|
||||
return ''
|
||||
}
|
||||
const dt = new Date(cellValue)
|
||||
const y = dt.getFullYear()
|
||||
const m = (dt.getMonth() + 1 + '').padStart(2, '0')
|
||||
const d = (dt.getDate() + '').padStart(2, '0')
|
||||
const hh = (dt.getHours() + '').padStart(2, '0')
|
||||
const mm = (dt.getMinutes() + '').padStart(2, '0')
|
||||
const ss = (dt.getSeconds() + '').padStart(2, '0')
|
||||
return `${y}-${m}-${d} ${hh}:${mm}:${ss}`
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取变量类型
|
||||
* @param value
|
||||
* @returns {string}
|
||||
* @constructor
|
||||
*/
|
||||
export function GetValueType(value) {
|
||||
return Object.prototype.toString.call(value).slice(8, -1).toLowerCase()
|
||||
}
|
||||
|
||||
/**
|
||||
* 数组去重
|
||||
* @param arr
|
||||
* @returns {any[]}
|
||||
* @constructor
|
||||
*/
|
||||
export function UniqueArrays(arr) {
|
||||
return [...new Set(arr)]
|
||||
}
|
||||
|
||||
/**
|
||||
* 手机号掩码
|
||||
* @param mobile
|
||||
* @returns {*|string}
|
||||
* @constructor
|
||||
*/
|
||||
export function MaskMobile(mobile) {
|
||||
if (mobile.length > 7) {
|
||||
return mobile.substr(0, 3) + '****' + mobile.substr(7)
|
||||
}
|
||||
return mobile
|
||||
}
|
||||
|
||||
/**
|
||||
* 邮箱掩码
|
||||
* @param email
|
||||
* @returns {string}
|
||||
* @constructor
|
||||
*/
|
||||
export function MaskEmail(email) {
|
||||
if (String(email).indexOf('@') > 0) {
|
||||
const str = email.split('@')
|
||||
let _s = ''
|
||||
if (str[0].length > 3) {
|
||||
for (let i = 0; i < str[0].length - 3; i++) {
|
||||
_s += '*'
|
||||
}
|
||||
}
|
||||
return str[0].substr(0, 3) + _s + '@' + str[1]
|
||||
}
|
||||
return email
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取Url中的查询参数
|
||||
* @param {string} url
|
||||
* @returns {Object}
|
||||
*/
|
||||
export function GetUrlQueryArgs(url) {
|
||||
url = url == null ? window.location.href : url
|
||||
const search = url.substring(url.lastIndexOf('?') + 1)
|
||||
const obj = {}
|
||||
const reg = /([^?&=]+)=([^?&=]*)/g
|
||||
search.replace(reg, (rs, $1, $2) => {
|
||||
const name = decodeURIComponent($1)
|
||||
let val = decodeURIComponent($2)
|
||||
val = String(val)
|
||||
obj[name] = val
|
||||
return rs
|
||||
})
|
||||
return obj
|
||||
}
|
||||
|
||||
/**
|
||||
* 将Url中的查询参数转成对象
|
||||
* @param {string} url
|
||||
* @returns {Object}
|
||||
*/
|
||||
export function ParseUrlQueryArgsToObject(url) {
|
||||
const search = url.split('?')[1]
|
||||
if (!search) {
|
||||
return {}
|
||||
}
|
||||
return JSON.parse(
|
||||
'{"' +
|
||||
decodeURIComponent(search)
|
||||
.replace(/"/g, '\\"')
|
||||
.replace(/&/g, '","')
|
||||
.replace(/=/g, '":"')
|
||||
.replace(/\+/g, ' ') +
|
||||
'"}'
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 合并两个属性不一致的对象
|
||||
* @param {Object} target
|
||||
* @param {(Object|Array)} source
|
||||
* @returns {Object}
|
||||
*/
|
||||
export function MergeObject(target, source) {
|
||||
if (typeof target !== 'object') {
|
||||
target = {}
|
||||
}
|
||||
if (Array.isArray(source)) {
|
||||
return source.slice()
|
||||
}
|
||||
Object.keys(source).forEach(property => {
|
||||
const sourceProperty = source[property]
|
||||
if (typeof sourceProperty === 'object') {
|
||||
target[property] = MergeObject(target[property], sourceProperty)
|
||||
} else {
|
||||
target[property] = sourceProperty
|
||||
}
|
||||
})
|
||||
return target
|
||||
}
|
||||
|
||||
/**
|
||||
* 防抖动
|
||||
* @param {Function} func
|
||||
* @param {number} wait
|
||||
* @param {boolean} immediate
|
||||
* @return {*}
|
||||
*/
|
||||
export function DeBounce(func, wait, immediate = false) {
|
||||
let timeout, args, context, timestamp, result
|
||||
const later = function() {
|
||||
// 据上一次触发时间间隔
|
||||
const last = +new Date() - timestamp
|
||||
// 上次被包装函数被调用时间间隔 last 小于设定时间间隔 wait
|
||||
if (last < wait && last > 0) {
|
||||
timeout = setTimeout(later, wait - last)
|
||||
} else {
|
||||
timeout = null
|
||||
// 如果设定为immediate===true,因为开始边界已经调用过了此处无需调用
|
||||
if (!immediate) {
|
||||
result = func.apply(context, args)
|
||||
context = args = null
|
||||
}
|
||||
}
|
||||
}
|
||||
return function(...args) {
|
||||
context = this
|
||||
timestamp = +new Date()
|
||||
const callNow = immediate && !timeout
|
||||
// 如果延时不存在,重新设定延时
|
||||
if (!timeout) timeout = setTimeout(later, wait)
|
||||
if (callNow) {
|
||||
result = func.apply(context, args)
|
||||
context = args = null
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化表格行列中的环境字符串
|
||||
* @param row
|
||||
* @param column
|
||||
* @param cellValue
|
||||
* @param index
|
||||
* @returns {string}
|
||||
* @constructor
|
||||
*/
|
||||
export function FormatRowEnvStr(row, column, cellValue, index) {
|
||||
if (cellValue === undefined) {
|
||||
return ''
|
||||
}
|
||||
const data = {
|
||||
daily: '日常环境',
|
||||
stage: '预发环境',
|
||||
gray: '灰度环境',
|
||||
production: '生产环境'
|
||||
}
|
||||
const title = data[cellValue]
|
||||
if (title) {
|
||||
return title
|
||||
}
|
||||
return ''
|
||||
}
|
||||
|
||||
export function IsEmpty(obj) {
|
||||
if (obj === undefined) {
|
||||
// console.error('is undefined')
|
||||
return true
|
||||
}
|
||||
if (obj === '') {
|
||||
// console.error('is ""')
|
||||
return true
|
||||
}
|
||||
if (obj === 'undefined') {
|
||||
// console.error('is "undefined"')
|
||||
return true
|
||||
}
|
||||
// console.error('is null')
|
||||
return obj === null
|
||||
}
|
||||
+171
-171
@@ -1,171 +1,171 @@
|
||||
/**
|
||||
* 是否链接
|
||||
* @param {string} path
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
export function IsExternal(path) {
|
||||
return /^(https?:|mailto:|tel:)/.test(path)
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 是否有效用户名
|
||||
// * @param {string} str
|
||||
// * @returns {Boolean}
|
||||
// */
|
||||
// export function IsValidUsername(str) {
|
||||
// const validMap = ['admin', 'editor']
|
||||
// return validMap.indexOf(str.trim()) >= 0
|
||||
// }
|
||||
|
||||
/**
|
||||
* 是否有效链接
|
||||
* @param {string} url
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
export function IsValidURL(url) {
|
||||
const reg = /^(https?|ftp):\/\/([a-zA-Z0-9.-]+(:[a-zA-Z0-9.&%$-]+)*@)*((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}|([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(:[0-9]+)*(\/($|[a-zA-Z0-9.,?'\\+&%$#=~_-]+))*$/
|
||||
return reg.test(url)
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否小写字母
|
||||
* @param {string} str
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
export function IsValidLowerCaseLetter(str) {
|
||||
const reg = /^[a-z]+$/
|
||||
return reg.test(str)
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否大写字母
|
||||
* @param {string} str
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
export function IsValidUpperCase(str) {
|
||||
const reg = /^[A-Z]+$/
|
||||
return reg.test(str)
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否包含大、小写字母
|
||||
* @param {string} str
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
export function IsValidLetter(str) {
|
||||
const reg = /^[A-Za-z]+$/
|
||||
return reg.test(str)
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否邮箱
|
||||
* @param {string} email
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
export function IsValidEmail(email) {
|
||||
const reg = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
|
||||
return reg.test(email)
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 是否手机号
|
||||
// * @param phone
|
||||
// * @returns {boolean}
|
||||
// * @constructor
|
||||
// */
|
||||
// export function IsValidPhone(phone) {
|
||||
// const reg = /^1([38][0-9]|4[014-9]|[59][0-35-9]|6[2567]|7[0-8])\d{8}$/
|
||||
// return reg.test(phone)
|
||||
// }
|
||||
|
||||
/**
|
||||
* 是否是字符串
|
||||
* @param {string} str
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
export function IsString(str) {
|
||||
return typeof str === 'string' || str instanceof String
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否数组
|
||||
* @param {Array} arg
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
export function IsArray(arg) {
|
||||
if (typeof Array.isArray === 'undefined') {
|
||||
return Object.prototype.toString.call(arg) === '[object Array]'
|
||||
}
|
||||
return Array.isArray(arg)
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否合法IP地址
|
||||
* @param rule
|
||||
* @param value
|
||||
* @param callback
|
||||
*/
|
||||
export function IsValidIP(rule, value, callback) {
|
||||
if (value === '' || value === undefined || value == null) {
|
||||
callback()
|
||||
} else {
|
||||
const reg = /^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/
|
||||
if ((!reg.test(value)) && value !== '') {
|
||||
callback(new Error('请输入正确的IP地址'))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 是否手机号码或者固话*/
|
||||
export function IsValidPhoneTwo(rule, value, callback) {
|
||||
const reg = /^((0\d{2,3}-\d{7,8})|(1([38][0-9]|4[014-9]|[59][0-35-9]|6[2567]|7[0-8])\d{8}))$/
|
||||
if (value === '' || value === undefined || value == null) {
|
||||
callback()
|
||||
} else {
|
||||
if ((!reg.test(value)) && value !== '') {
|
||||
callback(new Error('请输入正确的电话号码或者固话号码'))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 是否固话*/
|
||||
export function IsValidTelephone(rule, value, callback) {
|
||||
const reg = /0\d{2}-\d{7,8}/
|
||||
if (value === '' || value === undefined || value == null) {
|
||||
callback()
|
||||
} else {
|
||||
if ((!reg.test(value)) && value !== '') {
|
||||
callback(new Error('请输入正确的固话(格式:区号+号码,如010-1234567)'))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 是否手机号码*/
|
||||
export function IsValidPhone(value) {
|
||||
const reg = /^1([38][0-9]|4[014-9]|[59][0-35-9]|6[2567]|7[0-8])\d{8}$/
|
||||
if (value === '' || value === undefined || value == null) {
|
||||
return false
|
||||
} else {
|
||||
return !((!reg.test(value)) && value !== '')
|
||||
}
|
||||
}
|
||||
|
||||
/* 是否身份证号码*/
|
||||
export function IsValidIdNumber(rule, value, callback) {
|
||||
const reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/
|
||||
if (value === '' || value === undefined || value == null) {
|
||||
callback()
|
||||
} else {
|
||||
if ((!reg.test(value)) && value !== '') {
|
||||
callback(new Error('请输入正确的身份证号码'))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 是否链接
|
||||
* @param {string} path
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
export function IsExternal(path) {
|
||||
return /^(https?:|mailto:|tel:)/.test(path)
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 是否有效用户名
|
||||
// * @param {string} str
|
||||
// * @returns {Boolean}
|
||||
// */
|
||||
// export function IsValidUsername(str) {
|
||||
// const validMap = ['admin', 'editor']
|
||||
// return validMap.indexOf(str.trim()) >= 0
|
||||
// }
|
||||
|
||||
/**
|
||||
* 是否有效链接
|
||||
* @param {string} url
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
export function IsValidURL(url) {
|
||||
const reg = /^(https?|ftp):\/\/([a-zA-Z0-9.-]+(:[a-zA-Z0-9.&%$-]+)*@)*((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}|([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(:[0-9]+)*(\/($|[a-zA-Z0-9.,?'\\+&%$#=~_-]+))*$/
|
||||
return reg.test(url)
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否小写字母
|
||||
* @param {string} str
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
export function IsValidLowerCaseLetter(str) {
|
||||
const reg = /^[a-z]+$/
|
||||
return reg.test(str)
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否大写字母
|
||||
* @param {string} str
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
export function IsValidUpperCase(str) {
|
||||
const reg = /^[A-Z]+$/
|
||||
return reg.test(str)
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否包含大、小写字母
|
||||
* @param {string} str
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
export function IsValidLetter(str) {
|
||||
const reg = /^[A-Za-z]+$/
|
||||
return reg.test(str)
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否邮箱
|
||||
* @param {string} email
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
export function IsValidEmail(email) {
|
||||
const reg = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
|
||||
return reg.test(email)
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 是否手机号
|
||||
// * @param phone
|
||||
// * @returns {boolean}
|
||||
// * @constructor
|
||||
// */
|
||||
// export function IsValidPhone(phone) {
|
||||
// const reg = /^1([38][0-9]|4[014-9]|[59][0-35-9]|6[2567]|7[0-8])\d{8}$/
|
||||
// return reg.test(phone)
|
||||
// }
|
||||
|
||||
/**
|
||||
* 是否是字符串
|
||||
* @param {string} str
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
export function IsString(str) {
|
||||
return typeof str === 'string' || str instanceof String
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否数组
|
||||
* @param {Array} arg
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
export function IsArray(arg) {
|
||||
if (typeof Array.isArray === 'undefined') {
|
||||
return Object.prototype.toString.call(arg) === '[object Array]'
|
||||
}
|
||||
return Array.isArray(arg)
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否合法IP地址
|
||||
* @param rule
|
||||
* @param value
|
||||
* @param callback
|
||||
*/
|
||||
export function IsValidIP(rule, value, callback) {
|
||||
if (value === '' || value === undefined || value == null) {
|
||||
callback()
|
||||
} else {
|
||||
const reg = /^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/
|
||||
if ((!reg.test(value)) && value !== '') {
|
||||
callback(new Error('请输入正确的IP地址'))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 是否手机号码或者固话*/
|
||||
export function IsValidPhoneTwo(rule, value, callback) {
|
||||
const reg = /^((0\d{2,3}-\d{7,8})|(1([38][0-9]|4[014-9]|[59][0-35-9]|6[2567]|7[0-8])\d{8}))$/
|
||||
if (value === '' || value === undefined || value == null) {
|
||||
callback()
|
||||
} else {
|
||||
if ((!reg.test(value)) && value !== '') {
|
||||
callback(new Error('请输入正确的电话号码或者固话号码'))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 是否固话*/
|
||||
export function IsValidTelephone(rule, value, callback) {
|
||||
const reg = /0\d{2}-\d{7,8}/
|
||||
if (value === '' || value === undefined || value == null) {
|
||||
callback()
|
||||
} else {
|
||||
if ((!reg.test(value)) && value !== '') {
|
||||
callback(new Error('请输入正确的固话(格式:区号+号码,如010-1234567)'))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 是否手机号码*/
|
||||
export function IsValidPhone(value) {
|
||||
const reg = /^1([38][0-9]|4[014-9]|[59][0-35-9]|6[2567]|7[0-8])\d{8}$/
|
||||
if (value === '' || value === undefined || value == null) {
|
||||
return false
|
||||
} else {
|
||||
return !((!reg.test(value)) && value !== '')
|
||||
}
|
||||
}
|
||||
|
||||
/* 是否身份证号码*/
|
||||
export function IsValidIdNumber(rule, value, callback) {
|
||||
const reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/
|
||||
if (value === '' || value === undefined || value == null) {
|
||||
callback()
|
||||
} else {
|
||||
if ((!reg.test(value)) && value !== '') {
|
||||
callback(new Error('请输入正确的身份证号码'))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,41 +1,41 @@
|
||||
import store from '@/store'
|
||||
|
||||
/**
|
||||
* WebSocket客户端
|
||||
*/
|
||||
function CsWsClient(sid) {
|
||||
this.wsUri = store.getters && store.getters.websocketApi.replace('{sid}', sid)
|
||||
this.client = null
|
||||
/**
|
||||
* 初始化WebSocket连接
|
||||
* @param handleError -> function (e) { e是异常本身 }
|
||||
* @param handleMessage -> function (e) { e.data是message }
|
||||
*/
|
||||
this.connect = function(handleError, handleMessage) {
|
||||
this.client = new WebSocket(this.wsUri)
|
||||
// 连接发生错误
|
||||
this.client.onerror = handleError
|
||||
// 收到消息
|
||||
this.client.onmessage = handleMessage
|
||||
return this
|
||||
}
|
||||
/**
|
||||
* 发送客户端数据
|
||||
* @param data 客户端数据
|
||||
*/
|
||||
this.sendData = function(data) {
|
||||
this.client.send(JSON.stringify(data))
|
||||
}
|
||||
/**
|
||||
* 用于关闭ws连接
|
||||
*/
|
||||
this.close = function() {
|
||||
console.info('关闭连接')
|
||||
if (this.client.readyState === 1) {
|
||||
this.sendData([{}])
|
||||
this.client.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default CsWsClient
|
||||
import store from '@/store'
|
||||
|
||||
/**
|
||||
* WebSocket客户端
|
||||
*/
|
||||
function KitWsClient(sid) {
|
||||
this.wsUri = store.getters && store.getters.websocketApi.replace('{sid}', sid)
|
||||
this.client = null
|
||||
/**
|
||||
* 初始化WebSocket连接
|
||||
* @param handleError -> function (e) { e是异常本身 }
|
||||
* @param handleMessage -> function (e) { e.data是message }
|
||||
*/
|
||||
this.connect = function(handleError, handleMessage) {
|
||||
this.client = new WebSocket(this.wsUri)
|
||||
// 连接发生错误
|
||||
this.client.onerror = handleError
|
||||
// 收到消息
|
||||
this.client.onmessage = handleMessage
|
||||
return this
|
||||
}
|
||||
/**
|
||||
* 发送客户端数据
|
||||
* @param data 客户端数据
|
||||
*/
|
||||
this.sendData = function(data) {
|
||||
this.client.send(JSON.stringify(data))
|
||||
}
|
||||
/**
|
||||
* 用于关闭ws连接
|
||||
*/
|
||||
this.close = function() {
|
||||
console.info('关闭连接')
|
||||
if (this.client.readyState === 1) {
|
||||
this.sendData([{}])
|
||||
this.client.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default KitWsClient
|
||||
+2
-2
@@ -3,7 +3,7 @@ import Vue from 'vue'
|
||||
/**
|
||||
* 全屏锁定加载动画
|
||||
*/
|
||||
// export default function CsLoading() {
|
||||
// export default function KitLoading() {
|
||||
// this.instance = null
|
||||
// this.show = function() {
|
||||
// this.instance = Vue.prototype.$loading({
|
||||
@@ -20,7 +20,7 @@ import Vue from 'vue'
|
||||
// }
|
||||
// }
|
||||
|
||||
export default class CsLoading {
|
||||
export default class KitLoading {
|
||||
constructor() {
|
||||
this.instance = null
|
||||
}
|
||||
@@ -19,7 +19,7 @@ service.interceptors.request.use(
|
||||
// 让每个请求携带自定义token 请根据实际情况自行修改
|
||||
config.headers['Authorization'] = getToken()
|
||||
}
|
||||
config.headers['Content-Type'] = 'application/json'
|
||||
config.headers['Content-Type'] = 'application/json;charset=utf-8'
|
||||
return config
|
||||
},
|
||||
error => {
|
||||
|
||||
Reference in New Issue
Block a user