index.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. <template>
  2. <view style="display: flex;flex-direction: column;height: calc(100vh - 100rpx);"
  3. :style="{paddingTop:safetyTop+'px'}">
  4. <view class="box_school">
  5. <view class="box_warehouse" :class="curveFlag ? '' : 'activate_ware'" @click="getCurve(1)">书库</view>
  6. <view class="box_warehouse" :class="curveFlag ? 'activate_ware' : ''" @click="getCurve(2)">我的</view>
  7. </view>
  8. <view class="head_school_box">
  9. <view class="bank_box border_bank">
  10. <view class="item_bank center_in" :class="item == tabCurrent?'activate_box':''"
  11. v-for="(item,index) in tabList" :key="index">
  12. {{item}}
  13. </view>
  14. </view>
  15. <view class="bank_box">
  16. <view class="item_bank center_in" :class="item == tabCurrent1?'activate_box':''"
  17. v-for="(item,index) in tabList1" :key="index">
  18. {{item}}
  19. </view>
  20. </view>
  21. </view>
  22. <!-- 滚动容器 -->
  23. <scroll-view class="scroll-view" scroll-y>
  24. <view class="head_school">
  25. <image class="img_bsq" mode="scaleToFill" src="/static/mh-BsqlF_P3.png"></image>
  26. <view class="card_book">
  27. <view class="box_book" v-for="(item,index) in bookList" :key="index">
  28. <view class="book_img">
  29. <image class="img_book" mode="scaleToFill" src="/static/bk.png"></image>
  30. </view>
  31. <view class="book_title center_in">{{item}}</view>
  32. </view>
  33. </view>
  34. <view class="card_numerology">
  35. <view class="book_numerology" v-for="(item,index) in bookList" :key="index" @click="goBook">
  36. <view class="box_numerology">
  37. <image class="img_numerology" mode="scaleToFill" src="/static/bk.png"></image>
  38. <view class="numerology_title center_in">{{item}}</view>
  39. </view>
  40. </view>
  41. <view style="width: 33%;height: 1rpx;"></view>
  42. </view>
  43. </view>
  44. </scroll-view>
  45. </view>
  46. </template>
  47. <script>
  48. export default {
  49. data() {
  50. return {
  51. safetyTop: 0,
  52. curveFlag: false,
  53. tabList: ['山', '医', '命', '相', '卜'],
  54. tabList1: ['八字', '紫薇斗数', '七政四余'],
  55. tabCurrent: '命',
  56. tabCurrent1: '八字',
  57. bookList: ['基础知识', '专业知识', '神煞大全', '懒人表']
  58. }
  59. },
  60. onLoad() {
  61. const {
  62. safeAreaInsets
  63. } = uni.getSystemInfoSync()
  64. if (safeAreaInsets) {
  65. this.safetyTop = safeAreaInsets.top
  66. }
  67. },
  68. methods: {
  69. getCurve(type) {
  70. if (type == 1) {
  71. this.curveFlag = false
  72. } else {
  73. this.curveFlag = true
  74. }
  75. },
  76. // 书详情
  77. goBook() {
  78. uni.navigateTo({
  79. url: '/pages/school/bookParticulars'
  80. })
  81. },
  82. }
  83. }
  84. </script>
  85. <style lang="scss">
  86. page {
  87. background-color: #fff;
  88. }
  89. .box_school {
  90. display: flex;
  91. justify-content: center;
  92. align-items: center;
  93. background-color: #fff;
  94. padding: 24rpx 30rpx 24rpx 30rpx;
  95. }
  96. .box_warehouse {
  97. width: 150rpx;
  98. text-align: center;
  99. font-size: 32rpx;
  100. font-weight: bold;
  101. color: rgba(192, 192, 192, 1);
  102. }
  103. .activate_ware {
  104. position: relative;
  105. color: #000;
  106. }
  107. .activate_ware::after {
  108. content: '';
  109. position: absolute;
  110. left: calc(50% - 25rpx);
  111. bottom: -10rpx;
  112. width: 50rpx;
  113. height: 6rpx;
  114. background-color: $color-subject;
  115. }
  116. .scroll-view {
  117. flex: 1;
  118. overflow: hidden;
  119. }
  120. .head_school {
  121. height: 100%;
  122. background-color: #fff;
  123. }
  124. .head_school_box {
  125. border-top: 20rpx solid #F8F8F8;
  126. background-color: #fff;
  127. padding: 0rpx 20rpx;
  128. }
  129. .bank_box {
  130. display: flex;
  131. align-items: center;
  132. padding: 20rpx 0rpx;
  133. }
  134. .border_bank {
  135. border-bottom: 1rpx solid #e4e7ed;
  136. }
  137. .item_bank {
  138. flex: 1;
  139. color: #646566;
  140. font-size: 34rpx;
  141. }
  142. .activate_box {
  143. color: #b2955d;
  144. }
  145. .img_bsq {
  146. vertical-align: middle;
  147. margin: 10rpx 20rpx 0rpx 20rpx;
  148. width: calc(100% - 40rpx);
  149. height: 380rpx;
  150. }
  151. .card_book {
  152. display: flex;
  153. align-items: center;
  154. background-color: #f3f4f6;
  155. padding-top: 10rpx;
  156. margin: 0rpx 20rpx;
  157. border-bottom-left-radius: 30rpx;
  158. border-bottom-right-radius: 30rpx;
  159. }
  160. .box_book {
  161. flex: 1;
  162. display: flex;
  163. flex-direction: column;
  164. align-items: center;
  165. }
  166. .book_img {
  167. width: calc(100% - 40rpx);
  168. height: 200rpx;
  169. padding: 0rpx 20rpx 6rpx 20rpx;
  170. border-bottom: 1rpx solid #e4e7ed;
  171. }
  172. .img_book {
  173. width: 100%;
  174. height: 200rpx;
  175. border-radius: 6rpx;
  176. }
  177. .book_title {
  178. width: calc(100% - 40rpx);
  179. padding: 20rpx;
  180. font-size: 30rpx;
  181. }
  182. .box_book:nth-child(-n + 3) .book_title {
  183. border-right: 1rpx solid #e4e7ed;
  184. }
  185. .card_numerology {
  186. margin-top: 20rpx;
  187. display: flex;
  188. flex-direction: row;
  189. flex-wrap: wrap;
  190. justify-content: space-between;
  191. margin-bottom: 20rpx;
  192. }
  193. .book_numerology {
  194. display: flex;
  195. align-items: center;
  196. justify-content: center;
  197. width: 33%;
  198. margin-bottom: 10rpx;
  199. }
  200. .box_numerology {
  201. width: 180rpx;
  202. }
  203. .img_numerology {
  204. width: 100%;
  205. height: 230rpx;
  206. border-radius: 10rpx;
  207. }
  208. .numerology_title {
  209. font-size: 30rpx;
  210. padding: 10rpx 0rpx;
  211. }
  212. </style>