<template>
  <view class="chapter-container">
    <view class="header">
      <view class="nav-bar">
        <view class="back" @click="goBack">
          <text class="iconfont icon-back">&#xe60e;</text>
        </view>
        <view class="tabs">
          <view class="tab active">草稿箱</view>
          <view class="tab">已发布</view>
        </view>
        <view class="more">
          <text class="iconfont">&#xe612;</text>
        </view>
      </view>
    </view>
    
    <view class="chapter-list">
      <view class="chapter-item" v-for="(chapter, index) in chapters" :key="index">
        <view class="chapter-info">
          <text class="chapter-title">章节名</text>
          <text class="chapter-number">第{{index + 1}}章</text>
        </view>
        <text class="iconfont icon-arrow">&#xe65f;</text>
      </view>
    </view>
    
    <view class="bottom-actions">
      <button class="btn-settings">设置作品</button>
      <button class="btn-new" @click="addNewChapter">新建章节</button>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      chapters: Array(8).fill({}) // 模拟8个章节数据
    }
  },
  methods: {
    goBack() {
      uni.navigateBack()
    },
    addNewChapter() {
      // 添加新章节的逻辑
      uni.showToast({
        title: '新建章节',
        icon: 'none'
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.chapter-container {
  min-height: 100vh;
  background-color: #fff;
  
  .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;
          &.active {
            color: #000;
            font-weight: bold;
          }
        }
      }
      
      .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;
        }
        
        .chapter-number {
          font-size: 16px;
          color: #333;
        }
      }
      
      .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> 