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

165 lines
3.4 KiB

  1. <template>
  2. <view class="chapter-container">
  3. <navbar title="章节列表" leftClick @leftClick="$utils.navigateBack"/>
  4. <view class="tabs">
  5. <uv-tabs :list="tabs"
  6. :activeStyle="{color : '#0A2463', fontWeight : 600}"
  7. lineColor="#0A2463"
  8. :inactiveStyle="{color: '#0A2463'}"
  9. lineHeight="8rpx"
  10. lineWidth="50rpx"
  11. :scrollable="false"
  12. :current="activeTab"
  13. @click="clickTabs"></uv-tabs>
  14. </view>
  15. <view class="chapter-list">
  16. <view class="chapter-item" v-for="(chapter, index) in chapters" :key="index" @click="editChapter(chapter)">
  17. <view class="chapter-info">
  18. <text class="chapter-title">章节名</text>
  19. <text class="chapter-number">{{index + 1}}</text>
  20. </view>
  21. <uv-icon name="arrow-right" color="#999" size="28"></uv-icon>
  22. </view>
  23. </view>
  24. <view class="bottom-actions">
  25. <button class="btn-settings" @click="handleSettings">设置作品</button>
  26. <button class="btn-new" @click="addNewChapter">新建章节</button>
  27. </view>
  28. </view>
  29. </template>
  30. <script>
  31. import mixinsList from '@/mixins/list.js'
  32. export default {
  33. mixins: [mixinsList],
  34. components: {
  35. },
  36. data() {
  37. return {
  38. tabs : [
  39. {
  40. name : '已发布',
  41. },
  42. {
  43. name : '草稿箱',
  44. }
  45. ],
  46. activeTab: 0,
  47. mixinsListApi : 'getBookCatalogList',
  48. id : 0,
  49. }
  50. },
  51. onLoad(options) {
  52. // 根据tab参数决定初始tab
  53. if (options.activeTab) {
  54. this.activeTab = options.activeTab;
  55. }
  56. if(options.id){
  57. this.queryParams.bookId = options.id
  58. this.id = options.id
  59. this.queryParams.status = this.activeTab
  60. }
  61. },
  62. methods: {
  63. clickTabs(tab) {
  64. this.activeTab = tab.index;
  65. this.queryParams.status = this.activeTab
  66. this.getData()
  67. },
  68. addNewChapter() {
  69. uni.navigateTo({
  70. url: '/pages_order/author/editor?id=' + this.id
  71. })
  72. },
  73. editChapter(chapter) {
  74. uni.navigateTo({
  75. url: '/pages_order/author/editor?cid=' + chapter.id + '&id=' + this.id
  76. })
  77. },
  78. handleSettings() {
  79. uni.navigateTo({
  80. url: '/pages_order/novel/createNovel?type=edit'
  81. })
  82. }
  83. }
  84. }
  85. </script>
  86. <style lang="scss" scoped>
  87. .chapter-container {
  88. min-height: 100vh;
  89. background-color: #fff;
  90. padding-bottom: 70px;
  91. .chapter-list {
  92. padding: 20rpx 40rpx;
  93. background-color: rgb(255, 254, 254);
  94. margin: 50rpx 40rpx;
  95. border-radius: 3%;
  96. .chapter-item {
  97. display: flex;
  98. justify-content: space-between;
  99. align-items: center;
  100. padding: 15px 0;
  101. border-bottom: 1px solid #eee;
  102. .chapter-info {
  103. .chapter-title {
  104. font-size: 14px;
  105. color: #999;
  106. margin-bottom: 5px;
  107. display: block;
  108. }
  109. .chapter-number {
  110. font-size: 16px;
  111. color: #333;
  112. display: block;
  113. }
  114. }
  115. .icon-arrow {
  116. color: #999;
  117. font-size: 16px;
  118. }
  119. }
  120. }
  121. .bottom-actions {
  122. padding-bottom: calc(env(safe-area-inset-bottom) + 30rpx);
  123. position: fixed;
  124. bottom: 0;
  125. left: 0;
  126. right: 0;
  127. display: flex;
  128. padding: 10px 15px;
  129. background: #fff;
  130. box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.05);
  131. button {
  132. flex: 1;
  133. height: 40px;
  134. border-radius: 20px;
  135. font-size: 16px;
  136. margin: 0 5px;
  137. &.btn-settings {
  138. background: #fff;
  139. border: 1px solid #ddd;
  140. color: #333;
  141. }
  142. &.btn-new {
  143. background: #2b4acb;
  144. color: #fff;
  145. border: none;
  146. }
  147. }
  148. }
  149. }
  150. </style>