detail-live.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315
  1. <template>
  2. <view class="live">
  3. <scroll-view
  4. class="scroll-view"
  5. :scroll-y="true"
  6. :refresher-enabled="true"
  7. :refresher-triggered="triggered"
  8. :refresher-threshold="100"
  9. @refresherpulling="onPulling"
  10. @refresherrefresh="onRefresh"
  11. @scrolltolower="scrolltolower"
  12. @refresherabort="onAbort"
  13. >
  14. <view
  15. class="size28 c3 mg-bt24"
  16. v-for="(item, index) in info"
  17. :key="index"
  18. >
  19. <!-- <view class="size28 c3 mg-bt24">
  20. <text class="size32 Bold mg-rt20">2.36am </text>
  21. {{item.commentaries}}
  22. </view> -->
  23. <!-- <u-divider class="mg-bt24" lineColor="#E5E5E5"></u-divider> -->
  24. <view>
  25. <view class="li" style="display: flex" v-if="item.type === 1">
  26. <view class="size32 c3 Bold live-item">
  27. <text class="indexNumber">{{ item.display_overs }}</text>
  28. <text
  29. class="live-item-text"
  30. :class="
  31. item.runs_scored == 'w'
  32. ? 'live-item-text-red'
  33. : item.runs_scored == '4'
  34. ? 'live-item-text-green'
  35. : item.runs_scored == '6'
  36. ? 'live-item-text-green'
  37. : item.runs_scored == '8'
  38. ? 'live-item-text-green'
  39. : 'live-item-text-block'
  40. "
  41. >{{ item.runs_scored }}</text
  42. >
  43. </view>
  44. <view class="size28 c3 live-item">
  45. <text>{{ item.commentaries }}</text>
  46. </view>
  47. </view>
  48. </view>
  49. <view class="green-card" v-if="item.type === 2">
  50. <u-row>
  51. <u-col span="8" class="flex">
  52. <view class="flex-start">
  53. <view class="over17 size28 c6">
  54. OVER <br />
  55. <text class="size32">{{ item.serial_number }}</text>
  56. </view>
  57. <view class="size24 c6">
  58. {{ item.head.sessions_number }} <br />
  59. <text class="size28 mg-tp16 c3 Bold">
  60. {{ item.head.sum }}Runs</text
  61. >
  62. </view>
  63. </view>
  64. </u-col>
  65. <u-col span="4">
  66. <view
  67. class="size24 c6 pd-lt21"
  68. style="border-left: 1rpx solid #b1d9ff"
  69. >
  70. {{ item.head.country_code }}<br />
  71. <text class="size28 mg-tp16 c3 Bold">{{
  72. item.head.display_score
  73. }}</text>
  74. </view>
  75. </u-col>
  76. </u-row>
  77. <u-line color="#b1d9ff"></u-line>
  78. <u-row>
  79. <u-col span="6">
  80. <view class="size24 c6">
  81. {{ item.head.striker.name }}<br />
  82. <text class="size28 mg-tp16 c3 Bold">{{
  83. item.head.striker.runs_scored_so_far
  84. }}</text
  85. >({{ item.head.striker.balls_faced_so_far }})
  86. </view>
  87. </u-col>
  88. <u-col span="6">
  89. <view class="size24 c6">
  90. {{ item.head.non_striker.name }}<br />
  91. <text class="size28 mg-tp16 c3 Bold">{{
  92. item.head.non_striker.runs_scored_so_far
  93. }}</text
  94. >({{ item.head.non_striker.balls_faced_so_far }})
  95. </view>
  96. </u-col>
  97. <u-line direction="col" color="#219430"></u-line>
  98. </u-row>
  99. </view>
  100. </view>
  101. <u-empty
  102. v-if="info.length == 0"
  103. :show="loadingData"
  104. mode="data"
  105. width="474"
  106. height="312"
  107. textSize="28"
  108. marginTop="100"
  109. :text="$t('common.nodata')"
  110. icon="/static/image/common/nodata.png"
  111. >
  112. </u-empty>
  113. <u-loadmore
  114. v-if="info.length != 0"
  115. :status="status"
  116. fontSize="28"
  117. :line="true"
  118. :loading-text="statusType.loadingText"
  119. :loadmore-text="statusType.loadmoreText"
  120. :nomore-text="statusType.nomoreText"
  121. />
  122. </scroll-view>
  123. </view>
  124. </template>
  125. <script>
  126. export default {
  127. props: {
  128. matchDetail: {
  129. default: {}
  130. }
  131. },
  132. data() {
  133. return {
  134. info: [],
  135. loadingData: false,
  136. page: 1,
  137. triggered: false,
  138. _freshing: false,
  139. statusType: {
  140. loadingText: this.$t('common.lab'),
  141. loadmoreText: this.$t('common.lab1'),
  142. nomoreText: this.$t('common.lab2')
  143. },
  144. id: "",
  145. };
  146. },
  147. created() {
  148. uni.showLoading({
  149. title: this.$t('common.lab'),
  150. });
  151. this.cricket_match_detail_live()
  152. this._freshing = false;
  153. },
  154. methods: {
  155. onPulling(e) {
  156. },
  157. onRefresh() {
  158. if (this._freshing) return;
  159. this.triggered = true
  160. this._freshing = true;
  161. this.page = 1
  162. this.cricket_match_detail_live()
  163. },
  164. scrolltolower() {
  165. console.log('scrolltolower')
  166. },
  167. onAbort() {
  168. },
  169. cricket_match_detail_live(id) {
  170. this.status = "loading";
  171. if (this.page == 1) {
  172. this.triggered = true
  173. }
  174. this.loadingData = false
  175. uni.$u.http
  176. .post("/api/Cricket/cricket_match_detail_live_new", {
  177. match_id: this.matchDetail.match_id,
  178. page: this.page,
  179. })
  180. .then((res) => {
  181. if (this.page == 1) {
  182. this.info = res;
  183. } else {
  184. this.info = this.info.concat(res);
  185. }
  186. if (res.total > this.info.length) {
  187. this.status = "loadmore";
  188. this.page++;
  189. } else {
  190. this.status = "nomore";
  191. }
  192. })
  193. .finally((res) => {
  194. uni.hideLoading();
  195. this.loadingData = true;
  196. this.triggered = false;
  197. this._freshing = false;
  198. });
  199. },
  200. },
  201. };
  202. </script>
  203. <style lang="scss">
  204. .live {
  205. padding: 12px 15rpx;
  206. .scroll-view {
  207. height: calc(100vh - 320px)
  208. }
  209. .li {
  210. background-color: #fff;
  211. padding: 16rpx;
  212. border-radius: 5px;
  213. }
  214. .live-item {
  215. display: flex;
  216. flex-direction: column;
  217. .live-item-text {
  218. display: block;
  219. border-radius: 100rpx;
  220. color: #fff;
  221. width: 36rpx;
  222. height: 36rpx;
  223. background-color: #219430;
  224. text-align: center;
  225. line-height: 36rpx;
  226. }
  227. .live-item-text-green {
  228. background-color: green !important;
  229. }
  230. .live-item-text-red {
  231. background-color: red !important;
  232. }
  233. .live-item-text-block {
  234. background-color: #999999 !important;
  235. opacity: 0.7;
  236. }
  237. text {
  238. // flex: 1;
  239. }
  240. .indexNumber {
  241. width: 76rpx;
  242. text {
  243. display: block;
  244. border-radius: 100rpx;
  245. color: #fff;
  246. width: 36rpx;
  247. height: 36rpx;
  248. background-color: #219430;
  249. text-align: center;
  250. line-height: 36rpx;
  251. }
  252. }
  253. .indexRed {
  254. width: 76rpx;
  255. text {
  256. display: block;
  257. border-radius: 100rpx;
  258. color: #fff;
  259. width: 36rpx;
  260. height: 36rpx;
  261. background-color: red;
  262. text-align: center;
  263. line-height: 36rpx;
  264. }
  265. }
  266. }
  267. .green-card {
  268. background-color: #f3f8fe;
  269. margin-bottom: 8px;
  270. .u-row {
  271. padding: 24rpx;
  272. .over17 {
  273. background: #d8ecff;
  274. border-radius: 10rpx;
  275. border: 1rpx solid #b1d9ff;
  276. text-align: center;
  277. width: 101rpx;
  278. margin-right: 24rpx;
  279. }
  280. .u-col {
  281. text {
  282. display: inline-block;
  283. }
  284. &:last-child {
  285. border-left: 1rpx solid #b1d9ff;
  286. }
  287. }
  288. }
  289. }
  290. }
  291. @media screen and (orientation: landscape) {
  292. .live {
  293. .scroll-view {
  294. height: 50vh;
  295. }
  296. }
  297. }
  298. </style>