better-staridc-MNBT
1<?php
2/**
3 * 售卖前端 - 统一布局
4 * 仅被 shop_frontend 的视图引用;$content 由各视图通过 ob_start() 填充。
5 */
6if (!defined('IN_CRONLITE')) { exit; }
7$current_user = $current_user ?? null;
8$page_title = $page_title ?? '用户中心';
9$active = $active ?? '';
10$brand = $brand ?? 'MNBT 云服务';
11$brand_logo = $brand_logo ?? '';
12$brand_primary = $brand_primary ?? '#4f46e5';
13$brand_footer = $brand_footer ?? '';
14$brand_favicon = $brand_favicon ?? '';
15$has_balance = $has_balance ?? false;
16$has_hosting = $has_hosting ?? false;
17$content = $content ?? '';
18?>
19<!DOCTYPE html>
20<html lang="zh-CN">
21<head>
22<meta charset="UTF-8">
23<meta name="viewport" content="width=device-width, initial-scale=1.0">
24<?php if (!empty($brand_favicon)): ?><link rel="icon" href="<?= htmlspecialchars($brand_favicon) ?>"><?php endif; ?>
25<title><?= htmlspecialchars($page_title) ?> - <?= htmlspecialchars($brand) ?></title>
26<link rel="stylesheet" href="<?= htmlspecialchars($asset_url . 'style.css') ?>">
27<style>:root{--brand: <?= htmlspecialchars($brand_primary) ?>;}</style>
28</head>
29<body class="sf-body">
30
31<script>
32(function () {
33 window.sfMsg = function (id, text, type) {
34 var m = document.getElementById(id);
35 if (!m) return;
36 m.textContent = text || '';
37 m.className = 'sf-msg show ' + (type === 'success' ? 'sf-msg-success' : 'sf-msg-error');
38 };
39 window.sfPost = function (url, data, headers) {
40 var body = new URLSearchParams();
41 Object.keys(data || {}).forEach(function (k) {
42 var v = data[k];
43 body.append(k, v === undefined || v === null ? '' : v);
44 });
45 return fetch(url, {
46 method: 'POST',
47 headers: Object.assign({ 'Content-Type': 'application/x-www-form-urlencoded' }, headers || {}),
48 body: body.toString()
49 }).then(function (r) { return r.json(); });
50 };
51 window.sfChoice = function (form) {
52 form.querySelectorAll('.sf-choice').forEach(function (l) { l.classList.remove('active'); });
53 form.querySelectorAll('input[type="radio"]:checked').forEach(function (r) {
54 var p = r.closest('.sf-choice');
55 if (p) p.classList.add('active');
56 });
57 };
58})();
59</script>
60
61<?php include __DIR__ . '/partials/navbar.php'; ?>
62
63<main class="sf-container sf-main"><?= $content ?></main>
64
65<footer class="sf-footer">
66 <div class="sf-container"><?= htmlspecialchars($brand_footer ?: ($brand . ' · 用户中心')) ?></div>
67</footer>
68
69</body>
70</html>