v0.1测试
This commit is contained in:
49
frontend/includes/header.php
Normal file
49
frontend/includes/header.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/**
|
||||
* 班级操行分管理系统 - 公共头部
|
||||
*
|
||||
* 开发者: Canglan
|
||||
* 联系方式: admin@sea-studio.top
|
||||
* 版权归属: Sea Network Technology Studio
|
||||
* 许可证: MIT License
|
||||
*
|
||||
* 版权所有 © Sea Network Technology Studio
|
||||
*/
|
||||
|
||||
if (!isset($_SESSION)) {
|
||||
session_start();
|
||||
}
|
||||
|
||||
$current_page = basename($_SERVER['PHP_SELF'], '.php');
|
||||
$user_type = $_SESSION['user_type'] ?? '';
|
||||
$role = $_SESSION['role'] ?? '';
|
||||
$page_title = $page_title ?? '首页';
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
|
||||
<title><?php echo SITE_NAME; ?> - <?php echo $page_title; ?></title>
|
||||
<link rel="stylesheet" href="/assets/css/style.css">
|
||||
<?php if ($user_type === 'admin'): ?>
|
||||
<link rel="stylesheet" href="/assets/css/admin.css">
|
||||
<?php endif; ?>
|
||||
</head>
|
||||
<body>
|
||||
<div class="header">
|
||||
<h1><?php echo SITE_NAME; ?></h1>
|
||||
<div class="header-info">
|
||||
<span class="user-name" id="userName"><?php echo htmlspecialchars($_SESSION['real_name'] ?? ''); ?></span>
|
||||
<?php if ($role): ?>
|
||||
<span class="user-role">(<?php echo htmlspecialchars($role); ?>)</span>
|
||||
<?php endif; ?>
|
||||
<button class="btn-logout" id="logoutBtn">退出登录</button>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
const API_BASE_URL = '<?php echo API_BASE_URL; ?>';
|
||||
const JWT_STORAGE_KEY = '<?php echo JWT_STORAGE_KEY; ?>';
|
||||
const USER_STORAGE_KEY = '<?php echo USER_STORAGE_KEY; ?>';
|
||||
</script>
|
||||
<script src="/assets/js/common.js"></script>
|
||||
Reference in New Issue
Block a user