feat: 统一文件上传接口 + 模板图片展示 + 导航页 + 侧边栏调整
This commit is contained in:
15
web/dist/app2/index.html
vendored
15
web/dist/app2/index.html
vendored
@@ -1093,18 +1093,25 @@ function hashString(str) {
|
||||
return Math.abs(hash);
|
||||
}
|
||||
|
||||
function isIconURL(icon) {
|
||||
if (!icon) return false;
|
||||
var v = String(icon).trim();
|
||||
return v.indexOf('/uploads/') === 0 || v.indexOf('http://') === 0 || v.indexOf('https://') === 0;
|
||||
}
|
||||
|
||||
function generateIconHTML(app, size) {
|
||||
if (app.icon && app.icon.trim()) {
|
||||
return '<img class="app-icon-img" src="' + escapeHtml(app.icon) + '" alt="' + escapeHtml(app.name) + '" loading="lazy">';
|
||||
}
|
||||
var iconURL = isIconURL(app.icon) ? String(app.icon).trim() : '';
|
||||
const hash = hashString(app.name || 'A');
|
||||
const hue1 = hash % 360;
|
||||
const hue2 = (hash * 7 + 120) % 360;
|
||||
const initial = (app.name || '?').charAt(0);
|
||||
const borderHue = hue1;
|
||||
return '<div class="app-icon-placeholder" style="background:linear-gradient(135deg,hsl(' + hue1 + ',60%,12%),hsl(' + hue2 + ',55%,18%));border-color:hsl(' + borderHue + ',80%,45%);box-shadow:0 0 12px hsla(' + borderHue + ',80%,50%,0.3);">' +
|
||||
var imgHTML = iconURL ? '<img class="app-icon-img" src="' + escapeHtml(iconURL) + '" alt="' + escapeHtml(app.name) + '" loading="lazy" onerror="this.style.display=\'none\';this.nextElementSibling.style.display=\'flex\'">' : '';
|
||||
var placeholderStyle = 'background:linear-gradient(135deg,hsl(' + hue1 + ',60%,12%),hsl(' + hue2 + ',55%,18%));border-color:hsl(' + borderHue + ',80%,45%);box-shadow:0 0 12px hsla(' + borderHue + ',80%,50%,0.3);' + (iconURL ? 'display:none' : '');
|
||||
var placeholderHTML = '<div class="app-icon-placeholder" style="' + placeholderStyle + '">' +
|
||||
'<span style="color:hsl(' + hue1 + ',85%,60%);text-shadow:0 0 8px hsla(' + hue1 + ',85%,50%,0.5)">' + escapeHtml(initial) + '</span>' +
|
||||
'</div>';
|
||||
return imgHTML + placeholderHTML;
|
||||
}
|
||||
|
||||
function escapeHtml(str) {
|
||||
|
||||
Reference in New Issue
Block a user