list.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. <template>
  2. <view class="container">
  3. <div class="top">
  4. <div class="header">
  5. <img class="logo" src="/static/logo_big.png" alt="">
  6. <u--image
  7. class="border"
  8. :showLoading="true"
  9. :src="info.avatar || '/static/image/match/teams_avatar_ico@2x.png'"
  10. @click="go('/pages/Match/member/usermanger', true)"
  11. width="24px"
  12. height="24px"
  13. shape="circle"
  14. ></u--image>
  15. </div>
  16. <div class="title-box">
  17. <div class="flex" @click="stepBack">
  18. <u-icon name="arrow-left" color="#ffffff" size="16px" bold></u-icon>
  19. {{ type }}
  20. </div>
  21. </div>
  22. </div>
  23. <view class="" style="padding: 12px 0;">
  24. <view class="left">
  25. <view class="waterfall-item" @click="onTap(params.id)" v-for="(params) in list" :key="params.id">
  26. <view class="waterfall-item-img">
  27. <u--image
  28. :showLoading="true"
  29. :src="params.flie[0].img"
  30. width="100%"
  31. height="348rpx"
  32. >
  33. <template v-slot:loading>
  34. <image class="loading-banner-img" src="/static/image/common/video-list-bg.png" mode="aspectFill"></image>
  35. </template>
  36. </u--image>
  37. <div class="bg"></div>
  38. <div class="content">
  39. <div class="text-clamp2">{{ params.title }}</div>
  40. </div>
  41. <img class="play" src="/static/image/live/play-icon.png" alt="">
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. <u-loadmore
  47. :status="status"
  48. fontSize="28"
  49. :line="true"
  50. :loading-text="statusType.loadingText"
  51. :loadmore-text="statusType.loadmoreText"
  52. :nomore-text="statusType.nomoreText"
  53. />
  54. <u-empty v-if="obj.total == 0" mode="data" width="474" height="312" textSize="28" marginTop="100"
  55. :text="$t('common.nodata')" icon="/static/image/common/nodata.png">
  56. </u-empty>
  57. <div class="news-install">
  58. <install></install>
  59. </div>
  60. </view>
  61. </template>
  62. <script>
  63. import { numberToK } from '@/utils/util'
  64. import install from '@/components/install/install.vue'
  65. export default {
  66. components: {
  67. install
  68. },
  69. data() {
  70. return {
  71. // 初始化左右盒子
  72. list: [],
  73. type: '',
  74. obj: {
  75. total: 1
  76. },
  77. page: 1,
  78. status: 'loadmore',
  79. statusType:{
  80. loadingText: this.$t('common.lab'),
  81. loadmoreText: this.$t('common.lab1'),
  82. nomoreText: this.$t('common.lab2')
  83. },
  84. }
  85. },
  86. computed: {
  87. info() {
  88. return this.$store.state.info;
  89. },
  90. isLogin() {
  91. return this.$store.state.isLogin;
  92. },
  93. },
  94. onLoad(option) {
  95. this.type = option.type;
  96. },
  97. onReady() {
  98. this.getList();
  99. },
  100. // 触底触发
  101. onReachBottom() {
  102. if (this.status == 'loadmore') {
  103. this.page++;
  104. this.getList();
  105. }
  106. },
  107. // 下拉刷新
  108. onPullDownRefresh() {
  109. // 正常情况下接口返回应该很会很快。故意延迟调用,让用户有在刷新的体验感
  110. this.page = 1;
  111. this.list = [];
  112. this.getList();
  113. },
  114. methods: {
  115. onTap(id) {
  116. this.$toUrl('./live?id=' + id+'&tournament=' + this.type)
  117. },
  118. toUrl() {
  119. this.$toUrl('./publish')
  120. },
  121. // 获取数据
  122. getList() {
  123. // 设置状态为加载中
  124. this.status = 'loading';
  125. uni.$u.http.get('/api/Video/getTournamentVideoList', {
  126. params: {
  127. page: this.page,
  128. name: this.type
  129. }
  130. }).then(res => {
  131. // 获取到的数据,请注意数据结构
  132. // 第一页数据执行以下代码
  133. if (this.page == 1) {
  134. // 关闭下拉
  135. this.list=res.data || []
  136. uni.stopPullDownRefresh();
  137. // 设置组件状态为 重置,可供下拉刷新这类需要重置列表功能时使用
  138. } else {
  139. this.list = this.list.concat(res.data || [])
  140. }
  141. this.obj = res
  142. this.status = this.list.length == res.total ? 'nomore' : 'loadmore'
  143. }).catch(res => {})
  144. },
  145. numberToK(v) {
  146. return numberToK(v)
  147. },
  148. stepBack() {
  149. uni.switchTab({
  150. url: '/pages/Videos/index'
  151. })
  152. },
  153. go(url, login) {
  154. if (this.isLogin == 2 && login) {
  155. this.$toUrl('/pages/login/login')
  156. return
  157. }
  158. this.$toUrl(url)
  159. },
  160. }
  161. }
  162. </script>
  163. <style lang="scss">
  164. page {
  165. background-color: #f3f3f3;
  166. }
  167. .container {
  168. padding-bottom: 140rpx;
  169. }
  170. .top {
  171. position: sticky;
  172. top: 0;
  173. z-index: 999;
  174. .header {
  175. display: flex;
  176. align-items: center;
  177. justify-content: space-between;
  178. padding: 8rpx 16px 16rpx;
  179. background-color: #10044A;
  180. }
  181. .logo {
  182. height: 24px;
  183. }
  184. .border {
  185. border: 1px solid #CC2900;
  186. border-radius: 50%;
  187. }
  188. .title-box {
  189. height: 40px;
  190. background-color: #262E4A;
  191. padding: 0 16px;
  192. display: flex;
  193. align-items: center;
  194. color: #fff;
  195. font-weight: 500;
  196. font-size: 16px;
  197. .u-icon {
  198. margin-right: 10px;
  199. }
  200. }
  201. }
  202. .waterfall-item {
  203. background-color: #fff;
  204. overflow: hidden;
  205. font-size: 28rpx;
  206. color: #fff;
  207. font-weight: 500;
  208. margin-bottom: 20rpx;
  209. .waterfall-title {
  210. padding: 20rpx 10rpx;
  211. font-weight: 700;
  212. }
  213. .waterfall-item-img {
  214. position: relative;
  215. height: 348rpx;
  216. .loading-banner-img {
  217. width: 100%;
  218. height: 348rpx;
  219. }
  220. .bg {
  221. position: absolute;
  222. top: 0;
  223. left: 0;
  224. right: 0;
  225. bottom: 0;
  226. background: linear-gradient(180deg, rgba(16, 4, 74, 0) 0%, #080031 100%);
  227. }
  228. .content {
  229. position: absolute;
  230. left: 0;
  231. right: 0;
  232. bottom: 0;
  233. padding: 11px 72px 11px 16px;
  234. }
  235. .play {
  236. position: absolute;
  237. right: 16px;
  238. bottom: 19px;
  239. width: 28px;
  240. }
  241. }
  242. }
  243. .load-txt {
  244. padding: 0 0 20rpx 0;
  245. text-align: center;
  246. color: #999;
  247. font-size: 24rpx;
  248. }
  249. .publishicon {
  250. position: fixed;
  251. right: 32rpx;
  252. bottom: 220rpx;
  253. width: 94rpx;
  254. height: 94rpx;
  255. z-index: 99;
  256. }
  257. .news-install {
  258. position: fixed;
  259. left: 0;
  260. right: 0;
  261. bottom: var(--window-bottom);
  262. z-index: 200;
  263. }
  264. </style>