Files
TripLog/templates/layout.php
T

58 lines
2.3 KiB
PHP
Raw Normal View History

<?php $__isLoggedIn = \App\Auth::check(); ?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><?= e($pageTitle ?? '家庭出行记录') ?></title>
<link rel="stylesheet" href="/assets/style.css">
<link rel="stylesheet" href="/assets/vendor/cropper/cropper.min.css">
<script src="/assets/vendor/cropper/cropper.min.js"></script>
<script>
window._AMapSecurityConfig = {
securityJsCode: '<?= e(app_config()['amap']['security_js'] ?? '') ?>',
};
window.__AMAP_LOADED = false;
window.__AMAP_ERROR = null;
</script>
<script src="https://webapi.amap.com/maps?v=2.0&key=<?= e(app_config()['amap']['key'] ?? '') ?>&plugin=AMap.AutoComplete"
onload="window.__AMAP_LOADED = true;"
onerror="window.__AMAP_ERROR = 'script load failed';">
</script>
</head>
<body>
<?php if ($__isLoggedIn): ?>
<header class="topbar">
<a href="<?= url('activities/index') ?>" class="brand">🏠 家庭出行记录</a>
<nav>
<a href="<?= url('activities/index') ?>">活动列表</a>
<a href="<?= url('activities/create') ?>" class="btn-primary">+ 新建活动</a>
<?php if (\App\Auth::isAdmin()): ?>
<a href="<?= url('node_types/index') ?>">节点类型</a>
<a href="<?= url('vehicles/index') ?>">车辆</a>
<a href="<?= url('travel_modes/index') ?>">出行方式</a>
<a href="<?= url('role_tags/index') ?>">角色标签</a>
<a href="<?= url('users/index') ?>">用户管理</a>
<?php endif; ?>
<span class="user-info">
<a href="<?= url('users/edit', ['id' => \App\Auth::id()]) ?>" style="color:#555; text-decoration:none;">
<?= e($_SESSION['user_name'] ?? '') ?>
</a>
</span>
<a href="<?= url('auth/logout') ?>" class="logout-link">退出</a>
</nav>
</header>
<?php endif; ?>
<main class="container<?= $__isLoggedIn ? '' : ' container-guest' ?>">
<?php if ($err = flash('error')): ?>
<div class="alert"><?= e($err) ?></div>
<?php endif; ?>
<?php require $content; ?>
</main>
<?php if ($__isLoggedIn): ?>
<footer class="footer">家庭出行记录 · V1.0</footer>
<?php endif; ?>
</body>
</html>