resource.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  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. 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-100
  102. }else{
  103. this.swiper=this.screenHeight-this.customBar-150
  104. }
  105. // log
  106. }
  107. };
  108. </script>
  109. <style lang="scss" scoped>
  110. .resource{
  111. // background-color: #4a97f2;
  112. // padding-bottom: 50px;
  113. // margin-bottom: 50px;
  114. .search{
  115. background-color: #ffffff;
  116. padding: 0 10rpx;
  117. }
  118. .top{
  119. // width: 500rpx;
  120. display: flex;
  121. justify-content: space-between;
  122. margin: auto;
  123. background-color: #ffffff;
  124. padding: 10px 150rpx;
  125. // margin-bottom: 40px;
  126. font-size: 18px;
  127. // padding-top: 0;
  128. .info1{
  129. font-weight: bold;
  130. position: relative;
  131. .yun{
  132. width: 80rpx;
  133. height: 0rpx;
  134. position: absolute;
  135. left: 50%;
  136. transform: translate(-50%,-50%);
  137. box-shadow: 0px 0px 10px 2px #4a97f2;
  138. }
  139. }
  140. .info2{
  141. color: #666666;
  142. }
  143. }
  144. .scroll-view-height{
  145. // background-color: ;
  146. // height: 68vh;
  147. // background-color: red;
  148. // padding-bottom: 50px;
  149. .contBox{
  150. width: 100%;
  151. padding: 10px 30rpx;
  152. // height: 100%;
  153. display: flex;
  154. flex-wrap: wrap;
  155. justify-content: space-between;
  156. // background-color: greenyellow;
  157. margin-bottom: 50px;
  158. .cont{
  159. background-color: #ffffff;
  160. width: 320rpx;
  161. padding: 20rpx 15rpx;
  162. border-radius: 10px;
  163. margin-bottom: 20rpx;
  164. image{
  165. width: 100%;
  166. height: 80px;
  167. }
  168. .tit{
  169. width: 90%;
  170. margin: 10rpx 0;
  171. font-weight: bold;
  172. white-space:normal;
  173. display: -webkit-box;
  174. word-break: break-all;
  175. text-overflow: ellipsis;
  176. overflow: hidden;
  177. -webkit-box-orient: vertical;
  178. -webkit-line-clamp:2;/*设置 需要显示的行数*/
  179. }
  180. .teacher{
  181. font-size: 14px;
  182. color: #999999;
  183. }
  184. }
  185. }
  186. }
  187. }
  188. </style>