mirror of
https://github.com/ialley-workshop-open/uni-halo.git
synced 2026-07-27 04:20:43 +08:00
759373e327
1. 重构tabbar路由与多语言key,调整首页默认跳转 2. 拆分博客页面到subpkg目录,调整vite分包配置 3. 新增markdown、图片组件、滚动钩子等工具模块 4. 优化api类型定义与工具函数,修复图片缓存逻辑 5. 调整国际化文案与个人页面路径
34 lines
922 B
TypeScript
34 lines
922 B
TypeScript
import { sleep } from '@/utils/common'
|
|
|
|
export const randomImageUrl = {
|
|
ycy: 'https://t.alcy.cc/ycy',
|
|
pc: 'https://t.alcy.cc/pc',
|
|
moemp: 'https://t.alcy.cc/moemp',
|
|
picsum: 'https://picsum.photos/800/600',
|
|
bing: 'https://bing.img.run/rand_uhd.php',
|
|
xsot: 'https://api.xsot.cn/bing?jump=true',
|
|
}
|
|
|
|
type randomUrlKeys = keyof typeof randomImageUrl
|
|
|
|
export const randomVideosUrl = {
|
|
acg: 'https://t.alcy.cc/acg',
|
|
}
|
|
|
|
export function getPicSumImages(width: number = 800, height?: number) {
|
|
const t = `${Date.now()}+${Math.random()}`
|
|
if (!height) {
|
|
return `https://picsum.photos/${width}?t=${t}`
|
|
}
|
|
return `https://picsum.photos/${width}/${height}?t=${t}`
|
|
}
|
|
|
|
/**
|
|
* 获取随机图片URL
|
|
* @param type 图片类型 默认pc
|
|
* @returns 随机图片URL
|
|
*/
|
|
export function getRandomUrl(type?: randomUrlKeys) {
|
|
return `${randomImageUrl[type || 'pc' as randomUrlKeys]}?t=${Date.now()}+${Math.random()}`
|
|
}
|