Home.vue 4.6 KB

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