feat: 统一文件上传接口 + 模板图片展示 + 导航页 + 侧边栏调整
This commit is contained in:
20
web/dist/music2/index.html
vendored
20
web/dist/music2/index.html
vendored
@@ -1379,9 +1379,6 @@ function generateCover(title) {
|
||||
}
|
||||
|
||||
function getCoverBg(song) {
|
||||
if (song && song.cover) {
|
||||
return 'background-image:url(\'' + song.cover + '\');background-size:cover;background-position:center;';
|
||||
}
|
||||
return 'background:' + generateCover(song ? song.title : '') + ';';
|
||||
}
|
||||
|
||||
@@ -1442,6 +1439,7 @@ function renderHot(songs) {
|
||||
html += '<div class="chart-item" data-song-id="' + song.id + '">' +
|
||||
'<div class="chart-rank">' + rank + '</div>' +
|
||||
'<div class="chart-cover" style="' + getCoverBg(song) + '">' +
|
||||
(song.cover ? '<img src="' + song.cover + '" alt="" style="position:absolute;inset:0;width:100%;height:100%;object-fit:cover" onerror="this.style.display=\'none\'">' : '') +
|
||||
'<div style="position:absolute;width:10px;height:10px;border-radius:50%;background:rgba(0,0,0,0.4);top:50%;left:50%;transform:translate(-50%,-50%)"></div>' +
|
||||
'</div>' +
|
||||
'<div class="chart-info">' +
|
||||
@@ -1482,6 +1480,7 @@ function renderNew(songs) {
|
||||
'<div class="album-sleeve">' +
|
||||
'<div class="new-stamp">NEW</div>' +
|
||||
'<div class="album-cover-bg" style="' + getCoverBg(song) + '">' +
|
||||
(song.cover ? '<img src="' + song.cover + '" alt="" style="position:absolute;inset:0;width:100%;height:100%;object-fit:cover" onerror="this.style.display=\'none\'">' : '') +
|
||||
'<div class="album-cover-text">' + tagText + '</div>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
@@ -1523,7 +1522,7 @@ function renderLibrary(data) {
|
||||
if (song.is_new) badges.push('<span class="lib-tag new">NEW</span>');
|
||||
html += '<div class="library-row" data-song-id="' + song.id + '">' +
|
||||
'<div class="lib-rank">' + rank + '</div>' +
|
||||
'<div class="lib-cover" style="' + getCoverBg(song) + '"></div>' +
|
||||
'<div class="lib-cover" style="' + getCoverBg(song) + '">' + (song.cover ? '<img src="' + song.cover + '" alt="" style="position:absolute;inset:0;width:100%;height:100%;object-fit:cover" onerror="this.style.display=\'none\'">' : '') + '</div>' +
|
||||
'<div class="lib-title">' + song.title + badges.join('') + '</div>' +
|
||||
'<div class="lib-artist">' + song.artist + '</div>' +
|
||||
'<div class="lib-plays">' + formatNumber(song.play_count) + '</div>' +
|
||||
@@ -1647,10 +1646,17 @@ async function playSong(songId) {
|
||||
|
||||
// Cover on vinyl label
|
||||
const vinylLarge = document.getElementById('np-vinyl-large');
|
||||
vinylLarge.style.background = 'radial-gradient(circle at center, #c0392b 0%, #c0392b 14%, #0a0806 14.5%, #1a1410 16%, #0a0806 17%, #15100a 100%)';
|
||||
var oldVinylImg = vinylLarge.querySelector('img.vinyl-cover-img');
|
||||
if (oldVinylImg) oldVinylImg.remove();
|
||||
if (song.cover) {
|
||||
vinylLarge.style.background = 'url(\'' + song.cover + '\') center/cover';
|
||||
} else {
|
||||
vinylLarge.style.background = 'radial-gradient(circle at center, #c0392b 0%, #c0392b 14%, #0a0806 14.5%, #1a1410 16%, #0a0806 17%, #15100a 100%)';
|
||||
var vinylImg = document.createElement('img');
|
||||
vinylImg.className = 'vinyl-cover-img';
|
||||
vinylImg.src = song.cover;
|
||||
vinylImg.alt = '';
|
||||
vinylImg.style.cssText = 'position:absolute;inset:0;width:100%;height:100%;object-fit:cover;border-radius:50%;z-index:1';
|
||||
vinylImg.onerror = function(){ this.style.display='none'; };
|
||||
vinylLarge.insertBefore(vinylImg, vinylLarge.firstChild);
|
||||
}
|
||||
|
||||
// Show panel
|
||||
|
||||
Reference in New Issue
Block a user