Home.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. <template>
  2. <div class="app">
  3. <main-header></main-header>
  4. <login-modal></login-modal>
  5. <register-modal></register-modal>
  6. <div class="group" v-if="stations.official.length">
  7. <div class="group-title">Official Stations</div>
  8. <div class="group-stations">
  9. <div class="stations-station" v-for="station in stations.official" v-link="{ path: '/' + station.name }" @click="this.$dispatch('joinStation', station.id)">
  10. <img class="station-image" :src="station.playlist[station.currentSongIndex].thumbnail" />
  11. <div class="station-info">
  12. <div class="station-grid-left">
  13. <h3>{{ station.displayName }}</h3>
  14. <p>{{ station.description }}</p>
  15. </div>
  16. <div class="station-grid-right">
  17. <div>{{ station.userCount }}&nbsp;&nbsp;<i class="material-icons">perm_identity</i></div>
  18. </div>
  19. </div>
  20. </div>
  21. </div>
  22. </div>
  23. <div class="group" v-if="stations.community.length">
  24. <div class="group-title">Community Stations</div>
  25. <div class="group-stations">
  26. <div class="stations-station" v-for="station in stations.community" v-link="{ path: '/community/' + station.name }" @click="this.$dispatch('joinStation', station.id)">
  27. <img class="station-image" :src="station.playlist[station.currentSongIndex].thumbnail" />
  28. <div class="station-info">
  29. <div class="station-grid-left">
  30. <h3>{{ station.displayName }}</h3>
  31. <p>{{ station.description }}</p>
  32. </div>
  33. <div class="station-grid-right">
  34. <div>{{ station.userCount }}&nbsp;&nbsp;<i class="material-icons">perm_identity</i></div>
  35. </div>
  36. </div>
  37. </div>
  38. </div>
  39. </div>
  40. <main-footer></main-footer>
  41. </div>
  42. </template>
  43. <script>
  44. import MainHeader from '../MainHeader.vue';
  45. import MainFooter from '../MainFooter.vue';
  46. import LoginModal from '../Modals/Login.vue';
  47. import RegisterModal from '../Modals/Register.vue';
  48. export default {
  49. data() {
  50. return {
  51. isRegisterActive: false,
  52. isLoginActive: false,
  53. recaptcha: {
  54. key: ''
  55. },
  56. stations: {
  57. official: [],
  58. community: []
  59. }
  60. }
  61. },
  62. ready() {
  63. let _this = this;
  64. let socketInterval = setInterval(() => {
  65. if (!!_this.$parent.socket) {
  66. _this.socket = _this.$parent.socket;
  67. _this.socket.emit("stations.index", data => {
  68. if (data.status === "success") data.stations.forEach(station => {
  69. if (station.type == 'official') _this.stations.official.push(station);
  70. else _this.stations.community.push(station);
  71. });
  72. });
  73. _this.socket.emit("");
  74. _this.socket.on("");
  75. clearInterval(socketInterval);
  76. }
  77. }, 100);
  78. },
  79. methods: {
  80. toggleModal: function(type) {
  81. switch(type) {
  82. case 'register':
  83. this.isRegisterActive = !this.isRegisterActive;
  84. break;
  85. case 'login':
  86. this.isLoginActive = !this.isLoginActive;
  87. break;
  88. }
  89. },
  90. submitModal: function(type) {
  91. switch(type) {
  92. case 'register':
  93. this.$dispatch('register');
  94. this.toggleModal('register');
  95. break;
  96. case 'login':
  97. this.$dispatch('login');
  98. this.toggleModal('login');
  99. break;
  100. }
  101. }
  102. },
  103. components: { MainHeader, MainFooter, LoginModal, RegisterModal }
  104. }
  105. </script>
  106. <style lang="scss">
  107. @import 'theme.scss';
  108. * { box-sizing: border-box; }
  109. html {
  110. width: 100%;
  111. height: 100%;
  112. color: rgba(0, 0, 0, 0.87);
  113. body {
  114. width: 100%;
  115. height: 100%;
  116. margin: 0;
  117. padding: 0;
  118. }
  119. }
  120. @media only screen and (min-width: 1200px) {
  121. html {
  122. font-size: 15px;
  123. }
  124. }
  125. @media only screen and (min-width: 992px) {
  126. html {
  127. font-size: 14.5px;
  128. }
  129. }
  130. @media only screen and (min-width: 0) {
  131. html {
  132. font-size: 14px;
  133. }
  134. }
  135. .label {
  136. display: flex;
  137. }
  138. .g-recaptcha {
  139. display: flex;
  140. justify-content: center;
  141. margin-top: 20px;
  142. }
  143. .group {
  144. width: 100%;
  145. height: 448px;
  146. margin: 64px 0 0 0;
  147. .group-title {
  148. float: left;
  149. clear: none;
  150. width: 100%;
  151. height: 64px;
  152. line-height: 48px;
  153. text-align: center;
  154. font-size: 48px;
  155. }
  156. .group-stations {
  157. white-space: nowrap;
  158. text-align: center;
  159. overflow: hidden;
  160. float: left;
  161. clear: none;
  162. width: 100%;
  163. height: 400px;
  164. .stations-station {
  165. position: relative;
  166. top: 16px;
  167. display: inline-block;
  168. clear: none;
  169. width: 256px;
  170. height: 370px;
  171. margin: 0 16px 0 16px;
  172. box-shadow: 0 1px 6px 2px rgba(0, 0, 0, 0.25);
  173. cursor: pointer;
  174. .station-info {
  175. display: flex;
  176. flex-direction: row;
  177. align-items: center;
  178. }
  179. .station-image {
  180. width: 100%;
  181. height: 256px;
  182. object-fit: cover;
  183. }
  184. .station-grid-left {
  185. display: flex;
  186. flex-direction: column;
  187. width: 75%;
  188. text-align: left;
  189. padding-left: 10px;
  190. h3 {
  191. color: $blue;
  192. margin: 0;
  193. white-space: normal;
  194. padding-top: 10px;
  195. }
  196. p {
  197. margin: 0;
  198. white-space: normal;
  199. padding-top: 10px;
  200. }
  201. }
  202. .station-grid-right {
  203. display: flex;
  204. flex-direction: column;
  205. width: 25%;
  206. i {
  207. color: $blue;
  208. }
  209. }
  210. }
  211. }
  212. }
  213. </style>