2
0

Home.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  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. console.log(data)
  65. if (data.status === "success") data.stations.forEach(station => {
  66. if (station.type == 'official') _this.stations.official.push(station);
  67. else _this.stations.community.push(station);
  68. });
  69. });
  70. _this.socket.emit("apis.joinRoom", 'home', () => {});
  71. _this.socket.on('event:stations.created', (station) => {
  72. _this.stations[station.type].push(station);
  73. });
  74. clearInterval(socketInterval);
  75. }
  76. }, 100);
  77. },
  78. components: { MainHeader, MainFooter }
  79. }
  80. </script>
  81. <style lang="scss">
  82. @import 'theme.scss';
  83. * { box-sizing: border-box; }
  84. html {
  85. width: 100%;
  86. height: 100%;
  87. color: rgba(0, 0, 0, 0.87);
  88. body {
  89. width: 100%;
  90. height: 100%;
  91. margin: 0;
  92. padding: 0;
  93. }
  94. }
  95. @media only screen and (min-width: 1200px) {
  96. html {
  97. font-size: 15px;
  98. }
  99. }
  100. @media only screen and (min-width: 992px) {
  101. html {
  102. font-size: 14.5px;
  103. }
  104. }
  105. @media only screen and (min-width: 0) {
  106. html {
  107. font-size: 14px;
  108. }
  109. }
  110. .label {
  111. display: flex;
  112. }
  113. .g-recaptcha {
  114. display: flex;
  115. justify-content: center;
  116. margin-top: 20px;
  117. }
  118. .group {
  119. width: 100%;
  120. height: 448px;
  121. margin: 64px 0 0 0;
  122. .group-title {
  123. float: left;
  124. clear: none;
  125. width: 100%;
  126. height: 64px;
  127. line-height: 48px;
  128. text-align: center;
  129. font-size: 48px;
  130. }
  131. .group-stations {
  132. white-space: nowrap;
  133. text-align: center;
  134. overflow: hidden;
  135. float: left;
  136. clear: none;
  137. width: 100%;
  138. height: 400px;
  139. .stations-station {
  140. position: relative;
  141. top: 16px;
  142. display: inline-block;
  143. clear: none;
  144. width: 256px;
  145. height: 370px;
  146. margin: 0 16px 0 16px;
  147. box-shadow: 0 1px 6px 2px rgba(0, 0, 0, 0.25);
  148. cursor: pointer;
  149. .station-info {
  150. display: flex;
  151. flex-direction: row;
  152. align-items: center;
  153. }
  154. .station-image {
  155. width: 100%;
  156. height: 256px;
  157. object-fit: cover;
  158. }
  159. .station-grid-left {
  160. display: flex;
  161. flex-direction: column;
  162. width: 75%;
  163. text-align: left;
  164. padding-left: 10px;
  165. h3 {
  166. color: $blue;
  167. margin: 0;
  168. white-space: normal;
  169. padding-top: 10px;
  170. }
  171. p {
  172. margin: 0;
  173. white-space: normal;
  174. padding-top: 10px;
  175. }
  176. }
  177. .station-grid-right {
  178. display: flex;
  179. flex-direction: column;
  180. width: 25%;
  181. i {
  182. color: $blue;
  183. }
  184. }
  185. }
  186. }
  187. }
  188. </style>