index.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. <template>
  2. <view class="container">
  3. <view class="headbox">
  4. <view class="headnav x-bc">
  5. <view :class="activeTab == 0 ? 'headnav-item headnav-active':'headnav-item'" @click="handleNav(0)">
  6. <view>直播计划</view>
  7. <view class="headnav-num">3</view>
  8. <image src="@/static/images/idle.png" mode="aspectFill"></image>
  9. </view>
  10. <view :class="activeTab == 1? 'headnav-item headnav-active':'headnav-item'" @click="handleNav(1)">
  11. <view>今日直播</view>
  12. <view class="headnav-num">3</view>
  13. <image src="@/static/images/streaming.png" mode="aspectFill"></image>
  14. </view>
  15. <view :class="activeTab == 2 ? 'headnav-item headnav-active':'headnav-item'" @click="handleNav(2)">
  16. <view>往日直播</view>
  17. <view class="headnav-num">3</view>
  18. <image src="@/static/images/finished.png" mode="aspectFill"></image>
  19. </view>
  20. </view>
  21. <view class="x-bc">
  22. <view :class="searchbarNav == index ? 'searchbar x-c searchbar-active':'searchbar x-c'" v-for="(item,index) in searchbar" :key="index" @click="clickSearchbar(index)">
  23. <text>{{item.name}}</text><u-icon class="arrow-down" name="arrow-down" :color="searchbarNav == index ?'#1677ff':'#999'" size="12"></u-icon>
  24. </view>
  25. </view>
  26. </view>
  27. <view class="coursebox" :style="{height: contentH}">
  28. <!-- <mescroll-body top="88rpx" bottom="0" ref="mescrollRef" @init="mescrollInit" :down="downOption" :up="upOption" @down="downCallback" @up="upCallback"> -->
  29. <view class="courselist">
  30. <courseItem :activeTab="activeTab" />
  31. </view>
  32. <!-- </mescroll-body> -->
  33. </view>
  34. </view>
  35. </template>
  36. <script>
  37. import courseItem from "../components/courseItem.vue"
  38. export default {
  39. components: {
  40. courseItem
  41. },
  42. data() {
  43. return {
  44. contentH: 0,
  45. activeTab: 0,
  46. searchbarNav: 'colse',
  47. searchbar: [{
  48. name: '训练营-营期'
  49. },
  50. {
  51. name: '课程状态'
  52. }],
  53. mescroll:null,
  54. downOption: {
  55. auto:false//不要自动加载
  56. },
  57. upOption: {
  58. onScroll:false,
  59. use: true, // 是否启用上拉加载; 默认true
  60. page: {
  61. num: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
  62. size: 10 // 每页数据的数量,默认10
  63. },
  64. noMoreSize: 10, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
  65. textNoMore:"已经到底了",
  66. empty: {
  67. icon:'/static/images/empty.png',
  68. tip: '暂无数据'
  69. }
  70. },
  71. dataList: []
  72. }
  73. },
  74. mounted() {
  75. const windowHeight = uni.getSystemInfoSync().windowHeight
  76. this.contentH = `calc(${windowHeight}px - 132px - 56px)`
  77. },
  78. methods: {
  79. handleNav(type) {
  80. this.activeTab = type
  81. },
  82. clickSearchbar(type) {
  83. this.searchbarNav = type == this.searchbarNav ? 'colse' : type
  84. },
  85. mescrollInit(mescroll) {
  86. this.mescroll = mescroll;
  87. },
  88. /*下拉刷新的回调 */
  89. downCallback(mescroll) {
  90. mescroll.resetUpScroll()
  91. },
  92. upCallback(page) {
  93. // //联网加载数据
  94. // var that = this;
  95. // var data={
  96. // customerName:this.searchKey,
  97. // pageNum: page.num,
  98. // pageSize: page.size
  99. // };
  100. // uni.showLoading({
  101. // title:"加载中..."
  102. // })
  103. // getMyCustomerList(data).then(res => {
  104. // uni.hideLoading()
  105. // if(res.code==200){
  106. // //设置列表数据
  107. // if (page.num == 1) {
  108. // that.dataList = res.data.list;
  109. // } else {
  110. // that.dataList = that.dataList.concat(res.data.list);
  111. // }
  112. // that.mescroll.endBySize(res.data.list.length, res.data.total);
  113. // }else{
  114. // uni.showToast({
  115. // icon:'none',
  116. // title: "请求失败",
  117. // });
  118. // that.dataList = null;
  119. // that.mescroll.endErr();
  120. // }
  121. // });
  122. },
  123. }
  124. }
  125. </script>
  126. <style lang="scss">
  127. .container {
  128. font-family: PingFang SC, PingFang SC;
  129. font-weight: 400;
  130. font-size: 14px;
  131. color: #222;
  132. }
  133. .headbox {
  134. background-color: #fff;
  135. }
  136. .headnav {
  137. padding: 15px 12px;
  138. margin: 0 -10px -10px 0;
  139. box-sizing: border-box;
  140. image {
  141. height: 60px;
  142. width: 50px;
  143. position: absolute;
  144. z-index: 0;
  145. bottom: 0;
  146. right: 0;
  147. display: none;
  148. }
  149. &-item {
  150. flex: 1;
  151. font-size: 16px;
  152. padding: 10px;
  153. border-radius: 10px;
  154. background: #f5f5f5;
  155. margin: 0 10px 10px 0;
  156. position: relative;
  157. z-index: 1;
  158. overflow: hidden;
  159. color: #555;
  160. }
  161. &-active {
  162. background-color: rgb(231, 241, 255) !important;
  163. .headnav-num {
  164. color: #1677ff !important;
  165. }
  166. image {
  167. display: block !important;
  168. }
  169. }
  170. &-num {
  171. font-family: DIN, DIN;
  172. font-weight: bold;
  173. font-size: 25px;
  174. margin: 5px 0;
  175. }
  176. }
  177. .searchbar {
  178. flex: 1;
  179. padding-bottom: 10px;
  180. .arrow-down {
  181. margin-left: 5px;
  182. }
  183. &-active {
  184. color: #1677ff !important;
  185. .arrow-down {
  186. transform: rotate(180deg);
  187. }
  188. }
  189. }
  190. .coursebox {
  191. position: relative;
  192. overflow-y: auto;
  193. box-sizing: border-box;
  194. }
  195. .courselist {
  196. padding: 12px;
  197. box-sizing: border-box;
  198. }
  199. </style>