<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>星月写作</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/naive-ui@2.40.1/dist/naive-ui.css">
    <style>
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            margin: 0;
            padding: 0;
            background-color: #f9f9f9;
        }

        header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 15px 30px;
            background-color: #ffffff;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        }

        .logo {
            font-size: 28px;
            font-weight: 600;
            color: #FF6B6B;
        }

        nav, .right-nav {
            display: flex;
            gap: 20px;
        }

        .icon {
            text-decoration: none;
            color: #555;
            transition: color 0.3s;
        }

        .icon:hover {
            color: #FF6B6B;
        }

        .info-bar {
            background-color: #E6F7FF;
            padding: 15px;
            text-align: center;
            font-size: 14px;
            border-radius: 5px;
            margin: 15px 30px;
        }

        .tab-bar {
            display: flex;
            padding: 10px 30px;
            background-color: #ffffff;
            border-bottom: 2px solid #e0e0e0;
        }

        .tab {
            padding: 10px 20px;
            background: none;
            cursor: pointer;
            border: none;
            font-size: 16px;
            color: #777;
            transition: color 0.3s, border-bottom 0.3s;
        }

        .tab.active {
            border-bottom: 3px solid #1890FF;
            color: #1890FF;
        }

        .content {
            padding: 20px 30px;
            display: flex;
            flex-wrap: wrap;
            gap: 20px;
        }

        .new-work, .work-item {
            width: 260px;
            height: 160px;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            background-color: #ffffff;
            border-radius: 8px;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
            padding: 15px;
            transition: transform 0.3s;
        }

        .new-work:hover, .work-item:hover {
            transform: translateY(-5px);
        }

        .work-icon {
            width: 90px;
            height: 90px;
            background-color: #4CAF50;
            color: white;
            display: flex;
            justify-content: center;
            align-items: center;
            border-radius: 8px;
            font-size: 36px;
        }

        .work-info {
            text-align: center;
            margin-top: 10px;
        }

        .tag {
            background-color: #E0E0E0;
            padding: 4px 8px;
            border-radius: 12px;
            font-size: 12px;
            margin: 2px 2px;
        }

        .modal {
            display: none;
            position: fixed;
            z-index: 1;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            overflow: auto;
            background-color: rgba(0, 0, 0, 0.5);
        }

        .modal-content {
            background-color: #fefefe;
            margin: 15% auto;
            padding: 20px;
            border-radius: 8px;
            width: 80%;
            max-width: 400px;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
        }
    </style>
</head>
<body>
    <header>
        <div class="logo">C</div>
        <nav>
            <a href="#" class="icon">&#x1F6D2;</a>
            <a href="#" class="icon">&#x1F4B0;</a>
        </nav>
        <div class="right-nav">
            <a href="#" class="icon">&#x1F551;</a>
            <a href="#" class="icon">&#x1F4C4;</a>
            <a href="#" class="icon">教程</a>
        </div>
    </header>
    <main>
        <div class="info-bar">星月写作处于内测阶段，有任何问题和建议请联系管理员微信：JasonHan0601 国庆特惠来袭，详情咨询管理员</div>
        <div class="tab-bar">
            <button class="tab active">作品</button>
            <button class="tab">已归档</button>
        </div>
        <div class="content">
            <div class="new-work">
                <div class="work-icon"><h1>+</h1></div>
                <div style="width:100%;">
                    <n-button @click="showNewWorkModal" type="primary">+新建作品</n-button>
                    <n-button type="default">+导入作品</n-button>
                </div>
            </div>
            <div class="work-item">
                <div>
                    <div class="work-icon">月神殇</div>
                    <div class="work-info">
                        <h3>月神殇</h3>
                        <span class="tag">小说</span>
                        <span class="tag">1.0万字</span>
                    </div>
                </div>
                <div style="width:100%;">
                    <n-button @click="showNewChapterModal" type="primary">+新建章节</n-button>
                    <n-button @click="manageWork" type="default">作品管理</n-button>
                </div>
            </div>
        </div>
    </main>

    <n-modal v-model:show="newWorkModalVisible">
        <template #header>
            <h2>新建作品</h2>
        </template>
        <template #default>
            <n-input v-model="newWorkTitle" placeholder="作品标题" />
            <n-button @click="createNewWork" type="primary">创建</n-button>
        </template>
    </n-modal>

    <n-modal v-model:show="newChapterModalVisible">
        <template #header>
            <h2>新建章节</h2>
        </template>
        <template #default>
            <n-input v-model="newChapterTitle" placeholder="章节标题" />
            <n-button @click="createNewChapter" type="primary">创建</n-button>
        </template>
    </n-modal>

    <script src="https://cdn.jsdelivr.net/npm/vue@3.2.45/dist/vue.global.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/naive-ui@2.40.1/dist/naive-ui.umd.js"></script>
    <script>
        const { createApp, ref } = Vue;

        createApp({
            setup() {
                const newWorkModalVisible = ref(false);
                const newChapterModalVisible = ref(false);
                const newWorkTitle = ref('');
                const newChapterTitle = ref('');

                const showNewWorkModal = () => {
                    newWorkModalVisible.value = true;
                };

                const showNewChapterModal = () => {
                    newChapterModalVisible.value = true;
                };

                const createNewWork = () => {
                    if (newWorkTitle.value) {
                        alert(`作品 "${newWorkTitle.value}" 创建成功!`);
                        newWorkModalVisible.value = false;
                        newWorkTitle.value = '';
                    } else {
                        alert('请输入作品标题');
                    }
                };

                const createNewChapter = () => {
                    if (newChapterTitle.value) {
                        alert(`章节 "${newChapterTitle.value}" 创建成功!`);
                        newChapterModalVisible.value = false;
                        newChapterTitle.value = '';
                    } else {
                        alert('请输入章节标题');
                    }
                };

                const manageWork = () => {
                    alert('打开作品管理界面');
                };

                return {
                    newWorkModalVisible,
                    newChapterModalVisible,
                    newWorkTitle,
                    newChapterTitle,
                    showNewWorkModal,
                    showNewChapterModal,
                    createNewWork,
                    createNewChapter,
                    manageWork
                };
            }
        }).use(NaiveUI).mount('body');
    </script>
</body>
</html>