mirror of
https://github.com/ialley-workshop-open/uni-halo.git
synced 2026-07-27 04:20:43 +08:00
f105dedc23
1. 新增全局配置管理store,拉取uni-halo插件配置 2. 新增post-card文章卡片组件,简化首页文章列表代码 3. 优化tabbar样式与切换逻辑,调整图标库类型 4. 新增随机图片工具函数,重构首页横幅与分类模块 5. 调整openapi生成配置,新增工具类与样式类 6. 移除废弃的tabbar关于页面配置项
31 lines
808 B
TypeScript
31 lines
808 B
TypeScript
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 getPicsum(width: number = 800, height?: number) {
|
|
if (!height) {
|
|
return `https://picsum.photos/${width}`
|
|
}
|
|
return `https://picsum.photos/${width}/${height}`
|
|
}
|
|
|
|
/**
|
|
* 获取随机图片URL
|
|
* @param type 图片类型
|
|
* @returns 随机图片URL
|
|
*/
|
|
export function getRandomUrl(type?: randomUrlKeys) {
|
|
return `${randomImageUrl[type || 'pc' as randomUrlKeys]}?t=${Date.now()}+${Math.random()}`
|
|
}
|