添加页面补招功能
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import {toNumber} from 'lodash-es'
|
||||
import { toNumber } from 'lodash-es'
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -7,14 +7,14 @@ import {toNumber} from 'lodash-es'
|
||||
* @returns any
|
||||
*/
|
||||
export const withInstall = <T>(component: T, alias?: string) => {
|
||||
const comp = component as any
|
||||
comp.install = (app: any) => {
|
||||
app.component(comp.name || comp.displayName, component)
|
||||
if (alias) {
|
||||
app.config.globalProperties[alias] = component
|
||||
const comp = component as any
|
||||
comp.install = (app: any) => {
|
||||
app.component(comp.name || comp.displayName, component)
|
||||
if (alias) {
|
||||
app.config.globalProperties[alias] = component
|
||||
}
|
||||
}
|
||||
}
|
||||
return component as T & Plugin
|
||||
return component as T & Plugin
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -22,7 +22,7 @@ export const withInstall = <T>(component: T, alias?: string) => {
|
||||
* @returns 字符串下划线
|
||||
*/
|
||||
export const humpToUnderline = (str: string): string => {
|
||||
return str.replace(/([A-Z])/g, '-$1').toLowerCase()
|
||||
return str.replace(/([A-Z])/g, '-$1').toLowerCase()
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -30,21 +30,21 @@ export const humpToUnderline = (str: string): string => {
|
||||
* @returns 字符串驼峰
|
||||
*/
|
||||
export const underlineToHump = (str: string): string => {
|
||||
if (!str) return ''
|
||||
return str.replace(/\-(\w)/g, (_, letter: string) => {
|
||||
return letter.toUpperCase()
|
||||
})
|
||||
if (!str) return ''
|
||||
return str.replace(/\-(\w)/g, (_, letter: string) => {
|
||||
return letter.toUpperCase()
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 驼峰转横杠
|
||||
*/
|
||||
export const humpToDash = (str: string): string => {
|
||||
return str.replace(/([A-Z])/g, '-$1').toLowerCase()
|
||||
return str.replace(/([A-Z])/g, '-$1').toLowerCase()
|
||||
}
|
||||
|
||||
export const setCssVar = (prop: string, val: any, dom = document.documentElement) => {
|
||||
dom.style.setProperty(prop, val)
|
||||
dom.style.setProperty(prop, val)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -54,22 +54,22 @@ export const setCssVar = (prop: string, val: any, dom = document.documentElement
|
||||
*/
|
||||
// eslint-disable-next-line
|
||||
export const findIndex = <T = Recordable>(ary: Array<T>, fn: Fn): number => {
|
||||
if (ary.findIndex) {
|
||||
return ary.findIndex(fn)
|
||||
}
|
||||
let index = -1
|
||||
ary.some((item: T, i: number, ary: Array<T>) => {
|
||||
const ret: T = fn(item, i, ary)
|
||||
if (ret) {
|
||||
index = i
|
||||
return ret
|
||||
if (ary.findIndex) {
|
||||
return ary.findIndex(fn)
|
||||
}
|
||||
})
|
||||
return index
|
||||
let index = -1
|
||||
ary.some((item: T, i: number, ary: Array<T>) => {
|
||||
const ret: T = fn(item, i, ary)
|
||||
if (ret) {
|
||||
index = i
|
||||
return ret
|
||||
}
|
||||
})
|
||||
return index
|
||||
}
|
||||
|
||||
export const trim = (str: string) => {
|
||||
return str.replace(/(^\s*)|(\s*$)/g, '')
|
||||
return str.replace(/(^\s*)|(\s*$)/g, '')
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -77,81 +77,75 @@ export const trim = (str: string) => {
|
||||
* @param {String} fmt 需要转换的格式 如 yyyy-MM-dd、yyyy-MM-dd HH:mm:ss
|
||||
*/
|
||||
export function formatTime(time: Date | number | string, fmt: string) {
|
||||
if (!time) return ''
|
||||
else {
|
||||
const date = new Date(time)
|
||||
const o = {
|
||||
'M+': date.getMonth() + 1,
|
||||
'd+': date.getDate(),
|
||||
'H+': date.getHours(),
|
||||
'm+': date.getMinutes(),
|
||||
's+': date.getSeconds(),
|
||||
'q+': Math.floor((date.getMonth() + 3) / 3),
|
||||
S: date.getMilliseconds()
|
||||
if (!time) return ''
|
||||
else {
|
||||
const date = new Date(time)
|
||||
const o = {
|
||||
'M+': date.getMonth() + 1,
|
||||
'd+': date.getDate(),
|
||||
'H+': date.getHours(),
|
||||
'm+': date.getMinutes(),
|
||||
's+': date.getSeconds(),
|
||||
'q+': Math.floor((date.getMonth() + 3) / 3),
|
||||
S: date.getMilliseconds()
|
||||
}
|
||||
if (/(y+)/.test(fmt)) {
|
||||
fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length))
|
||||
}
|
||||
for (const k in o) {
|
||||
if (new RegExp('(' + k + ')').test(fmt)) {
|
||||
fmt = fmt.replace(RegExp.$1, RegExp.$1.length === 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length))
|
||||
}
|
||||
}
|
||||
return fmt
|
||||
}
|
||||
if (/(y+)/.test(fmt)) {
|
||||
fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length))
|
||||
}
|
||||
for (const k in o) {
|
||||
if (new RegExp('(' + k + ')').test(fmt)) {
|
||||
fmt = fmt.replace(
|
||||
RegExp.$1,
|
||||
RegExp.$1.length === 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length)
|
||||
)
|
||||
}
|
||||
}
|
||||
return fmt
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成随机字符串
|
||||
*/
|
||||
export function toAnyString() {
|
||||
const str: string = 'xxxxx-xxxxx-4xxxx-yxxxx-xxxxx'.replace(/[xy]/g, (c: string) => {
|
||||
const r: number = (Math.random() * 16) | 0
|
||||
const v: number = c === 'x' ? r : (r & 0x3) | 0x8
|
||||
return v.toString()
|
||||
})
|
||||
return str
|
||||
const str: string = 'xxxxx-xxxxx-4xxxx-yxxxx-xxxxx'.replace(/[xy]/g, (c: string) => {
|
||||
const r: number = (Math.random() * 16) | 0
|
||||
const v: number = c === 'x' ? r : (r & 0x3) | 0x8
|
||||
return v.toString()
|
||||
})
|
||||
return str
|
||||
}
|
||||
|
||||
/**
|
||||
* 首字母大写
|
||||
*/
|
||||
export function firstUpperCase(str: string) {
|
||||
return str.toLowerCase().replace(/( |^)[a-z]/g, (L) => L.toUpperCase())
|
||||
return str.toLowerCase().replace(/( |^)[a-z]/g, L => L.toUpperCase())
|
||||
}
|
||||
|
||||
export const generateUUID = () => {
|
||||
if (typeof crypto === 'object') {
|
||||
if (typeof crypto.randomUUID === 'function') {
|
||||
return crypto.randomUUID()
|
||||
if (typeof crypto === 'object') {
|
||||
if (typeof crypto.randomUUID === 'function') {
|
||||
return crypto.randomUUID()
|
||||
}
|
||||
if (typeof crypto.getRandomValues === 'function' && typeof Uint8Array === 'function') {
|
||||
const callback = (c: any) => {
|
||||
const num = Number(c)
|
||||
return (num ^ (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (num / 4)))).toString(16)
|
||||
}
|
||||
return '10000000-1000-4000-8000-100000000000'.replace(/[018]/g, callback)
|
||||
}
|
||||
}
|
||||
if (typeof crypto.getRandomValues === 'function' && typeof Uint8Array === 'function') {
|
||||
const callback = (c: any) => {
|
||||
const num = Number(c)
|
||||
return (num ^ (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (num / 4)))).toString(
|
||||
16
|
||||
)
|
||||
}
|
||||
return '10000000-1000-4000-8000-100000000000'.replace(/[018]/g, callback)
|
||||
}
|
||||
}
|
||||
let timestamp = new Date().getTime()
|
||||
let performanceNow =
|
||||
(typeof performance !== 'undefined' && performance.now && performance.now() * 1000) || 0
|
||||
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
|
||||
let random = Math.random() * 16
|
||||
if (timestamp > 0) {
|
||||
random = (timestamp + random) % 16 | 0
|
||||
timestamp = Math.floor(timestamp / 16)
|
||||
} else {
|
||||
random = (performanceNow + random) % 16 | 0
|
||||
performanceNow = Math.floor(performanceNow / 16)
|
||||
}
|
||||
return (c === 'x' ? random : (random & 0x3) | 0x8).toString(16)
|
||||
})
|
||||
let timestamp = new Date().getTime()
|
||||
let performanceNow = (typeof performance !== 'undefined' && performance.now && performance.now() * 1000) || 0
|
||||
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {
|
||||
let random = Math.random() * 16
|
||||
if (timestamp > 0) {
|
||||
random = (timestamp + random) % 16 | 0
|
||||
timestamp = Math.floor(timestamp / 16)
|
||||
} else {
|
||||
random = (performanceNow + random) % 16 | 0
|
||||
performanceNow = Math.floor(performanceNow / 16)
|
||||
}
|
||||
return (c === 'x' ? random : (random & 0x3) | 0x8).toString(16)
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -163,13 +157,13 @@ export const generateUUID = () => {
|
||||
*/
|
||||
// @ts-ignore
|
||||
export const fileSizeFormatter = (row, column, cellValue) => {
|
||||
const fileSize = cellValue
|
||||
const unitArr = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
|
||||
const srcSize = parseFloat(fileSize)
|
||||
const index = Math.floor(Math.log(srcSize) / Math.log(1024))
|
||||
const size = srcSize / Math.pow(1024, index)
|
||||
const sizeStr = size.toFixed(2) //保留的小数位数
|
||||
return sizeStr + ' ' + unitArr[index]
|
||||
const fileSize = cellValue
|
||||
const unitArr = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
|
||||
const srcSize = parseFloat(fileSize)
|
||||
const index = Math.floor(Math.log(srcSize) / Math.log(1024))
|
||||
const size = srcSize / Math.pow(1024, index)
|
||||
const sizeStr = size.toFixed(2) //保留的小数位数
|
||||
return sizeStr + ' ' + unitArr[index]
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -178,16 +172,16 @@ export const fileSizeFormatter = (row, column, cellValue) => {
|
||||
* @param source 源对象
|
||||
*/
|
||||
export const copyValueToTarget = (target: any, source: any) => {
|
||||
const newObj = Object.assign({}, target, source)
|
||||
// 删除多余属性
|
||||
Object.keys(newObj).forEach((key) => {
|
||||
// 如果不是target中的属性则删除
|
||||
if (Object.keys(target).indexOf(key) === -1) {
|
||||
delete newObj[key]
|
||||
}
|
||||
})
|
||||
// 更新目标对象值
|
||||
Object.assign(target, newObj)
|
||||
const newObj = Object.assign({}, target, source)
|
||||
// 删除多余属性
|
||||
Object.keys(newObj).forEach(key => {
|
||||
// 如果不是target中的属性则删除
|
||||
if (Object.keys(target).indexOf(key) === -1) {
|
||||
delete newObj[key]
|
||||
}
|
||||
})
|
||||
// 更新目标对象值
|
||||
Object.assign(target, newObj)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -196,9 +190,9 @@ export const copyValueToTarget = (target: any, source: any) => {
|
||||
* @param urlStr 链接地址,默认为当前浏览器的地址
|
||||
*/
|
||||
export const getUrlValue = (key: string, urlStr: string = location.href): string => {
|
||||
if (!urlStr || !key) return ''
|
||||
const url = new URL(decodeURIComponent(urlStr))
|
||||
return url.searchParams.get(key) ?? ''
|
||||
if (!urlStr || !key) return ''
|
||||
const url = new URL(decodeURIComponent(urlStr))
|
||||
return url.searchParams.get(key) ?? ''
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -207,7 +201,7 @@ export const getUrlValue = (key: string, urlStr: string = location.href): string
|
||||
* @param urlStr 链接地址,默认为当前浏览器的地址
|
||||
*/
|
||||
export const getUrlNumberValue = (key: string, urlStr: string = location.href): number => {
|
||||
return toNumber(getUrlValue(key, urlStr))
|
||||
return toNumber(getUrlValue(key, urlStr))
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -216,7 +210,7 @@ export const getUrlNumberValue = (key: string, urlStr: string = location.href):
|
||||
* @param order 顺序
|
||||
*/
|
||||
export const buildSortingField = ({ prop, order }) => {
|
||||
return { field: prop, order: order === 'ascending' ? 'asc' : 'desc' }
|
||||
return { field: prop, order: order === 'ascending' ? 'asc' : 'desc' }
|
||||
}
|
||||
|
||||
// ========== NumberUtils 数字方法 ==========
|
||||
@@ -228,14 +222,14 @@ export const buildSortingField = ({ prop, order }) => {
|
||||
* @return 求和结果,默认为 0
|
||||
*/
|
||||
export const getSumValue = (values: number[]): number => {
|
||||
return values.reduce((prev, curr) => {
|
||||
const value = Number(curr)
|
||||
if (!Number.isNaN(value)) {
|
||||
return prev + curr
|
||||
} else {
|
||||
return prev
|
||||
}
|
||||
}, 0)
|
||||
return values.reduce((prev, curr) => {
|
||||
const value = Number(curr)
|
||||
if (!Number.isNaN(value)) {
|
||||
return prev + curr
|
||||
} else {
|
||||
return prev
|
||||
}
|
||||
}, 0)
|
||||
}
|
||||
|
||||
// ========== 通用金额方法 ==========
|
||||
@@ -245,9 +239,9 @@ export const getSumValue = (values: number[]): number => {
|
||||
* @param num
|
||||
*/
|
||||
export const formatToFraction = (num: number | string | undefined): string => {
|
||||
if (typeof num === 'undefined') return '0.00'
|
||||
const parsedNumber = typeof num === 'string' ? parseFloat(num) : num
|
||||
return (parsedNumber / 100.0).toFixed(2)
|
||||
if (typeof num === 'undefined') return '0.00'
|
||||
const parsedNumber = typeof num === 'string' ? parseFloat(num) : num
|
||||
return (parsedNumber / 100.0).toFixed(2)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -258,25 +252,25 @@ export const formatToFraction = (num: number | string | undefined): string => {
|
||||
*/
|
||||
// TODO @芋艿:看看怎么融合掉
|
||||
export const floatToFixed2 = (num: number | string | undefined): string => {
|
||||
let str = '0.00'
|
||||
if (typeof num === 'undefined') {
|
||||
let str = '0.00'
|
||||
if (typeof num === 'undefined') {
|
||||
return str
|
||||
}
|
||||
const f = formatToFraction(num)
|
||||
const decimalPart = f.toString().split('.')[1]
|
||||
const len = decimalPart ? decimalPart.length : 0
|
||||
switch (len) {
|
||||
case 0:
|
||||
str = f.toString() + '.00'
|
||||
break
|
||||
case 1:
|
||||
str = f.toString() + '0'
|
||||
break
|
||||
case 2:
|
||||
str = f.toString()
|
||||
break
|
||||
}
|
||||
return str
|
||||
}
|
||||
const f = formatToFraction(num)
|
||||
const decimalPart = f.toString().split('.')[1]
|
||||
const len = decimalPart ? decimalPart.length : 0
|
||||
switch (len) {
|
||||
case 0:
|
||||
str = f.toString() + '.00'
|
||||
break
|
||||
case 1:
|
||||
str = f.toString() + '0'
|
||||
break
|
||||
case 2:
|
||||
str = f.toString()
|
||||
break
|
||||
}
|
||||
return str
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -285,24 +279,24 @@ export const floatToFixed2 = (num: number | string | undefined): string => {
|
||||
*/
|
||||
// TODO @芋艿:看看怎么融合掉
|
||||
export const convertToInteger = (num: number | string | undefined): number => {
|
||||
if (typeof num === 'undefined') return 0
|
||||
const parsedNumber = typeof num === 'string' ? parseFloat(num) : num
|
||||
// TODO 分转元后还有小数则四舍五入
|
||||
return Math.round(parsedNumber * 100)
|
||||
if (typeof num === 'undefined') return 0
|
||||
const parsedNumber = typeof num === 'string' ? parseFloat(num) : num
|
||||
// TODO 分转元后还有小数则四舍五入
|
||||
return Math.round(parsedNumber * 100)
|
||||
}
|
||||
|
||||
/**
|
||||
* 元转分
|
||||
*/
|
||||
export const yuanToFen = (amount: string | number): number => {
|
||||
return convertToInteger(amount)
|
||||
return convertToInteger(amount)
|
||||
}
|
||||
|
||||
/**
|
||||
* 分转元
|
||||
*/
|
||||
export const fenToYuan = (price: string | number): string => {
|
||||
return formatToFraction(price)
|
||||
return formatToFraction(price)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -312,10 +306,10 @@ export const fenToYuan = (price: string | number): string => {
|
||||
* @param reference 对比数值
|
||||
*/
|
||||
export const calculateRelativeRate = (value?: number, reference?: number) => {
|
||||
// 防止除0
|
||||
if (!reference) return 0
|
||||
// 防止除0
|
||||
if (!reference) return 0
|
||||
|
||||
return ((100 * ((value || 0) - reference)) / reference).toFixed(0)
|
||||
return ((100 * ((value || 0) - reference)) / reference).toFixed(0)
|
||||
}
|
||||
|
||||
// ========== ERP 专属方法 ==========
|
||||
@@ -333,17 +327,17 @@ const ERP_PRICE_DIGIT = 2
|
||||
* @return 格式化后的数量
|
||||
*/
|
||||
export const erpNumberFormatter = (num: number | string | undefined, digit: number) => {
|
||||
if (num == null) {
|
||||
return ''
|
||||
}
|
||||
if (typeof num === 'string') {
|
||||
num = parseFloat(num)
|
||||
}
|
||||
// 如果非 number,则直接返回空串
|
||||
if (isNaN(num)) {
|
||||
return ''
|
||||
}
|
||||
return num.toFixed(digit)
|
||||
if (num == null) {
|
||||
return ''
|
||||
}
|
||||
if (typeof num === 'string') {
|
||||
num = parseFloat(num)
|
||||
}
|
||||
// 如果非 number,则直接返回空串
|
||||
if (isNaN(num)) {
|
||||
return ''
|
||||
}
|
||||
return num.toFixed(digit)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -355,7 +349,7 @@ export const erpNumberFormatter = (num: number | string | undefined, digit: numb
|
||||
* @return 格式化后的数量
|
||||
*/
|
||||
export const erpCountInputFormatter = (num: number | string | undefined) => {
|
||||
return erpNumberFormatter(num, ERP_COUNT_DIGIT)
|
||||
return erpNumberFormatter(num, ERP_COUNT_DIGIT)
|
||||
}
|
||||
|
||||
// noinspection JSCommentMatchesSignature
|
||||
@@ -366,7 +360,7 @@ export const erpCountInputFormatter = (num: number | string | undefined) => {
|
||||
* @return 格式化后的数量
|
||||
*/
|
||||
export const erpCountTableColumnFormatter = (_, __, cellValue: any, ___) => {
|
||||
return erpNumberFormatter(cellValue, ERP_COUNT_DIGIT)
|
||||
return erpNumberFormatter(cellValue, ERP_COUNT_DIGIT)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -378,7 +372,7 @@ export const erpCountTableColumnFormatter = (_, __, cellValue: any, ___) => {
|
||||
* @return 格式化后的数量
|
||||
*/
|
||||
export const erpPriceInputFormatter = (num: number | string | undefined) => {
|
||||
return erpNumberFormatter(num, ERP_PRICE_DIGIT)
|
||||
return erpNumberFormatter(num, ERP_PRICE_DIGIT)
|
||||
}
|
||||
|
||||
// noinspection JSCommentMatchesSignature
|
||||
@@ -389,7 +383,7 @@ export const erpPriceInputFormatter = (num: number | string | undefined) => {
|
||||
* @return 格式化后的数量
|
||||
*/
|
||||
export const erpPriceTableColumnFormatter = (_, __, cellValue: any, ___) => {
|
||||
return erpNumberFormatter(cellValue, ERP_PRICE_DIGIT)
|
||||
return erpNumberFormatter(cellValue, ERP_PRICE_DIGIT)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -400,10 +394,10 @@ export const erpPriceTableColumnFormatter = (_, __, cellValue: any, ___) => {
|
||||
* @return 总价格。如果有任一为空,则返回 undefined
|
||||
*/
|
||||
export const erpPriceMultiply = (price: number, count: number) => {
|
||||
if (price == null || count == null) {
|
||||
return undefined
|
||||
}
|
||||
return parseFloat((price * count).toFixed(ERP_PRICE_DIGIT))
|
||||
if (price == null || count == null) {
|
||||
return undefined
|
||||
}
|
||||
return parseFloat((price * count).toFixed(ERP_PRICE_DIGIT))
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -415,8 +409,8 @@ export const erpPriceMultiply = (price: number, count: number) => {
|
||||
* @param total 总值
|
||||
*/
|
||||
export const erpCalculatePercentage = (value: number, total: number) => {
|
||||
if (total === 0) return 0
|
||||
return ((value / total) * 100).toFixed(2)
|
||||
if (total === 0) return 0
|
||||
return ((value / total) * 100).toFixed(2)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -425,13 +419,34 @@ export const erpCalculatePercentage = (value: number, total: number) => {
|
||||
* @param areaName 地区名称
|
||||
*/
|
||||
export const areaReplace = (areaName: string) => {
|
||||
if (!areaName) {
|
||||
if (!areaName) {
|
||||
return areaName
|
||||
}
|
||||
return areaName
|
||||
}
|
||||
return areaName
|
||||
.replace('维吾尔自治区', '')
|
||||
.replace('壮族自治区', '')
|
||||
.replace('回族自治区', '')
|
||||
.replace('自治区', '')
|
||||
.replace('省', '')
|
||||
.replace('维吾尔自治区', '')
|
||||
.replace('壮族自治区', '')
|
||||
.replace('回族自治区', '')
|
||||
.replace('自治区', '')
|
||||
.replace('省', '')
|
||||
}
|
||||
/**
|
||||
* bes64解密函数
|
||||
*
|
||||
* @param areaName 地区名称
|
||||
*/
|
||||
//
|
||||
export const decryptFromBase64 = (base64Str: string) => {
|
||||
try {
|
||||
const binaryStr = atob(base64Str)
|
||||
const encodedStr = binaryStr
|
||||
.split('')
|
||||
.map(char => {
|
||||
return '%' + ('00' + char.charCodeAt(0).toString(16)).slice(-2)
|
||||
})
|
||||
.join('')
|
||||
return decodeURIComponent(encodedStr)
|
||||
} catch (error) {
|
||||
console.error('解密出错:', error)
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user