四零语境前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

234 lines
5.3 KiB

  1. <template>
  2. <view class="desk-container">
  3. <!-- 顶部搜索栏 -->
  4. <view class="header">
  5. <view class="search-container">
  6. <uv-search
  7. placeholder="请输入要查询的内容"
  8. :show-action="true"
  9. :action-style="{color: '#fff', backgroundColor: '#06DADC', borderRadius:'8rpx', width:'100rpx', height: '64rpx', lineHeight: '64rpx', borderRadius: '198rpx', text:'white', fontSize:'26rpx'}"
  10. shape="round"
  11. bg-color="#F3F3F3"
  12. color="#C6C6C6"
  13. height="32"
  14. margin="0"
  15. searchIconColor="#8B8B8B"
  16. placeholderColor="#c6c6c6"
  17. ></uv-search>
  18. </view>
  19. </view>
  20. <!-- 书籍网格 -->
  21. <view class="book-grid-container">
  22. <view class="book-grid">
  23. <view
  24. v-for="(book, index) in bookList"
  25. :key="index"
  26. class="book-grid-item"
  27. >
  28. <view class="book-grid-cover">
  29. <image :src="book.cover" mode="aspectFill"></image>
  30. </view>
  31. <view class="book-grid-info">
  32. <text class="book-grid-title">{{ book.title }}</text>
  33. <view class="book-grid-meta">
  34. <text class="book-grid-grade">{{ book.grade }}/</text>
  35. <image src="/static/播放图标.png" class="book-grid-duration-icon" />
  36. <text class="book-grid-duration">{{ book.duration }}</text>
  37. </view>
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. </view>
  43. </template>
  44. <script>
  45. export default {
  46. data() {
  47. return {
  48. // 书籍列表数据
  49. bookList: [
  50. {
  51. cover: '/static/默认图片.png',
  52. title: '精讲短文',
  53. grade: '四级',
  54. duration: '03:24'
  55. },
  56. {
  57. cover: '/static/默认图片.png',
  58. title: '精讲短文',
  59. grade: '四级',
  60. duration: '03:24'
  61. },
  62. {
  63. cover: '/static/默认图片.png',
  64. title: '精讲短文',
  65. grade: '六级',
  66. duration: '03:24'
  67. },
  68. {
  69. cover: '/static/默认图片.png',
  70. title: '精讲短文',
  71. grade: '六级',
  72. duration: '03:24'
  73. },
  74. {
  75. cover: '/static/默认图片.png',
  76. title: '精讲短文',
  77. grade: '六级',
  78. duration: '03:24'
  79. },
  80. {
  81. cover: '/static/默认图片.png',
  82. title: '精讲短文',
  83. grade: '考研',
  84. duration: '03:24'
  85. },
  86. {
  87. cover: '/static/默认图片.png',
  88. title: '精讲短文',
  89. grade: '考研',
  90. duration: '03:24'
  91. },
  92. {
  93. cover: '/static/默认图片.png',
  94. title: '精讲短文',
  95. grade: '考研',
  96. duration: '03:24'
  97. },
  98. {
  99. cover: '/static/默认图片.png',
  100. title: '精讲短文',
  101. grade: '四级',
  102. duration: '03:24'
  103. },
  104. {
  105. cover: '/static/默认图片.png',
  106. title: '精讲短文',
  107. grade: '四级',
  108. duration: '03:24'
  109. },
  110. {
  111. cover: '/static/默认图片.png',
  112. title: '精讲短文',
  113. grade: '六级',
  114. duration: '03:24'
  115. },
  116. {
  117. cover: '/static/默认图片.png',
  118. title: '精讲短文',
  119. grade: '六级',
  120. duration: '03:24'
  121. },
  122. {
  123. cover: '/static/默认图片.png',
  124. title: '精讲短文',
  125. grade: '考研',
  126. duration: '03:24'
  127. },
  128. {
  129. cover: '/static/默认图片.png',
  130. title: '精讲短文',
  131. grade: '考研',
  132. duration: '03:24'
  133. }
  134. ]
  135. }
  136. },
  137. methods: {
  138. }
  139. }
  140. </script>
  141. <style lang="scss" scoped>
  142. .desk-container {
  143. background: #fff;
  144. min-height: 100vh;
  145. }
  146. // 顶部搜索栏
  147. .header {
  148. display: flex;
  149. align-items: center;
  150. padding: 20rpx 32rpx;
  151. background: #fff;
  152. .search-container {
  153. flex: 1;
  154. }
  155. }
  156. // 书籍网格容器
  157. .book-grid-container {
  158. padding: 20rpx 30rpx;
  159. }
  160. // 书籍网格布局
  161. .book-grid {
  162. display: flex;
  163. flex-wrap: wrap;
  164. gap: 32rpx;
  165. .book-grid-item {
  166. width: 208rpx;
  167. display: flex;
  168. flex-direction: column;
  169. .book-grid-cover {
  170. box-shadow: 0px 4px 4px 0px #C0BCBA75;
  171. width: 100%;
  172. height: 278rpx;
  173. border-radius: 16rpx;
  174. overflow: hidden;
  175. margin-bottom: 16rpx;
  176. image {
  177. width: 100%;
  178. height: 100%;
  179. }
  180. }
  181. .book-grid-info {
  182. padding: 6rpx;
  183. box-sizing: border-box;
  184. .book-grid-title {
  185. font-size: 28rpx;
  186. font-weight: 700;
  187. color: $primary-text-color;
  188. overflow: hidden;
  189. text-overflow: ellipsis;
  190. white-space: nowrap;
  191. }
  192. .book-grid-meta {
  193. display: flex;
  194. align-items: center;
  195. margin-top: 8rpx;
  196. .book-grid-duration-icon {
  197. width: 24rpx;
  198. height: 24rpx;
  199. margin-right: 12rpx;
  200. }
  201. .book-grid-grade {
  202. font-size: 24rpx;
  203. color: $secondary-text-color;
  204. margin-right: 8rpx;
  205. }
  206. .book-grid-duration {
  207. font-size: 24rpx;
  208. color: $secondary-text-color;
  209. }
  210. }
  211. }
  212. }
  213. }
  214. </style>