index.vue 8.2 KB

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