当前位置:   article > 正文

微信小程序-实现音乐播放页(flex)_微信小程序音乐界面

微信小程序音乐界面

音乐小程序播放页自适应布局,tab栏切换

index.wxml

  1. <image class="bg-img" mode="aspectFill" src="{{currentSong.al.picUrl}}"></image>
  2. <view class="bg-cover"></view>
  3. <view class="">
  4. <nav-bar>
  5. <view class="tab" slot="title">
  6. <view style="color:{{currentIndex === 0?'white':''}}">歌曲</view>
  7. <view class="divider">|</view>
  8. <view style="color:{{currentIndex === 1?'white':''}}" bindtap="handleLyric">歌词</view>
  9. </view>
  10. </nav-bar>
  11. <swiper class="swiper" style="height:{{countHeight}}px" bindchange="handleSwiperChange">
  12. <swiper-item class="music">
  13. <view class="album">
  14. <image class="img" src="{{currentSong.al.picUrl}}"></image>
  15. </view>
  16. <view class="info">
  17. <view class="title">{{currentSong.name}}</view>
  18. <view class="subtitle">
  19. <view class="singer">
  20. <block wx:for="{{currentSong.ar}}" wx:key="id">
  21. <text v-if="{{currentSong.length !== index+1}}">{{item.name}} /</text>
  22. <text v-if="{{currentSong.length === index+1}}">{{item.name}}</text>
  23. </block>
  24. </view>
  25. <view class="alias" wx:if="{{currentSong.alia.length}}">专辑:{{currentSong.alia[0]}}</view>
  26. </view>
  27. </view>
  28. <view class="music-lyric">我是歌词,呵呵哈哈哈</view>
  29. <view class="progress">
  30. <slider class="slider" block-size="{{16}}"></slider>
  31. <view class="time">
  32. <view class="current">2:99</view>
  33. <view class="duration">{{duration}}</view>
  34. </view>
  35. </view>
  36. <view class="option">
  37. <image class="btn btn-mode" src="/assets/images/player/play_order.png"> </image>
  38. <image class="btn btn-prev" src="/assets/images/player/play_prev.png"> </image>
  39. <image class="btn btn-pause" src="/assets/images/player/play_pause.png"> </image>
  40. <image class="btn btn-next" src="/assets/images/player/play_next.png"> </image>
  41. <image class="btn btn-music" src="/assets/images/player/play_music.png"> </image>
  42. </view>
  43. </swiper-item>
  44. <swiper-item class="lyric">2</swiper-item>
  45. </swiper>
  46. </view>

index.wxss

  1. /* pages/music-player/index.wxss */
  2. page{
  3. width: 100%;
  4. }
  5. .bg-img ,.bg-cover{
  6. position: fixed;
  7. z-index: -1;
  8. top:0;
  9. left: 0;
  10. width: 100%;
  11. height: 100%;
  12. }
  13. .bg-cover{
  14. background-color: rgba(0,0,0,.5);
  15. backdrop-filter: blur(10px);
  16. }
  17. .tab{
  18. display: flex;
  19. font-size: 28rpx;
  20. justify-content: center;
  21. color: rgb(209, 202, 202);
  22. }
  23. .divider{
  24. margin: 0 20rpx;
  25. }
  26. .music{
  27. display: flex;
  28. flex-direction: column;
  29. box-sizing: border-box;
  30. padding:0 40rpx;
  31. }
  32. .album{
  33. flex: 7;
  34. }
  35. .album .img{
  36. width: 100%;
  37. height: 100%;
  38. border-radius: 20rpx;
  39. }
  40. .info{
  41. color: #fff;
  42. }
  43. .info .title{
  44. margin: 20rpx 0;
  45. font-size: 36rpx;
  46. }
  47. .info .subtitle{
  48. font-size: 28rpx;
  49. color: #ccc;
  50. line-height: 50rpx;
  51. }
  52. .music-lyric{
  53. margin-top: 40rpx;
  54. color: #fff;
  55. font-size: 32rpx;
  56. text-align: center;
  57. }
  58. .time{
  59. display: flex;
  60. justify-content: space-between;
  61. color: #fff;
  62. font-size: 28rpx;
  63. margin:0 30rpx;
  64. }
  65. .slider{
  66. margin: 10rpx;
  67. }
  68. .option{
  69. display: flex;
  70. flex: 1;
  71. justify-content: space-between;
  72. align-items: center;
  73. padding-bottom: 20rpx;
  74. }
  75. .btn-mode,.btn-music{
  76. width: 70rpx;
  77. height: 70rpx;
  78. }
  79. .btn-prev,.btn-next{
  80. width: 70rpx;
  81. height: 70rpx;
  82. }
  83. .btn-pause{
  84. width: 140rpx;
  85. height: 140rpx;
  86. }

 完整项目请移步gitee:https://gitee.com/yue_yue_wang/wymusic

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Monodyee/article/detail/616325
推荐阅读
相关标签
  

闽ICP备14008679号