broadcast.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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="inner-img" @click="goVideo(Gitem)">
  23. <image :src="Gitem.imgurl" mode="" class="img"></image>
  24. <image :src="settingFile.root_img+'/static/app/imgs/much/play.png'" class="item-play"
  25. mode="">
  26. </image>
  27. </view>
  28. <view class="inner-title">{{ Gitem.title }}</view>
  29. </view>
  30. </view>
  31. </view>
  32. <admyself :opshow="true"></admyself>
  33. </view>
  34. </template>
  35. <script>
  36. import Api from '@/api/broadcast/index.js';
  37. import tabbar from '@/components/tabbar/tabbar.vue';
  38. export default {
  39. data() {
  40. return {
  41. primary: this.$theme.primary,
  42. showVideo: false,
  43. videoSrc: '',
  44. data_list: '',
  45. modelData: [{
  46. label: '农场监控'
  47. }, {
  48. label: '农场视频'
  49. }],
  50. initIndex: 0,
  51. top_title: 1,
  52. settingFile: getApp().globalData.siteinfo,
  53. type: 1
  54. };
  55. },
  56. methods: {
  57. tabsChange(item) {
  58. let that = this;
  59. that.type = item.index + 1;
  60. that.getList();
  61. },
  62. getList() {
  63. let that = this;
  64. Api.getList({
  65. type: that.type
  66. }).then(res => {
  67. that.data_list = res.data;
  68. console.log(that.data_list);
  69. });
  70. },
  71. goVideo(e) {
  72. if (e.jumptype == 'webview') {
  73. let ad_link = encodeURIComponent(JSON.stringify(e.src));
  74. uni.navigateTo({
  75. url: '/pagesE/pages/showhfive/showhfive?url=' + ad_link
  76. })
  77. } else {
  78. uni.navigateTo({
  79. url: `./transmit?id=${e.id}`
  80. })
  81. }
  82. }
  83. },
  84. mounted() {
  85. this.getList();
  86. },
  87. onPullDownRefresh() {
  88. this.data_list = [];
  89. this.getList(this.type);
  90. setTimeout(() => {
  91. uni.stopPullDownRefresh();
  92. }, 600);
  93. },
  94. components: {
  95. tabbar
  96. }
  97. };
  98. </script>
  99. <style lang="scss">
  100. page {
  101. width: 100%;
  102. height: 100%;
  103. // padding-bottom: 140rpx;
  104. }
  105. .broadcast {
  106. width: 100%;
  107. height: 100%;
  108. .wrap-item {
  109. .title {
  110. width: 100%;
  111. height: 60rpx;
  112. background: #ebeef5;
  113. font-size: 28rpx;
  114. display: flex;
  115. align-items: center;
  116. padding-left: 30rpx;
  117. box-sizing: border-box;
  118. }
  119. .inner {
  120. width: 100%;
  121. padding: 30rpx 15rpx;
  122. display: flex;
  123. flex-wrap: wrap;
  124. // justify-content: space-between;
  125. box-sizing: border-box;
  126. .inner-item {
  127. width: calc(100% / 3);
  128. .inner-img {
  129. width: 98%;
  130. margin: 0;
  131. height: 215rpx;
  132. position: relative;
  133. .img {
  134. width: 100%;
  135. height: 100%;
  136. }
  137. .item-play {
  138. width: 55rpx;
  139. height: 55rpx;
  140. position: absolute;
  141. top: 50%;
  142. left: 50%;
  143. margin-top: -27.5rpx;
  144. margin-left: -27.5rpx;
  145. }
  146. }
  147. .inner-title {
  148. width: 100%;
  149. font-size: 27rpx;
  150. height: 70rpx;
  151. display: flex;
  152. align-items: center;
  153. justify-content: center;
  154. }
  155. }
  156. }
  157. }
  158. }
  159. </style>