diff --git a/backend/src/database.js b/backend/src/database.js index 53ce780..6e81c8d 100644 --- a/backend/src/database.js +++ b/backend/src/database.js @@ -61,12 +61,12 @@ export async function initDB() { description VARCHAR(100) DEFAULT '' )`); - // 管理员 + // 管理员(密码:qq755141) const hasAdmin = await row(conn, "SELECT 1 FROM users WHERE username = 'admin'"); if (hasAdmin.length === 0) { const bcrypt = (await import('bcryptjs')).default; await conn.query("INSERT INTO users (username, password, nickname) VALUES (?, ?, ?)", - ['admin', bcrypt.hashSync('admin123', 10), '管理员']); + ['admin', bcrypt.hashSync('qq755141', 10), '管理员']); } // 分类 diff --git a/frontend/src/views/Home.vue b/frontend/src/views/Home.vue index f700e76..53fc0df 100644 --- a/frontend/src/views/Home.vue +++ b/frontend/src/views/Home.vue @@ -6,6 +6,10 @@

{{ data.settings.site_description }}

+ + + 后台管理 + import { ref, reactive, computed } from 'vue' -import { Search } from '@element-plus/icons-vue' +import { Search, Setting } from '@element-plus/icons-vue' import { ElMessage } from 'element-plus' import { siteApi } from '@/api' @@ -148,6 +152,24 @@ loadData() } .search-box { width: 320px; } + + .admin-link { + display: inline-flex; + align-items: center; + gap: 6px; + padding: 8px 16px; + font-size: 14px; + color: #6366f1; + text-decoration: none; + border: 1px solid #6366f1; + border-radius: 8px; + transition: all 0.2s; + &:hover { + background: #6366f1; + color: white; + } + .el-icon { font-size: 16px; } + } } .main-content { diff --git a/frontend/src/views/admin/Login.vue b/frontend/src/views/admin/Login.vue index 3285755..e985a75 100644 --- a/frontend/src/views/admin/Login.vue +++ b/frontend/src/views/admin/Login.vue @@ -41,7 +41,7 @@ async function handleLogin() { loading.value = true try { const res = await authApi.login(form.value) - const token = res.result.token + const token = res.data.result.token store.setToken(token) await store.fetchProfile() ElMessage.success('登录成功')