index.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398
  1. <template>
  2. <view class="container">
  3. <div class="top">
  4. <div class="header">
  5. <img class="logo" src="/static/logo_big.png" alt="">
  6. <u--image
  7. class="border"
  8. :showLoading="true"
  9. :src="info.avatar || '/static/image/match/teams_avatar_ico@2x.png'"
  10. @click="go('/pages/Match/member/usermanger', true)"
  11. width="24px"
  12. height="24px"
  13. shape="circle"
  14. ></u--image>
  15. </div>
  16. <div class="title-box">
  17. <!-- Videos -->
  18. {{ $t('video.lab') }}
  19. </div>
  20. <div class="bar-list">
  21. <div class="item" :class="{'active': item.id == barId}" v-for="item in barList" :key="item.id" @click="changeBar(item.id)">{{ item.name }}</div>
  22. </div>
  23. </div>
  24. <div class="banner-box" :class="{'fadeInBtm': animationLoaded}" v-if="bannerInfo.id" @click="onTap(bannerInfo.id)">
  25. <img class="img" :src="bannerInfo.flie[0].img" alt="">
  26. <div class="info-box">
  27. <div class="title text-clamp2">{{ bannerInfo.title }}</div>
  28. </div>
  29. <img class="play" src="/static/image/live/play-icon.png" alt="">
  30. </div>
  31. <div class="type-box">
  32. <div class="type-item" v-for="item in list" :key="item.name">
  33. <div class="type">
  34. <div :class="{'fadeInRight': animationLoaded}">{{ item.name }}</div>
  35. <div class="see" :class="{'fadeInLeft': animationLoaded}" @click="$toUrl('./list?type=' + item.name)">
  36. <!-- See all -->
  37. {{ $t('video.lab1') }}
  38. </div>
  39. </div>
  40. <div class="list1" :class="{'fadeInTop': animationLoaded}">
  41. <div class="item" v-for="li in item.list" :key="li.id" @click="onTap(li.id, item.name)">
  42. <div class="img-box">
  43. <u--image :showLoading="true" :src="li.flie[0].img" width="100%" height="105px">
  44. <template v-slot:loading>
  45. <image class="loading-list-img" src="/static/image/common/live-list-bg.png"></image>
  46. </template>
  47. </u--image>
  48. <img class="play" src="/static/image/live/play-icon.png" alt="">
  49. </div>
  50. <div class="body">
  51. <div class="title text-clamp2">{{ li.title }}</div>
  52. <div class="flex">
  53. <div class="live">
  54. {{ li.username }}
  55. </div>
  56. <div>{{ li.addtime }}</div>
  57. </div>
  58. </div>
  59. </div>
  60. </div>
  61. </div>
  62. <div class="type-item" v-if="otherList.length">
  63. <div class="type" :class="{'fadeInRight': animationLoaded}">
  64. <div>
  65. <!-- Others -->
  66. {{ $t('video.lab18') }}
  67. </div>
  68. </div>
  69. <div class="list1" :class="{'fadeInTop': animationLoaded}">
  70. <div class="item" v-for="item in otherList" :key="item.id" @click="onTap(item.id)">
  71. <div class="img-box">
  72. <u--image :showLoading="true" :src="item.flie[0].img" width="100%" height="105px">
  73. <template v-slot:loading>
  74. <image class="loading-list-img" src="/static/image/common/live-list-bg.png"></image>
  75. </template>
  76. </u--image>
  77. <img class="play" src="/static/image/live/play-icon.png" alt="">
  78. </div>
  79. <div class="body">
  80. <div class="title text-clamp2">{{ item.title }}</div>
  81. <div class="flex">
  82. <div class="live">
  83. {{ item.username }}
  84. </div>
  85. <div>{{ item.addtime }}</div>
  86. </div>
  87. </div>
  88. </div>
  89. </div>
  90. </div>
  91. <div class="type-item" v-if="showsList.length">
  92. <div class="type" :class="{'fadeInRight': animationLoaded}">
  93. <div>
  94. <!-- Onecric Shows -->
  95. {{ $t('video.lab3') }}
  96. </div>
  97. </div>
  98. <div class="list1" :class="{'fadeInTop': animationLoaded}">
  99. <div class="item1" v-for="item in showsList" :key="item.id" @click="onTap(item.id)">
  100. <u--image :showLoading="true" :src="item.img" width="100%" height="120px">
  101. <template v-slot:loading>
  102. <image class="loading-list-img" src="/static/image/common/live-list-bg.png"></image>
  103. </template>
  104. </u--image>
  105. </div>
  106. </div>
  107. </div>
  108. </div>
  109. <div class="news-install">
  110. <install></install>
  111. </div>
  112. </view>
  113. </template>
  114. <script>
  115. import animationMixin from '@/pages/mixins/animation'
  116. import { numberToK } from '@/utils/util'
  117. import install from '@/components/install/install.vue'
  118. export default {
  119. mixins: [animationMixin],
  120. components: {
  121. install
  122. },
  123. data() {
  124. return {
  125. barList: [],
  126. barId: null,
  127. bannerInfo: {
  128. flie: []
  129. },
  130. list: [],
  131. otherList: [],
  132. showsList: []
  133. }
  134. },
  135. computed: {
  136. info() {
  137. return this.$store.state.info;
  138. },
  139. isLogin() {
  140. return this.$store.state.isLogin;
  141. },
  142. },
  143. onPullDownRefresh() {
  144. this.init();
  145. },
  146. onReady() {
  147. this.init()
  148. },
  149. methods: {
  150. init() {
  151. uni.$u.http.get('/api/Video/getCategory').then(res => {
  152. this.barList = res || []
  153. if (this.barList.length) {
  154. this.barId = this.barList[0].id
  155. this.getTournamentVideo()
  156. } else {
  157. this.barId = null
  158. uni.stopPullDownRefresh();
  159. }
  160. })
  161. },
  162. getTournamentVideo() {
  163. uni.$u.http.get('/api/Video/getTournamentVideo', {
  164. params: {
  165. id: this.barId
  166. }
  167. }).then(res => {
  168. this.bannerInfo = res.banner || {
  169. flie: []
  170. }
  171. this.otherList = res.others || []
  172. this.showsList = res.shows || []
  173. let list = res.list || []
  174. let list1 = []
  175. list.forEach((item) => {
  176. if (item.list && item.list.length > 0) {
  177. list1.push(item)
  178. }
  179. })
  180. this.list = list1
  181. }).finally(() => {
  182. uni.stopPullDownRefresh();
  183. if (this.animationLoaded) {
  184. return
  185. }
  186. this.animationLoaded = true
  187. this.$nextTick(() => {
  188. this.scrollFun()
  189. })
  190. })
  191. },
  192. onTap(id,tournament) {
  193. let url = './live?id=' + id
  194. if (tournament) {
  195. url += ('&tournament='+tournament)
  196. }
  197. this.$toUrl(url)
  198. },
  199. numberToK(v) {
  200. return numberToK(v)
  201. },
  202. changeBar(id) {
  203. if (this.barId == id) {
  204. return
  205. }
  206. this.barId = id
  207. },
  208. go(url, login) {
  209. if (this.isLogin == 2 && login) {
  210. this.$toUrl('/pages/login/login')
  211. return
  212. }
  213. this.$toUrl(url)
  214. },
  215. }
  216. }
  217. </script>
  218. <style lang="scss">
  219. page {
  220. background-color: #f3f3f3;
  221. }
  222. .container {
  223. padding-bottom: var(--window-bottom);
  224. }
  225. .top {
  226. position: sticky;
  227. top: 0;
  228. z-index: 999;
  229. .header {
  230. display: flex;
  231. align-items: center;
  232. justify-content: space-between;
  233. padding: 8rpx 16px 16rpx;
  234. background-color: #10044A;
  235. }
  236. .logo {
  237. height: 24px;
  238. }
  239. .border {
  240. border: 1px solid #CC2900;
  241. border-radius: 50%;
  242. }
  243. .title-box {
  244. height: 40px;
  245. background-color: #262E4A;
  246. padding: 0 16px;
  247. display: flex;
  248. align-items: center;
  249. color: #fff;
  250. font-weight: 500;
  251. font-size: 16px;
  252. }
  253. .bar-list {
  254. display: flex;
  255. align-items: center;
  256. flex-wrap: nowrap;
  257. overflow: auto;
  258. background-color: #fff;
  259. .item {
  260. padding: 12px 16px;
  261. font-weight: 500;
  262. font-size: 14px;
  263. color: #000000;
  264. white-space: nowrap;
  265. border-bottom: 2px solid transparent;
  266. &.active {
  267. border-color: #FF3300;
  268. }
  269. }
  270. }
  271. }
  272. .banner-box {
  273. position: relative;
  274. .img {
  275. width: 100%;
  276. display: block;
  277. }
  278. .info-box {
  279. position: absolute;
  280. top: 0;
  281. left: 0;
  282. right: 0;
  283. bottom: 0;
  284. background: linear-gradient(180deg, rgba(16, 4, 74, 0) 0%, #080031 100%);
  285. display: flex;
  286. flex-direction: column;
  287. justify-content: flex-end;
  288. padding: 26rpx 16px;
  289. .title {
  290. color: #fff;
  291. font-weight: 600;
  292. font-size: 26px;
  293. margin-bottom: 16px;
  294. }
  295. .tip {
  296. font-weight: 500;
  297. font-size: 16px;
  298. color: #C7C7C7;
  299. margin-bottom: 16px;
  300. }
  301. }
  302. .play {
  303. position: absolute;
  304. top: 50%;
  305. left: 50%;
  306. transform: translate(-50%, -50%);
  307. width: 46px;
  308. }
  309. }
  310. .type-box {
  311. padding: 0 0 16px 8px;
  312. min-height: 70vh;
  313. .type-item {
  314. .type {
  315. padding: 26px 8px 10px 0;
  316. display: flex;
  317. align-items: center;
  318. justify-content: space-between;
  319. font-weight: 600;
  320. font-size: 18px;
  321. line-height: 1;
  322. color: #242424;
  323. .see {
  324. font-weight: 400;
  325. font-size: 14px;
  326. color: #4E4E4E;
  327. }
  328. }
  329. }
  330. .list1 {
  331. display: flex;
  332. flex-wrap: nowrap;
  333. overflow: auto;
  334. .item {
  335. background: #FFFFFF;
  336. box-shadow: 0px 4px 26px rgba(174, 174, 174, 0.16);
  337. border-radius: 4px;
  338. min-width: 214px;
  339. max-width: 214px;
  340. overflow: hidden;
  341. margin-right: 16px;
  342. .img-box {
  343. position: relative;
  344. .play {
  345. position: absolute;
  346. top: 50%;
  347. left: 50%;
  348. transform: translate(-50%, -50%);
  349. width: 46px;
  350. }
  351. }
  352. .loading-list-img {
  353. width: 100%;
  354. height: 105px;
  355. }
  356. }
  357. .item1 {
  358. border-radius: 4px;
  359. min-width: 106px;
  360. max-width: 106px;
  361. overflow: hidden;
  362. margin-right: 16px;
  363. }
  364. .body {
  365. padding: 12px 10px;
  366. .title {
  367. font-weight: 500;
  368. font-size: 14px;
  369. color: #242424;
  370. margin-bottom: 8px;
  371. }
  372. .tip {
  373. font-weight: 400;
  374. font-size: 12px;
  375. color: #4E4E4E;
  376. margin-bottom: 26px;
  377. }
  378. .flex {
  379. justify-content: space-between;
  380. font-weight: 400;
  381. font-size: 10px;
  382. color: #4E4E4E;
  383. .live {
  384. font-weight: 500;
  385. color: #FF3300;
  386. }
  387. }
  388. }
  389. }
  390. }
  391. .news-install {
  392. position: sticky;
  393. bottom: var(--window-bottom);
  394. z-index: 200;
  395. }
  396. </style>