OtherTab.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  1. <!-- 足球 -->
  2. <template>
  3. <view class="list">
  4. <view class="list-head" v-if="hotList.length != 0">
  5. <view class="list-title flex-start">
  6. <text>{{$t('live.anchor')}}</text>
  7. </view>
  8. <view class="list-list flex-start">
  9. <view class="list-list-li" v-for="(item,index) in hotList" :key="index">
  10. <image :src="item.avatar" mode=""></image>
  11. <view class="text-clamp">{{item.user_nickname}}</view>
  12. </view>
  13. </view>
  14. </view>
  15. <view class="detail-title flex-start">
  16. <image src="/static/image/live/detail01.png" mode=""></image>
  17. <text style="">{{$t('live.title')}}</text>
  18. </view>
  19. <view class="detail-video-list flex" style="flex-wrap: wrap;">
  20. <view class="detail-video-li" v-for="(item,index) in liveList" :key="index" @click="$toUrl(`./live-detail?id=${item.live_id}&ID=${item.id}`)">
  21. <div v-if="item.islive==0" class="zhezao">{{formatDate(item.starttime)}}</div>
  22. <div class="img_box">
  23. <u--image :showLoading="true" :src="(item.home_logo && item.away_logo) ? item.bottom : item.thumb" width="100%" height="176rpx">
  24. <template v-slot:loading>
  25. <image class="loading-list-img" src="/static/image/common/live-list-bg.png"></image>
  26. </template>
  27. </u--image>
  28. <image v-if="item.home_logo && item.away_logo" class="home_logo" :src="item.home_logo" mode="aspectFill" alt=""></image>
  29. <image v-if="item.home_logo && item.away_logo" class="away_logo" :src="item.away_logo" mode="aspectFill" alt=""></image>
  30. </div>
  31. <image v-if="item.islive==1" src="/static/image/live/live-icon.png" mode="" class="live-icon"></image>
  32. <view class="detail-video-content ">
  33. <view class="detail-video-title text-clamp2">
  34. {{item.title}}
  35. </view>
  36. <view class="detail-video-right flex">
  37. <image class="detail-video-content-logo" :src="item.avatar" mode="aspectFill"></image>
  38. <view class="detail-video-info flex">
  39. <text class="text-clamp">{{item.user_nickname}}</text>
  40. <u-icon color="#999" name="eye" size="30" v-if="item.viewers && item.islive==1"></u-icon>
  41. <view v-if="item.islive==1">{{numberToK(item.viewers)}}</view>
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. <u-empty
  48. v-if="liveList.length == 0"
  49. mode="data"
  50. width="474"
  51. height="312"
  52. textSize="28"
  53. marginTop="100"
  54. :text="$t('common.nodata')"
  55. icon="/static/image/common/nodata.png"
  56. >
  57. </u-empty>
  58. <!-- <u-empty text="暂无直播" v-if="liveList.total == 0" src="/static/images/competition/none.png" icon-size="400" mode="list"></u-empty> -->
  59. </view>
  60. </template>
  61. <script>
  62. import { numberToK } from '@/utils/util'
  63. export default {
  64. data() {
  65. return {
  66. liveList: []
  67. }
  68. },
  69. computed: {
  70. hotList() {
  71. return this.liveList.filter(item => {
  72. return item.ishot == 1
  73. })
  74. }
  75. },
  76. mounted() {
  77. },
  78. methods:{
  79. getList(){
  80. // 正在直播
  81. // type 1 无人直播 0 主播直播
  82. // islive 1 正在直播 0 未开始
  83. // ishot 1热门直播
  84. let data = {
  85. type: 1,
  86. }
  87. uni.$u.http.get('/api/live_streaming/getLiveListold', {params:data}).then(res => {
  88. this.liveList = res.data || []
  89. })
  90. },
  91. numberToK(v) {
  92. return numberToK(v)
  93. },
  94. formatDate(value) {
  95. var date1 = this.$common.parseTime(value * 1000, '{y}/{m}/{d} {h}:{i}:{s}')
  96. var date = new Date(date1 + ' UTC+5:30');
  97. var weekNum = new Date().getDay()
  98. let week = ""
  99. switch (weekNum) {
  100. case 0:
  101. week = "Sun";
  102. break;
  103. case 1:
  104. week = "Mon";
  105. break;
  106. case 2:
  107. week = "Tue";
  108. break;
  109. case 3:
  110. week = "Wed";
  111. break;
  112. case 4:
  113. week = "Thu";
  114. break;
  115. case 5:
  116. week = "Fri";
  117. break;
  118. case 6:
  119. week = "Sat";
  120. break;
  121. }
  122. var MonthNum = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1)
  123. let Month = ''
  124. switch (MonthNum) {
  125. case 1:
  126. Month = "Jan";
  127. break;
  128. case 2:
  129. Month = "Feb";
  130. break;
  131. case 3:
  132. Month = "Mar";
  133. break;
  134. case 4:
  135. Month = "Apr";
  136. break;
  137. case 5:
  138. Month = "May";
  139. break;
  140. case 6:
  141. Month = "Jun";
  142. break;
  143. case 7:
  144. Month = "Jul";
  145. break;
  146. case 8:
  147. Month = "Aug";
  148. break;
  149. case 9:
  150. Month = "Sept";
  151. break;
  152. case 10:
  153. Month = "Oct";
  154. break;
  155. case 11:
  156. Month = "Nov";
  157. break;
  158. case 12:
  159. Month = "Dec";
  160. break;
  161. }
  162. let day = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate())
  163. // this.week = week
  164. // this.month = Month
  165. // this.day = day
  166. var hours = date.getHours();
  167. var minutes = date.getMinutes();
  168. var ampm = hours >= 12 ? 'PM' : 'AM';
  169. if (hours != 12) {
  170. hours = hours % 12;
  171. }
  172. if (hours == 12 && minutes) {
  173. hours = hours % 12;
  174. ampm = 'PM'
  175. }
  176. hours = hours < 10 ? "0" + hours : hours;
  177. minutes = minutes < 10 ? '0' + minutes : minutes;
  178. // var strTime = week + ',' + day + Month + '.' + 'Watch live in' + hours + ':' + minutes + ' ' + ampm;
  179. var strTime = this.$t('match.lab92') + ' ' + hours + ':' + minutes + ' ' + ampm;
  180. return strTime;
  181. },
  182. }
  183. }
  184. </script>
  185. <style lang="scss">
  186. .zhezao {
  187. background: rgba(0, 0, 0, 0.5);
  188. position: absolute;
  189. top: 0;
  190. left: 0;
  191. z-index: 2;
  192. color: #fff;
  193. text-align: center;
  194. line-height: 1;
  195. padding: 10rpx 6rpx;
  196. border-radius: 6rpx;
  197. font-size: 16rpx;
  198. white-space: nowrap;
  199. }
  200. .live-icon {
  201. position: absolute;
  202. right: 10rpx;
  203. bottom: 160rpx;
  204. width: 60rpx;
  205. height: 32rpx;
  206. }
  207. .list {
  208. padding: 0 18rpx 140rpx;
  209. // padding-top: 6vh;
  210. }
  211. .list-head {
  212. overflow: hidden;
  213. margin-top: 20rpx;
  214. border-radius: 12rpx;
  215. background-color: white;
  216. .list-title {
  217. padding: 16rpx 12rpx;
  218. background: url(/static/image/news/hot-title.png)left top / 290rpx 100% no-repeat;
  219. // image {
  220. // width: 28rpx;
  221. // height: 32rpx;
  222. // margin-right: 12rpx;
  223. // }
  224. text {
  225. color: #fff;
  226. font-size: 28rpx;
  227. }
  228. }
  229. }
  230. .list-list-li{
  231. margin-right: 20rpx;
  232. image {
  233. width: 72rpx;
  234. height: 72rpx;
  235. margin: 0 auto;
  236. display: block;
  237. border-radius: 50%;
  238. margin-bottom: 10rpx;
  239. }
  240. view {
  241. max-width: 99%;
  242. }
  243. }
  244. .list-list {
  245. padding: 0 8rpx;
  246. margin-top: 24rpx;
  247. margin-bottom: 24rpx;
  248. width: 100%;
  249. overflow: auto;
  250. }
  251. .detail-title {
  252. margin-top: 32rpx;
  253. font-weight: bold;
  254. image {
  255. width: 40rpx;
  256. height: 40rpx;
  257. margin-right: 16rpx;
  258. }
  259. text {
  260. color: #333;
  261. font-size: 32rpx;
  262. }
  263. }
  264. .detail-video-li {
  265. overflow: hidden;
  266. margin-top: 20rpx;
  267. position: relative;
  268. width: calc(100% / 2 - 9rpx);
  269. border-radius: 12rpx;
  270. background-color: white;
  271. .loading-list-img {
  272. width: 100%;
  273. height: 176rpx;
  274. display: block;
  275. }
  276. .img_box {
  277. position: relative;
  278. }
  279. .home_logo, .away_logo {
  280. position: absolute;
  281. top: 50%;
  282. transform: translateY(-50%);
  283. width: 90rpx;
  284. height: 90rpx;
  285. border-radius: 50%;
  286. }
  287. .home_logo {
  288. left: 30rpx;
  289. }
  290. .away_logo {
  291. right: 30rpx;
  292. }
  293. .detail-video-content {
  294. padding: 16rpx;
  295. .detail-video-content-logo {
  296. width: 40rpx;
  297. height: 40rpx;
  298. border-radius: 50%;
  299. margin-right: 24rpx;
  300. }
  301. .detail-video-title {
  302. width: 99%;
  303. height: 80rpx;
  304. color: #333;
  305. font-size: 28rpx;
  306. }
  307. }
  308. .detail-video-info {
  309. font-size: 24rpx;
  310. flex: 1;
  311. image {
  312. width: 24rpx;
  313. height: 24rpx;
  314. margin-right: 6rpx;
  315. }
  316. text {
  317. flex: 1;
  318. width: 100rpx;
  319. color: #9193B4;
  320. }
  321. view {
  322. color: #999;
  323. }
  324. }
  325. }
  326. .detail-video-right {
  327. flex: 1;
  328. min-width: 100px;
  329. }
  330. </style>