resource.vue 4.5 KB

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