match-list.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365
  1. <template>
  2. <view class="select">
  3. <view class="select-head">
  4. <u-navbar :leftText="parent.title" titleWidth="200" bgColor="transparent" leftIconColor="#fff" :titleStyle="{color:'#fff'}" :fixed="false" leftIconSize="48" :autoBack="true"></u-navbar>
  5. <view class="select-tab">
  6. <u-tabs
  7. :list="list1"
  8. lineWidth="100rpx"
  9. @click="changeTab"
  10. lineHeight="4"
  11. lineColor="#DC3C23"
  12. :activeStyle="{color:'#DC3C23',fontSize:'32rpx',fontWeight:'Bold'}"
  13. :inactiveStyle="{color:'#fff',fontSize:'32rpx'}"
  14. ></u-tabs>
  15. </view>
  16. </view>
  17. <view class="list" v-if="activeIndex == 0">
  18. <view class="li" :class="{'match-target': item.id == parent.matchid}" v-for="(item,index) in tournament_match" :key="index" @click="$toUrl('./match-detail?id=' + item.id + '&title=' + parent.title)">
  19. <view class="li-top flex">
  20. <!-- status 0未开始 1已开始 2已结束 -->
  21. <view class="flex-start font28">
  22. <image src="/static/image/match/begin.png" mode="" v-if="item.status == 1"></image>
  23. <text v-if="item.status == 0" class="begin">{{item.live_time}}</text>
  24. <!-- <text v-if="item.status == 2">{{item.match_result}}</text> -->
  25. {{item.match_num}}
  26. <!-- {{item1.status == 0?item1.live_time+ ' ' + :item1.match_result}} -->
  27. </view>
  28. <!-- <image src="/static/image/match/schedule_adorn_ico@2x.png" mode=""></image> -->
  29. </view>
  30. <view class="li-team flex font32">
  31. <view class="flex-start">
  32. <image :src="item.home_logo || '/static/image/common/team.png'" mode="aspectFit"></image>
  33. {{item.home_name}}
  34. </view>
  35. <view class="li-team-value" :style="{color:item.match_result_type == 'w'?'#000':'#666'}">
  36. {{item.home_display_score}}
  37. </view>
  38. </view>
  39. <view class="li-team flex">
  40. <view class="flex-start">
  41. <image :src="item.away_logo || '/static/image/common/team.png'" mode="aspectFit"></image>
  42. {{item.away_name}}
  43. </view>
  44. <view class="" :style="{color:item.match_result_type == 'r'?'#000':'#666'}">
  45. {{item.away_display_score}}
  46. </view>
  47. </view>
  48. <view class="li-foot font28">
  49. {{item.match_result}}
  50. </view>
  51. </view>
  52. <u-empty
  53. v-if="tournament_match && tournament_match.length == 0"
  54. mode="data"
  55. width="474"
  56. height="312"
  57. textSize="28"
  58. marginTop="100"
  59. :text="$t('common.nodata')"
  60. icon="/static/image/common/nodata.png"
  61. >
  62. </u-empty>
  63. </view>
  64. <view v-else-if="activeIndex == 1">
  65. <view class="stats-main mg-tp12">
  66. <view class="flex-start stats-main-title">
  67. <view></view>
  68. <text class="size36 c3 Bold">
  69. {{ $t('match.lab80') }}
  70. </text>
  71. </view>
  72. <view class="stats-main-content">
  73. <u-row v-for="item in 5" :key="item" justify="space-between" @click="toUrl(0,item)">
  74. <view>
  75. <text class="size32 c3 Bold">{{item == 1?'Highest Individual Score':item == 2?'Most Runs':item == 3?'Best Batting Average':item == 4?'Highest Strike Rate':'Maximum Sixes'}}</text>
  76. <view class="mg-tp16 size c3">
  77. {{item == 1?stats.highest_score_name:item == 2?stats.most_runs_name:item == 3?stats.best_battingAv_name:item == 4?stats.highest_strikeRate_name:stats.maximum_sixes_name}} - <text class="Bold">
  78. {{item == 1?stats.highest_score:item == 2?stats.most_runs:item == 3?stats.best_battingAv:item == 4?stats.highest_strikeRate:stats.maximum_sixes}}
  79. </text>
  80. </view>
  81. </view>
  82. <image src="../../static/image/match/next_ico@2x.png" mode="heightFix" class="arrow-right"></image>
  83. </u-row>
  84. </view>
  85. </view>
  86. <u-gap bgColor="#E5E5E5" heignt="24"></u-gap>
  87. <view class="stats-main mg-tp12">
  88. <view class="flex-start stats-main-title">
  89. <view></view>
  90. <text class="size36 c3 Bold">
  91. {{ $t('match.lab81') }}
  92. </text>
  93. </view>
  94. <view class="stats-main-content">
  95. <u-row v-for="item in 3" justify="space-between" :key="item" @click="toUrl(5,item)">
  96. <view>
  97. <text class="size32 c3 Bold">{{item == 1?'Most Wickets':item == 2?'Best Bowling Average':'Best Bowling Economy'}}</text>
  98. <view class="mg-tp16 size c3">
  99. {{item == 1?stats.most_wickets_name:item == 2?stats.best_bowling_average_name:stats.best_bowling_economy_name}} - <text class="Bold">{{item == 1?stats.most_wickets:item == 2?stats.best_bowling_average:stats.best_bowling_economy}}</text>
  100. </view>
  101. </view>
  102. <image src="../../static/image/match/next_ico@2x.png" mode="heightFix" class="arrow-right"></image>
  103. </u-row>
  104. </view>
  105. </view>
  106. <view class="stats-main mg-tp12" style="display: none;">
  107. <view class="flex-start stats-main-title">
  108. <view></view>
  109. <text class="size36 c3 Bold">
  110. {{ $t('match.lab82') }}
  111. </text>
  112. </view>
  113. <view class="stats-main-content">
  114. <u-row v-for="item in 3" justify="space-between" :key="item" @click="toUrl(8,item)">
  115. <view>
  116. <text class="size32 c3 Bold">{{item == 1?'Most Catches':item == 2?'Most Run Outs':'Most Stumpings'}}</text>
  117. <view class="mg-tp16 size c3">
  118. {{item == 1?stats.most_catches_name:item == 2?stats.most_run_outs_name:stats.most_stumpings_name}} - <text class="Bold">{{item == 1?stats.most_catches:item == 2?stats.most_run_outs:stats.most_stumpings}}</text>
  119. </view>
  120. </view>
  121. <image src="../../static/image/match/next_ico@2x.png" mode="heightFix" class="arrow-right"></image>
  122. </u-row>
  123. </view>
  124. </view>
  125. </view>
  126. <Teams ref="teams" v-else-if="activeIndex == 2" />
  127. <Points ref="points" v-else-if="activeIndex == 3" />
  128. <Updates v-else-if="activeIndex == 4" ref="Updates" />
  129. </view>
  130. </template>
  131. <script>
  132. import Teams from './compontent/Teams.vue';
  133. import Points from './compontent/Points.vue';
  134. import Updates from './compontent/Updates.vue'
  135. export default {
  136. components:{Teams,Points,Updates},
  137. data(){
  138. return {
  139. list1:[
  140. {
  141. name: this.$t('match.lab83'),
  142. },
  143. {
  144. name: this.$t('match.lab84'),
  145. },
  146. {
  147. name: this.$t('match.lab'),
  148. },
  149. {
  150. name: this.$t('match.lab85'),
  151. },
  152. // {
  153. // name: this.$t('match.lab79'),
  154. // }
  155. ],
  156. page:1,
  157. parent:{
  158. title:'',
  159. },
  160. stats:{},//Stats
  161. status:'more',
  162. firstSign: false,
  163. tournament_team:[],
  164. activeIndex:0,
  165. tournament_match:[],
  166. }
  167. },
  168. onLoad(option) {
  169. this.parent = option;
  170. this.get_cricket_tournament_match()
  171. },
  172. onPullDownRefresh() {
  173. this.page = 1;
  174. this.changeTab({index:this.activeIndex})
  175. setTimeout(res=>{
  176. uni.stopPullDownRefresh()
  177. },1500)
  178. },
  179. onReachBottom() {
  180. if(this.status == 'more' && this.activeIndex == 0) {
  181. this.get_cricket_tournament_match()
  182. }
  183. },
  184. methods: {
  185. toUrl(type,i) {
  186. let title = this.parent.type.toUpperCase()
  187. this.$toUrl(`./stats-detail?id=${this.parent.id}&type=${(type+i) - 1}&title=Tour Stats:${title}`)
  188. // ''+parent.id+ '&title=' + parent.title
  189. },
  190. get_cricket_tournament_match() {
  191. let time = new Date();
  192. this.status = 'loading';
  193. let timeZone = time.toLocaleTimeString('en-us',{timeZoneName:'short'}); //'1:12:38 PM GMT+8'
  194. let timeZoneId = Intl.DateTimeFormat().resolvedOptions().timeZone; //'Asia/Shanghai'
  195. uni.$u.http.post('/api/Cricket/get_cricket_tournament_match',{tournament_id:this.parent.id,timezone:timeZoneId,page:this.page}).then(res=>{
  196. if(this.page == 1) {
  197. this.tournament_match = res.data
  198. }else {
  199. this.tournament_match = this.tournament_match.concat(res.data);
  200. }
  201. if(res.tatal == 0) {
  202. this.status = 'none'
  203. }
  204. if(this.tournament_match.length < res.total) {
  205. this.status = 'more'
  206. this.page++
  207. }else {
  208. this.status = 'noMore'
  209. }
  210. !this.firstSign && this.$nextTick(() => {
  211. uni.pageScrollTo({
  212. duration: 0,
  213. selector: '.match-target',
  214. });
  215. this.firstSign = true
  216. })
  217. // }
  218. }).catch(res=>{})
  219. uni.$u.http.post('/api/Cricket/get_tournament_stats',{id:this.parent.id}).then(res=>{
  220. this.stats = res
  221. }).catch(res=>{})
  222. },
  223. /* 获取团队列表 */
  224. get_tournament_team() {
  225. uni.$u.http.post('/api/Cricket/get_tournament_team',{tournament_id:this.parent.id}).then(res=>{
  226. this.tournament_team = res
  227. }).catch(res=>{})
  228. },
  229. changeTab(e) {
  230. this.activeIndex = e.index
  231. if(e.index == 0){
  232. this.get_cricket_tournament_match()
  233. }else if(e.index == 2) {
  234. this.$nextTick(res=>{
  235. this.$refs.teams.get_tournament_team(this.parent.id)
  236. })
  237. }else if(e.index == 3) {
  238. this.$nextTick(res=>{
  239. this.$refs.points.cricket_tournament_standings(this.parent.id)
  240. })
  241. }else if(e.index == 4) {
  242. this.$nextTick(res=>{
  243. this.$refs.Updates.getList(this.parent.id,1)
  244. })
  245. }
  246. }
  247. },
  248. }
  249. </script>
  250. <style lang="scss">
  251. /deep/.u-navbar__content__left__text {
  252. width: 90%;
  253. display: block;
  254. overflow: hidden;
  255. /* //超出的文本隐藏 */
  256. text-overflow: ellipsis;
  257. /* //溢出用省略号显示 */
  258. white-space: nowrap;
  259. /* //溢出不换行 */
  260. }
  261. .select-head {
  262. position: sticky;
  263. top: 0;
  264. z-index: 99;
  265. background-color: $color1;
  266. .select-tab {
  267. padding: 0 28rpx;
  268. margin-top: 20rpx;
  269. }
  270. }
  271. .list {
  272. padding: 0 28rpx;
  273. padding-bottom: 100rpx;
  274. .li {
  275. padding: 24rpx;
  276. box-shadow: 0px 0px 8rpx 0px $color7;
  277. border-radius: 10rpx;
  278. margin-top: 24rpx;
  279. }
  280. .li-top {
  281. color: $color4;
  282. image {
  283. width: 36rpx;
  284. height: 36rpx;
  285. }
  286. view {
  287. image {
  288. width: 82rpx;
  289. height: 42rpx;
  290. margin-right: 16rpx;
  291. }
  292. }
  293. text {
  294. margin-right: 16rpx;
  295. }
  296. .begin {
  297. color: #666;
  298. padding: 0 10rpx;
  299. background-color: #E5E5E5;
  300. }
  301. }
  302. .li-team {
  303. width: 80%;
  304. margin-top: 24rpx;
  305. image {
  306. width: 56rpx;
  307. height: 56rpx;
  308. margin-right: 16rpx;
  309. }
  310. .li-team-value {
  311. color: $color4;
  312. }
  313. }
  314. .li-foot {
  315. color: $color4;
  316. margin-top: 24rpx;
  317. }
  318. }
  319. .stats-main{
  320. padding: 24rpx 28rpx;
  321. .stats-main-title{
  322. view{
  323. width: 6rpx;
  324. height: 40rpx;
  325. background: #DC3C23;
  326. margin-right: 16rpx;
  327. }
  328. }
  329. .stats-main-content{
  330. margin-top: 29rpx;
  331. background: #FFFFFF;
  332. box-shadow: 0rpx 0rpx 8rpx 1rpx $color7;
  333. border-radius: 10rpx 10rpx 10rpx 10rpx;
  334. .u-row{
  335. border-bottom: 1rpx solid #E5E5E5;
  336. padding: 24rpx;
  337. .arrow-right{
  338. width: 48rpx;
  339. height: 48rpx;
  340. }
  341. }
  342. }
  343. }
  344. </style>