Home.vue 4.4 KB

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