index.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <template>
  2. <view class="radius shadow fotter-container" v-if="playInfo">
  3. <view class="fixed-container" @click.stop="toSongDetail">
  4. <view class="cu-avatar playImage round" :style="'background-image:url(' + playInfo.coverImgUrl + ')'"></view>
  5. <view class="play-center">
  6. <view class="music-name">{{ playInfo.title }}</view>
  7. <!-- <view class="music-author">{{ playInfo.singer }}</view> -->
  8. </view>
  9. <view class="play-right">
  10. <view class="play-list relative" @click.stop="changePlaying">
  11. <text :class="['iconfont', !paused ? 'icon-playStop' : 'icon-playStart']" style="font-size: 28px"></text>
  12. </view>
  13. <text class="iconfont icon-liebiao play-list" @click.stop="modelShow = true"></text>
  14. </view>
  15. </view>
  16. <play-list v-model="modelShow"></play-list>
  17. </view>
  18. </template>
  19. <script>
  20. import playList from './playList.vue';
  21. import { mapState } from 'vuex';
  22. export default {
  23. data() {
  24. return {
  25. modelShow: false
  26. };
  27. },
  28. components: {
  29. playList
  30. },
  31. computed: mapState({
  32. playInfo: state => state.playInfo,
  33. paused: state => state.paused
  34. }),
  35. methods: {
  36. //修改播放状态
  37. changePlaying() {
  38. let list = this.$audio.audiolist;
  39. let index = list.findIndex(item => item.id == this.playInfo.id);
  40. this.$audio.operate(index);
  41. this.$store.commit('SET_PASUED', !this.paused);
  42. },
  43. toSongDetail() {
  44. if (this.modelShow) return;
  45. uni.navigateTo({
  46. url: '../play/index'
  47. });
  48. }
  49. }
  50. };
  51. </script>
  52. <style lang="scss" scoped>
  53. .fotter-container {
  54. height: 110rpx;
  55. width: 100%;
  56. // position: fixed;
  57. // bottom: 0px;
  58. // left: 0;
  59. z-index: 9999;
  60. .fixed-container {
  61. position: fixed;
  62. z-index: 20;
  63. width: 100%;
  64. height: 110rpx;
  65. bottom: 0px;
  66. // box-shadow: 0 1px 2px rgb(0, 21, 0.1);
  67. display: flex;
  68. background: rgba(22, 125, 242, 1);;
  69. }
  70. .playImage {
  71. width: 80rpx;
  72. height: 80rpx;
  73. margin: auto 15px auto 10px;
  74. }
  75. .play-center {
  76. flex: auto;
  77. display: flex;
  78. flex-wrap: wrap;
  79. align-content: center;
  80. max-width: calc(100% - 300rpx);
  81. .music-name {
  82. color: #ffffff;
  83. font-size: 32rpx;
  84. margin-bottom: 4px;
  85. width: 100%;
  86. overflow: hidden;
  87. text-overflow: ellipsis;
  88. white-space: nowrap;
  89. }
  90. .music-author {
  91. font-size: 24rpx;
  92. color: rgba(0, 0, 0, 0.5);
  93. width: 100%;
  94. }
  95. }
  96. .play-right {
  97. width: 92px;
  98. display: flex;
  99. justify-content: space-between;
  100. align-items: center;
  101. .play-list {
  102. font-size: 30px;
  103. margin-right: 12px;
  104. }
  105. }
  106. }
  107. </style>