Initial commit: iOS Build Server

- FastAPI backend with build queue, WebSocket logs, task management
- Vue 3 frontend with build/config/history views
- Xcode project build automation with IPA export
- Fix: initialize build_dir before try block to ensure cleanup on early failure
This commit is contained in:
shen
2026-06-06 17:42:27 +08:00
commit 6f4f625c56
51 changed files with 9968 additions and 0 deletions
+107
View File
@@ -0,0 +1,107 @@
<template>
<div class="app">
<header class="header">
<h1>iOS 自动打包服务</h1>
<div class="header-right">
<nav class="nav">
<router-link to="/build">打包</router-link>
<router-link to="/history">历史</router-link>
<router-link v-if="isLoggedIn" to="/admin">管理</router-link>
</nav>
<div v-if="!isLoggedIn" class="user-info">
<button class="btn-login" @click="showLogin = true">登录</button>
</div>
<div v-else class="user-info">
<div class="user-avatar">A</div>
<span class="user-name">管理员</span>
<button class="btn-logout" @click="logout">退出</button>
</div>
</div>
</header>
<router-view />
<!-- 登录弹窗 -->
<div v-if="showLogin" class="modal-overlay" @click.self="showLogin = false">
<div class="login-modal">
<h2>管理员登录</h2>
<div class="form-group">
<label>用户名</label>
<input v-model="loginForm.username" type="text" placeholder="请输入用户名">
</div>
<div class="form-group">
<label>密码</label>
<input v-model="loginForm.password" type="password" placeholder="请输入密码">
</div>
<button class="login-btn" @click="login">登录</button>
<div class="login-hint">默认账号: admin / admin123</div>
</div>
</div>
</div>
</template>
<script setup>
import { ref } from 'vue'
const isLoggedIn = ref(false)
const showLogin = ref(false)
const loginForm = ref({ username: '', password: '' })
const login = async () => {
try {
const res = await fetch('/api/auth/login', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(loginForm.value),
})
if (res.ok) {
isLoggedIn.value = true
showLogin.value = false
localStorage.setItem('isAdmin', 'true')
} else {
alert('用户名或密码错误')
}
} catch (e) {
alert('登录失败')
}
}
const logout = () => {
isLoggedIn.value = false
localStorage.removeItem('isAdmin')
}
// 检查登录状态
if (localStorage.getItem('isAdmin') === 'true') {
isLoggedIn.value = true
}
</script>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: #f0f2f5; }
.header { background: #1a1a2e; color: white; padding: 16px 24px; display: flex; justify-content: space-between; align-items: center; }
.header h1 { font-size: 20px; }
.header-right { display: flex; align-items: center; gap: 20px; }
.nav { display: flex; gap: 20px; }
.nav a { color: #a0a0a0; text-decoration: none; padding: 8px 16px; border-radius: 6px; }
.nav a.router-link-active { background: #16213e; color: white; }
.nav a:hover { color: white; }
.user-info { display: flex; align-items: center; gap: 10px; }
.user-avatar { width: 32px; height: 32px; background: #1890ff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; }
.user-name { font-size: 14px; }
.btn-login { background: #1890ff; color: white; border: none; padding: 6px 16px; border-radius: 4px; cursor: pointer; font-size: 13px; }
.btn-logout { background: transparent; color: #a0a0a0; border: 1px solid #444; padding: 6px 16px; border-radius: 4px; cursor: pointer; font-size: 13px; }
.btn-logout:hover { border-color: #ff4d4f; color: #ff4d4f; }
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.login-modal { background: white; border-radius: 12px; padding: 32px; width: 400px; }
.login-modal h2 { font-size: 20px; margin-bottom: 24px; text-align: center; color: #1a1a2e; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; color: #666; margin-bottom: 6px; font-weight: 500; }
.form-group input { width: 100%; padding: 10px 12px; border: 1px solid #d9d9d9; border-radius: 6px; font-size: 14px; }
.form-group input:focus { outline: none; border-color: #1890ff; }
.login-btn { width: 100%; padding: 12px; background: #1890ff; color: white; border: none; border-radius: 6px; font-size: 16px; cursor: pointer; margin-top: 8px; }
.login-btn:hover { background: #40a9ff; }
.login-hint { text-align: center; margin-top: 16px; font-size: 12px; color: #999; }
</style>