broadcast.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. <template>
  2. <view :class="[AppTheme]" class="broadcast">
  3. <!-- #ifdef APP-PLUS || MP-WEIXIN -->
  4. <u-sticky offsetTop="0" style="z-index: 99;">
  5. <!-- #endif -->
  6. <!-- #ifdef H5 -->
  7. <u-sticky offsetTop="-44" style="z-index: 99;">
  8. <!-- #endif -->
  9. <u-tabs :list="modelData" @click="tabsChange" keyName="label" :activeStyle="{
  10. color: primary,
  11. transform: 'scale(1.05)'
  12. }" :inactiveStyle="{
  13. color: '#606266',
  14. transform: 'scale(1)'
  15. }" lineWidth="40" itemStyle="padding-left: 15px; padding-right: 15px; height: 34px;" :lineColor="primary">
  16. </u-tabs>
  17. </u-sticky>
  18. <view v-for="(item, index) in data_list" class="wrap-item" :key="index">
  19. <view class="title">{{ item.name }}</view>
  20. <view class="inner">
  21. <view v-for="(Gitem, Gindex) in item.list" class="inner-item" :key="Gindex">
  22. <view class="item">
  23. <view class="inner-img" @click="goVideo(Gitem)">
  24. <image :src="Gitem.imgurl" mode="" class="img"></image>
  25. <image :src="settingFile.root_img+'/static/app/imgs/much/play.png'" class="item-play"
  26. mode="">
  27. </image>
  28. </view>
  29. <view class="inner-title">{{ Gitem.title }}</view>
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. <u-empty v-if="!data_list" text="暂时数据" mode="list" marginTop="100"></u-empty>
  35. <admyself :opshow="true"></admyself>
  36. </view>
  37. </template>
  38. <script>
  39. import Api from '@/api/broadcast/index.js';
  40. import tabbar from '@/components/tabbar/tabbar.vue';
  41. export default {
  42. data() {
  43. return {
  44. primary: this.$theme.primary,
  45. showVideo: false,
  46. videoSrc: '',
  47. data_list: '',
  48. modelData: [],
  49. initIndex: 0,
  50. top_title: 1,
  51. settingFile: getApp().globalData.siteinfo,
  52. type: 1,
  53. sid: 0
  54. };
  55. },
  56. methods: {
  57. tabsChange(item) {
  58. console.log('item', item)
  59. let that = this;
  60. that.type = item.index + 1;
  61. that.sid = item.id;
  62. that.getList(item.id);
  63. },
  64. getList(id) {
  65. let that = this;
  66. Api.getList({
  67. id: id
  68. }).then(res => {
  69. uni.stopPullDownRefresh();
  70. if (res.data.list && res.data.list.length > 0) {
  71. that.data_list = res.data.list;
  72. } else {
  73. that.data_list = null;
  74. }
  75. if (that.modelData == [] || that.modelData.length <= 0) {
  76. that.modelData = res.data.catelist
  77. }
  78. console.log(that.data_list);
  79. });
  80. },
  81. goVideo(e) {
  82. if (e.jumptype == 'webview') {
  83. let ad_link = encodeURIComponent(JSON.stringify(e.src));
  84. uni.navigateTo({
  85. url: '/pagesE/pages/showhfive/showhfive?url=' + ad_link
  86. })
  87. } else {
  88. uni.navigateTo({
  89. url: `./transmit?id=${e.id}`
  90. })
  91. }
  92. }
  93. },
  94. onLoad() {
  95. this.getList(0);
  96. },
  97. onPullDownRefresh() {
  98. this.data_list = [];
  99. this.getList(this.sid);
  100. },
  101. components: {
  102. tabbar
  103. }
  104. };
  105. </script>
  106. <style lang="scss">
  107. page {
  108. width: 100%;
  109. height: 100%;
  110. // padding-bottom: 140rpx;
  111. }
  112. .u-tabs {
  113. background: #FFFFFF !important;
  114. }
  115. .broadcast {
  116. width: 100%;
  117. height: 100%;
  118. .wrap-item {
  119. .title {
  120. width: 100%;
  121. height: 60rpx;
  122. background: #ebeef5;
  123. font-size: 28rpx;
  124. display: flex;
  125. align-items: center;
  126. padding-left: 30rpx;
  127. box-sizing: border-box;
  128. }
  129. .inner {
  130. width: 100%;
  131. padding: 10rpx 0rpx 10rpx 0rpx;
  132. display: flex;
  133. flex-wrap: wrap;
  134. box-sizing: border-box;
  135. justify-content: space-between;
  136. .inner-item {
  137. width: calc(750rpx / 2);
  138. display: flex;
  139. flex-wrap: wrap;
  140. box-sizing: border-box;
  141. justify-content: center;
  142. .item {
  143. width: 90%;
  144. display: flex;
  145. justify-content: center;
  146. flex-wrap: wrap;
  147. padding: 10rpx;
  148. .inner-img {
  149. width: 100%;
  150. margin: 0;
  151. height: 220rpx;
  152. position: relative;
  153. justify-content: center;
  154. .img {
  155. width: 100%;
  156. height: 100%;
  157. border-radius: 10rpx;
  158. }
  159. .item-play {
  160. width: 55rpx;
  161. height: 55rpx;
  162. position: absolute;
  163. top: 50%;
  164. left: 50%;
  165. margin-top: -27.5rpx;
  166. margin-left: -27.5rpx;
  167. }
  168. }
  169. .inner-title {
  170. width: 100%;
  171. font-size: 27rpx;
  172. height: 60rpx;
  173. display: flex;
  174. align-items: center;
  175. justify-content: center;
  176. }
  177. }
  178. }
  179. }
  180. }
  181. }
  182. </style>