live-view.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670
  1. <!-- 推荐 -->
  2. <template>
  3. <view class="list">
  4. <view class="list-swiper">
  5. <view class=""
  6. style="background: rgb(221, 221, 221);width: 100%;height: 60vw;border-radius: 20rpx;"
  7. v-if="list.length == 0">
  8. </view>
  9. <swiper v-else class="swiper" circular :indicator-dots="false" @change="swiperChange" :autoplay="true" :interval="2000"
  10. :duration="500">
  11. <swiper-item v-for="(item, index) in list" :key="index" @click="swiperClick(item)">
  12. <div class="swiper-box">
  13. <u--image
  14. mode="scaleToFill"
  15. :showLoading="true"
  16. :src="item.img"
  17. width="100%"
  18. height="60vw"
  19. >
  20. <template v-slot:loading>
  21. <image class="loading-banner-img" src="/static/image/common/video-banner-bg.png"></image>
  22. </template>
  23. </u--image>
  24. <div class="info-box">
  25. <div class="title text-clamp">1st T20I, India v New Zealand</div>
  26. <div class="tip">2023 Men's T20I Series | JSCA International Stadium Complex, Ranchi</div>
  27. <div class="btn-box">
  28. <div class="btn">
  29. <img class="img" src="/static/image/live/polygon.png" alt="">
  30. Watch
  31. </div>
  32. </div>
  33. </div>
  34. </div>
  35. </swiper-item>
  36. </swiper>
  37. <div v-if="list.length > 1" class="swiper__indicator">
  38. <div class="line__bar">
  39. <div class="dots" :class="{'active': index == swiperCurrent}" v-for="(i, index) in list" :key="index">
  40. </div>
  41. </div>
  42. </div>
  43. </view>
  44. <div class="live-list-box" v-if="todayList.length > 0">
  45. <div class="flex">
  46. <div class="all flex" @click="toMatch">View all <img class="right" src="/static/image/live/right.png" alt=""></div>
  47. </div>
  48. <div class="mySwiper">
  49. <div class="swiper-wrapper">
  50. <div class="swiper-slide" v-for="(item, index) in todayList" :key="index">
  51. <div class="today-box">
  52. <div class="box1">
  53. Match 5, South Africa Women 2023 Tri-Series | Buffalo Park, East London
  54. <img class="right" src="/static/image/live/right.png" alt="">
  55. </div>
  56. <div class="box2">
  57. at 28 January, 19:00 Local ( 22:00 PKT ) - Buffalo Park, East London, South Africa
  58. </div>
  59. <u-row>
  60. <u-col span="6">
  61. <view class="bg-purple">
  62. <img class="logo" src="https://cdn.sportmonks.com/images/cricket/teams/24/1976.png" alt=""/>
  63. <div class="text-clamp">{{ item.home_name }}</div>
  64. </view>
  65. </u-col>
  66. <u-col span="6">
  67. <view class="bg-purple bg-purple1 text-clamp">
  68. <img class="logo" src="https://cdn.sportmonks.com/images/cricket/teams/24/1976.png" alt=""/>
  69. <div class="text-clamp">{{ item.away_name }}</div>
  70. </view>
  71. </u-col>
  72. </u-row>
  73. </div>
  74. </div>
  75. </div>
  76. </div>
  77. </div>
  78. <div class="anchor-list">
  79. <div class="item">
  80. <u--image
  81. :showLoading="true"
  82. :src="'/static/image/match/teams_avatar_ico@2x.png'"
  83. width="62px"
  84. height="62px"
  85. shape="circle"
  86. ></u--image>
  87. </div>
  88. <div class="item">
  89. <u--image
  90. :showLoading="true"
  91. :src="'/static/image/match/teams_avatar_ico@2x.png'"
  92. width="62px"
  93. height="62px"
  94. shape="circle"
  95. ></u--image>
  96. </div>
  97. <div class="item">
  98. <u--image
  99. :showLoading="true"
  100. :src="'/static/image/match/teams_avatar_ico@2x.png'"
  101. width="62px"
  102. height="62px"
  103. shape="circle"
  104. ></u--image>
  105. </div>
  106. <div class="item">
  107. <u--image
  108. :showLoading="true"
  109. :src="'/static/image/match/teams_avatar_ico@2x.png'"
  110. width="62px"
  111. height="62px"
  112. shape="circle"
  113. ></u--image>
  114. </div>
  115. <div class="item">
  116. <u--image
  117. :showLoading="true"
  118. :src="'/static/image/match/teams_avatar_ico@2x.png'"
  119. width="62px"
  120. height="62px"
  121. shape="circle"
  122. ></u--image>
  123. </div>
  124. <div class="item">
  125. <u--image
  126. :showLoading="true"
  127. :src="'/static/image/match/teams_avatar_ico@2x.png'"
  128. width="62px"
  129. height="62px"
  130. shape="circle"
  131. ></u--image>
  132. </div>
  133. </div>
  134. <div class="type-box">
  135. <div class="type-item">
  136. <div class="type" @click="toMatch">
  137. <div>T20s</div>
  138. <div class="see">See all</div>
  139. </div>
  140. <div class="list1">
  141. <div class="item">
  142. <div class="img-box">
  143. <u--image :showLoading="true" src="https://api.onecric.tv/upload/WechatIMG443.jpg" width="100%" height="105px">
  144. <template v-slot:loading>
  145. <image class="loading-list-img" src="/static/image/common/live-list-bg.png"></image>
  146. </template>
  147. </u--image>
  148. <img class="play" src="/static/image/live/play-icon.png" alt="">
  149. </div>
  150. <div class="body">
  151. <div class="title text-clamp">India v New Zealand</div>
  152. <div class="tip">2023 Men's T20I Series | 1st T20I</div>
  153. <div class="flex">
  154. <div class="live">Live</div>
  155. <div>JSCA Stadium Complex</div>
  156. </div>
  157. </div>
  158. </div>
  159. <div class="item">
  160. <div class="img-box">
  161. <u--image :showLoading="true" src="https://qiniu.onecric.tv/moren.png" width="100%" height="105px">
  162. <template v-slot:loading>
  163. <image class="loading-list-img" src="/static/image/common/live-list-bg.png"></image>
  164. </template>
  165. </u--image>
  166. <img class="play" src="/static/image/live/play-icon.png" alt="">
  167. </div>
  168. <div class="body">
  169. <div class="title text-clamp">India v New Zealand</div>
  170. <div class="tip">2023 Men's T20I Series | 1st T20I</div>
  171. <div class="flex">
  172. <div class="live">Live</div>
  173. <div>JSCA Stadium Complex</div>
  174. </div>
  175. </div>
  176. </div>
  177. </div>
  178. </div>
  179. <div class="type-item">
  180. <div class="type">
  181. <div>T20s</div>
  182. <div class="see">See all</div>
  183. </div>
  184. <div class="list1">
  185. <div class="item">
  186. <div class="img-box">
  187. <u--image :showLoading="true" src="https://api.onecric.tv/upload/WechatIMG443.jpg" width="100%" height="105px">
  188. <template v-slot:loading>
  189. <image class="loading-list-img" src="/static/image/common/live-list-bg.png"></image>
  190. </template>
  191. </u--image>
  192. <img class="play" src="/static/image/live/play-icon.png" alt="">
  193. </div>
  194. <div class="body">
  195. <div class="title text-clamp">India v New Zealand</div>
  196. <div class="tip">2023 Men's T20I Series | 1st T20I</div>
  197. <div class="flex">
  198. <div class="live">Live</div>
  199. <div>JSCA Stadium Complex</div>
  200. </div>
  201. </div>
  202. </div>
  203. <div class="item">
  204. <div class="img-box">
  205. <u--image :showLoading="true" src="https://api.onecric.tv/upload/WechatIMG443.jpg" width="100%" height="105px">
  206. <template v-slot:loading>
  207. <image class="loading-list-img" src="/static/image/common/live-list-bg.png"></image>
  208. </template>
  209. </u--image>
  210. <img class="play" src="/static/image/live/play-icon.png" alt="">
  211. </div>
  212. <div class="body">
  213. <div class="title text-clamp">India v New Zealand</div>
  214. <div class="tip">2023 Men's T20I Series | 1st T20I</div>
  215. <div class="flex">
  216. <div class="live">Live</div>
  217. <div>JSCA Stadium Complex</div>
  218. </div>
  219. </div>
  220. </div>
  221. </div>
  222. </div>
  223. </div>
  224. <u-toast ref="uToast"></u-toast>
  225. </view>
  226. </template>
  227. <script>
  228. import { numberToK, parseTime } from '@/utils/util'
  229. export default {
  230. components: {
  231. },
  232. data() {
  233. return {
  234. liveList: {
  235. live_commentary: {},
  236. nolive_broadcast: {},
  237. robot: {}
  238. },
  239. todayList: [],
  240. comingList: [],
  241. live_commentary: [],
  242. nolive_broadcast: [],
  243. robot: [],
  244. bannerList: [],
  245. robotLength: 0,
  246. swiperCurrent: 0,
  247. swiper: null
  248. }
  249. },
  250. props: {
  251. list: {
  252. type: Array,
  253. default: []
  254. }
  255. },
  256. mounted() {
  257. this.getList()
  258. },
  259. methods: {
  260. swiperClick(item) {
  261. if (item.anchor_id) {
  262. uni.navigateTo({
  263. url: `./live-detail?id=${item.anchor_id}&ID=${item.id}`
  264. })
  265. return
  266. }
  267. if (item.param_id) {
  268. uni.navigateTo({
  269. url: '/pages/Match/match-detail?id=' + item.param_id
  270. })
  271. return
  272. }
  273. },
  274. // 点击history
  275. historyLive(item) {
  276. // console.error(item)
  277. // return
  278. uni.navigateTo({
  279. url:`/pages/Live/history-detail?id=${item.Uid}&ID=${item.live_id}&MediaUrl=${item.MediaUrl}`
  280. })
  281. },
  282. /* 跳转 */
  283. toUrl(item) {
  284. console.log(item);
  285. /* item.type == 1?'basketball':'football */
  286. if (item.type == 1) {
  287. uni.navigateTo({
  288. url: '../competition/basketballDetail?id=' + item.id
  289. })
  290. } else {
  291. uni.navigateTo({
  292. url: '../competition/detail?id=' + item.sourceid
  293. })
  294. }
  295. },
  296. toUrlLive(item) {
  297. gtag('event', 'live_H5', {
  298. 'live_H5': '0'
  299. });
  300. uni.navigateTo({
  301. url: `./live-detail?id=${item.live_id}&ID=${item.id}`
  302. })
  303. },
  304. getList() {
  305. uni.$u.http.get('/api/live_streaming/getLiveList', {
  306. params: 2
  307. }).then(res => {
  308. this.live_commentary = res.data || []
  309. })
  310. uni.$u.http.get('/api/live_streaming/getLiveListNew', {
  311. params: {
  312. timeZone: this.$store.state.timeZone
  313. }
  314. }).then(res => {
  315. this.todayList = res.toay || [];
  316. this.comingList = res.upcoming || [];
  317. this.$nextTick(() => {
  318. this.swiper && this.swiper.destroy();
  319. this.swiper = new Swiper(".mySwiper", {
  320. loop: true,
  321. spaceBetween: 16,
  322. autoplay: true,
  323. });
  324. })
  325. })
  326. uni.$u.http.get('/api/LivePlayBack/list', {}).then(res => {
  327. if (res.list) {
  328. this.robotLength = res.list.length
  329. this.robot = res.list.slice(0, 6)
  330. } else {
  331. this.robot = []
  332. }
  333. })
  334. },
  335. toMatch() {
  336. sessionStorage.setItem('match_live', JSON.stringify(2))
  337. uni.switchTab({
  338. url: '/pages/Match/Match'
  339. })
  340. },
  341. swiperChange(e) {
  342. this.swiperCurrent = e.detail.current
  343. },
  344. numberToK(v) {
  345. return numberToK(v)
  346. },
  347. formatDate(value) {
  348. var date1 = this.$common.parseTime(value * 1000, '{y}/{m}/{d} {h}:{i}:{s}')
  349. var date = new Date(date1 + ' UTC+5:30');
  350. var weekNum = new Date().getDay()
  351. let week = ""
  352. switch (weekNum) {
  353. case 0:
  354. week = "Sun";
  355. break;
  356. case 1:
  357. week = "Mon";
  358. break;
  359. case 2:
  360. week = "Tue";
  361. break;
  362. case 3:
  363. week = "Wed";
  364. break;
  365. case 4:
  366. week = "Thu";
  367. break;
  368. case 5:
  369. week = "Fri";
  370. break;
  371. case 6:
  372. week = "Sat";
  373. break;
  374. }
  375. var MonthNum = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1)
  376. let Month = ''
  377. switch (MonthNum) {
  378. case 1:
  379. Month = "Jan";
  380. break;
  381. case 2:
  382. Month = "Feb";
  383. break;
  384. case 3:
  385. Month = "Mar";
  386. break;
  387. case 4:
  388. Month = "Apr";
  389. break;
  390. case 5:
  391. Month = "May";
  392. break;
  393. case 6:
  394. Month = "Jun";
  395. break;
  396. case 7:
  397. Month = "Jul";
  398. break;
  399. case 8:
  400. Month = "Aug";
  401. break;
  402. case 9:
  403. Month = "Sept";
  404. break;
  405. case 10:
  406. Month = "Oct";
  407. break;
  408. case 11:
  409. Month = "Nov";
  410. break;
  411. case 12:
  412. Month = "Dec";
  413. break;
  414. }
  415. let day = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate())
  416. // this.week = week
  417. // this.month = Month
  418. // this.day = day
  419. var hours = date.getHours();
  420. var minutes = date.getMinutes();
  421. var ampm = hours >= 12 ? 'PM' : 'AM';
  422. hours = hours % 12;
  423. hours = hours ? hours : 12; // the hour '0' should be '12'
  424. minutes = minutes < 10 ? '0' + minutes : minutes;
  425. // var strTime = week + ',' + day + Month + '.' + 'Watch live in' + hours + ':' + minutes + ' ' + ampm;
  426. var strTime = this.$t('match.lab92') + ' ' + hours + ':' + minutes + ' ' + ampm;
  427. return strTime;
  428. },
  429. parseTime(t) {
  430. return parseTime(t, '{m}-{d} {h}:{i}')
  431. },
  432. parseTime1(t) {
  433. return parseTime(t, '{y}-{m}-{d} {h}:{i}')
  434. }
  435. }
  436. }
  437. </script>
  438. <style lang="scss">
  439. .list {
  440. padding-bottom: 140rpx;
  441. }
  442. .list-swiper {
  443. padding: 0;
  444. position: relative;
  445. .swiper {
  446. height: 60vw;
  447. }
  448. .loading-banner-img {
  449. width: 100%;
  450. height: 60vw;
  451. }
  452. .swiper-box {
  453. position: relative;
  454. }
  455. .info-box {
  456. position: absolute;
  457. top: 0;
  458. left: 0;
  459. right: 0;
  460. bottom: 0;
  461. background: linear-gradient(180deg, rgba(16, 4, 74, 0) 0%, #080031 100%);
  462. display: flex;
  463. flex-direction: column;
  464. justify-content: flex-end;
  465. padding: 26rpx 16px;
  466. .title {
  467. color: #fff;
  468. font-weight: 600;
  469. font-size: 26px;
  470. margin-bottom: 16px;
  471. }
  472. .tip {
  473. font-weight: 500;
  474. font-size: 16px;
  475. color: #C7C7C7;
  476. margin-bottom: 16px;
  477. }
  478. .btn-box {
  479. height: 34px;
  480. .btn {
  481. height: 34px;
  482. width: 92px;
  483. background: linear-gradient(94.25deg, #FF3300 -3.08%, #D22A00 100%);
  484. border-radius: 4px;
  485. display: flex;
  486. align-items: center;
  487. justify-content: center;
  488. color: #fff;
  489. font-weight: 500;
  490. font-size: 14px;
  491. }
  492. .img {
  493. width: 14px;
  494. margin-right: 6px;
  495. }
  496. }
  497. }
  498. .swiper__indicator {
  499. position: absolute;
  500. right: 16px;
  501. bottom: 39rpx;
  502. z-index: 2;
  503. .line__bar {
  504. display: flex;
  505. align-items: center;
  506. }
  507. .dots {
  508. width: 8px;
  509. height: 8px;
  510. border: 1px solid #D52B01;
  511. border-radius: 50%;
  512. & + .dots {
  513. margin-left: 8px;
  514. }
  515. &.active {
  516. background-color: #D52B01;
  517. }
  518. }
  519. }
  520. }
  521. .live-list-box {
  522. padding-top: 16px;
  523. .all {
  524. font-weight: 500;
  525. font-size: 14px;
  526. color: #242424;
  527. padding: 0 16px;
  528. .right {
  529. margin-left: 8px;
  530. width: 9px;
  531. }
  532. }
  533. .mySwiper {
  534. overflow: hidden;
  535. padding: 12px 16px 16px;
  536. }
  537. .today-box {
  538. background: #FFFFFF;
  539. box-shadow: 0px 4px 26px -4px rgba(78, 78, 78, 0.25);
  540. border-radius: 6px;
  541. padding: 24px 24px 20px;
  542. .box1 {
  543. padding-right: 25px;
  544. position: relative;
  545. font-weight: 500;
  546. font-size: 14px;
  547. color: #242424;
  548. margin-bottom: 16px;
  549. .right {
  550. width: 9px;
  551. position: absolute;
  552. right: 0;
  553. top: 50%;
  554. transform: translateY(-50%);
  555. }
  556. }
  557. .box2 {
  558. font-weight: 600;
  559. font-size: 12px;
  560. color: #4E4E4E;
  561. margin-bottom: 16px;
  562. }
  563. .bg-purple {
  564. font-weight: 600;
  565. font-size: 18px;
  566. color: #242424;
  567. display: flex;
  568. align-items: center;
  569. .logo {
  570. width: 30px;
  571. margin-right: 16rpx;
  572. }
  573. }
  574. .bg-purple1 {
  575. padding-left: 10px;
  576. justify-content: flex-end;
  577. }
  578. }
  579. }
  580. .anchor-list {
  581. padding: 10px 0 10px 16px;
  582. overflow: auto;
  583. display: flex;
  584. align-items: center;
  585. flex-wrap: nowrap;
  586. .item {
  587. margin-right: 12px;
  588. padding: 6px;
  589. border-radius: 50%;
  590. border: 2px solid #CC2900;
  591. }
  592. }
  593. .type-box {
  594. padding: 0 0 16px 8px;
  595. .type-item {
  596. margin-bottom: 10px;
  597. .type {
  598. padding: 16px 8px 10px 0;
  599. display: flex;
  600. align-items: center;
  601. justify-content: space-between;
  602. font-weight: 600;
  603. font-size: 18px;
  604. line-height: 1;
  605. color: #242424;
  606. .see {
  607. font-weight: 400;
  608. font-size: 14px;
  609. color: #4E4E4E;
  610. }
  611. }
  612. }
  613. .list1 {
  614. display: flex;
  615. flex-wrap: nowrap;
  616. overflow: auto;
  617. .item {
  618. background: #FFFFFF;
  619. box-shadow: 0px 4px 26px rgba(174, 174, 174, 0.16);
  620. border-radius: 4px;
  621. min-width: 214px;
  622. max-width: 214px;
  623. overflow: hidden;
  624. margin-right: 16px;
  625. .img-box {
  626. position: relative;
  627. .play {
  628. position: absolute;
  629. top: 50%;
  630. left: 50%;
  631. transform: translate(-50%, -50%);
  632. width: 46px;
  633. }
  634. }
  635. .loading-list-img {
  636. width: 100%;
  637. height: 105px;
  638. }
  639. }
  640. .body {
  641. padding: 12px 10px;
  642. .title {
  643. font-weight: 500;
  644. font-size: 14px;
  645. color: #242424;
  646. margin-bottom: 8px;
  647. }
  648. .tip {
  649. font-weight: 400;
  650. font-size: 12px;
  651. color: #4E4E4E;
  652. margin-bottom: 26px;
  653. }
  654. .flex {
  655. justify-content: space-between;
  656. font-weight: 400;
  657. font-size: 10px;
  658. color: #4E4E4E;
  659. .live {
  660. font-weight: 500;
  661. color: #FF3300;
  662. }
  663. }
  664. }
  665. }
  666. }
  667. </style>