index.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <template>
  2. <view>
  3. <view class="training-camp">
  4. <view class="training-camp-btn" @click="choose">请选择训练营</view>
  5. </view>
  6. <u-picker :show="show" :columns="columns" title="训练营选择" @confirm="confirm" @cancel="cancel"></u-picker>
  7. <view class="container-body x-start" :style="{height: contentH}">
  8. <view class="container-left">
  9. <view class="classification active">全部</view>
  10. <view class="classification">测试</view>
  11. </view>
  12. <view class="container-right">
  13. <!-- <mescroll-body top="88rpx" bottom="0" ref="mescrollRef" @init="mescrollInit" :down="downOption" :up="upOption" @down="downCallback" @up="upCallback"> -->
  14. <view class="list">
  15. <courseItem :from="'course'" :activeTab="0" v-for="i in 9" />
  16. </view>
  17. <!-- </mescroll-body> -->
  18. </view>
  19. </view>
  20. </view>
  21. </template>
  22. <script>
  23. import courseItem from "../components/courseItem.vue"
  24. export default {
  25. components: {
  26. courseItem
  27. },
  28. data() {
  29. return {
  30. contentH: 0,
  31. show: false,
  32. columns: [
  33. ['中国', '美国', '日本']
  34. ],
  35. mescroll:null,
  36. downOption: {
  37. auto:false//不要自动加载
  38. },
  39. upOption: {
  40. onScroll:false,
  41. use: true, // 是否启用上拉加载; 默认true
  42. page: {
  43. num: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
  44. size: 10 // 每页数据的数量,默认10
  45. },
  46. noMoreSize: 10, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
  47. textNoMore:"已经到底了",
  48. empty: {
  49. icon:'/static/images/empty.png',
  50. tip: '暂无数据'
  51. }
  52. },
  53. dataList: []
  54. }
  55. },
  56. mounted() {
  57. const windowHeight = uni.getSystemInfoSync().windowHeight
  58. this.contentH = `calc(${windowHeight}px - 52px - 56px)`
  59. },
  60. methods: {
  61. choose() {
  62. this.show = true
  63. },
  64. cancel() {
  65. this.show = false
  66. },
  67. confirm(e) {
  68. console.log('confirm', e)
  69. this.show = false
  70. },
  71. mescrollInit(mescroll) {
  72. this.mescroll = mescroll;
  73. },
  74. /*下拉刷新的回调 */
  75. downCallback(mescroll) {
  76. mescroll.resetUpScroll()
  77. },
  78. upCallback(page) {
  79. // //联网加载数据
  80. // var that = this;
  81. // var data={
  82. // customerName:this.searchKey,
  83. // pageNum: page.num,
  84. // pageSize: page.size
  85. // };
  86. // uni.showLoading({
  87. // title:"加载中..."
  88. // })
  89. // getMyCustomerList(data).then(res => {
  90. // uni.hideLoading()
  91. // if(res.code==200){
  92. // //设置列表数据
  93. // if (page.num == 1) {
  94. // that.dataList = res.data.list;
  95. // } else {
  96. // that.dataList = that.dataList.concat(res.data.list);
  97. // }
  98. // that.mescroll.endBySize(res.data.list.length, res.data.total);
  99. // }else{
  100. // uni.showToast({
  101. // icon:'none',
  102. // title: "请求失败",
  103. // });
  104. // that.dataList = null;
  105. // that.mescroll.endErr();
  106. // }
  107. // });
  108. },
  109. }
  110. }
  111. </script>
  112. <style>
  113. page {
  114. background-color: #f5f4f5;
  115. }
  116. </style>
  117. <style lang="scss" scoped>
  118. .training-camp {
  119. padding: 10px;
  120. font-family: PingFang SC, PingFang SC;
  121. font-weight: 400;
  122. font-size: 14px;
  123. color: #222222;
  124. &-btn {
  125. font-size: 15px;
  126. width: 100%;
  127. height: 32px;
  128. line-height: 32px;
  129. text-align: center;
  130. background-color: #fff;
  131. border-radius: 50px;
  132. border: 1px solid #ccc;
  133. }
  134. }
  135. .container-left {
  136. flex-shrink: 0;
  137. background-color: #fff;
  138. width: 80px;
  139. height: 100%;
  140. overflow-y: auto;
  141. font-family: PingFang SC, PingFang SC;
  142. font-weight: 400;
  143. font-size: 14px;
  144. color: #222222;
  145. .active {
  146. background-color: #f5f4f5;
  147. font-weight: bold;
  148. position: relative;
  149. &::after {
  150. content: "";
  151. height: 15px;
  152. width: 4px;
  153. background-color: #1677ff;
  154. position: absolute;
  155. top: 50%;
  156. left: 0;
  157. transform: translateY(-50%);
  158. }
  159. }
  160. .classification {
  161. padding: 20px 16px;
  162. box-sizing: border-box;
  163. }
  164. }
  165. .container-right {
  166. flex: 1;
  167. height: 100%;
  168. overflow-y: auto;
  169. .list {
  170. padding: 10px;
  171. box-sizing: border-box;
  172. width: 100%;
  173. }
  174. }
  175. </style>