resource.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. <template>
  2. <view class="resource">
  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-20+'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+'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. swiper:0
  64. };
  65. },
  66. methods: {
  67. toggleActive1() {
  68. this.isActive1 = true;
  69. this.isActive2 = false;
  70. this.tab = true;
  71. },
  72. toggleActive2() {
  73. this.isActive1 = false;
  74. this.isActive2 = true;
  75. this.tab = false;
  76. },
  77. swipeIndex(index){
  78. this.current=index.detail.current;
  79. },
  80. phoneLogin(){
  81. this.current=0
  82. },
  83. accountLogin(){
  84. this.current=1
  85. },
  86. },
  87. onReady() {
  88. uni.createSelectorQuery().select('.uni-tabbar').boundingClientRect((rect) => {
  89. if (rect) {
  90. const tabBarHeight = rect.height;
  91. console.log('底部导航栏高度:', tabBarHeight);
  92. }
  93. }).exec();
  94. },
  95. onLoad() {
  96. // console.log(this.screenHeight);
  97. // console.log(this.navheight);
  98. console.log(this.tabBarHeight);
  99. if(this.navheight){
  100. this.swiper=this.screenHeight-this.navheight-140
  101. }else{
  102. this.swiper=this.screenHeight-this.customBar-150
  103. }
  104. }
  105. };
  106. </script>
  107. <style lang="scss" scoped>
  108. .resource{
  109. // background-color: #4a97f2;
  110. // padding-bottom: 50px;
  111. // margin-bottom: 50px;
  112. .search{
  113. background-color: #ffffff;
  114. padding: 0 10rpx;
  115. }
  116. .top{
  117. // width: 500rpx;
  118. display: flex;
  119. justify-content: space-between;
  120. margin: auto;
  121. background-color: #ffffff;
  122. padding: 10px 150rpx;
  123. // margin-bottom: 40px;
  124. font-size: 18px;
  125. // padding-top: 0;
  126. .info1{
  127. font-weight: bold;
  128. position: relative;
  129. .yun{
  130. width: 80rpx;
  131. height: 0rpx;
  132. position: absolute;
  133. left: 50%;
  134. transform: translate(-50%,-50%);
  135. box-shadow: 0px 0px 10px 2px #4a97f2;
  136. }
  137. }
  138. .info2{
  139. color: #666666;
  140. }
  141. }
  142. .scroll-view-height{
  143. // background-color: ;
  144. // height: 68vh;
  145. // background-color: red;
  146. // padding-bottom: 50px;
  147. .contBox{
  148. width: 100%;
  149. padding: 10px 30rpx;
  150. // height: 100%;
  151. display: flex;
  152. flex-wrap: wrap;
  153. justify-content: space-between;
  154. // background-color: greenyellow;
  155. margin-bottom: 50px;
  156. .cont{
  157. background-color: #ffffff;
  158. width: 320rpx;
  159. padding: 20rpx 15rpx;
  160. border-radius: 10px;
  161. margin-bottom: 20rpx;
  162. image{
  163. width: 100%;
  164. height: 80px;
  165. }
  166. .tit{
  167. width: 90%;
  168. margin: 10rpx 0;
  169. font-weight: bold;
  170. white-space:normal;
  171. display: -webkit-box;
  172. word-break: break-all;
  173. text-overflow: ellipsis;
  174. overflow: hidden;
  175. -webkit-box-orient: vertical;
  176. -webkit-line-clamp:2;/*设置 需要显示的行数*/
  177. }
  178. .teacher{
  179. font-size: 14px;
  180. color: #999999;
  181. }
  182. }
  183. }
  184. }
  185. }
  186. </style>