Compare commits
57 Commits
feature-us
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 41a169f2ea | |||
| 2207c987a9 | |||
| afddab0584 | |||
| 47af4aca14 | |||
| a303098ec8 | |||
| 0469b97bd5 | |||
| 7573374102 | |||
| 8d7894ef9a | |||
| b7db13bd32 | |||
| 91312268aa | |||
| d4a81d36de | |||
| 2b2e5da541 | |||
| e768a3975b | |||
| 5ac3791a05 | |||
| ac633048b4 | |||
| a82c158c5f | |||
| 858b205d5d | |||
| b793db559e | |||
| 8e523bf976 | |||
| aca3b6ecb5 | |||
| 6acf5a68a4 | |||
| 5fade46e46 | |||
| c51d6cb241 | |||
| 0cd09e473c | |||
| 33b0426313 | |||
| aa0f709ca9 | |||
| 1dfdc26bab | |||
| b3bad42f62 | |||
| 3c28b9be57 | |||
| bdf7bc0684 | |||
| 401374bed8 | |||
| f0c139694a | |||
| 51a237e275 | |||
| c1c5f53c86 | |||
| 74e8a13585 | |||
| 7e92fe47cc | |||
| dc04fd9b84 | |||
| 0de640edd8 | |||
| c185db7fd8 | |||
| af94031e94 | |||
| 62853dcbdd | |||
| 3c9ba2ef8f | |||
| d15d2827ff | |||
| 8eb51e4202 | |||
| 8d552fef41 | |||
| e496310532 | |||
| 8101eb52bd | |||
| 942ac51236 | |||
| c45070300f | |||
| 0a55dea92f | |||
| 4eeef1d1b3 | |||
| 0d333d6492 | |||
| 0aadca89a7 | |||
| 0caf063e09 | |||
| 54651daee1 | |||
| 5941191ed6 | |||
| de9fd8a73e |
23
.gitea/workflows/code-review.yml
Normal file
23
.gitea/workflows/code-review.yml
Normal file
@@ -0,0 +1,23 @@
|
||||
name: AI Code Review (on comment)
|
||||
|
||||
on:
|
||||
issue_comment:
|
||||
types: [created, edited]
|
||||
|
||||
jobs:
|
||||
code-review:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event.issue.pull_request && (startsWith(github.event.comment.body, 'openai') || github.event.comment.body == 'openai')
|
||||
|
||||
steps:
|
||||
|
||||
- name: Comment on PR
|
||||
uses: https://devstar.cn/beppeb/pr-comment-action@main
|
||||
with:
|
||||
body: "✅ 构建完成!"
|
||||
token: e61260b1d4b4c981e6f91913fa98933005271f89
|
||||
server: https://devstar.cn
|
||||
owner: beppeb
|
||||
repo: demo-workflow-repo
|
||||
pr_number: 8
|
||||
|
||||
22
.gitea/workflows/test1.yml
Normal file
22
.gitea/workflows/test1.yml
Normal file
@@ -0,0 +1,22 @@
|
||||
name: ai-reviews
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [created, edited]
|
||||
|
||||
jobs:
|
||||
review:
|
||||
name: Review PR
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Review code
|
||||
uses: kekxv/AiReviewPR@v0.0.5
|
||||
with:
|
||||
model: 'deepseek-r1:8b'
|
||||
host: 'http://127.0.0.1:11434'
|
||||
REVIEW_PULL_REQUEST: false
|
||||
203
css/styles.css
Normal file
203
css/styles.css
Normal file
@@ -0,0 +1,203 @@
|
||||
/* 基本样式重置 */
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: 'Microsoft YaHei', Arial, sans-serif;
|
||||
line-height: 1.6;
|
||||
color: #333;
|
||||
background-color: #f4f4f4;
|
||||
}
|
||||
|
||||
.container {
|
||||
width: 90%;
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
padding: 0 20px;
|
||||
}
|
||||
|
||||
/* 头部样式 */
|
||||
header {
|
||||
background-color: #3498db;
|
||||
color: #fff;
|
||||
padding: 1rem 0;
|
||||
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
|
||||
}
|
||||
|
||||
header h1 {
|
||||
margin: 0;
|
||||
font-size: 1.8rem;
|
||||
}
|
||||
|
||||
nav {
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
nav ul {
|
||||
list-style: none;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
nav ul li {
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
||||
nav ul li a {
|
||||
color: #fff;
|
||||
text-decoration: none;
|
||||
padding: 5px 10px;
|
||||
border-radius: 3px;
|
||||
transition: background-color 0.3s;
|
||||
}
|
||||
|
||||
nav ul li a:hover,
|
||||
nav ul li a.active {
|
||||
background-color: rgba(255,255,255,0.2);
|
||||
}
|
||||
|
||||
/* 页脚样式 */
|
||||
footer {
|
||||
background-color: #333;
|
||||
color: #fff;
|
||||
padding: 1rem 0;
|
||||
margin-top: 2rem;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* 主内容区域 */
|
||||
main {
|
||||
padding: 2rem 0;
|
||||
}
|
||||
|
||||
.welcome-section {
|
||||
background-color: #fff;
|
||||
padding: 2rem;
|
||||
border-radius: 5px;
|
||||
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
|
||||
margin-top: 2rem;
|
||||
}
|
||||
|
||||
/* 登录页面样式 */
|
||||
.login-page {
|
||||
background-color: #f9f9f9;
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.login-container {
|
||||
width: 100%;
|
||||
max-width: 400px;
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
.login-box {
|
||||
background-color: #fff;
|
||||
padding: 2rem;
|
||||
border-radius: 5px;
|
||||
box-shadow: 0 2px 15px rgba(0,0,0,0.1);
|
||||
}
|
||||
|
||||
.login-box h1 {
|
||||
text-align: center;
|
||||
margin-bottom: 2rem;
|
||||
color: #3498db;
|
||||
}
|
||||
|
||||
.form-group {
|
||||
margin-bottom: 1.5rem;
|
||||
}
|
||||
|
||||
label {
|
||||
display: block;
|
||||
margin-bottom: 0.5rem;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
input[type="text"],
|
||||
input[type="password"] {
|
||||
width: 100%;
|
||||
padding: 0.8rem;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 4px;
|
||||
font-size: 1rem;
|
||||
transition: border-color 0.3s;
|
||||
}
|
||||
|
||||
input[type="text"]:focus,
|
||||
input[type="password"]:focus {
|
||||
border-color: #3498db;
|
||||
outline: none;
|
||||
box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
|
||||
}
|
||||
|
||||
.btn-login {
|
||||
background-color: #3498db;
|
||||
color: #fff;
|
||||
border: none;
|
||||
padding: 0.8rem;
|
||||
width: 100%;
|
||||
font-size: 1rem;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.3s;
|
||||
}
|
||||
|
||||
.btn-login:hover {
|
||||
background-color: #2980b9;
|
||||
}
|
||||
|
||||
.error-message {
|
||||
color: #e74c3c;
|
||||
font-size: 0.85rem;
|
||||
margin-top: 5px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.form-message {
|
||||
text-align: center;
|
||||
margin-top: 1rem;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.form-message.error {
|
||||
color: #e74c3c;
|
||||
}
|
||||
|
||||
.form-message.success {
|
||||
color: #2ecc71;
|
||||
}
|
||||
|
||||
/* 响应式设计 */
|
||||
@media screen and (max-width: 768px) {
|
||||
header h1 {
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
|
||||
nav ul {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
nav ul li {
|
||||
margin-right: 0;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 480px) {
|
||||
.login-container {
|
||||
padding: 0.5rem;
|
||||
}
|
||||
|
||||
.login-box {
|
||||
padding: 1.5rem;
|
||||
}
|
||||
|
||||
.login-box h1 {
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
}
|
||||
121
js/login.js
Normal file
121
js/login.js
Normal file
@@ -0,0 +1,121 @@
|
||||
/**
|
||||
* 登录功能实现
|
||||
* 原生JavaScript,不依赖框架
|
||||
*/
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const loginForm = document.getElementById('loginForm');
|
||||
const usernameInput = document.getElementById('username');
|
||||
const passwordInput = document.getElementById('password');
|
||||
const usernameError = document.getElementById('username-error');
|
||||
const passwordError = document.getElementById('password-error');
|
||||
const formMessage = document.getElementById('form-message');
|
||||
|
||||
// 用于演示的模拟用户数据
|
||||
const mockUsers = [
|
||||
{ username: 'admin', password: 'admin123' },
|
||||
{ username: 'user', password: 'user123' }
|
||||
];
|
||||
|
||||
/**
|
||||
* 表单提交处理
|
||||
*/
|
||||
loginForm.addEventListener('submit', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
// 重置错误信息
|
||||
resetErrors();
|
||||
|
||||
// 获取输入值
|
||||
const username = usernameInput.value.trim();
|
||||
const password = passwordInput.value.trim();
|
||||
|
||||
// 验证表单
|
||||
let isValid = validateForm(username, password);
|
||||
|
||||
if (isValid) {
|
||||
// 模拟登录请求
|
||||
mockLogin(username, password);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* 表单验证
|
||||
*/
|
||||
function validateForm(username, password) {
|
||||
let isValid = true;
|
||||
|
||||
// 验证用户名
|
||||
if (username === '') {
|
||||
displayError(usernameError, '请输入用户名');
|
||||
isValid = false;
|
||||
} else if (username.length < 3) {
|
||||
displayError(usernameError, '用户名长度必须至少为3个字符');
|
||||
isValid = false;
|
||||
}
|
||||
|
||||
// 验证密码
|
||||
if (password === '') {
|
||||
displayError(passwordError, '请输入密码');
|
||||
isValid = false;
|
||||
} else if (password.length < 6) {
|
||||
displayError(passwordError, '密码长度必须至少为6个字符');
|
||||
isValid = false;
|
||||
}
|
||||
|
||||
return isValid;
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示错误信息
|
||||
*/
|
||||
function displayError(element, message) {
|
||||
element.textContent = message;
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置错误信息
|
||||
*/
|
||||
function resetErrors() {
|
||||
usernameError.textContent = '';
|
||||
passwordError.textContent = '';
|
||||
formMessage.textContent = '';
|
||||
formMessage.className = 'form-message';
|
||||
}
|
||||
|
||||
/**
|
||||
* 模拟登录
|
||||
*/
|
||||
function mockLogin(username, password) {
|
||||
// 显示加载状态
|
||||
formMessage.textContent = '登录中...';
|
||||
formMessage.className = 'form-message';
|
||||
|
||||
// 模拟网络延迟
|
||||
setTimeout(function() {
|
||||
// 检查用户是否存在
|
||||
const user = mockUsers.find(user =>
|
||||
user.username === username && user.password === password
|
||||
);
|
||||
|
||||
if (user) {
|
||||
// 登录成功
|
||||
formMessage.textContent = '登录成功,即将跳转...';
|
||||
formMessage.className = 'form-message success';
|
||||
|
||||
// 保存登录状态到本地存储
|
||||
localStorage.setItem('isLoggedIn', 'true');
|
||||
localStorage.setItem('username', username);
|
||||
|
||||
// 重定向到首页
|
||||
setTimeout(function() {
|
||||
window.location.href = 'index.html';
|
||||
}, 1000);
|
||||
} else {
|
||||
// 登录失败
|
||||
formMessage.textContent = '用户名或密码错误';
|
||||
formMessage.className = 'form-message error';
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
56
js/main.js
Normal file
56
js/main.js
Normal file
@@ -0,0 +1,56 @@
|
||||
/**
|
||||
* 主页JavaScript
|
||||
*/
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// 检查用户是否已登录
|
||||
checkLoginStatus();
|
||||
|
||||
// 初始化页面事件
|
||||
initEvents();
|
||||
});
|
||||
|
||||
/**
|
||||
* 检查用户登录状态
|
||||
*/
|
||||
function checkLoginStatus() {
|
||||
const isLoggedIn = localStorage.getItem('isLoggedIn');
|
||||
|
||||
if (!isLoggedIn) {
|
||||
// 如果未登录,重定向到登录页面
|
||||
window.location.href = 'login.html';
|
||||
return;
|
||||
}
|
||||
|
||||
// 获取并显示用户名
|
||||
const username = localStorage.getItem('username');
|
||||
if (username) {
|
||||
document.getElementById('username').textContent = username;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化页面事件
|
||||
*/
|
||||
function initEvents() {
|
||||
// 退出登录
|
||||
const logoutBtn = document.getElementById('logout');
|
||||
if (logoutBtn) {
|
||||
logoutBtn.addEventListener('click', function(e) {
|
||||
e.preventDefault();
|
||||
logout();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 退出登录
|
||||
*/
|
||||
function logout() {
|
||||
// 清除本地存储中的登录信息
|
||||
localStorage.removeItem('isLoggedIn');
|
||||
localStorage.removeItem('username');
|
||||
|
||||
// 重定向到登录页面
|
||||
window.location.href = 'login.html';
|
||||
}
|
||||
Reference in New Issue
Block a user