统一排行榜对齐星雀UI,页面资源后台配置实时刷新

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
XingQue
2026-06-27 01:26:11 +08:00
parent 1ab2e2080a
commit 21112173f2
292 changed files with 64010 additions and 81 deletions

View File

@@ -0,0 +1,74 @@
// /utils/imageUrl.js - 统一的COS图片路径管理
const app = getApp();
/**
* 获取完整的COS图片URL
* @param {string} path - 图片相对路径,如 'a_long/images/common/arrow-down.png'
* @returns {string} 完整的URL
*/
export function getImageUrl(path) {
if (!app || !app.globalData || !app.globalData.ossImageUrl) {
console.warn('⚠️ App.globalData.ossImageUrl 未初始化');
return path; // 返回原路径作为fallback
}
// 如果已经是完整URL直接返回
if (path.startsWith('http')) {
return path;
}
// 拼接完整URL
return app.globalData.ossImageUrl + path;
}
/**
* 获取常用图片的URL
*/
export const imageUrls = {
// 身份相关
identityIcon: 'a_long/images/identity/identity-icon.png',
arrowDown: 'a_long/images/common/arrow-down.png',
bossIcon: 'a_long/images/identity/boss-icon.png',
dashouIcon: 'a_long/images/identity/dashou-icon.png',
shangjiaIcon: 'a_long/images/identity/shangjia-icon.png',
// 公共图标
actionIcon: 'a_long/images/common/action.png',
emptyMessage: 'a_long/images/common/empty-message.png',
// 通知相关
notificationOn: 'a_long/images/notifications/notification-on.png',
notificationOff: 'a_long/images/notifications/notification-off.png',
// TabBar图标
tabbarHome: 'a_long/images/tabbar/home.png',
tabbarHomeActive: 'a_long/images/tabbar/home-active.png',
tabbarCategory: 'a_long/images/tabbar/category.png',
tabbarCategoryActive: 'a_long/images/tabbar/category-active.png',
tabbarMessage: 'a_long/images/tabbar/message.png',
tabbarMessageActive: 'a_long/images/tabbar/message-active.png',
tabbarProfile: 'a_long/images/tabbar/profile.png',
tabbarProfileActive: 'a_long/images/tabbar/profile-active.png',
// 用户相关
defaultAvatar: 'a_long/images/common/default-avatar.png'
};
/**
* 预加载常用图片
*/
export function preloadCommonImages() {
const images = Object.values(imageUrls).map(path => getImageUrl(path));
images.forEach(src => {
wx.getImageInfo({
src: src,
success: () => {
console.log('✅ 图片预加载成功:', src);
},
fail: (err) => {
console.warn('⚠️ 图片预加载失败:', src, err);
}
});
});
}