style: 优化样式

This commit is contained in:
ViperEkura 2026-04-14 11:03:47 +08:00
parent 4bf59fe6e0
commit 54d6034f16
5 changed files with 121 additions and 63 deletions

View File

@ -18,49 +18,11 @@
</nav>
<div class="header-right">
<button class="header-btn" @click="toggleTheme" :title="isDark ? '切换到浅色模式' : '切换到暗色模式'">
<svg v-if="!isDark" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"></path>
</svg>
<svg v-else width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="5"></circle>
<line x1="12" y1="1" x2="12" y2="3"></line>
<line x1="12" y1="21" x2="12" y2="23"></line>
<line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line>
<line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line>
<line x1="1" y1="12" x2="3" y2="12"></line>
<line x1="21" y1="12" x2="23" y2="12"></line>
<line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line>
<line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line>
</svg>
</button>
</div>
</header>
</template>
<script setup>
import { ref, onMounted } from 'vue'
const isDark = ref(localStorage.getItem('theme') === 'dark')
const toggleTheme = () => {
isDark.value = !isDark.value
if (isDark.value) {
document.documentElement.setAttribute('data-theme', 'dark')
localStorage.setItem('theme', 'dark')
} else {
document.documentElement.removeAttribute('data-theme')
localStorage.setItem('theme', 'light')
}
}
onMounted(() => {
if (localStorage.getItem('theme') === 'dark') {
document.documentElement.setAttribute('data-theme', 'dark')
isDark.value = true
}
})
const navItems = [
{
path: '/',
@ -163,24 +125,6 @@ const navItems = [
margin-left: auto;
}
.header-btn {
width: 32px;
height: 32px;
border-radius: 6px;
background: var(--bg-secondary);
border: 1px solid var(--border-light);
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
color: var(--text-secondary);
transition: all 0.2s;
}
.header-btn:hover {
border-color: var(--accent-primary);
color: var(--accent-primary);
}
@media (max-width: 768px) {
.brand-text {
display: none;

View File

@ -4,6 +4,11 @@ import App from './App.vue'
import router from './router'
import { pinia } from './utils'
// 初始化夜间模式
if (localStorage.getItem('theme') === 'dark') {
document.documentElement.setAttribute('data-theme', 'dark')
}
createApp(App)
.use(router)
.use(pinia)

View File

@ -257,12 +257,26 @@ body {
}
.md-content blockquote {
border-left: 3px solid var(--border-medium);
border-left: 3px solid var(--text-tertiary);
padding-left: 12px;
margin: 0.5em 0;
color: var(--text-secondary);
}
[data-theme="dark"] .md-content blockquote {
border-left-color: var(--text-secondary);
}
.md-content hr {
border: none;
border-top: 1px solid var(--border-light);
margin: 1em 0;
}
[data-theme="dark"] .md-content hr {
border-top-color: rgba(255, 255, 255, 0.2);
}
.md-content ul,
.md-content ol {
padding-left: 20px;
@ -555,6 +569,33 @@ body {
box-shadow: 0 0 0 3px var(--accent-primary-light), inset 0 1px 2px rgba(0, 0, 0, 0.2);
}
/* ============ Select Dropdown Arrow ============ */
select {
appearance: none !important;
-webkit-appearance: none !important;
-moz-appearance: none !important;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
background-repeat: no-repeat !important;
background-position: right 10px center !important;
padding-right: 32px !important;
cursor: pointer;
}
/* 展开时箭头向上 */
select:focus,
select[aria-expanded="true"] {
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='18 15 12 9 6 15'%3E%3C/polyline%3E%3C/svg%3E") !important;
}
[data-theme="dark"] select {
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a0a0a0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
}
[data-theme="dark"] select:focus,
[data-theme="dark"] select[aria-expanded="true"] {
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a0a0a0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='18 15 12 9 6 15'%3E%3C/polyline%3E%3C/svg%3E") !important;
}
.page-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));

View File

@ -105,8 +105,12 @@
class="chat-input"
:disabled="sending"
/>
<button @click="sendMessage" class="btn-send" :disabled="sending || !newMessage.trim()">
{{ sending ? '发送中...' : '发送' }}
<button @click="sendMessage" class="btn-send" :disabled="sending || !newMessage.trim()" :title="sending ? '发送中...' : '发送'">
<span v-if="sending">...</span>
<svg v-else viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<line x1="22" y1="2" x2="11" y2="13"></line>
<polygon points="22 2 15 22 11 13 2 9 22 2"></polygon>
</svg>
</button>
</div>
</div>
@ -527,9 +531,28 @@ onUnmounted(() => {
animation: pulse 1.5s ease-in-out infinite;
}
.conv-item-actions { display: flex; gap: 0.25rem; opacity: 1; }
.btn-icon { padding: 0.2rem; background: transparent; border: none; cursor: pointer; font-size: 0.75rem; opacity: 0.6; transition: opacity 0.15s; }
.btn-icon:hover { opacity: 1; }
.btn-icon {
background: transparent;
border: none;
cursor: pointer;
padding: 4px;
border-radius: 4px;
color: var(--text-secondary);
transition: all 0.15s;
display: flex;
align-items: center;
justify-content: center;
}
.btn-icon:hover {
background: var(--bg-hover);
color: var(--accent-primary);
}
.btn-icon svg {
width: 14px;
height: 14px;
}
.btn-delete-icon { color: var(--danger-color); }
.btn-delete-icon:hover { color: var(--danger-color); }
/* 侧边栏分页 */
.sidebar-pagination { display: flex; justify-content: center; align-items: center; gap: 0.75rem; padding: 0.75rem; border-top: 1px solid var(--border-light); font-size: 0.8rem; color: var(--text-secondary); }
@ -575,8 +598,9 @@ onUnmounted(() => {
.chat-input-area { padding: 1rem; border-top: 1px solid var(--border-light); display: flex; gap: 0.75rem; }
.chat-input { flex: 1; padding: 0.65rem 0.9rem; border: 1px solid var(--border-input); border-radius: 8px; background: var(--bg-input); color: var(--text-primary); font-size: 0.9rem; }
.chat-input:focus { outline: none; border-color: var(--accent-primary); }
.btn-send { padding: 0.5rem 1rem; background: var(--accent-primary); color: white; border: none; border-radius: 8px; cursor: pointer; font-size: 0.85rem; }
.btn-send:hover { background: var(--accent-primary-hover); }
.btn-send { width: 40px; height: 40px; background: var(--accent-primary); color: white; border: none; border-radius: 8px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.15s ease; }
.btn-send:hover:not(:disabled) { background: var(--accent-primary-hover); transform: translateY(-1px); box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3); }
.btn-send:disabled { opacity: 0.5; cursor: not-allowed; }
/* 按钮样式 */
.btn-primary { padding: 0.5rem 1rem; background: var(--accent-primary); color: white; border: none; border-radius: 6px; cursor: pointer; font-size: 0.85rem; transition: all 0.2s; }

View File

@ -33,6 +33,28 @@
</div>
</div>
<!-- 外观设置 -->
<div class="settings-section">
<div class="section-title">
<span class="section-icon">🎨</span>
<span class="section-text">外观</span>
</div>
<div class="settings-card">
<div class="settings-row">
<div class="row-label">
<span class="row-title">夜间模式</span>
<span class="row-desc">切换深色/浅色主题</span>
</div>
<div class="row-value">
<label class="switch" @click.prevent="toggleTheme">
<input type="checkbox" v-model="isDark" />
<span class="slider"></span>
</label>
</div>
</div>
</div>
</div>
<!-- 模型设置 -->
<div class="settings-section">
<div class="section-title">
@ -250,6 +272,27 @@ import { useRouter } from 'vue-router'
const router = useRouter()
const { logout } = useAuth()
//
const isDark = ref(localStorage.getItem('theme') === 'dark')
const toggleTheme = () => {
isDark.value = !isDark.value
if (isDark.value) {
document.documentElement.setAttribute('data-theme', 'dark')
localStorage.setItem('theme', 'dark')
} else {
document.documentElement.removeAttribute('data-theme')
localStorage.setItem('theme', 'light')
}
}
onMounted(() => {
if (localStorage.getItem('theme') === 'dark') {
document.documentElement.setAttribute('data-theme', 'dark')
isDark.value = true
}
})
const handleLogout = async () => {
if (!confirm('确定要退出登录吗?')) return
await logout(authAPI)
@ -486,6 +529,7 @@ onMounted(() => {
/* 内联输入框 */
.inline-select, .inline-input { padding: 0.5rem 0.75rem; border: 1px solid var(--border-input); border-radius: 6px; background: var(--bg-input); color: var(--text-primary); font-size: 0.85rem; min-width: 180px; }
.inline-input { width: 120px; }
.inline-input { width: 120px; }
.input-with-hint { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.hint-inline { font-size: 0.75rem; color: var(--text-tertiary); }
textarea { width: 100%; padding: 0.75rem; border: 1px solid var(--border-input); border-radius: 8px; background: var(--bg-input); color: var(--text-primary); font-size: 0.85rem; resize: vertical; min-height: 80px; box-sizing: border-box; }