match-detail.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419
  1. <template>
  2. <view class="detail">
  3. <view class="detail-head" v-if="dispalyTop">
  4. <div class="header">
  5. <img class="logo" src="/static/logo_big.png" alt="">
  6. <div class="flex">
  7. <img class="msg" src="/static/image/match/msg-icon.png" alt="">
  8. <u--image
  9. class="border"
  10. :showLoading="true"
  11. :src="info.avatar || '/static/image/match/teams_avatar_ico@2x.png'"
  12. @click="go('/pages/Match/member/usermanger', true)"
  13. width="24px"
  14. height="24px"
  15. shape="circle"
  16. ></u--image>
  17. </div>
  18. </div>
  19. <div class="title-box">
  20. <div class="flex" @click="stepBack">
  21. <u-icon name="arrow-left" color="#ffffff" size="16px" bold></u-icon>
  22. <!-- Live matches -->
  23. {{ tournament_name }}
  24. </div>
  25. </div>
  26. <view class="nav">
  27. <view class="nav-name flex font32">
  28. <text>{{match_detail.home_name}}</text>
  29. <text>{{match_detail.away_name}}</text>
  30. </view>
  31. <view class="nav-score flex">
  32. <view class="nav-score-li flex-start">
  33. <image :src="match_detail.home_logo || '/static/image/common/team.png'" mode="aspectFit"></image>
  34. <view class="font36">{{match_detail.home_display_score}}</view>
  35. <text class="font24">({{match_detail.home_display_overs}})</text>
  36. </view>
  37. <image v-if="match_detail.status == 2" src="/static/image/match/matches_detail_vs_ico@2x.png" class="nav-score-center" mode=""></image>
  38. <view class="nav-score" style="text-align: center;" v-if="match_detail.status == 0">
  39. {{ $t('match.lab76') }}<text style="color: #ff4100;">{{match_detail.live_time}}</text>
  40. </view>
  41. <view class="nav-score-li flex-start">
  42. <text class="font24">({{match_detail.away_display_overs}})</text>
  43. <view class="font36">{{match_detail.away_display_score}}</view>
  44. <image style="margin: 0;margin-left: 16rpx;" :src="match_detail.away_logo || '/static/image/common/team.png'" mode="aspectFit"></image>
  45. </view>
  46. </view>
  47. <!-- <view class="nav-score" style="text-align: center;" v-if="match_detail.status == 1">
  48. 456456464
  49. </view> -->
  50. <!-- <view class="nav-score" style="text-align: center;" v-if="match_detail.status == 2">
  51. match starts in <text style="color: #ff4100;">{{match_detail.live_time}}</text>
  52. </view> -->
  53. <view class="nav-time font28">
  54. {{match_detail.match_result}}
  55. </view>
  56. <!-- <view class="nav-tab flex" v-if="match_detail.status==1">
  57. <view class="" @click="liveStatusTop()">
  58. Live animation
  59. {{ $t('match.lab77') }}
  60. </view>
  61. <text>|</text>
  62. <view class="" @click="liveStatusChange">
  63. Live video
  64. {{ $t('match.lab78') }}
  65. </view>
  66. </view>
  67. <view class="width150 nav-tab " v-else>
  68. <view class="text-center" @click="liveStatusTop()">
  69. Live animation
  70. {{ $t('match.lab77') }}
  71. </view>
  72. </view> -->
  73. </view>
  74. </view>
  75. <view class="">
  76. <view style="height: 300px;overflow: hidden;" v-if="liveStatus == 1">
  77. <iframe style="width: 100%;" height="300" :src="match_detail.live_path" frameborder="0"></iframe>
  78. </view>
  79. <view style="height: 306px;overflow: hidden;" v-if="liveStatus == 2">
  80. <iframe style="width: 100%;" height="306" :src="match_detail.live_url" frameborder="0"></iframe>
  81. </view>
  82. </view>
  83. <view class="detail-tab">
  84. <u-tabs
  85. :list="list1"
  86. :current="Index"
  87. lineWidth="80rpx"
  88. @click="changeTab"
  89. lineHeight="4"
  90. :scrollable="true"
  91. lineColor="#DC3C23"
  92. :activeStyle="{color:'#DC3C23',fontSize:'32rpx'}"
  93. :inactiveStyle="{color:'#333',fontSize:'32rpx'}"
  94. ></u-tabs>
  95. </view>
  96. <!-- <u-sticky offset-top="0"> -->
  97. <!-- </u-sticky> -->
  98. <view class="content">
  99. <Fantasy v-if="Index == 0" :info="match_detail" ref="fantasy"></Fantasy>
  100. <Info v-if="Index == 1" :matchDetail="match_detail" ref="info" />
  101. <Live v-if="Index == 2" ref="live" />
  102. <Scorecard v-if="Index == 3" :list="competition_list" :matchDetail="match_detail" ref="Scorecard" />
  103. <Updates v-if="(Index == 4 && updateList.length)" :list="updateList" ref="Updates" />
  104. <Squad v-if="(Index == 5 || (Index == 4 && updateList.length == 0))" :matchDetail="match_detail" ref="squad"/>
  105. </view>
  106. </view>
  107. </template>
  108. <script>
  109. import Fantasy from './compontent/fantasy.vue';
  110. import Info from './compontent/Info.vue';
  111. import Live from './compontent/live.vue';
  112. import Scorecard from './compontent/Scorecard.vue';
  113. import Updates from './compontent/Updates.vue';
  114. import Squad from './compontent/Squad.vue';
  115. export default {
  116. components:{Fantasy,Info,Live,Scorecard,Updates,Squad},
  117. data() {
  118. return {
  119. Index:0,
  120. parent:{},
  121. liveStatus:0,
  122. match_detail:{},
  123. competition_list: [],
  124. dispalyTop:true,
  125. updateList: [],
  126. list1: [
  127. {
  128. name: this.$t('match.lab31'),
  129. },
  130. {
  131. name: this.$t('live.detailTab4'),
  132. },
  133. {
  134. name: this.$t('live.detailTab3'),
  135. },
  136. // {
  137. // name: 'highlights',
  138. // },
  139. {
  140. name: this.$t('live.detailTab5'),
  141. },
  142. // {
  143. // name: this.$t('match.lab79'),
  144. // },
  145. {
  146. name:this.$t('live.detailTab6')
  147. }
  148. ],
  149. time1: null,
  150. tournament_name: ''
  151. }
  152. },
  153. computed: {
  154. info() {
  155. return this.$store.state.info;
  156. },
  157. isLogin() {
  158. return this.$store.state.isLogin;
  159. },
  160. system() {
  161. return this.$store.state.system;
  162. },
  163. },
  164. onLoad(option) {
  165. this.parent = option;
  166. if (this.parent.live == 1) {
  167. this.Index = 2
  168. }
  169. this.cricket_match_detail()
  170. },
  171. onPullDownRefresh() {
  172. // this.page = 1
  173. this.changeTab({index:this.Index})
  174. setTimeout(res=>{
  175. uni.stopPullDownRefresh()
  176. },1500)
  177. },
  178. onUnload() {
  179. this.time1 && clearInterval(this.time1);
  180. },
  181. methods: {
  182. // 显示隐藏顶部,并更改状态
  183. liveStatusTop(){
  184. this.liveStatus = 1
  185. this.dispalyTop = false
  186. },
  187. leftClick() {
  188. if(this.liveStatus == 1 || this.liveStatus == 2){
  189. this.liveStatus = 0
  190. }else {
  191. this.$back()
  192. }
  193. },
  194. changeTab(e) {
  195. this.Index = e.index
  196. if(e.index == 0) {
  197. this.$nextTick(res=>{
  198. // this.$refs.fantasy.cricket_tournament_standings(this.match_detail.tournament_id);
  199. this.$refs.fantasy.cricket_match_detail_fantasy(this.match_detail.match_id);
  200. })
  201. }else if(e.index == 1) {
  202. this.$nextTick(res=>{
  203. this.$refs.info.cricket_tournament_standings(this.match_detail.tournament_id);
  204. this.$refs.info.cricket_match_detail_info(this.parent.id);
  205. })
  206. }else if(e.index == 2) {
  207. this.$nextTick(res=>{
  208. this.$refs.live.cricket_match_detail_live(this.match_detail.match_id);
  209. })
  210. }else if(e.index == 4) {
  211. if (this.updateList.len == 0) {
  212. this.$refs.squad.cricket_match_detail_squad(this.match_detail);
  213. }
  214. // this.$nextTick(res=>{
  215. // this.$refs.Updates.getList(this.match_detail.match_id,0);
  216. // })
  217. }else if(e.index == 5) {
  218. this.$nextTick(res=>{
  219. this.$refs.squad.cricket_match_detail_squad(this.match_detail);
  220. })
  221. }
  222. },
  223. /* 获取详情 */
  224. cricket_match_detail() {
  225. let time = new Date();
  226. let timeZone = time.toLocaleTimeString('en-us',{timeZoneName:'short'}); //'1:12:38 PM GMT+8'
  227. let timeZoneId = Intl.DateTimeFormat().resolvedOptions().timeZone; //'Asia/Shanghai'
  228. uni.$u.http.post('/api/Cricket/cricket_match_detail',{match_id:this.parent.id,timezone:timeZoneId}).then(res=>{
  229. this.match_detail = res;
  230. this.competition_list = res.competition_list || []
  231. this.getUpdate(this.match_detail.match_id,0)
  232. this.cricket_match_detail_info(this.match_detail.match_id)
  233. this.changeTab({index:this.Index})
  234. if (this.parent.animation) {
  235. this.liveStatusTop()
  236. }
  237. }).catch(res=>{})
  238. },
  239. liveStatusChange() {
  240. this.liveStatus = 2;
  241. // let watchingOutSign = localStorage.getItem('watchingOutSign')
  242. // if (watchingOutSign && this.isLogin != 1) {
  243. // this.$r.loginBox()
  244. // this.$store.state.loginShowSign = true
  245. // this.$store.state.loginShowCloseSign = false;
  246. // } else {
  247. this.getIsLogin()
  248. // }
  249. },
  250. /* 判断是否登录 未登录情况下只能停留3分钟 180秒 */
  251. getIsLogin() {
  252. let that = this;
  253. if (this.isLogin == 1) return;
  254. uni.$u.http.get('/api/universal/getHot', {}).then(res => {
  255. this.$store.state.system = res;
  256. if (!this.system.login_remind || Number(this.system.login_remind) > 5000) return;
  257. this.time1 = setTimeout((res) => {
  258. if (this.isLogin == 1) {
  259. return
  260. }
  261. localStorage.setItem('watchingOutSign', true)
  262. this.$toast(this.$t('live.lab40'));
  263. setTimeout((res1) => {
  264. this.$toUrl('/pages/login/login')
  265. }, 1500);
  266. }, this.system.login_remind * 60000);
  267. })
  268. },
  269. stepBack() {
  270. uni.switchTab({
  271. url: '/pages/Match/Match'
  272. })
  273. },
  274. /* 详情 */
  275. cricket_match_detail_info(id) {
  276. let time = new Date();
  277. let timeZone = time.toLocaleTimeString('en-us',{timeZoneName:'short'}); //'1:12:38 PM GMT+8'
  278. let timeZoneId = Intl.DateTimeFormat().resolvedOptions().timeZone; //'Asia/Shanghai'
  279. uni.$u.http.post('/api/Cricket/cricket_match_detail_info',{match_id:id,timezone:timeZoneId}).then(res=>{
  280. this.tournament_name = res.tournament_name;
  281. }).catch(res=>{})
  282. },
  283. go(url, login) {
  284. if (this.isLogin == 2 && login) {
  285. this.$toUrl('/pages/login/login')
  286. return
  287. }
  288. this.$toUrl(url)
  289. },
  290. getUpdate(id, type) {
  291. uni.$u.http.post('/api/Cricket/cricket_match_detail_updates',{id:id,type:type}).then(res=>{
  292. this.updateList = (res || []);
  293. if (this.updateList.length) {
  294. this.list1 = [
  295. {
  296. name: this.$t('match.lab31'),
  297. },
  298. {
  299. name: this.$t('live.detailTab4'),
  300. },
  301. {
  302. name: this.$t('live.detailTab3'),
  303. },
  304. // {
  305. // name: 'highlights',
  306. // },
  307. {
  308. name: this.$t('live.detailTab5'),
  309. },
  310. {
  311. name: this.$t('match.lab79'),
  312. },
  313. {
  314. name:this.$t('live.detailTab6')
  315. }
  316. ]
  317. }
  318. }).catch(res=>{})
  319. }
  320. },
  321. }
  322. </script>
  323. <style lang="scss">
  324. .detail-head {
  325. position: sticky;
  326. top: 0;
  327. z-index: 9;
  328. overflow: hidden;
  329. background: url(/static/image/match/schedule_pulldown_ico@2x.png) center top / 100% 100% no-repeat;
  330. .header {
  331. display: flex;
  332. align-items: center;
  333. justify-content: space-between;
  334. padding: 8rpx 16px 16rpx;
  335. background-color: #10044A;
  336. .msg {
  337. width: 19px;
  338. margin-right: 16px;
  339. }
  340. .border {
  341. border: 1px solid #CC2900;
  342. border-radius: 50%;
  343. }
  344. }
  345. .logo {
  346. height: 24px;
  347. }
  348. .title-box {
  349. height: 40px;
  350. background-color: #262E4A;
  351. padding: 0 16px;
  352. display: flex;
  353. align-items: center;
  354. color: #fff;
  355. font-weight: 500;
  356. font-size: 16px;
  357. .u-icon {
  358. margin-right: 10px;
  359. }
  360. }
  361. .nav {
  362. color: #fff;
  363. padding: 0 52rpx;
  364. }
  365. .nav-name {
  366. margin-top: 54rpx;
  367. text {
  368. max-width: 30%;
  369. text-align: center;
  370. }
  371. }
  372. .nav-score-center {
  373. width: 48rpx;
  374. height: 48rpx;
  375. margin: 0 54rpx;
  376. }
  377. .nav-score-li {
  378. image {
  379. width: 80rpx;
  380. height: 80rpx;
  381. margin-right: 16rpx;
  382. }
  383. text {
  384. // margin-top: 20rpx;
  385. // align-self: flex-end;
  386. }
  387. }
  388. .nav-time {
  389. margin-top: 34rpx;
  390. margin-bottom: 102rpx;
  391. text-align: center;
  392. }
  393. .width150{
  394. width: 290rpx !important;
  395. }
  396. .nav-tab {
  397. width: 506rpx;
  398. margin: 24rpx auto;
  399. padding: 6rpx 6rpx;
  400. border-radius: 40rpx;
  401. background-color: rgba(0,0,0,0.5);
  402. }
  403. }
  404. .detail-tab {
  405. z-index: 999;
  406. background-color: $color6;
  407. }
  408. </style>