list.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <template>
  2. <view class="box">
  3. <!-- 1 回放 2.直播列表 -->
  4. <view v-if="flag == 1" class="boxlist">
  5. <view v-if="item.live_status=='101'" @click="nextTo(item,ind, 1)" class="bb vidLi dfsb" v-for="(item, ind) in list" :key="ind">
  6. <image class="imgbox" :src="item.share_img" mode=""></image>
  7. <view class="dffd flex1">
  8. <view class="title elli">{{ item.name }}</view>
  9. <view class="textgrey fontsm">{{ item.up_name }}</view>
  10. <view class="auth dfsb">
  11. <text class="fontssm textgrey">作者:{{ item.anchor_name }}</text>
  12. </view>
  13. </view>
  14. </view>
  15. </view>
  16. <!-- <navigator url="plugin-private://wx00d3d08bf67e853e/pages/live-player-plugin?room_id=6&custom_params=''">
  17. gogoogogog
  18. </navigator> -->
  19. <view v-if="flag == 2" class="boxlist">
  20. <view v-if="item.live_status !='101'" @click="nextTo(item,ind, 2)" class="bb vidLi dfsb" v-for="(item, ind) in list" :key="ind">
  21. <image class="imgbox" :src="item.share_img" mode=""></image>
  22. <view class="dffd flex1">
  23. <view class="title elli">{{ item.name }}</view>
  24. <!-- 101:直播中,102:未开始,103已结束,104禁播,105:暂停,106:异常,107:已过期 -->
  25. <view class="textgrey fontsm">{{ item.live_status=='101'?'直播中':item.live_status=='102'?'未开始':item.live_status=='103'?'已结束,观看回放':'暂未开始' }}</view>
  26. <view class="auth dfsb">
  27. <text class="fontssm textgrey">作者:{{ item.anchor_name }}</text>
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. </view>
  33. </template>
  34. <script>
  35. export default {
  36. data() {
  37. return {};
  38. },
  39. props: {
  40. list: {
  41. type: Array,
  42. default: []
  43. },
  44. flag: {
  45. type: [String, Number],
  46. default: 1 //1 回放 2.直播列表
  47. }
  48. },
  49. methods: {
  50. nextTo(item,ind, val) {
  51. if (val == 1) {
  52. let roomId = item.roomid; // 填写具体的房间号,可通过下面【获取直播房间列表】 API 获取
  53. let customParams = '' // 开发者在直播间页面路径上携带自定义参数(如示例中的path和pid参数),后续可以在分享卡片链接和跳转至商详页时获取,详见【获取自定义参数】、【直播间到商详页面携带参数】章节(上限600个字符,超过部分会被截断)
  54. uni.navigateTo({
  55. url: `plugin-private://wx2b03c6e691cd7370/pages/live-player-plugin?room_id=${roomId}&custom_params=${customParams}`
  56. })
  57. }else{
  58. // uni.navigateTo({
  59. // url:'/pagesA/broadcast/blist?item='+JSON.stringify(item)
  60. // });
  61. this.$api.request('live/get_replay', { roomid: item.roomid }).then(data => {
  62. if (data.code == 200) {
  63. let media_url= data.data.live_replay[0].media_url;
  64. uni.navigateTo({
  65. url: '/pagesA/broadcast/bdInfo?media_url=' + JSON.stringify(media_url)
  66. });
  67. console.log(media_url);
  68. } else {
  69. this.$api.toast(data.msg);
  70. }
  71. });
  72. }
  73. }
  74. }
  75. };
  76. </script>
  77. <style scoped lang="scss">
  78. .boxlist {
  79. .vidLi {
  80. width: 100%;
  81. padding: 27rpx 0;
  82. background-color: #fff;
  83. &:nth-of-type(2n) {
  84. margin-right: 0;
  85. }
  86. .imgbox {
  87. width: 146rpx;
  88. height: 146rpx;
  89. margin-right: 18rpx;
  90. border-radius: 10rpx;
  91. }
  92. .title {
  93. font-size: 28rpx;
  94. line-height: 40rpx;
  95. margin-bottom: 12rpx;
  96. }
  97. .auth {
  98. margin-top: 15rpx;
  99. width: 100%;
  100. }
  101. .down {
  102. width: 35rpx;
  103. height: 30rpx;
  104. margin-left: 58rpx;
  105. }
  106. }
  107. }
  108. </style>