|
|
- <template>
- <view class="chapter-container">
- <view class="header">
- <view class="nav-bar">
- <view class="back" @click="goBack">
- <text class="iconfont icon-back"></text>
- </view>
- <view class="tabs">
- <view class="tab" :class="{ active: activeTab === 'draft' }" @click="switchTab('draft')">草稿箱</view>
- <view class="tab" :class="{ active: activeTab === 'published' }" @click="switchTab('published')">已发布</view>
- </view>
- <view class="more">
- <text class="iconfont"></text>
- </view>
- </view>
- </view>
-
- <view class="chapter-list">
- <view class="chapter-item" v-for="(chapter, index) in chapters" :key="index" @click="editChapter(chapter)">
- <view class="chapter-info">
- <text class="chapter-title">章节名</text>
- <text class="chapter-number">第{{index + 1}}章</text>
- </view>
- <text class="iconfont icon-arrow"></text>
- </view>
- </view>
-
- <view class="bottom-actions">
- <button class="btn-settings" @click="handleSettings">设置作品</button>
- <button class="btn-new" @click="addNewChapter">新建章节</button>
- </view>
- </view>
- </template>
-
- <script>
- export default {
- data() {
- return {
- activeTab: 'draft',
- chapters: Array(8).fill({}) // 模拟8个章节数据
- }
- },
- methods: {
- goBack() {
- uni.navigateBack()
- },
- switchTab(tab) {
- this.activeTab = tab
- // 根据tab加载不同的章节列表
- },
- addNewChapter() {
- uni.navigateTo({
- url: '/pages_order/author/editor'
- })
- },
- editChapter(chapter) {
- uni.navigateTo({
- url: '/pages_order/author/editor?id=' + chapter.id
- })
- },
- handleSettings() {
- uni.navigateTo({
- url: '/pages_order/novel/createNovel?type=edit'
- })
- }
- }
- }
- </script>
-
- <style lang="scss" scoped>
- .chapter-container {
- min-height: 100vh;
- background-color: #fff;
- padding-bottom: 70px;
-
- .header {
- background: #fff;
- padding-top: var(--status-bar-height);
-
- .nav-bar {
- height: 44px;
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 0 15px;
-
- .back {
- padding: 5px;
- .icon-back {
- font-size: 20px;
- }
- }
-
- .tabs {
- display: flex;
- .tab {
- padding: 0 15px;
- font-size: 16px;
- color: #666;
- position: relative;
-
- &.active {
- color: #000;
- font-weight: bold;
-
- &::after {
- content: '';
- position: absolute;
- bottom: -4px;
- left: 50%;
- transform: translateX(-50%);
- width: 20px;
- height: 2px;
- background: #2b4acb;
- border-radius: 1px;
- }
- }
- }
- }
-
- .more {
- padding: 5px;
- }
- }
- }
-
- .chapter-list {
- padding: 0 15px;
-
- .chapter-item {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 15px 0;
- border-bottom: 1px solid #eee;
-
- .chapter-info {
- .chapter-title {
- font-size: 14px;
- color: #999;
- margin-bottom: 5px;
- display: block;
- }
-
- .chapter-number {
- font-size: 16px;
- color: #333;
- display: block;
- }
- }
-
- .icon-arrow {
- color: #999;
- font-size: 16px;
- }
- }
- }
-
- .bottom-actions {
- position: fixed;
- bottom: 0;
- left: 0;
- right: 0;
- display: flex;
- padding: 10px 15px;
- background: #fff;
- box-shadow: 0 -2px 6px rgba(0,0,0,0.05);
-
- button {
- flex: 1;
- height: 40px;
- border-radius: 20px;
- font-size: 16px;
- margin: 0 5px;
-
- &.btn-settings {
- background: #fff;
- border: 1px solid #ddd;
- color: #333;
- }
-
- &.btn-new {
- background: #2b4acb;
- color: #fff;
- border: none;
- }
- }
- }
- }
- </style>
|