index.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451
  1. <template>
  2. <!-- #ifdef MP -->
  3. <view v-if="liveList.length > 0">
  4. <view class="live-wrapper-b">
  5. <navigator class="live-item-b" v-for="(item,index) in liveList" :key="index"
  6. :url="'plugin-private://wx2b03c6e691cd7370/pages/live-player-plugin?room_id=' + item.room_id+'&custom_params='+custom_params"
  7. hover-class="none" :style="[{'background':bg},{'box-shadow':`0px 1px 20px ${boxShadow}`}]">
  8. <view class="img-box">
  9. <view class="label bgblue" v-if="item.live_status == 102">
  10. <view class="txt">{{$t(`预告`)}}</view>
  11. <view class="msg">{{item.show_time}}</view>
  12. </view>
  13. <view class="label bggary" v-if="item.live_status==103">
  14. <image src="/static/images/live-02.png" mode="" style="width: 20rpx; height: 20rpx;"></image>
  15. <text>{{$t(`回放`)}}</text>
  16. </view>
  17. <view class="label bgred" v-if="item.live_status==101">
  18. <image src="/static/images/live-01.png" mode="" style="width: 21rpx; height: 22rpx;"></image>
  19. <text>{{$t(`进行中`)}}</text>
  20. </view>
  21. <image :src="item.share_img"></image>
  22. </view>
  23. <view class="info">
  24. <view class="title line1">{{item.name}}</view>
  25. <view class="people">
  26. <image :src="item.anchor_img" alt="">
  27. <text>{{item.anchor_name}}</text>
  28. </view>
  29. </view>
  30. </navigator>
  31. </view>
  32. </view>
  33. <!-- #endif -->
  34. </template>
  35. <script>
  36. import {
  37. getLiveList
  38. } from '@/api/api.js';
  39. export default {
  40. name: 'liveBroadcast',
  41. props: {
  42. dataConfig: {
  43. type: Object,
  44. default: () => {}
  45. }
  46. },
  47. data() {
  48. return {
  49. page: 1,
  50. limit: 10,
  51. listStyle: 1,
  52. isScroll: true,
  53. liveList: [],
  54. custom_params:''
  55. }
  56. },
  57. created() {},
  58. mounted() {
  59. this.custom_params= encodeURIComponent(JSON.stringify({spid:this.$store.state.app.uid}))
  60. this.getLiveList();
  61. },
  62. methods: {
  63. getLiveList: function() {
  64. let limit = this.$config.LIMIT;
  65. if (!this.isScroll) return
  66. getLiveList(this.page, this.limit)
  67. .then(res => {
  68. this.isScroll = res.data.length >= this.limit
  69. this.page++
  70. this.liveList = this.liveList.concat(res.data);
  71. })
  72. .catch(res => {});
  73. }
  74. },
  75. onReachBottom() {
  76. this.getLiveList()
  77. }
  78. };
  79. </script>
  80. <style lang="scss">
  81. .live-wrapper {
  82. position: relative;
  83. width: 100%;
  84. overflow: hidden;
  85. border-radius: 16rpx;
  86. image {
  87. width: 100%;
  88. height: 400rpx;
  89. }
  90. .live-top {
  91. z-index: 20;
  92. position: absolute;
  93. left: 0;
  94. top: 0;
  95. display: flex;
  96. align-items: center;
  97. justify-content: center;
  98. color: #fff;
  99. width: 180rpx;
  100. height: 54rpx;
  101. border-radius: 0rpx 0px 18rpx 0px;
  102. image {
  103. width: 30rpx;
  104. height: 30rpx;
  105. margin-right: 10rpx;
  106. /* #ifdef H5 */
  107. display: block;
  108. /* #endif */
  109. }
  110. }
  111. .live-title {
  112. position: absolute;
  113. left: 0;
  114. bottom: 6rpx;
  115. width: 100%;
  116. height: 70rpx;
  117. line-height: 70rpx;
  118. text-align: center;
  119. font-size: 30rpx;
  120. color: #fff;
  121. background: rgba(0, 0, 0, 0.35);
  122. }
  123. &.mores {
  124. width: 100%;
  125. .item {
  126. position: relative;
  127. width: 320rpx;
  128. display: inline-block;
  129. border-radius: 16rpx;
  130. overflow: hidden;
  131. margin-right: 20rpx;
  132. image {
  133. width: 320rpx;
  134. height: 180rpx;
  135. border-radius: 16rpx;
  136. object-fit: cover;
  137. }
  138. .live-title {
  139. height: 40rpx;
  140. line-height: 40rpx;
  141. text-align: center;
  142. font-size: 22rpx;
  143. }
  144. .live-top {
  145. width: 120rpx;
  146. height: 36rpx;
  147. font-size: 22rpx;
  148. image {
  149. width: 20rpx;
  150. height: 20rpx;
  151. }
  152. }
  153. }
  154. }
  155. }
  156. .live-wrapper-a {
  157. padding: 0rpx 20rpx 0;
  158. .live-item-a {
  159. display: flex;
  160. background: #fff;
  161. margin-bottom: 20rpx;
  162. border-radius: 16rpx;
  163. overflow: hidden;
  164. &:last-child {
  165. margin-bottom: 0;
  166. }
  167. .img-box {
  168. position: relative;
  169. width: 340rpx;
  170. height: 270rpx;
  171. image {
  172. width: 100%;
  173. height: 100%;
  174. }
  175. }
  176. .info {
  177. flex: 1;
  178. display: flex;
  179. flex-direction: column;
  180. justify-content: space-between;
  181. padding: 15rpx 20rpx;
  182. .title {
  183. font-size: 30rpx;
  184. color: #333;
  185. }
  186. .people {
  187. display: flex;
  188. align-items: center;
  189. color: #999;
  190. font-size: 24rpx;
  191. margin-top: 10rpx;
  192. image {
  193. width: 32rpx;
  194. height: 32rpx;
  195. border-radius: 50%;
  196. margin-right: 10rpx;
  197. }
  198. }
  199. .goods-wrapper {
  200. display: flex;
  201. .goods-item {
  202. position: relative;
  203. width: 96rpx;
  204. height: 96rpx;
  205. margin-right: 20rpx;
  206. overflow: hidden;
  207. border-radius: 16rpx;
  208. &:last-child {
  209. margin-right: 0;
  210. }
  211. image {
  212. width: 100%;
  213. height: 100%;
  214. border-radius: 16rpx;
  215. }
  216. .bg {
  217. position: absolute;
  218. left: 0;
  219. top: 0;
  220. width: 100%;
  221. height: 100%;
  222. border-radius: 16rpx;
  223. background: rgba(0, 0, 0, 0.3);
  224. }
  225. text {
  226. position: absolute;
  227. left: 0;
  228. bottom: 0;
  229. width: 100%;
  230. height: 60rpx;
  231. line-height: 70rpx;
  232. color: #fff;
  233. background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.75) 100%);
  234. }
  235. .num {
  236. display: flex;
  237. align-items: center;
  238. justify-content: center;
  239. position: absolute;
  240. left: 0;
  241. top: 0;
  242. width: 100%;
  243. height: 100%;
  244. background: rgba(0, 0, 0, 0.3);
  245. color: #fff;
  246. font-size: 28rpx;
  247. }
  248. }
  249. }
  250. .empty-goods {
  251. width: 96rpx;
  252. height: 96rpx;
  253. border-radius: 6rpx;
  254. background-color: #B2B2B2;
  255. color: #fff;
  256. font-size: 20rpx;
  257. text-align: center;
  258. line-height: 96rpx;
  259. }
  260. }
  261. }
  262. &.live-wrapper-c {
  263. .live-item-a {
  264. display: flex;
  265. flex-direction: column;
  266. .img-box {
  267. width: 100%;
  268. border-radius: 8px 8px 0 0;
  269. }
  270. .info {
  271. display: flex;
  272. justify-content: space-between;
  273. align-items: center;
  274. flex-direction: initial;
  275. .left {
  276. width: 69%;
  277. }
  278. .goods-wrapper {
  279. flex: 1;
  280. }
  281. }
  282. }
  283. }
  284. }
  285. .live-wrapper-b {
  286. padding: 20rpx 20rpx 0;
  287. display: flex;
  288. justify-content: space-between;
  289. flex-wrap: wrap;
  290. .live-item-b {
  291. width: 345rpx;
  292. background-color: #fff;
  293. border-radius: 16rpx;
  294. overflow: hidden;
  295. margin-bottom: 20rpx;
  296. overflow: hidden;
  297. .img-box {
  298. position: relative;
  299. image {
  300. width: 100%;
  301. height: 190rpx;
  302. }
  303. }
  304. .info {
  305. display: flex;
  306. flex-direction: column;
  307. padding: 20rpx;
  308. .title {
  309. font-size: 30rpx;
  310. color: #333;
  311. }
  312. .people {
  313. display: flex;
  314. margin-top: 10rpx;
  315. color: #999;
  316. image {
  317. width: 36rpx;
  318. height: 36rpx;
  319. border-radius: 50%;
  320. margin-right: 10rpx;
  321. }
  322. }
  323. }
  324. }
  325. }
  326. .label {
  327. display: flex;
  328. align-items: center;
  329. justify-content: center;
  330. position: absolute;
  331. left: 20rpx;
  332. top: 20rpx;
  333. border-radius: 22rpx 0px 22rpx 22rpx;
  334. font-size: 24rpx;
  335. color: #fff;
  336. image {
  337. margin-right: 10rpx;
  338. }
  339. text {
  340. font-size: 22rpx;
  341. }
  342. }
  343. .bgred {
  344. width: 132rpx;
  345. height: 38rpx;
  346. background: linear-gradient(270deg, #F5742F 0%, #FF1717 100%)
  347. }
  348. .bggary {
  349. width: 108rpx;
  350. height: 38rpx;
  351. background: linear-gradient(270deg, #999999 0%, #666666 100%)
  352. }
  353. .bgblue {
  354. width: 220rpx;
  355. height: 38rpx;
  356. // background: rgba(0,0,0,0.36);
  357. background: linear-gradient(80deg, #2FA1F5 0%, #0076FF 5%, rgba(0, 0, 0, 0.36) 100%);
  358. overflow: hidden;
  359. .txt {
  360. position: relative;
  361. left: -5rpx;
  362. display: flex;
  363. align-items: center;
  364. justify-content: center;
  365. width: 38px;
  366. height: 100%;
  367. text-align: center;
  368. // background: linear-gradient(270deg, #2FA1F5 0%, #0076FF 100%);
  369. }
  370. }
  371. .title-box {
  372. display: flex;
  373. justify-content: space-between;
  374. align-items: center;
  375. padding: 20rpx;
  376. font-size: 32rpx;
  377. .more {
  378. display: flex;
  379. align-items: center;
  380. justify-content: center;
  381. font-size: 26rpx;
  382. color: #666;
  383. .iconfont {
  384. font-size: 26rpx;
  385. margin-top: 8rpx;
  386. }
  387. }
  388. }
  389. .empty-txt {
  390. height: 60rpx;
  391. line-height: 60rpx;
  392. text-align: center;
  393. font-size: 24rpx;
  394. color: #999;
  395. }
  396. </style>