feat: 统一文件上传接口 + 模板图片展示 + 导航页 + 侧边栏调整

This commit is contained in:
admin
2026-07-10 20:43:02 +08:00
parent cbd0430452
commit ce6823e282
25 changed files with 933 additions and 166 deletions

View File

@@ -1023,12 +1023,23 @@ img { max-width: 100%; display: block; }
function renderAppIcon(app, size) {
size = size || 64;
var radius = Math.round(size * 0.28);
if (app.icon && (app.icon.indexOf('http') === 0 || app.icon.indexOf('/') === 0)) {
return '<div class="app-icon-wrap" style="width:' + size + 'px;height:' + size + 'px;border-radius:' + radius + 'px"><img src="' + escapeHtml(app.icon) + '" class="app-icon-img" alt="' + escapeHtml(app.name) + '" loading="lazy"></div>';
var iconURL = '';
if (app.icon) {
var v = String(app.icon).trim();
if (v.indexOf('/uploads/') === 0 || v.indexOf('http://') === 0 || v.indexOf('https://') === 0) {
iconURL = v;
}
}
var grad = generateGradient(app.name);
var letter = (app.name || '?').charAt(0).toUpperCase();
return '<div class="app-icon-wrap" style="background:' + grad + ';width:' + size + 'px;height:' + size + 'px;border-radius:' + radius + 'px">' + escapeHtml(letter) + '</div>';
var wrapStyle = 'width:' + size + 'px;height:' + size + 'px;border-radius:' + radius + 'px';
if (iconURL) {
return '<div class="app-icon-wrap" style="background:' + grad + ';' + wrapStyle + '">' +
'<img src="' + escapeHtml(iconURL) + '" class="app-icon-img" alt="' + escapeHtml(app.name) + '" loading="lazy" style="position:absolute;inset:0" onerror="this.style.display=\'none\';this.nextElementSibling.style.display=\'block\'">' +
'<span style="display:none">' + escapeHtml(letter) + '</span>' +
'</div>';
}
return '<div class="app-icon-wrap" style="background:' + grad + ';' + wrapStyle + '">' + escapeHtml(letter) + '</div>';
}
// ==================== API ====================