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

159 lines
3.2 KiB

  1. <template>
  2. <view class="chapter-container">
  3. <view class="header">
  4. <view class="nav-bar">
  5. <view class="back" @click="goBack">
  6. <text class="iconfont icon-back">&#xe60e;</text>
  7. </view>
  8. <view class="tabs">
  9. <view class="tab active">草稿箱</view>
  10. <view class="tab">已发布</view>
  11. </view>
  12. <view class="more">
  13. <text class="iconfont">&#xe612;</text>
  14. </view>
  15. </view>
  16. </view>
  17. <view class="chapter-list">
  18. <view class="chapter-item" v-for="(chapter, index) in chapters" :key="index">
  19. <view class="chapter-info">
  20. <text class="chapter-title">章节名</text>
  21. <text class="chapter-number">{{index + 1}}</text>
  22. </view>
  23. <text class="iconfont icon-arrow">&#xe65f;</text>
  24. </view>
  25. </view>
  26. <view class="bottom-actions">
  27. <button class="btn-settings">设置作品</button>
  28. <button class="btn-new" @click="addNewChapter">新建章节</button>
  29. </view>
  30. </view>
  31. </template>
  32. <script>
  33. export default {
  34. data() {
  35. return {
  36. chapters: Array(8).fill({}) // 模拟8个章节数据
  37. }
  38. },
  39. methods: {
  40. goBack() {
  41. uni.navigateBack()
  42. },
  43. addNewChapter() {
  44. // 添加新章节的逻辑
  45. uni.showToast({
  46. title: '新建章节',
  47. icon: 'none'
  48. })
  49. }
  50. }
  51. }
  52. </script>
  53. <style lang="scss" scoped>
  54. .chapter-container {
  55. min-height: 100vh;
  56. background-color: #fff;
  57. .header {
  58. background: #fff;
  59. padding-top: var(--status-bar-height);
  60. .nav-bar {
  61. height: 44px;
  62. display: flex;
  63. align-items: center;
  64. justify-content: space-between;
  65. padding: 0 15px;
  66. .back {
  67. padding: 5px;
  68. .icon-back {
  69. font-size: 20px;
  70. }
  71. }
  72. .tabs {
  73. display: flex;
  74. .tab {
  75. padding: 0 15px;
  76. font-size: 16px;
  77. color: #666;
  78. &.active {
  79. color: #000;
  80. font-weight: bold;
  81. }
  82. }
  83. }
  84. .more {
  85. padding: 5px;
  86. }
  87. }
  88. }
  89. .chapter-list {
  90. padding: 0 15px;
  91. .chapter-item {
  92. display: flex;
  93. justify-content: space-between;
  94. align-items: center;
  95. padding: 15px 0;
  96. border-bottom: 1px solid #eee;
  97. .chapter-info {
  98. .chapter-title {
  99. font-size: 14px;
  100. color: #999;
  101. margin-bottom: 5px;
  102. }
  103. .chapter-number {
  104. font-size: 16px;
  105. color: #333;
  106. }
  107. }
  108. .icon-arrow {
  109. color: #999;
  110. font-size: 16px;
  111. }
  112. }
  113. }
  114. .bottom-actions {
  115. position: fixed;
  116. bottom: 0;
  117. left: 0;
  118. right: 0;
  119. display: flex;
  120. padding: 10px 15px;
  121. background: #fff;
  122. box-shadow: 0 -2px 6px rgba(0,0,0,0.05);
  123. button {
  124. flex: 1;
  125. height: 40px;
  126. border-radius: 20px;
  127. font-size: 16px;
  128. margin: 0 5px;
  129. &.btn-settings {
  130. background: #fff;
  131. border: 1px solid #ddd;
  132. color: #333;
  133. }
  134. &.btn-new {
  135. background: #2b4acb;
  136. color: #fff;
  137. border: none;
  138. }
  139. }
  140. }
  141. }
  142. </style>