1 Star 0 Fork 0

李业锋/musicH5

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
index.html 2.59 KB
一键复制 编辑 原始数据 按行查看 历史
李业锋 提交于 2023-12-01 15:51 . h5-music
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>lyf音乐</title>
<style>
body{
margin: 0;
padding:0;
}
body>.title{
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 50px;
background: rgb(77, 85, 237);
text-align: center;
line-height: 50px;
font-size: 30px;
color: aliceblue;
z-index: 9;
}
.list{
padding: 50px 10px 10px;
box-sizing: border-box;
}
.list .item{
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 10px;
}
.img-wrap{
position: relative;
width: 20vw;
height: 20vw;
background-color: rgb(227, 242, 237);
overflow: hidden;
border-radius: 10px;
}
.img-wrap img{
position: absolute;
top: 50%;
width: 100%;
transform: translateY(-50%);
}
.item .title{
width: 63vw;
height: 50px;
font-size: 20px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.item .play{
font-size: 30px;
}
</style>
<script src="./js/axios.js"></script>
</head>
<body>
<div class="title">lyf音乐</div>
<div class="list" id="list">
<!-- <div class="item">
<div class="img-wrap">
<img src="" alt="" srcset="">
</div>
<div class="title">我事个名字和萨哈哈哈哈哈哈哈哈哈</div>
<div class="play">▶️</div>
</div> -->
</div>
</body>
<script>
window.onload=()=>{
let list=document.getElementById("list")
axios.get("/musicApi/top/artists?offset=0&limit=30").then(res=>{
if(res.status==200){
let str=""
res.data.artists.forEach(item=>{
let url=item.picUrl+'?param=200y200'
str+=`
<div class="item" data-id="${item.id}" data-url="${item.picUrl+'?param=200y200'}">
<div class="img-wrap">
<img src="${url}" >
</div>
<div class="title">${item.name}</div>
<div class="play">...</div>
</div>
`
})
list.innerHTML=str
setTimeout(() => {
let items=list.querySelectorAll(".item")
items.forEach((i,index)=>{
i.onclick=()=>{
let id=res.data.artists[index].id
let url=res.data.artists[index].picUrl
window.location.href=`/music/playerDetail.html?id=${id}&src=${url}`
}
})
}, 500);
}
})
}
</script>
</html>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/liyefeng123/music-h5.git
[email protected]:liyefeng123/music-h5.git
liyefeng123
music-h5
musicH5
master

搜索帮助