index.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <template>
  2. <view>
  3. <view class="cu-bar tabbar bg-tabbar shadow foot">
  4. <view class="action" @click="handleToHome">
  5. <view class="cuIcon-cu-image"><image :src="'../../static/tabBar/' + [currentPage == 'home' ? 'homeSel' : 'home'] + '.png'"></image></view>
  6. <view :class="currentPage == 'home' ? 'tabbar-text-active-color' : 'tabbar-text-color'" style="margin-top:2px">首页</view>
  7. </view>
  8. <view class="action" @click="handleToReport">
  9. <view class="cuIcon-cu-image"><image :src="'../../static/tabBar/' + [currentPage == 'report' ? 'reportSel' : 'report'] + '.png'"></image></view>
  10. <view :class="currentPage == 'report' ? 'tabbar-text-active-color' : 'tabbar-text-color'" style="margin-top:2px">报告</view>
  11. </view>
  12. <view class="action" @click="handleToDiscovery">
  13. <view class="cuIcon-cu-image"><image :src="'../../static/tabBar/' + [currentPage == 'index' ? 'discoverSel' : 'discover'] + '.png'"></image></view>
  14. <view :class="currentPage == 'index' ? 'tabbar-text-active-color' : 'tabbar-text-color'" style="margin-top:2px">发现</view>
  15. </view>
  16. <view class="action" @click="handleToMy">
  17. <view class="cuIcon-cu-image"><image :src="'../../static/tabBar/' + [currentPage == 'my' ? 'mySel' : 'my'] + '.png'"></image></view>
  18. <view :class="currentPage == 'my' ? 'tabbar-text-active-color' : 'tabbar-text-color'" style="margin-top:2px">我的</view>
  19. </view>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. import { mapState } from 'vuex';
  25. export default {
  26. props: {
  27. currentPage: {
  28. type: String,
  29. default: 'home'
  30. }
  31. },
  32. computed: mapState({
  33. playInfo: state => state.playInfo,
  34. paused: state => state.paused
  35. }),
  36. data() {
  37. return {
  38. time: null,
  39. rotate: 0
  40. };
  41. },
  42. created() {
  43. this.init();
  44. },
  45. methods: {
  46. init() {
  47. if (!this.paused) {
  48. this.initRotate();
  49. } else {
  50. clearInterval(this.timer);
  51. }
  52. },
  53. handleToPlay() {
  54. uni.navigateTo({
  55. url: '/pages/play/index'
  56. });
  57. },
  58. handleToDiscovery() {
  59. uni.navigateTo({
  60. url: '/pages/tabBar/find'
  61. });
  62. },
  63. handleToReport() {
  64. uni.navigateTo({
  65. url: '/pages/tabBar/report'
  66. });
  67. },
  68. handleToMy(){
  69. uni.navigateTo({
  70. url: '/pages/tabBar/my'
  71. });
  72. },
  73. handleToHome(){
  74. uni.reLaunch({
  75. url: '/pages/tabBar/home'
  76. });
  77. },
  78. initRotate() {
  79. this.timer = setInterval(() => {
  80. this.rotate += 15;
  81. }, 1000);
  82. }
  83. },
  84. watch: {
  85. paused() {
  86. this.init();
  87. }
  88. }
  89. };
  90. </script>
  91. <style lang="scss" scoped>
  92. .music-img {
  93. position: absolute;
  94. width: 35px;
  95. z-index: 2;
  96. height: 35px;
  97. border-radius: 50%;
  98. line-height: 35px;
  99. font-size: 25px;
  100. top: -17px;
  101. left: 0;
  102. right: 0;
  103. margin: auto;
  104. padding: 0;
  105. transition: all 1s linear;
  106. }
  107. </style>