初始化版本
This commit is contained in:
136
index.php
Normal file
136
index.php
Normal file
@@ -0,0 +1,136 @@
|
||||
<?php
|
||||
session_start();
|
||||
if (!isset($_SESSION['auth']) || !$_SESSION['auth']) {
|
||||
// 未登录:显示登录页并退出
|
||||
?>
|
||||
<!doctype html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>登录 - 笔记管理</title>
|
||||
<link rel="stylesheet" href="assets/css/style.css" />
|
||||
<style>
|
||||
.login-wrap { min-height: 100vh; display:flex; align-items:center; justify-content:center; background:#f7f8fa; }
|
||||
.login-card { width: 360px; padding: 24px; border:1px solid var(--border); border-radius:12px; background:#fff; box-shadow: 0 8px 24px rgba(0,0,0,0.08); }
|
||||
.login-card h1 { font-size: 18px; margin: 0 0 16px; }
|
||||
.login-card .field { margin: 12px 0; }
|
||||
.login-card input { width: 100%; padding: 10px 12px; border:1px solid var(--border); border-radius:8px; }
|
||||
.login-card button { width: 100%; margin-top: 12px; padding: 10px 12px; border-radius:8px; border:1px solid var(--border); background:#1677ff; color:#fff; cursor:pointer; }
|
||||
.login-tip { color:#666; font-size:12px; margin-top:8px; }
|
||||
.login-err { color:#d03050; font-size:13px; min-height: 18px; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="login-wrap">
|
||||
<div class="login-card">
|
||||
<h1>请输入访问密码</h1>
|
||||
<div class="field">
|
||||
<input id="loginPwd" type="password" placeholder="输入密码" />
|
||||
</div>
|
||||
<div id="loginErr" class="login-err"></div>
|
||||
<button id="loginBtn">登录</button>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
const btn = document.getElementById('loginBtn');
|
||||
const pwdInput = document.getElementById('loginPwd');
|
||||
const err = document.getElementById('loginErr');
|
||||
async function doLogin() {
|
||||
const password = pwdInput.value.trim();
|
||||
err.textContent = '';
|
||||
try {
|
||||
const resp = await fetch('api.php?action=login', {
|
||||
method: 'POST', headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ password })
|
||||
});
|
||||
const data = await resp.json();
|
||||
if (data.ok) {
|
||||
// 设置本地标记,供静态页前端校验
|
||||
localStorage.setItem('auth_ok', '1');
|
||||
location.href = 'index.php';
|
||||
} else {
|
||||
err.textContent = data.message || '登录失败';
|
||||
}
|
||||
} catch (e) {
|
||||
err.textContent = '网络错误,请稍后再试';
|
||||
}
|
||||
}
|
||||
btn.addEventListener('click', doLogin);
|
||||
pwdInput.addEventListener('keydown', (e) => { if (e.key === 'Enter') doLogin(); });
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
exit;
|
||||
}
|
||||
// 简单的单页应用,左侧菜单 + 右侧页面(工作进度看板)
|
||||
?>
|
||||
<!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="assets/css/style.css" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="app">
|
||||
|
||||
<main class="main">
|
||||
<div class="header">
|
||||
<div class="header-left">
|
||||
<strong>项目列表 · 工作进度看板</strong>
|
||||
</div>
|
||||
<div class="header-right">
|
||||
<input type="month" id="monthFilterInput" class="input" title="按年月筛选" />
|
||||
<button class="btn" id="monthFilterClearBtn" title="清除月份">清除月份</button>
|
||||
<select id="statusFilterSelect" class="select" title="筛选状态">
|
||||
<option value="全部">全部</option>
|
||||
<option value="待做">待做</option>
|
||||
<option value="进行">进行</option>
|
||||
<option value="完成">完成</option>
|
||||
<option value="异常">异常</option>
|
||||
</select>
|
||||
<input id="projectSearchInput" class="input" placeholder="搜索项目" />
|
||||
<input id="newProjectName" class="input" placeholder="新项目名称" />
|
||||
<button class="btn primary" onclick="createProject()">新增项目</button>
|
||||
<button class="btn" onclick="cleanupUnusedUploads()" title="后台检测并删除未使用的图片/附件">清理未用图片</button>
|
||||
<button class="btn danger" onclick="logout()" title="退出登录">退出登录</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<section class="status-board" id="statusBoard">
|
||||
<!-- JS 渲染四个列:待做、进行、完成、异常 -->
|
||||
</section>
|
||||
|
||||
<section class="chart-card">
|
||||
<h3 class="chart-title">月份曲线图 <span class="muted-small">展示最近12个月各状态项目数量</span></h3>
|
||||
<div class="chart-container">
|
||||
<canvas id="monthlyChart"></canvas>
|
||||
</div>
|
||||
<div id="chartMsg" class="chart-msg"></div>
|
||||
</section>
|
||||
|
||||
<section class="chart-card">
|
||||
<h3 class="chart-title">导出的HTML管理
|
||||
<span style="display:flex; gap:8px; align-items:center;">
|
||||
<input id="exportsSearchInput" class="input" placeholder="搜索文件名" />
|
||||
<input type="month" id="exportsMonthInput" class="input" title="按月份筛选" />
|
||||
<button class="btn" id="exportsMonthClearBtn" title="清除月份筛选">清除月份</button>
|
||||
<button class="btn" onclick="loadExports()" title="刷新导出列表">刷新</button>
|
||||
</span>
|
||||
</h3>
|
||||
<div class="muted-small" id="exportsCount"></div>
|
||||
<div id="exportsList"></div>
|
||||
</section>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<!-- 详情改为单独页面,不再使用悬浮弹窗 -->
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
||||
<script src="assets/js/app.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user