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

228 lines
6.4 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. <view class="header">
  4. <view class="tab-container">
  5. <view class="tab active">阅读</view>
  6. <view class="tab">作品</view>
  7. </view>
  8. </view>
  9. <view class="novel-grid">
  10. <!-- 第一行小说 -->
  11. <view class="novel-row">
  12. <!-- 小说1 -->
  13. <view class="novel-item" @click="toNovelDetail('1')">
  14. <image class="novel-cover" src="https://tse4-mm.cn.bing.net/th/id/OIP-C.iUyxJ_fxLjjX3kEBjteXWwAAAA?rs=1&pid=ImgDetMain" mode="aspectFill"></image>
  15. <view class="novel-title">我是半妖</view>
  16. </view>
  17. <!-- 小说2 -->
  18. <view class="novel-item" @click="toNovelDetail('2')">
  19. <image class="novel-cover" src="https://tse4-mm.cn.bing.net/th/id/OIP-C.iUyxJ_fxLjjX3kEBjteXWwAAAA?rs=1&pid=ImgDetMain" mode="aspectFill"></image>
  20. <view class="novel-title">兽王进化从被小萝莉召唤开始</view>
  21. </view>
  22. <!-- 小说3 -->
  23. <view class="novel-item" @click="toNovelDetail('3')">
  24. <image class="novel-cover" src="https://tse4-mm.cn.bing.net/th/id/OIP-C.iUyxJ_fxLjjX3kEBjteXWwAAAA?rs=1&pid=ImgDetMain" mode="aspectFill"></image>
  25. <view class="novel-title">魔法少女纯爷们</view>
  26. </view>
  27. </view>
  28. <!-- 第二行小说 -->
  29. <view class="novel-row">
  30. <!-- 小说4 -->
  31. <view class="novel-item" @click="toNovelDetail('4')">
  32. <image class="novel-cover" src="https://tse4-mm.cn.bing.net/th/id/OIP-C.iUyxJ_fxLjjX3kEBjteXWwAAAA?rs=1&pid=ImgDetMain"></image>
  33. <view class="novel-title">我是一条小青龙</view>
  34. </view>
  35. <!-- 小说5 -->
  36. <view class="novel-item" @click="toNovelDetail('5')">
  37. <image class="novel-cover" src="https://tse4-mm.cn.bing.net/th/id/OIP-C.iUyxJ_fxLjjX3kEBjteXWwAAAA?rs=1&pid=ImgDetMain"></image>
  38. <view class="novel-title">女帝别闹朕怀孕了</view>
  39. </view>
  40. <!-- 小说6 -->
  41. <view class="novel-item" @click="toNovelDetail('6')">
  42. <image class="novel-cover" src="https://tse4-mm.cn.bing.net/th/id/OIP-C.iUyxJ_fxLjjX3kEBjteXWwAAAA?rs=1&pid=ImgDetMain" mode="aspectFill"></image>
  43. <view class="novel-title">中国式应酬应酬是门技术活</view>
  44. </view>
  45. </view>
  46. <!-- 第三行小说 -->
  47. <view class="novel-row">
  48. <!-- 小说7 -->
  49. <view class="novel-item" @click="toNovelDetail('7')">
  50. <image class="novel-cover" src="https://tse4-mm.cn.bing.net/th/id/OIP-C.iUyxJ_fxLjjX3kEBjteXWwAAAA?rs=1&pid=ImgDetMain" mode="aspectFill"></image>
  51. <view class="novel-title">苏世民我的经验与教训</view>
  52. </view>
  53. <!-- 小说8 -->
  54. <view class="novel-item" @click="toNovelDetail('8')">
  55. <image class="novel-cover" src="https://tse4-mm.cn.bing.net/th/id/OIP-C.iUyxJ_fxLjjX3kEBjteXWwAAAA?rs=1&pid=ImgDetMain" mode="aspectFill"></image>
  56. <view class="novel-title">认知觉醒开启自我改变的原动力</view>
  57. </view>
  58. <!-- 小说9 -->
  59. <view class="novel-item" @click="toNovelDetail('9')">
  60. <image class="novel-cover" src="https://tse4-mm.cn.bing.net/th/id/OIP-C.iUyxJ_fxLjjX3kEBjteXWwAAAA?rs=1&pid=ImgDetMain" mode="aspectFill"></image>
  61. <view class="novel-title">纳瓦尔宝典</view>
  62. </view>
  63. </view>
  64. </view>
  65. <tabber select="book"/>
  66. </view>
  67. </template>
  68. <script>
  69. import tabber from '@/components/base/tabbar.vue'
  70. import { mapGetters } from 'vuex'
  71. export default {
  72. components : {
  73. tabber,
  74. },
  75. computed : {
  76. ...mapGetters(['userShop']),
  77. },
  78. data() {
  79. return {
  80. novels: [
  81. {
  82. id: '1',
  83. title: '我是半妖',
  84. cover: 'https://tse4-mm.cn.bing.net/th/id/OIP-C.iUyxJ_fxLjjX3kEBjteXWwAAAA?rs=1&pid=ImgDetMain'
  85. },
  86. {
  87. id: '2',
  88. title: '兽王进化:从被小萝莉召唤开始',
  89. cover: 'https://tse4-mm.cn.bing.net/th/id/OIP-C.iUyxJ_fxLjjX3kEBjteXWwAAAA?rs=1&pid=ImgDetMain'
  90. },
  91. {
  92. id: '3',
  93. title: '魔法少女纯爷们',
  94. cover: 'https://tse4-mm.cn.bing.net/th/id/OIP-C.iUyxJ_fxLjjX3kEBjteXWwAAAA?rs=1&pid=ImgDetMain'
  95. },
  96. {
  97. id: '4',
  98. title: '我是一条小青龙',
  99. cover: 'https://tse4-mm.cn.bing.net/th/id/OIP-C.iUyxJ_fxLjjX3kEBjteXWwAAAA?rs=1&pid=ImgDetMain'
  100. },
  101. {
  102. id: '5',
  103. title: '女帝:别闹,朕怀孕了!',
  104. cover: 'https://tse4-mm.cn.bing.net/th/id/OIP-C.iUyxJ_fxLjjX3kEBjteXWwAAAA?rs=1&pid=ImgDetMain'
  105. },
  106. {
  107. id: '6',
  108. title: '中国式应酬——应酬是门技术活',
  109. cover: 'https://tse4-mm.cn.bing.net/th/id/OIP-C.iUyxJ_fxLjjX3kEBjteXWwAAAA?rs=1&pid=ImgDetMain'
  110. },
  111. {
  112. id: '7',
  113. title: '苏世民:我的经验与教训',
  114. cover: 'https://tse4-mm.cn.bing.net/th/id/OIP-C.iUyxJ_fxLjjX3kEBjteXWwAAAA?rs=1&pid=ImgDetMain'
  115. },
  116. {
  117. id: '8',
  118. title: '认知觉醒:开启自我改变的原动力',
  119. cover: 'https://tse4-mm.cn.bing.net/th/id/OIP-C.iUyxJ_fxLjjX3kEBjteXWwAAAA?rs=1&pid=ImgDetMain'
  120. },
  121. {
  122. id: '9',
  123. title: '纳瓦尔宝典',
  124. cover: 'https://tse4-mm.cn.bing.net/th/id/OIP-C.iUyxJ_fxLjjX3kEBjteXWwAAAA?rs=1&pid=ImgDetMain'
  125. }
  126. ]
  127. }
  128. },
  129. onShow() {
  130. // 页面显示时的逻辑
  131. },
  132. methods: {
  133. // 跳转到小说详情页
  134. toNovelDetail(id) {
  135. uni.navigateTo({
  136. url: '/pages_order/novel/novelDetail?id=' + id
  137. })
  138. },
  139. }
  140. }
  141. </script>
  142. <style scoped lang="scss">
  143. .page {
  144. background-color: #ffffff;
  145. min-height: 100vh;
  146. }
  147. .header {
  148. display: flex;
  149. justify-content: center;
  150. align-items: center;
  151. padding: 20rpx 30rpx;
  152. .tab-container {
  153. display: flex;
  154. align-items: center;
  155. font-size: 34rpx;
  156. .tab {
  157. margin-right: 30rpx;
  158. color: #999;
  159. &.active {
  160. color: #000;
  161. font-weight: bold;
  162. font-size: 36rpx;
  163. }
  164. }
  165. }
  166. .icons {
  167. display: flex;
  168. align-items: center;
  169. .icon {
  170. margin-right: 20rpx;
  171. }
  172. }
  173. }
  174. .novel-grid {
  175. padding: 10rpx 30rpx;
  176. .novel-row {
  177. display: flex;
  178. justify-content: space-between;
  179. margin-bottom: 40rpx;
  180. .novel-item {
  181. width: 31%;
  182. .novel-cover {
  183. width: 100%;
  184. height: 240rpx;
  185. border-radius: 16rpx;
  186. box-shadow: 0 4rpx 12rpx rgba(0,0,0,0.1);
  187. }
  188. .novel-title {
  189. font-size: 24rpx;
  190. margin-top: 16rpx;
  191. line-height: 1.4;
  192. height: 64rpx;
  193. overflow: hidden;
  194. text-overflow: ellipsis;
  195. display: -webkit-box;
  196. -webkit-line-clamp: 2;
  197. -webkit-box-orient: vertical;
  198. color: #333;
  199. }
  200. }
  201. }
  202. }
  203. </style>