Admin.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. <template>
  2. <div class="app">
  3. <main-header />
  4. <div class="tabs is-centered">
  5. <ul>
  6. <li
  7. :class="{ 'is-active': currentTab == 'queueSongs' }"
  8. @click="showTab('queueSongs')"
  9. >
  10. <router-link to="/admin/queuesongs">
  11. <i class="material-icons">queue_music</i>
  12. <span>&nbsp;Queue Songs</span>
  13. </router-link>
  14. </li>
  15. <li
  16. :class="{ 'is-active': currentTab == 'songs' }"
  17. @click="showTab('songs')"
  18. >
  19. <router-link to="/admin/songs">
  20. <i class="material-icons">music_note</i>
  21. <span>&nbsp;Songs</span>
  22. </router-link>
  23. </li>
  24. <li
  25. :class="{ 'is-active': currentTab == 'stations' }"
  26. @click="showTab('stations')"
  27. >
  28. <router-link to="/admin/stations">
  29. <i class="material-icons">hearing</i>
  30. <span>&nbsp;Stations</span>
  31. </router-link>
  32. </li>
  33. <li
  34. :class="{ 'is-active': currentTab == 'reports' }"
  35. @click="showTab('reports')"
  36. >
  37. <router-link to="/admin/reports">
  38. <i class="material-icons">report_problem</i>
  39. <span>&nbsp;Reports</span>
  40. </router-link>
  41. </li>
  42. <li
  43. :class="{ 'is-active': currentTab == 'news' }"
  44. @click="showTab('news')"
  45. >
  46. <router-link to="/admin/news">
  47. <i class="material-icons">chrome_reader_mode</i>
  48. <span>&nbsp;News</span>
  49. </router-link>
  50. </li>
  51. <li
  52. :class="{ 'is-active': currentTab == 'users' }"
  53. @click="showTab('users')"
  54. >
  55. <router-link to="/admin/users">
  56. <i class="material-icons">person</i>
  57. <span>&nbsp;Users</span>
  58. </router-link>
  59. </li>
  60. <li
  61. :class="{ 'is-active': currentTab == 'statistics' }"
  62. @click="showTab('statistics')"
  63. >
  64. <router-link to="/admin/statistics">
  65. <i class="material-icons">show_chart</i>
  66. <span>&nbsp;Statistics</span>
  67. </router-link>
  68. </li>
  69. <li
  70. :class="{ 'is-active': currentTab == 'punishments' }"
  71. @click="showTab('punishments')"
  72. >
  73. <router-link to="/admin/punishments">
  74. <i class="material-icons">gavel</i>
  75. <span>&nbsp;Punishments</span>
  76. </router-link>
  77. </li>
  78. </ul>
  79. </div>
  80. <queue-songs v-if="currentTab == 'queueSongs'" />
  81. <songs v-if="currentTab == 'songs'" />
  82. <stations v-if="currentTab == 'stations'" />
  83. <reports v-if="currentTab == 'reports'" />
  84. <news v-if="currentTab == 'news'" />
  85. <users v-if="currentTab == 'users'" />
  86. <statistics v-if="currentTab == 'statistics'" />
  87. <punishments v-if="currentTab == 'punishments'" />
  88. </div>
  89. </template>
  90. <script>
  91. import MainHeader from "../MainHeader.vue";
  92. import QueueSongs from "../Admin/QueueSongs.vue";
  93. import Songs from "../Admin/Songs.vue";
  94. import Stations from "../Admin/Stations.vue";
  95. import Reports from "../Admin/Reports.vue";
  96. import News from "../Admin/News.vue";
  97. import Users from "../Admin/Users.vue";
  98. import Statistics from "../Admin/Statistics.vue";
  99. import Punishments from "../Admin/Punishments.vue";
  100. export default {
  101. components: {
  102. MainHeader,
  103. QueueSongs,
  104. Songs,
  105. Stations,
  106. Reports,
  107. News,
  108. Users,
  109. Statistics,
  110. Punishments
  111. },
  112. data() {
  113. return {
  114. currentTab: "queueSongs"
  115. };
  116. },
  117. mounted() {
  118. this.changeTab(this.$route.path);
  119. },
  120. watch: {
  121. $route(route) {
  122. this.changeTab(route.path);
  123. }
  124. },
  125. methods: {
  126. changeTab: function(path) {
  127. switch (path) {
  128. case "/admin/queuesongs":
  129. this.currentTab = "queueSongs";
  130. break;
  131. case "/admin/songs":
  132. this.currentTab = "songs";
  133. break;
  134. case "/admin/stations":
  135. this.currentTab = "stations";
  136. break;
  137. case "/admin/reports":
  138. this.currentTab = "reports";
  139. break;
  140. case "/admin/news":
  141. this.currentTab = "news";
  142. break;
  143. case "/admin/users":
  144. this.currentTab = "users";
  145. break;
  146. case "/admin/statistics":
  147. this.currentTab = "statistics";
  148. break;
  149. case "/admin/punishments":
  150. this.currentTab = "punishments";
  151. break;
  152. default:
  153. this.currentTab = "queueSongs";
  154. }
  155. },
  156. showTab: function(tab) {
  157. this.currentTab = tab;
  158. }
  159. }
  160. };
  161. </script>
  162. <style lang="scss" scoped>
  163. .is-active a {
  164. color: #03a9f4 !important;
  165. border-color: #03a9f4 !important;
  166. }
  167. </style>