|
|
|
@ -1,3 +1,5 @@ |
|
|
|
import { PREFIX } from '@/enums' |
|
|
|
|
|
|
|
/** |
|
|
|
*随机数 |
|
|
|
* @param {number} max |
|
|
|
@ -117,15 +119,8 @@ export const formatDay = (date: Date, format: 'y.m.d' | 'y/m/d' | 'y-m-d' = 'y-m |
|
|
|
return `${year}-${month}-${week}` |
|
|
|
} |
|
|
|
|
|
|
|
//判断当前系统
|
|
|
|
export const isAndroid = () => { |
|
|
|
const userAgent = navigator.userAgent |
|
|
|
const agents = ['Android', 'iPhone', 'iPad'] as const |
|
|
|
return agents.some(item => userAgent.includes(item)) |
|
|
|
} |
|
|
|
|
|
|
|
//指定key的图片类型加上前缀
|
|
|
|
export const addPrefixByRecursive = (data: any[], prefix = '/static/offline', exp = /\.(png|jpg|jpeg|JPG|PNG|MP4|mp4)$/) => { |
|
|
|
export const addPrefixByRecursive = (data: any[], prefix = PREFIX.STATIC_URL, exp = /\.(png|jpg|jpeg|JPG|PNG|MP4|mp4)$/) => { |
|
|
|
if (data && typeof data === 'object') { |
|
|
|
for (const key in data) { |
|
|
|
if (typeof data[key] === 'string' && exp.test(data[key])) { |
|
|
|
|