resource.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. <template>
  2. <view class="resource" :style="{height:swiper+'px'}">
  3. <statusBar :item="navBarData"></statusBar>
  4. <view class="search">
  5. <uni-search-bar bgColor="#f0f2f5" placeholder="搜索" cancelButton="none" clearButton="none" :focus="true"></uni-search-bar>
  6. </view>
  7. <view class="top">
  8. <view class="left" @click="phoneLogin" :class="current==0?info1:info2">
  9. <text>资源库</text>
  10. <view :class="current==0?yun:info2"></view>
  11. </view>
  12. <view class="right" @click="accountLogin" :class="current==1?info1:info2">
  13. <text>精品慕课</text>
  14. <view :class="current==1?yun:info2"></view>
  15. </view>
  16. </view>
  17. <swiper class="scroll-view-height" :style="{height:swiper+'px'}" @change="swipeIndex" :current="current" :duration="300">
  18. <swiper-item>
  19. <scroll-view scroll-y="true" :style="{height:swiper-10+'px'}">
  20. <view class="contBox">
  21. <view class="cont" v-for="i in 10">
  22. <image src="../../static/yym/Rectangle 1918.png" mode=""></image>
  23. <view class="tit">
  24. 这里是课程名称课程名称课程名称课程名称课程名称
  25. </view>
  26. <view class="teacher">
  27. 主讲老师:舒某某{{swiper}}
  28. </view>
  29. </view>
  30. </view>
  31. </scroll-view>
  32. </swiper-item>
  33. <swiper-item>
  34. <scroll-view scroll-y="true" :style="{height:swiper-10+'px'}">
  35. <view class="contBox">
  36. <view class="cont" v-for="i in 10">
  37. <image src="../../static/yym/Rectangle 1918.png" mode=""></image>
  38. <view class="tit">
  39. 这里是课程名称课程名称课程名称课程名称课程名称
  40. </view>
  41. <view class="teacher">
  42. 主讲老师:舒某某{{swiper}}
  43. </view>
  44. </view>
  45. </view>
  46. </scroll-view>
  47. </swiper-item>
  48. </swiper>
  49. </view>
  50. </template>
  51. <script>
  52. export default {
  53. data() {
  54. return {
  55. navBarData: {
  56. title: '资源库',
  57. btn: 0
  58. },
  59. current:0,//登录方式切换
  60. info1:'info1', //类名
  61. info2:'info2',
  62. yun:'yun',
  63. isOK:false, //用户协议是否勾选
  64. swiper:0
  65. };
  66. },
  67. methods: {
  68. toggleActive1() {
  69. this.isActive1 = true;
  70. this.isActive2 = false;
  71. this.tab = true;
  72. },
  73. toggleActive2() {
  74. this.isActive1 = false;
  75. this.isActive2 = true;
  76. this.tab = false;
  77. },
  78. swipeIndex(index){
  79. this.current=index.detail.current;
  80. },
  81. },
  82. onReady() {
  83. uni.createSelectorQuery().select('.uni-tabbar').boundingClientRect((rect) => {
  84. if (rect) {
  85. const tabBarHeight = rect.height;
  86. console.log('底部导航栏高度:', tabBarHeight);
  87. }
  88. }).exec();
  89. },
  90. onLoad() {
  91. // console.log(this.screenHeight);
  92. // console.log(this.navheight);
  93. console.log(this.tabBarHeight);
  94. if(this.navheight){
  95. this.swiper=this.screenHeight-this.navheight-100
  96. }else{
  97. this.swiper=this.screenHeight-this.customBar-150
  98. }
  99. // log
  100. }
  101. };
  102. </script>
  103. <style lang="scss" scoped>
  104. .resource{
  105. // background-color: #4a97f2;
  106. // padding-bottom: 50px;
  107. // margin-bottom: 50px;
  108. .search{
  109. background-color: #ffffff;
  110. padding: 0 10rpx;
  111. }
  112. .top{
  113. // width: 500rpx;
  114. display: flex;
  115. justify-content: space-between;
  116. margin: auto;
  117. background-color: #ffffff;
  118. padding: 10px 150rpx;
  119. // margin-bottom: 40px;
  120. font-size: 18px;
  121. // padding-top: 0;
  122. .info1{
  123. font-weight: bold;
  124. position: relative;
  125. .yun{
  126. width: 80rpx;
  127. height: 0rpx;
  128. position: absolute;
  129. left: 50%;
  130. transform: translate(-50%,-50%);
  131. box-shadow: 0px 0px 10px 2px #4a97f2;
  132. }
  133. }
  134. .info2{
  135. color: #666666;
  136. }
  137. }
  138. .scroll-view-height{
  139. // background-color: ;
  140. // height: 68vh;
  141. // background-color: red;
  142. // padding-bottom: 50px;
  143. .contBox{
  144. width: 100%;
  145. padding: 10px 30rpx;
  146. // height: 100%;
  147. display: flex;
  148. flex-wrap: wrap;
  149. justify-content: space-between;
  150. // background-color: greenyellow;
  151. margin-bottom: 50px;
  152. .cont{
  153. background-color: #ffffff;
  154. width: 320rpx;
  155. padding: 20rpx 15rpx;
  156. border-radius: 10px;
  157. margin-bottom: 20rpx;
  158. image{
  159. width: 100%;
  160. height: 80px;
  161. }
  162. .tit{
  163. width: 90%;
  164. margin: 10rpx 0;
  165. font-weight: bold;
  166. white-space:normal;
  167. display: -webkit-box;
  168. word-break: break-all;
  169. text-overflow: ellipsis;
  170. overflow: hidden;
  171. -webkit-box-orient: vertical;
  172. -webkit-line-clamp:2;/*设置 需要显示的行数*/
  173. }
  174. .teacher{
  175. font-size: 14px;
  176. color: #999999;
  177. }
  178. }
  179. }
  180. }
  181. }
  182. </style>