208 lines
6.8 KiB
HTML
208 lines
6.8 KiB
HTML
<!doctype html>
|
|
<html lang="zh-CN">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<title id="page-title">神彩算 - 公告详情</title>
|
|
<script src="../public/css/layui/layui.js"></script>
|
|
<script src="../config.js"></script>
|
|
<script src="../utils/ApiClient.js"></script>
|
|
<script src="../utils/DateUtil.js"></script>
|
|
<script src="../utils/CommonUtil.js"></script>
|
|
<link rel="stylesheet" href="../public/css/layui/css/layui.css" />
|
|
<link rel="stylesheet" href="../public/css/public.css" />
|
|
<link rel="stylesheet" href="../public/css/gonggao.css" />
|
|
</head>
|
|
<body>
|
|
<!-- Header -->
|
|
<nav class="topbar" id="navbar">
|
|
<div class="topbar__inner">
|
|
<a href="index.html" class="topbar__brand">
|
|
<img
|
|
src="../images/home-logo.png"
|
|
alt="神彩算"
|
|
class="topbar__logo"
|
|
/>
|
|
</a>
|
|
<div class="topbar__nav" id="navLotteryItems">
|
|
<!-- <a href="index.html" class="topbar__nav-link">首页</a> -->
|
|
</div>
|
|
<div class="topbar__user">
|
|
<div id="notLoggedInBox" class="topbar__guest">
|
|
<a href="login.html" class="topbar__btn topbar__btn--ghost">登录</a>
|
|
<a href="reg.html" class="topbar__btn topbar__btn--primary"
|
|
>免费注册</a
|
|
>
|
|
</div>
|
|
<div id="loggedInBox" class="topbar__logged" style="display: none">
|
|
<a href="usercenter.html" class="topbar__profile">
|
|
<img
|
|
id="userAvatar"
|
|
src="../public/img/userimg.png"
|
|
alt=""
|
|
class="topbar__avatar"
|
|
/>
|
|
<div class="topbar__meta">
|
|
<span id="userName" class="topbar__uname">用户</span>
|
|
<span id="userLevel" class="topbar__ubadge">会员</span>
|
|
</div>
|
|
</a>
|
|
<button class="topbar__btn topbar__btn--logout" onclick="logout()">
|
|
退出登录
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
|
|
<!-- Main -->
|
|
<main class="cxz-main">
|
|
<div class="cxz-breadcrumb">
|
|
<a href="index.html">首页</a><span class="sep">></span>
|
|
<a href="gonggaolist.html">网站公告</a><span class="sep">></span>
|
|
<span>公告详情</span>
|
|
</div>
|
|
|
|
<div class="cxz-notice-card">
|
|
<div class="cxz-notice-header">
|
|
<h1 class="cxz-notice-title" id="noticeTitle">加载中...</h1>
|
|
<div class="cxz-notice-meta" id="noticeTime">--</div>
|
|
</div>
|
|
<div class="cxz-notice-body" id="noticeContent">
|
|
<p style="text-align: center; color: var(--text-muted)">加载中...</p>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="cxz-back-bar">
|
|
<a href="gonggaolist.html" class="cxz-back-btn">返回公告列表</a>
|
|
</div>
|
|
</main>
|
|
|
|
<!-- Footer -->
|
|
<footer class="site-footer">
|
|
<div class="site-footer__inner">
|
|
<img
|
|
src="../images/home-logo.png"
|
|
alt="神彩算"
|
|
class="site-footer__logo"
|
|
/>
|
|
<p id="copyright-info">神彩算以开奖数据、免费文章、资讯推荐为核心</p>
|
|
<div class="site-footer__meta">
|
|
<a
|
|
id="beian"
|
|
href="https://beian.miit.gov.cn/"
|
|
target="_blank"
|
|
style="font-size: 12px; color: rgba(255, 255, 255, 0.5)"
|
|
>工信部备案号</a
|
|
>
|
|
<span id="additional-info">本站仅供数据分析参考</span>
|
|
</div>
|
|
</div>
|
|
</footer>
|
|
|
|
<button
|
|
class="gotop"
|
|
id="backTop"
|
|
type="button"
|
|
onclick="window.scrollTo({ top: 0, behavior: 'smooth' })"
|
|
>
|
|
↑
|
|
</button>
|
|
|
|
<script>
|
|
const $ = layui.$;
|
|
const urlParams = new URLSearchParams(window.location.search);
|
|
const noticeId = urlParams.get("id") || "";
|
|
|
|
function logout() {
|
|
localStorage.removeItem("token");
|
|
window.location.reload();
|
|
}
|
|
|
|
function checkLogin() {
|
|
const token = localStorage.getItem("token");
|
|
if (token) {
|
|
$("#notLoggedInBox").hide();
|
|
$("#loggedInBox").css("display", "flex");
|
|
CommonUtil.getCurrentUserDetail(
|
|
function (data) {
|
|
$("#userName").text(data.nickName || "用户");
|
|
$("#userLevel").text(data.isExpert === "1" ? "专家" : "会员");
|
|
if (data.avatar) $("#userAvatar").attr("src", data.avatar);
|
|
},
|
|
function () {
|
|
$("#notLoggedInBox").show();
|
|
$("#loggedInBox").hide();
|
|
},
|
|
);
|
|
}
|
|
}
|
|
|
|
function renderNav() {
|
|
ApiClient.post("/api/web/menu/getFormatList", {}).then(function (res) {
|
|
if (res.code !== 0 || !res.data) return;
|
|
var $nav = $("#navLotteryItems");
|
|
$nav.find(".topbar__nav-link").not(":first").remove();
|
|
$.each(res.data, function (i, item) {
|
|
$nav.append(
|
|
'<a href="cai.html?id=' +
|
|
item.suoxie +
|
|
'" class="topbar__nav-link">' +
|
|
item.name +
|
|
"</a>",
|
|
);
|
|
});
|
|
});
|
|
}
|
|
|
|
$(window).on("scroll", function () {
|
|
$(window).scrollTop() > 320
|
|
? $("#backTop").addClass("is-visible")
|
|
: $("#backTop").removeClass("is-visible");
|
|
});
|
|
|
|
function loadNotice() {
|
|
ApiClient.get(ApiClient.API.noticeDetail(noticeId)).then(
|
|
function (res) {
|
|
if (res.code === 0 && res.data) {
|
|
renderNotice(res.data);
|
|
} else {
|
|
layui.layer.msg("公告不存在", { icon: 2 });
|
|
$("#noticeTitle").text("公告不存在");
|
|
$("#noticeContent").html(
|
|
'<p style="text-align:center;color:var(--text-muted);">该公告不存在或已删除</p>',
|
|
);
|
|
}
|
|
},
|
|
);
|
|
}
|
|
|
|
function renderNotice(data) {
|
|
$("#noticeTitle").text(data.noticeTitle || "无标题");
|
|
if (data.createTime) {
|
|
$("#noticeTime").text(
|
|
"发布时间:" + DateUtil.formatDateToYearMonthDay(data.createTime),
|
|
);
|
|
}
|
|
$("#noticeContent").html(data.noticeContent || "");
|
|
document.title = "神彩算 - " + (data.noticeTitle || "公告详情");
|
|
}
|
|
|
|
$(function () {
|
|
checkLogin();
|
|
if (noticeId) {
|
|
loadNotice();
|
|
} else {
|
|
layui.layer.msg("公告ID不存在", { icon: 2 });
|
|
$("#noticeTitle").text("参数错误");
|
|
$("#noticeContent").html(
|
|
'<p style="text-align:center;color:var(--text-muted);">缺少公告ID参数</p>',
|
|
);
|
|
}
|
|
CommonUtil.loadPageConfig();
|
|
renderNav();
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|