小说小程序前端代码仓库(小程序)
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.

305 lines
6.0 KiB

1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
  1. <template>
  2. <view class="page">
  3. <navbar title="书城"/>
  4. <view class="tabs-container">
  5. <scroll-view scroll-x class="tabs-scroll" show-scrollbar="false">
  6. <view class="tabs">
  7. <view class="tab-item" :class="{active: activeTab === 'ranking'}">
  8. <text>排行榜</text>
  9. </view>
  10. <view class="tab-item">
  11. <text>历史</text>
  12. </view>
  13. <view class="tab-item">
  14. <text>科幻</text>
  15. </view>
  16. <view class="tab-item">
  17. <text>异能</text>
  18. </view>
  19. <view class="tab-item">
  20. <text>逆袭</text>
  21. </view>
  22. <view class="tab-item">
  23. <text>娱乐圈</text>
  24. </view>
  25. </view>
  26. </scroll-view>
  27. </view>
  28. <view class="category">
  29. <view class="left-menu">
  30. <view class="menu-item active">
  31. <text>推荐榜</text>
  32. </view>
  33. <view class="menu-item">
  34. <text>完本榜</text>
  35. </view>
  36. <view class="menu-item">
  37. <text>阅读榜</text>
  38. </view>
  39. <view class="menu-item">
  40. <text>口碑榜</text>
  41. </view>
  42. <view class="menu-item">
  43. <text>新书榜</text>
  44. </view>
  45. <view class="menu-item">
  46. <text>高分榜</text>
  47. </view>
  48. </view>
  49. <view class="right-content">
  50. <view class="novel-list">
  51. <view class="novel-item" v-for="(item, index) in novelList" :key="index">
  52. <view class="rank-number" :class="{'top-rank': index < 3}">
  53. {{index + 1}}
  54. </view>
  55. <view class="novel-cover">
  56. <image :src="item.cover" mode="aspectFill"></image>
  57. </view>
  58. <view class="novel-info">
  59. <view class="novel-title">{{item.title}}</view>
  60. <view class="novel-tags">
  61. <text class="tag" v-for="(tag, tagIndex) in item.tags" :key="tagIndex">{{tag}}</text>
  62. </view>
  63. <view class="novel-author">{{item.author}}</view>
  64. </view>
  65. <view class="novel-status">
  66. <text>{{item.status}}</text>
  67. </view>
  68. </view>
  69. </view>
  70. </view>
  71. </view>
  72. <tabber select="category" />
  73. </view>
  74. </template>
  75. <script>
  76. import tabber from '@/components/base/tabbar.vue'
  77. export default {
  78. components: {
  79. tabber,
  80. },
  81. data() {
  82. return {
  83. activeTab: 'ranking',
  84. novelList: [
  85. {
  86. title: '网游之绝世萧尊',
  87. author: '星梦辰缘',
  88. cover: '/static/image/novel/cover1.jpg',
  89. tags: ['玄幻', '校园', '热血'],
  90. status: '完结'
  91. },
  92. {
  93. title: '网游:1级的我,偷窃神明',
  94. author: '我是解药猫',
  95. cover: '/static/image/novel/cover2.jpg',
  96. tags: ['玄幻', '校园', '热血'],
  97. status: '连载中'
  98. },
  99. {
  100. title: '全民网游:我有神级造物主',
  101. author: '我吃西红柿',
  102. cover: '/static/image/novel/cover3.jpg',
  103. tags: ['玄幻', '校园', '热血'],
  104. status: '完结'
  105. },
  106. {
  107. title: '潜伏传说的我,携西罗摩修',
  108. author: '清风明月',
  109. cover: '/static/image/novel/cover4.jpg',
  110. tags: ['玄幻', '校园', '热血'],
  111. status: '完结'
  112. },
  113. {
  114. title: '网游之一杆定乾坤',
  115. author: '香蕉流文',
  116. cover: '/static/image/novel/cover5.jpg',
  117. tags: ['玄幻', '校园', '热血'],
  118. status: '连载中'
  119. },
  120. {
  121. title: '网游之一杆定乾坤',
  122. author: '香蕉流文',
  123. cover: '/static/image/novel/cover5.jpg',
  124. tags: ['玄幻', '校园', '热血'],
  125. status: '连载中'
  126. }
  127. ]
  128. }
  129. },
  130. methods: {
  131. changeTab(tab) {
  132. this.activeTab = tab;
  133. }
  134. }
  135. }
  136. </script>
  137. <style scoped lang="scss">
  138. .page {
  139. background-color: #f5f5f5;
  140. }
  141. .tabs-container {
  142. background-color: #fff;
  143. position: sticky;
  144. top: 0;
  145. z-index: 10;
  146. }
  147. .tabs-scroll {
  148. white-space: nowrap;
  149. width: 100%;
  150. }
  151. .tabs {
  152. display: flex;
  153. height: 80rpx;
  154. line-height: 80rpx;
  155. padding: 0 20rpx;
  156. .tab-item {
  157. padding: 0 20rpx;
  158. font-size: 28rpx;
  159. color: #666;
  160. &.active {
  161. color: #2b5cff;
  162. font-weight: bold;
  163. position: relative;
  164. &::after {
  165. content: '';
  166. position: absolute;
  167. bottom: 0;
  168. left: 50%;
  169. transform: translateX(-50%);
  170. width: 40rpx;
  171. height: 4rpx;
  172. background-color: #2b5cff;
  173. }
  174. }
  175. }
  176. }
  177. .category {
  178. display: flex;
  179. height: calc(100vh - 240rpx);
  180. .left-menu {
  181. width: 180rpx;
  182. background-color: #f5f5f5;
  183. .menu-item {
  184. height: 100rpx;
  185. line-height: 100rpx;
  186. text-align: center;
  187. font-size: 28rpx;
  188. color: #666;
  189. &.active {
  190. background-color: #fff;
  191. color: #2b5cff;
  192. font-weight: bold;
  193. position: relative;
  194. &::before {
  195. content: '';
  196. position: absolute;
  197. left: 0;
  198. top: 50%;
  199. transform: translateY(-50%);
  200. width: 6rpx;
  201. height: 36rpx;
  202. background-color: #2b5cff;
  203. }
  204. }
  205. }
  206. }
  207. .right-content {
  208. flex: 1;
  209. background-color: #fff;
  210. padding: 20rpx;
  211. overflow-y: auto;
  212. .novel-list {
  213. .novel-item {
  214. display: flex;
  215. align-items: center;
  216. padding: 20rpx 0;
  217. border-bottom: 1px solid #eee;
  218. .rank-number {
  219. width: 40rpx;
  220. text-align: center;
  221. font-size: 32rpx;
  222. color: #999;
  223. font-weight: bold;
  224. &.top-rank {
  225. color: #ff6b00;
  226. }
  227. }
  228. .novel-cover {
  229. width: 120rpx;
  230. height: 160rpx;
  231. margin: 0 20rpx;
  232. image {
  233. width: 100%;
  234. height: 100%;
  235. border-radius: 8rpx;
  236. }
  237. }
  238. .novel-info {
  239. flex: 1;
  240. .novel-title {
  241. font-size: 28rpx;
  242. font-weight: bold;
  243. color: #333;
  244. margin-bottom: 10rpx;
  245. }
  246. .novel-tags {
  247. display: flex;
  248. margin-bottom: 10rpx;
  249. .tag {
  250. font-size: 22rpx;
  251. color: #999;
  252. margin-right: 10rpx;
  253. &::before {
  254. content: '[';
  255. }
  256. &::after {
  257. content: ']';
  258. }
  259. }
  260. }
  261. .novel-author {
  262. font-size: 24rpx;
  263. color: #999;
  264. }
  265. }
  266. .novel-status {
  267. font-size: 24rpx;
  268. color: #67c23a;
  269. }
  270. }
  271. }
  272. }
  273. }
  274. </style>