index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. <template>
  2. <view class="container">
  3. <view class="navBarBox">
  4. <!-- 状态栏占位 -->
  5. <view class="statusBar" :style="{ paddingTop: statusBarHeight + 'px' }"></view>
  6. <!-- 真正的导航栏内容 -->
  7. <view class="navBar">
  8. 小说书城
  9. </view>
  10. </view>
  11. <view class="pdx-30 pdy-10 bg-white">
  12. <view class="flex ai_center jc_between">
  13. <view class="menu_item" v-for="(item, index) in menuList" :class="{ active_menu: index === 0 }">
  14. {{ item }}
  15. <view v-if="index === 0" class="active_bg"></view>
  16. <view v-else class="active"></view>
  17. </view>
  18. <up-input class="flex1 mgl-30" placeholder="搜索书名或作者" suffixIcon="search" suffixIconStyle="color: #909399"></up-input>
  19. </view>
  20. </view>
  21. <scroll-view scroll-y class="scroll_box">
  22. <view class="pdy-30 pdx-30 bg-white">
  23. <view class="">
  24. <view class="flex ai_center jc_between">
  25. <view class="flex ai_center text-32">
  26. <svg t="1752222012281" class="w-50 h-50 mgr-10" viewBox="0 0 1024 1024" version="1.1"
  27. xmlns="http://www.w3.org/2000/svg" p-id="32757" width="128" height="128">
  28. <path
  29. d="M928.6 208c-27 1.4-51.8 18.6-62.7 43.4-12.1 27.7-6.2 56 10 76.3l-7.7 32.3c-15.7 66-74.6 112.5-142.5 112.5-76.4 0-139.9-58.7-146-134.8l-7.3-91.4c35.2-23.4 56-66.8 45.9-114-8.7-40.5-41.5-73.2-82.1-81.7C466.5 35.9 405 88.9 405 156.2c0 37.6 19.3 70.8 48.5 90.1l-7.3 91.4c-6.1 76.1-69.6 134.8-146 134.8-67.8 0-126.8-46.6-142.5-112.5l-7.7-32.3c16.2-20.2 22.1-48.6 10-76.3-10.8-24.8-35.6-42.1-62.7-43.4-49.4-2.5-85.3 40.7-77.4 86.3 4.4 25.2 21.1 45.2 42.8 54.8l65.6 463.5h769v-0.2l65.6-463.3c21.8-9.6 38.5-29.6 42.8-54.8 8.2-45.6-27.7-88.8-77.1-86.3z"
  30. fill="#F9C85D" p-id="32758"></path>
  31. <path d="M781.3 961.3h-541c-63 0-114-51-114-114h769c0 63-51.1 114-114 114z"
  32. fill="#83C6EF" p-id="32759"></path>
  33. <path d="M93 281.4m-73.9 0a73.9 73.9 0 1 0 147.8 0 73.9 73.9 0 1 0-147.8 0Z"
  34. fill="#F9C85D" p-id="32760"></path>
  35. <path
  36. d="M928.6 208c-27 1.4-51.8 18.6-62.7 43.4-12.1 27.7-6.2 56 10 76.3l-7.7 32.3c-15.7 66-74.6 112.5-142.5 112.5-76.4 0-139.9-58.7-146-134.8l-7.3-91.4c35.2-23.4 56-66.8 45.9-114-8.7-40.5-41.5-73.2-82.1-81.7-7.9-1.7-15.7-2.3-23.4-2.3v764.4h384.5v-0.2l65.6-463.3c21.8-9.6 38.5-29.6 42.8-54.8 8.2-45.7-27.7-88.9-77.1-86.4z"
  37. fill="#FFB103" p-id="32761"></path>
  38. <path d="M933.3 281.4m-73.8 0a73.8 73.8 0 1 0 147.6 0 73.8 73.8 0 1 0-147.6 0Z"
  39. fill="#F9C85D" p-id="32762"></path>
  40. <path d="M513 154.3m-109.2 0a109.2 109.2 0 1 0 218.4 0 109.2 109.2 0 1 0-218.4 0Z"
  41. fill="#F9C85D" p-id="32763"></path>
  42. <path d="M510.8 847.3v114H784c61.5 0 111.3-49.8 111.3-111.3v-2.7H510.8z" fill="#429BCF"
  43. p-id="32764"></path>
  44. <path
  45. d="M146.4 230.5c-8.7 45.1-45.9 84.2-99.2 108.5 12.6 10.1 28.4 16.3 45.8 16.3 40.8 0 73.9-33.1 73.9-73.9 0-19.7-7.9-37.6-20.5-50.9zM986.9 231.1c-10.1 44.5-47.9 82.7-101.3 106.3 12.9 11 29.4 17.9 47.7 17.9 40.8 0 73.8-33 73.8-73.8-0.1-19.6-7.8-37.2-20.2-50.4zM589.1 76c2.3 6.6 3.6 13.5 3.6 20.5 0 51.4-64.1 93.1-143.1 93.1-14.3 0-28.1-1.4-41.1-4 13.5 45 55.2 77.7 104.6 77.7 60.3 0 109.2-48.9 109.2-109.2-0.1-30.6-12.8-58.3-33.2-78.1z"
  46. fill="#FFB103" p-id="32765"></path>
  47. <path
  48. d="M55.848334 249.331715a8.4 19.9 60 1 0 34.467811-19.9 8.4 19.9 60 1 0-34.467811 19.9Z"
  49. fill="#F7EAD0" p-id="32766"></path>
  50. <path
  51. d="M945.164493 246.695113a19.9 8.4 30 1 0 8.4-14.549226 19.9 8.4 30 1 0-8.4 14.549226Z"
  52. fill="#F7EAD0" p-id="32767"></path>
  53. <path d="M469.7 77.7a41.4 10.6 0 1 0 82.8 0 41.4 10.6 0 1 0-82.8 0Z" fill="#F7EAD0"
  54. p-id="32768"></path>
  55. <path
  56. d="M546 630.8h-61.4c-13.9 0-25.3-11.4-25.3-25.3s11.4-25.3 25.3-25.3H546c13.9 0 25.3 11.4 25.3 25.3s-11.4 25.3-25.3 25.3z"
  57. fill="#DA3329" p-id="32769"></path>
  58. <path d="M546 580.1h-33v50.7h33c13.9 0 25.3-11.4 25.3-25.3 0-14-11.4-25.4-25.3-25.4z"
  59. fill="#C11B16" p-id="32770"></path>
  60. </svg>
  61. 排行榜
  62. </view>
  63. <view class="flex ai_center">
  64. 查看全部榜单
  65. <svg t="1752219361738" class="w-30 h-30 mgl-10" fill="#000" viewBox="0 0 1024 1024"
  66. version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="12887" width="128" height="128">
  67. <path
  68. d="M782.8 511.1 351.9 942c-22.8 22.8-59.8 22.8-82.6 0-22.8-22.8-22.8-59.8 0-82.6L617.5 511.1 269.2 162.8c-22.8-22.8-22.8-59.8 0-82.6 22.8-22.8 59.8-22.8 82.6 0L782.8 511.1 782.8 511.1zM782.8 511.1"
  69. p-id="12888"></path>
  70. </svg>
  71. </view>
  72. </view>
  73. <view class="book_list mgt-30">
  74. <view class="book_item" v-for="item in 5">
  75. <image style="width: 86rpx;height: 113rpx;background-color: skyblue;border-radius: 12rpx;"
  76. src="" mode="scaleToFill" />
  77. <view class="mgl-10 flex flex1 fd_c jc_center">
  78. <view class="ellipsis"><text>1</text>斗破苍穹斗破苍穹斗破苍穹斗破苍穹</view>
  79. <view class="text-24 mgt-10 text-600" style="color: #fedb65">888.88万人阅读</view>
  80. </view>
  81. </view>
  82. </view>
  83. </view>
  84. </view>
  85. <view class="pdy-30 pdx-30 bg-white mgt-30" v-for="item in 3">
  86. <view class="">
  87. <view class="flex ai_center text-32">
  88. 全网精品
  89. </view>
  90. <view class="book_list_item mgt-30">
  91. <view class="book_item" v-for="item in 5">
  92. <image class="img" src="" mode="scaleToFill" />
  93. <view class="book_name">
  94. 斗破苍穹斗破苍穹斗破苍穹
  95. </view>
  96. <view class="hint">已完结</view>
  97. </view>
  98. </view>
  99. </view>
  100. </view>
  101. <view class="h-100 flex ai_center jc_center">
  102. 到底啦~~
  103. </view>
  104. </scroll-view>
  105. <!-- 引入自定义 TabBar -->
  106. <custom-tabbar :currentIndex='1' />
  107. </view>
  108. </template>
  109. <script setup>
  110. import { ref, onBeforeMount } from "vue";
  111. import CustomTabbar from "@/components/custom-tabbar.vue";
  112. // 状态栏高度
  113. let statusBarHeight = ref(0);
  114. // 导航栏高度
  115. let navBarHeight = ref(0);
  116. onBeforeMount(() => {
  117. statusBarHeight.value = uni.getSystemInfoSync()['statusBarHeight'];
  118. const custom = uni.getMenuButtonBoundingClientRect();
  119. // 导航栏的高度 = 胶囊的高度 + (胶囊距离顶部的距离 - 状态栏的高度)* 2
  120. // 即胶囊的上下边距
  121. navBarHeight.value = custom.height + (custom.top - statusBarHeight.value) * 2;
  122. });
  123. const menuList = ref([
  124. '名作',
  125. '佳作'
  126. ])
  127. const value = ref('');
  128. </script>
  129. <style lang="scss" scoped>
  130. page {
  131. background-color: #f9f9f9;
  132. }
  133. .container {
  134. display: flex;
  135. flex-direction: column;
  136. .navBarBox {
  137. .navBar {
  138. width: 100%;
  139. height: 80rpx !important;
  140. line-height: 80rpx;
  141. padding-left: 30rpx;
  142. font-size: 32rpx;
  143. color: #333;
  144. font-weight: 600;
  145. background-color: #fff;
  146. }
  147. }
  148. .menu_item {
  149. font-size: 28rpx;
  150. color: #9b9b9b;
  151. display: flex;
  152. flex-direction: column;
  153. align-items: center;
  154. padding: 8rpx 16rpx;
  155. .active_menu {
  156. color: #fd4345;
  157. }
  158. .active {
  159. margin-top: 8rpx;
  160. width: 30rpx;
  161. height: 6rpx;
  162. background-color: #fff;
  163. border-radius: 8rpx;
  164. }
  165. .active_bg {
  166. margin-top: 8rpx;
  167. width: 30rpx;
  168. height: 6rpx;
  169. border-radius: 8rpx;
  170. background-color: #fd4345;
  171. }
  172. }
  173. .input {
  174. flex: 1;
  175. margin: 0 20rpx;
  176. background-color: #f6f6f6;
  177. font-size: 26rpx;
  178. height: 50rpx !important;
  179. border-radius: 50rpx;
  180. padding-left: 30rpx;
  181. color: #9a9a9a;
  182. }
  183. .scroll_box {
  184. overflow-y: auto;
  185. height: calc(100vh - 260rpx);
  186. }
  187. .book_list {
  188. width: 100%;
  189. display: grid;
  190. justify-content: space-between;
  191. grid-template-columns: repeat(auto-fill, 44vw);
  192. grid-gap: 20rpx;
  193. .book_item {
  194. display: flex;
  195. width: 44vw;
  196. }
  197. }
  198. // 超出2行
  199. .ellipsis {
  200. line-height: 1.2;
  201. overflow: hidden;
  202. text-overflow: ellipsis;
  203. display: -webkit-box;
  204. line-clamp: 2;
  205. -webkit-line-clamp: 2;
  206. /* 限制显示2行 */
  207. -webkit-box-orient: vertical;
  208. }
  209. .book_list_item {
  210. width: 100%;
  211. display: grid;
  212. justify-content: space-between;
  213. grid-template-columns: repeat(auto-fill, 216rpx);
  214. grid-gap: 20rpx;
  215. .book_item {
  216. position: relative;
  217. width: 216rpx;
  218. display: flex;
  219. flex-direction: column;
  220. .img {
  221. width: 216rpx;
  222. height: 300rpx;
  223. background-color: rgb(104, 122, 129);
  224. border-radius: 12rpx;
  225. }
  226. .book_name {
  227. font-style: 28rpx;
  228. color: #303030;
  229. margin-top: 10rpx;
  230. overflow: hidden;
  231. text-overflow: ellipsis;
  232. display: -webkit-box;
  233. line-clamp: 1;
  234. -webkit-line-clamp: 1;
  235. /* 限制显示1行 */
  236. -webkit-box-orient: vertical;
  237. }
  238. .hint {
  239. position: absolute;
  240. top: 0;
  241. left: 0;
  242. padding: 8rpx 16rpx;
  243. background-color: #7d8bfb;
  244. color: #fff;
  245. font-size: 24rpx;
  246. border-radius: 12rpx 0 12rpx 0;
  247. }
  248. }
  249. }
  250. }
  251. </style>