Help
RSS
API
Feed
Maltego
Contact
Domain > 77445263.top
×
More information on this domain is in
AlienVault OTX
Is this malicious?
Yes
No
DNS Resolutions
Date
IP Address
2026-01-25
47.76.85.123
(
ClassC
)
Port 80
HTTP/1.1 200 OKServer: nginxDate: Sun, 25 Jan 2026 23:17:37 GMTContent-Type: text/htmlContent-Length: 106900Last-Modified: Thu, 27 Nov 2025 12:30:01 GMTConnection: keep-aliveVary: Accept-EncodingETag: 69284449-1a194Accept-Ranges: bytes !DOCTYPE html>html langzh-CN>head> meta charsetUTF-8> meta nameviewport contentwidthdevice-width, initial-scale1.0> title>智汇论坛 - 分享知识,交流思想/title> link relstylesheet hrefhttps://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css> style> * { margin: 0; padding: 0; box-sizing: border-box; font-family: Segoe UI, Tahoma, Geneva, Verdana, sans-serif; } :root { --primary: #4361ee; --secondary: #3a0ca3; --accent: #4cc9f0; --light: #f8f9fa; --dark: #212529; --success: #4bb543; --warning: #ffcc00; --danger: #dc3545; --gray: #6c757d; --light-gray: #e9ecef; } body { background-color: #f5f7fb; color: var(--dark); line-height: 1.6; } .container { max-width: 1200px; margin: 0 auto; padding: 0 20px; } /* 头部样式 */ header { background: linear-gradient(135deg, var(--primary), var(--secondary)); color: white; padding: 15px 0; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); position: sticky; top: 0; z-index: 100; } .header-content { display: flex; justify-content: space-between; align-items: center; } .logo { display: flex; align-items: center; gap: 10px; font-size: 1.8rem; font-weight: 700; cursor: pointer; } .logo i { color: var(--accent); } .search-bar { flex: 0 1 500px; position: relative; } .search-bar input { width: 100%; padding: 12px 20px; border-radius: 50px; border: none; font-size: 1rem; background: rgba(255, 255, 255, 0.9); transition: all 0.3s ease; } .search-bar input:focus { outline: none; box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3); background: white; } .search-bar button { position: absolute; right: 5px; top: 5px; background: var(--primary); color: white; border: none; border-radius: 50px; padding: 7px 15px; cursor: pointer; transition: background 0.3s; } .search-bar button:hover { background: var(--secondary); } .user-actions { display: flex; align-items: center; gap: 15px; } .btn { padding: 10px 20px; border-radius: 50px; border: none; font-weight: 600; cursor: pointer; transition: all 0.3s; } .btn-primary { background: var(--accent); color: white; } .btn-primary:hover { background: #3aa8d8; transform: translateY(-2px); } .btn-outline { background: transparent; border: 2px solid white; color: white; } .btn-outline:hover { background: white; color: var(--primary); } .btn-secondary { background: var(--secondary); color: white; } .btn-secondary:hover { background: #2d0a8a; } .btn-success { background: var(--success); color: white; } .btn-success:hover { background: #3d9436; } .btn-danger { background: var(--danger); color: white; } .btn-danger:hover { background: #bd2130; } .btn-sm { padding: 6px 12px; font-size: 0.9rem; } /* 主要内容区域 */ .main-content { display: flex; gap: 20px; margin-top: 30px; } /* 侧边栏样式 */ .sidebar { flex: 0 0 250px; background: white; border-radius: 12px; box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05); padding: 20px; height: fit-content; } .sidebar h3 { margin-bottom: 15px; padding-bottom: 10px; border-bottom: 2px solid var(--light-gray); color: var(--secondary); } .categories { list-style: none; } .categories li { margin-bottom: 10px; } .categories a { display: flex; align-items: center; gap: 10px; padding: 10px 15px; border-radius: 8px; color: var(--dark); text-decoration: none; transition: all 0.3s; } .categories a:hover, .categories a.active { background: var(--light); color: var(--primary); font-weight: 600; } .categories a i { width: 20px; text-align: center; } .stats { margin-top: 30px; } .stat-item { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--light-gray); } /* 帖子列表样式 */ .posts-container { flex: 1; } .section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; } .section-header h2 { color: var(--secondary); } .filter-options { display: flex; gap: 10px; } .filter-options select { padding: 8px 15px; border-radius: 8px; border: 1px solid var(--light-gray); background: white; } .post-card { background: white; border-radius: 12px; box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05); padding: 20px; margin-bottom: 20px; transition: transform 0.3s, box-shadow 0.3s; cursor: pointer; } .post-card:hover { transform: translateY(-5px); box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1); } .post-header { display: flex; justify-content: space-between; margin-bottom: 15px; } .post-category { background: var(--light); color: var(--primary); padding: 5px 10px; border-radius: 50px; font-size: 0.8rem; font-weight: 600; } .post-time { color: var(--gray); font-size: 0.9rem; } .post-title { font-size: 1.3rem; margin-bottom: 10px; color: var(--dark); } .post-title a { color: inherit; text-decoration: none; } .post-title a:hover { color: var(--primary); } .post-excerpt { color: var(--gray); margin-bottom: 15px; } .post-footer { display: flex; justify-content: space-between; align-items: center; } .post-author { display: flex; align-items: center; gap: 10px; } .avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--primary); color: white; display: flex; align-items: center; justify-content: center; font-weight: bold; cursor: pointer; } .post-stats { display: flex; gap: 15px; color: var(--gray); } .post-stat { display: flex; align-items: center; gap: 5px; cursor: pointer; } .post-stat.liked { color: var(--danger); } /* 热门话题样式 */ .trending-topics { margin-top: 40px; } .topics-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 15px; } .topic-card { background: white; border-radius: 12px; box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05); padding: 15px; text-align: center; transition: all 0.3s; cursor: pointer; } .topic-card:hover { transform: translateY(-5px); box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1); } .topic-icon { font-size: 2rem; color: var(--primary); margin-bottom: 10px; } /* 表单样式 */ .form-container { max-width: 600px; margin: 40px auto; background: white; border-radius: 12px; box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05); padding: 30px; } .form-header { text-align: center; margin-bottom: 30px; } .form-header h2 { color: var(--secondary); margin-bottom: 10px; } .form-group { margin-bottom: 20px; } .form-group label { display: block; margin-bottom: 8px; font-weight: 600; color: var(--dark); } .form-control { width: 100%; padding: 12px 15px; border-radius: 8px; border: 1px solid var(--light-gray); font-size: 1rem; transition: border 0.3s; } .form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1); } textarea.form-control { min-height: 150px; resize: vertical; } .form-footer { text-align: center; margin-top: 20px; } .form-footer a { color: var(--primary); text-decoration: none; } .form-footer a:hover { text-decoration: underline; } /* 帖子详情页样式 */ .post-detail { background: white; border-radius: 12px; box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05); padding: 30px; margin-bottom: 30px; } .post-detail-header { display: flex; justify-content: space-between; margin-bottom: 20px; padding-bottom: 15px; border-bottom: 1px solid var(--light-gray); } .post-detail-title { font-size: 1.8rem; color: var(--dark); margin-bottom: 10px; } .post-detail-content { line-height: 1.8; margin-bottom: 30px; } .post-detail-content p { margin-bottom: 15px; } .post-actions { display: flex; gap: 15px; margin-top: 20px; } /* 评论区域样式 */ .comments-section { margin-top: 40px; } .comment-form { background: white; border-radius: 12px; box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05); padding: 20px; margin-bottom: 20px; } .comment-list { display: flex; flex-direction: column; gap: 15px; } .comment { background: white; border-radius: 12px; box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05); padding: 15px; } .comment-header { display: flex; justify-content: space-between; margin-bottom: 10px; } .comment-author { display: flex; align-items: center; gap: 10px; } .comment-time { color: var(--gray); font-size: 0.9rem; } .comment-content { line-height: 1.6; } /* 个人面板样式 */ .profile-container { display: flex; gap: 30px; } .profile-sidebar { flex: 0 0 300px; background: white; border-radius: 12px; box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05); padding: 20px; height: fit-content; } .profile-main { flex: 1; } .profile-header { display: flex; align-items: center; gap: 20px; margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--light-gray); } .profile-avatar { width: 80px; height: 80px; border-radius: 50%; background: var(--primary); color: white; display: flex; align-items: center; justify-content: center; font-size: 2rem; font-weight: bold; } .profile-info h2 { color: var(--secondary); margin-bottom: 5px; } .profile-stats { display: flex; gap: 20px; margin-top: 10px; } .profile-stat { text-align: center; } .profile-stat-value { font-size: 1.5rem; font-weight: bold; color: var(--primary); } .profile-stat-label { font-size: 0.9rem; color: var(--gray); } .profile-actions { display: flex; gap: 10px; margin-top: 15px; } /* 用户主页样式 */ .user-posts { margin-top: 30px; } /* 图片上传样式 */ .image-upload { margin-bottom: 20px; } .image-preview { max-width: 100%; max-height: 300px; margin-top: 10px; border-radius: 8px; display: none; } /* 底部样式 */ footer { background: var(--dark); color: white; padding: 40px 0 20px; margin-top: 50px; } .footer-content { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 30px; margin-bottom: 30px; } .footer-column h4 { margin-bottom: 20px; color: var(--accent); } .footer-links { list-style: none; } .footer-links li { margin-bottom: 10px; } .footer-links a { color: #adb5bd; text-decoration: none; transition: color 0.3s; } .footer-links a:hover { color: white; } .copyright { text-align: center; padding-top: 20px; border-top: 1px solid #495057; color: #adb5bd; font-size: 0.9rem; } /* 用户信息样式 */ .user-info { display: flex; align-items: center; gap: 10px; } .user-name { font-weight: 600; cursor: pointer; } /* 响应式设计 */ @media (max-width: 992px) { .main-content { flex-direction: column; } .sidebar { flex: 1; } .header-content { flex-wrap: wrap; gap: 15px; } .search-bar { flex: 1 1 100%; order: 3; } .profile-container { flex-direction: column; } .profile-sidebar { flex: 1; } } @media (max-width: 576px) { .user-actions { flex-wrap: wrap; justify-content: center; } .section-header { flex-direction: column; align-items: flex-start; gap: 10px; } .filter-options { width: 100%; justify-content: space-between; } .post-detail-header { flex-direction: column; gap: 10px; } .profile-header { flex-direction: column; text-align: center; } .profile-stats { justify-content: center; } } /* 页面切换动画 */ .page { display: none; } .page.active { display: block; } .hidden { display: none; } /* 新增样式 */ .balance-display { background: var(--success); color: white; padding: 5px 10px; border-radius: 15px; font-size: 0.9rem; margin-left: 10px; } .balance-amount { font-weight: bold; } .admin-panel { margin-top: 20px; padding: 15px; background: var(--light); border-radius: 8px; } .modal { position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); } .modal-content { background: white; margin: 5% auto; padding: 20px; border-radius: 12px; width: 90%; max-width: 500px; position: relative; } .close { position: absolute; right: 15px; top: 15px; font-size: 1.5rem; cursor: pointer; } .admin-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 15px; } .message-container { display: flex; height: 400px; } .message-sidebar { width: 200px; border-right: 1px solid var(--light-gray); padding-right: 15px; } .message-main { flex: 1; display: flex; flex-direction: column; } .message-contact { display: flex; align-items: center; gap: 10px; padding: 10px; cursor: pointer; border-radius: 8px; } .message-contact:hover { background: var(--light); } .message-chat { flex: 1; overflow-y: auto; padding: 15px; } .message { margin-bottom: 15px; max-width: 70%; } .message.sent { margin-left: auto; text-align: right; } .message-content { background: var(--light); padding: 10px; border-radius: 12px; display: inline-block; } .message.sent .message-content { background: var(--primary); color: white; } .message-image { max-width: 200px; border-radius: 8px; } .message-input { display: flex; gap: 10px; padding: 15px; border-top: 1px solid var(--light-gray); } .message-input textarea { flex: 1; padding: 10px; border: 1px solid var(--light-gray); border-radius: 8px; resize: none; } .avatar-upload { margin-top: 20px; } .current-avatar img { width: 100px; height: 100px; border-radius: 50%; object-fit: cover; margin-bottom: 10px; } .post-reward { color: var(--warning); font-size: 0.9rem; margin-top: 5px; } .message-transfer { background: var(--warning); color: white; padding: 5px; border-radius: 5px; margin-top: 5px; font-size: 0.8rem; } .admin-activation { margin-top: 20px; padding: 15px; background: var(--light); border-radius: 8px; } .video-upload { margin-bottom: 20px; } .video-preview { max-width: 100%; max-height: 300px; margin-top: 10px; border-radius: 8px; display: none; } .home-btn { margin-left: 10px; } /style>/head>body> !-- 头部 --> header> div classcontainer> div classheader-content> div classlogo onclickshowPage(home)> i classfas fa-comments>/i> span>智汇论坛/span> /div> div classsearch-bar> input typetext idsearch-input placeholder搜索话题、帖子或用户...> button onclickperformSearch()>i classfas fa-search>/i>/button> /div> div classuser-actions> div iduser-info classuser-info hidden> div classavatar iduser-avatar onclickshowPage(profile)>用/div> span classuser-name idusername-display onclickshowPage(profile)>用户名/span> button classbtn btn-outline onclicklogout()>退出/button> /div> div idguest-actions> button classbtn btn-outline onclickshowPage(login)>登录/button> button classbtn btn-primary onclickshowPage(register)>注册/button> /div> /div> /div> /div> /header> !-- 首页 --> div idhome classpage active> div classcontainer> div classmain-content> !-- 侧边栏 --> aside classsidebar> h3>论坛分类/h3> ul classcategories idcategories-list> !-- 分类将通过JavaScript动态加载 --> /ul> div classstats> h3>论坛统计/h3> div classstat-item> span>今日帖子/span> span idtoday-posts>0/span> /div> div classstat-item> span>会员总数/span> span idtotal-users>0/span> /div> div classstat-item> span>在线用户/span> span idonline-users>0/span> /div> /div> /aside> !-- 帖子列表 --> main classposts-container> div classsection-header> h2 idposts-title>最新帖子/h2> div classfilter-options> select idsort-posts> option valuedate>最新发布/option> option valueviews>最多浏览/option> option valuelikes>最多点赞/option> option valuecomments>最多评论/option> /select> button classbtn btn-primary idnew-post-btn onclickshowPage(new-post)>i classfas fa-plus>/i> 发布新帖/button> button classbtn btn-primary home-btn onclickshowPage(home)>i classfas fa-home>/i> 返回主页/button> /div> /div> div idposts-list> !-- 帖子将通过JavaScript动态加载 --> /div> !-- 热门话题 --> div classtrending-topics> div classsection-header> h2>热门话题/h2> /div> div classtopics-grid idtrending-topics> !-- 热门话题将通过JavaScript动态加载 --> /div> /div> /main> /div> /div> /div> !-- 登录页面 --> div idlogin classpage> div classcontainer> div classform-container> div classform-header> h2>登录账号/h2> p>欢迎回到智汇论坛/p> /div> form idlogin-form> div classform-group> label forlogin-username>用户名/label> input typetext idlogin-username classform-control placeholder请输入用户名 required> /div> div classform-group> label forlogin-password>密码/label> input typepassword idlogin-password classform-control placeholder请输入密码 required> /div> div classform-group> label foradmin-code>管理员激活码(可选)/label> input typepassword idadmin-code classform-control placeholder请输入管理员激活码> /div> div classform-group> button typesubmit classbtn btn-primary stylewidth: 100%;>登录/button> /div> div classform-footer> p>还没有账号? a href# onclickshowPage(register)>立即注册/a>/p> /div> /form> /div> /div> /div> !-- 注册页面 --> div idregister classpage> div classcontainer> div classform-container> div classform-header> h2>注册账号/h2> p>加入智汇论坛,开启知识分享之旅/p> /div> form idregister-form> div classform-group> label forregister-username>用户名/label> input typetext idregister-username classform-control placeholder请输入用户名 required> /div> div classform-group> label forregister-email>电子邮箱/label> input typeemail idregister-email classform-control placeholder请输入电子邮箱 required> /div> div classform-group> label forregister-password>密码/label> input typepassword idregister-password classform-control placeholder请输入密码 required> /div> div classform-group> label forregister-confirm-password>确认密码/label> input typepassword idregister-confirm-password classform-control placeholder请再次输入密码 required> /div> div classform-group> button typesubmit classbtn btn-primary stylewidth: 100%;>注册/button> /div> div classform-footer> p>已有账号? a href# onclickshowPage(login)>立即登录/a>/p> /div> /form> /div> /div> /div> !-- 发布新帖页面 --> div idnew-post classpage> div classcontainer> div classform-container> div classform-header> h2>发布新帖/h2> p>分享您的知识与见解/p> /div> form idnew-post-form> div classform-group> label forpost-title>标题/label> input typetext idpost-title classform-control placeholder请输入帖子标题 required> /div> div classform-group> label forpost-category>分类/label> select idpost-category classform-control required> option value>请选择分类/option> !-- 分类将通过JavaScript动态加载 --> /select> /div> div classform-group image-upload> label forpost-image>上传图片/label> input typefile idpost-image classform-control acceptimage/*> img idimage-preview classimage-preview src alt图片预览> /div> div classform-group video-upload> label forpost-video>上传视频/label> input typefile idpost-video classform-control acceptvideo/*> video idvideo-preview classvideo-preview controls>/video> /div> div classform-group> label forpost-content>内容/label> textarea idpost-content classform-control placeholder请输入帖子内容 required>/textarea> /div> div classform-group> button typesubmit classbtn btn-primary stylewidth: 100%;>发布帖子/button> button typebutton classbtn btn-outline home-btn stylecolor: var(--dark); border-color: var(--light-gray); margin-top: 10px; onclickshowPage(home)>i classfas fa-home>/i> 返回主页/button> /div> /form> /div> /div> /div> !-- 帖子详情页面 --> div idpost-detail classpage> div classcontainer> div classpost-detail idpost-detail-content> !-- 帖子详情将通过JavaScript动态加载 --> /div> div classcomments-section idcomments-section> !-- 评论区域将通过JavaScript动态加载 --> /div> /div> /div> !-- 个人面板页面 --> div idprofile classpage> div classcontainer> div classprofile-container> div classprofile-sidebar> div classprofile-header> div classprofile-avatar idprofile-avatar>用/div> div classprofile-info> h2 idprofile-username>用户名/h2> p idprofile-email>邮箱/p> div classprofile-stats> div classprofile-stat> div classprofile-stat-value idprofile-posts>0/div> div classprofile-stat-label>帖子/div> /div> div classprofile-stat> div classprofile-stat-value idprofile-followers>0/div> div classprofile-stat-label>粉丝/div> /div> div classprofile-stat> div classprofile-stat-value idprofile-following>0/div> div classprofile-stat-label>关注/div> /div> /div> /div> /div> div classprofile-actions> button classbtn btn-primary onclickshowPage(new-post)>i classfas fa-plus>/i> 发布新帖/button> button classbtn btn-outline home-btn stylecolor: var(--dark); border-color: var(--light-gray); onclickshowPage(home)>i classfas fa-home>/i> 返回主页/button> /div> !-- 管理员面板 --> div idadmin-panel-container>/div> !-- 头像上传 --> div idavatar-upload-container>/div> /div> div classprofile-main> h2>我的帖子/h2> div iduser-posts-list classuser-posts> !-- 用户帖子将通过JavaScript动态加载 --> /div> /div> /div> /div> /div> !-- 用户主页 --> div iduser-profile classpage> div classcontainer> div classprofile-container> div classprofile-sidebar> div classprofile-header> div classprofile-avatar iduser-profile-avatar>用/div> div classprofile-info> h2 iduser-profile-username>用户名/h2> div classprofile-stats> div classprofile-stat> div classprofile-stat-value iduser-profile-posts>0/div> div classprofile-stat-label>帖子/div> /div> div classprofile-stat> div classprofile-stat-value iduser-profile-followers>0/div> div classprofile-stat-label>粉丝/div> /div> div classprofile-stat> div classprofile-stat-value iduser-profile-following>0/div> div classprofile-stat-label>关注/div> /div> /div> /div> /div> div classprofile-actions iduser-profile-actions> !-- 关注按钮将通过JavaScript动态加载 --> /div> /div> div classprofile-main> h2>他的帖子/h2> div idother-user-posts classuser-posts> !-- 用户帖子将通过JavaScript动态加载 --> /div> /div> /div> /div> /div> !-- 底部 --> footer> div classcontainer> div classfooter-content> div classfooter-column> h4>关于我们/h4> ul classfooter-links> li>a href#>论坛简介/a>/li> li>a href#>管理团队/a>/li> li>a href#>加入我们/a>/li> li>a href#>联系方式/a>/li> /ul> /div> div classfooter-column> h4>帮助中心/h4> ul classfooter-links> li>a href#>使用指南/a>/li> li>a href#>常见问题/a>/li> li>a href#>社区规范/a>/li> li>a href#>反馈建议/a>/li> /ul> /div> div classfooter-column> h4>合作伙伴/h4> ul classfooter-links> li>a href#>技术社区/a>/li> li>a href#>开源项目/a>/li> li>a href#>培训机构/a>/li> li>a href#>招聘平台/a>/li> /ul> /div> div classfooter-column> h4>关注我们/h4> ul classfooter-links> li>a href#>i classfab fa-weibo>/i> 微博/a>/li> li>a href#>i classfab fa-weixin>/i> 微信公众号/a>/li> li>a href#>i classfab fa-zhihu>/i> 知乎/a>/li> li>a href#>i classfab fa-github>/i> GitHub/a>/li> /ul> /div> /div> div classcopyright> p>© 2023 智汇论坛 版权所有 | 致力于打造最好的技术交流社区/p> /div> /div> /footer> script> // 论坛数据存储 let forumData { users: , posts: , categories: { id: 1, name: 全部帖子, icon: fas fa-home }, { id: 2, name: 技术开发, icon: fas fa-code }, { id: 3, name: 设计创意, icon: fas fa-palette }, { id: 4, name: 商业职场, icon: fas fa-chart-line }, { id: 5, name: 游戏娱乐, icon: fas fa-gamepad }, { id: 6, name: 生活情感, icon: fas fa-heart }, { id: 7, name: 学习交流, icon: fas fa-graduation-cap } , comments: , likes: , follows: , currentUser: null, currentCategory: 1, currentSort: date, viewedUser: null }; // 新增全局变量 let userBalances JSON.parse(localStorage.getItem(userBalances)) || {}; let privateMessages JSON.parse(localStorage.getItem(privateMessages)) || {}; let userAvatars JSON.parse(localStorage.getItem(userAvatars)) || {}; let adminUsers JSON.parse(localStorage.getItem(adminUsers)) || ; let pinnedPosts JSON.parse(localStorage.getItem(pinnedPosts)) || ; let bannedUsers JSON.parse(localStorage.getItem(bannedUsers)) || ; let frozenBalances JSON.parse(localStorage.getItem(frozenBalances)) || {}; // 初始化论坛数据 function initForumData() { const savedData localStorage.getItem(forumData); if (savedData) { forumData JSON.parse(savedData); } else { // 初始化示例数据 forumData.users { id: 1, username: 张明, email: zhang@example.com, password: 123456, joinDate: new Date(2023-01-15).toISOString() }, { id: 2, username: 李思思, email: li@example.com, password: 123456, joinDate: new Date(2023-02-20).toISOString() }, { id: 3, username: 王老师, email: wang@example.com, password: 123456, joinDate: new Date(2023-03-10).toISOString() }, { id: 4, username: 赵经理, email: zhao@example.com, password: 123456, joinDate: new Date(2023-04-05).toISOString() } ; forumData.posts { id: 1, title: Vue 3.0 组合式API在实际项目中的应用经验分享, content: 最近在大型项目中全面采用了Vue 3.0的组合式API,相比Options API,代码组织更加清晰,逻辑复用更加方便。本文将分享在实际开发中的一些最佳实践和遇到的坑..., category: 2, author: 1, date: new Date(Date.now() - 2 * 60 * 60 * 1000).toISOString(), views: 342, comments: 3, likes: 15, image: null, video: null }, { id: 2, title: 2023年UI设计趋势解析:玻璃拟态与新拟态设计的应用, content: 随着技术的进步和用户审美的变化,UI设计风格也在不断演进。本文将详细解析2023年最受关注的两种设计风格:玻璃拟态和新拟态设计,包括它们的特征、应用场景和实现方法..., category: 3, author: 2, date: new Date(Date.now() - 5 * 60 * 60 * 1000).toISOString(), views: 521, comments: 5, likes: 36, image: null, video: null }, { id: 3, title: 高效学习编程的方法论:如何避免陷入教程地狱, content: 很多初学者在学习编程时会陷入不断看教程但实际编码能力提升缓慢的困境。本文分享一套经过验证的高效学习方法,帮助大家建立正确的学习路径,快速提升编程实战能力..., category: 7, author: 3, date: new Date(Date.now() - 24 * 60 * 60 * 1000).toISOString(), views: 689, comments: 8, likes: 48, image: null, video: null }, { id: 4, title: 远程工作模式下团队协作效率提升策略, content: 随着远程工作的普及,如何保持团队协作效率成为管理者面临的新挑战。本文基于多家科技公司的实践经验,总结出一套有效的远程团队管理方法和工具使用策略..., category: 4, author: 4, date: new Date(Date.now() - 2 * 24 * 60 * 60 * 1000).toISOString(), views: 427, comments: 4, likes: 22, image: null, video: null } ; forumData.comments { id: 1, postId: 1, author: 2, content: 写得真好,学到了很多!, date: new Date(Date.now() - 60 * 60 * 1000).toISOString() }, { id: 2, postId: 1, author: 3, content: 感谢分享,期待更多关于Vue 3.0的内容!, date: new Date(Date.now() - 30 * 60 * 1000).toISOString() }, { id: 3, postId: 1, author: 4, content: 我们团队也在用Vue 3.0,确实比2.x好用很多。, date: new Date(Date.now() - 15 * 60 * 1000).toISOString() }, { id: 4, postId: 2, author: 1, content: 玻璃拟态设计确实很漂亮,但实现起来有点复杂。, date: new Date(Date.now() - 45 * 60 * 1000).toISOString() }, { id: 5, postId: 2, author: 3, content: 新拟态设计在移动端应用效果很好!, date: new Date(Date.now() - 20 * 60 * 1000).toISOString() } ; forumData.likes { userId: 2, postId: 1 }, { userId: 3, postId: 1 }, { userId: 4, postId: 1 }, { userId: 1, postId: 2 }, { userId: 3, postId: 2 }, { userId: 4, postId: 2 } ; forumData.follows { follower: 2, following: 1 }, { follower: 3, following: 1 }, { follower: 4, following: 1 }, { follower: 1, following: 2 } ; saveForumData(); } // 检查是否有已登录的用户 const savedUser localStorage.getItem(currentUser); if (savedUser) { forumData.currentUser JSON.parse(savedUser); updateUserInterface(); } // 加载分类 loadCategories(); // 加载帖子列表 loadPosts(); // 加载热门话题 loadTrendingTopics(); // 更新统计信息 updateStats(); // 初始化余额系统 initBalanceSystem(); // 初始化新功能 initNewFeatures(); } // 保存论坛数据到localStorage function saveForumData() { localStorage.setItem(forumData, JSON.stringify(forumData)); } // 页面切换函数 function showPage(pageId) { // 隐藏所有页面 document.querySelectorAll(.page).forEach(page > { page.classList.remove(active); }); // 显示目标页面 document.getElementById(pageId).classList.add(active); // 特殊处理 if (pageId home) { loadPosts(); updateStats(); } else if (pageId profile && forumData.currentUser) { loadUserProfile(forumData.currentUser.id); } else if (pageId new-post) { loadCategoryOptions(); } // 初始化新功能 setTimeout(initNewFeatures, 100); } // 加载分类 function loadCategories() { const categoriesList document.getElementById(categories-list); categoriesList.innerHTML ; forumData.categories.forEach(category > { const categoryElement document.createElement(li); const isActive category.id forumData.currentCategory ? active : ; categoryElement.innerHTML ` a href# class${isActive} onclickselectCategory(${category.id})> i class${category.icon}>/i> ${category.name} /a> `; categoriesList.appendChild(categoryElement); }); // 如果是管理员,添加自定义分类按钮 if (forumData.currentUser && adminUsers.includes(forumData.currentUser.id)) { const addCategoryBtn document.createElement(li); addCategoryBtn.innerHTML ` a href# onclickaddCustomCategory()> i classfas fa-plus>/i> 添加分类 /a> `; categoriesList.appendChild(addCategoryBtn); } } // 选择分类 function selectCategory(categoryId) { forumData.currentCategory categoryId; loadCategories(); loadPosts(); } // 加载帖子列表 function loadPosts() { const postsList document.getElementById(posts-list); const postsTitle document.getElementById(posts-title); postsList.innerHTML ; // 获取当前分类名称 const currentCategory forumData.categories.find(c > c.id forumData.currentCategory); postsTitle.textContent currentCategory ? currentCategory.name : 最新帖子; // 筛选帖子 let filteredPosts forumData.posts; if (forumData.currentCategory ! 1) { // 1是全部帖子 filteredPosts forumData.posts.filter(post > post.category forumData.currentCategory); } // 排序帖子 const sortedPosts ...filteredPosts.sort((a, b) > { if (forumData.currentSort date) { return new Date(b.date) - new Date(a.date); } else if (forumData.currentSort views) { return b.views - a.views; } else if (forumData.currentSort likes) { return b.likes - a.likes; } else if (forumData.currentSort comments) { return b.comments - a.comments; } return 0; }); sortedPosts.forEach(post > { const postDate new Date(post.date); const timeAgo getTimeAgo(postDate); const author forumData.users.find(u > u.id post.author); const category forumData.categories.find(c > c.id post.category); const isLiked forumData.currentUser && forumData.likes.some(like > like.userId forumData.currentUser.id && like.postId post.id); const postElement document.createElement(div); postElement.className post-card; postElement.onclick () > showPostDetail(post.id); postElement.dataset.postId post.id; postElement.innerHTML ` div classpost-header> span classpost-category>${category ? category.name : 未知分类}/span> span classpost-time>${timeAgo}/span> /div> h3 classpost-title>${post.title}/h3> p classpost-excerpt>${post.content.substring(0, 150)}.../p> ${post.image ? `img src${post.image} alt帖子图片 stylemax-width: 100%; border-radius: 8px; margin-bottom: 15px;>` : } ${post.video ? `video src${post.video} controls stylemax-width: 100%; border-radius: 8px; margin-bottom: 15px;>/video>` : } div classpost-footer> div classpost-author onclickevent.stopPropagation(); showUserProfile(${post.author})> div classavatar>${author ? author.username.charAt(0) : ?}/div> span>${author ? author.username : 未知用户}/span> /div> div classpost-stats> div classpost-stat>i classfar fa-eye>/i> ${post.views}/div> div classpost-stat>i classfar fa-comment>/i> ${post.comments}/div> div classpost-stat ${isLiked ? liked : } onclickevent.stopPropagation(); toggleLike(${post.id})> i class${isLiked ? fas : far} fa-heart>/i> ${post.likes} /div> /div> /div> `; // 添加打赏信息 addRewardInfoToPost(postElement, post.id); postsList.appendChild(postElement); }); } // 显示帖子详情 function showPostDetail(postId) { const post forumData.posts.find(p > p.id postId); if (!post) return; const postDetailContent document.getElementById(post-detail-content); const commentsSection document.getElementById(comments-section); const postDate new Date(post.date); const formattedDate postDate.toLocaleString(zh-CN); const author forumData.users.find(u > u.id post.author); const category forumData.categories.find(c > c.id post.category); const isLiked forumData.currentUser && forumData.likes.some(like > like.userId forumData.currentUser.id && like.postId post.id); // 增加浏览量 post.views++; saveForumData(); postDetailContent.innerHTML ` div classpost-detail-header> div> span classpost-category>${category ? category.name : 未知分类}/span> h1 classpost-detail-title>${post.title}/h1> div classpost-author onclickshowUserProfile(${post.author})> div classavatar>${author ? author.username.charAt(0) : ?}/div> span>${author ? author.username : 未知用户}/span> span classpost-time>发布于 ${formattedDate}/span> /div> /div> div classpost-stats> div classpost-stat>i classfar fa-eye>/i> ${post.views}/div> div classpost-stat>i classfar fa-comment>/i> ${post.comments}/div> div classpost-stat ${isLiked ? liked : } onclicktoggleLike(${post.id})> i class${isLiked ? fas : far} fa-heart>/i> ${post.likes} /div> /div> /div> div classpost-detail-content> ${post.image ? `img src${post.image} alt帖子图片 stylemax-width: 100%; border-radius: 8px; margin-bottom: 20px;>` : } ${post.video ? `video src${post.video} controls stylemax-width: 100%; border-radius: 8px; margin-bottom: 20px;>/video>` : } p>${post.content}/p> /div> div classpost-actions> button classbtn ${isLiked ? btn-danger : btn-primary} onclicktoggleLike(${post.id})> i class${isLiked ? fas : far} fa-heart>/i> ${isLiked ? 取消点赞 : 点赞} /button> button classbtn btn-success onclickaddRewardSystem(${post.id})> i classfas fa-gift>/i> 打赏 /button> button classbtn btn-outline home-btn stylecolor: var(--dark); border-color: var(--light-gray); onclickshowPage(home)> i classfas fa-arrow-left>/i> 返回主页 /button> /div> `; // 加载评论 loadComments(postId); showPage(post-detail); } // 加载评论 function loadComments(postId) { const commentsSection document.getElementById(comments-section); const postComments forumData.comments.filter(comment > comment.postId postId); let commentsHTML ` div classcomment-form> h3>发表评论/h3> form idcomment-form> div classform-group> textarea idcomment-content classform-control placeholder请输入评论内容 ${!forumData.currentUser ? disabled : }>/textarea> /div> div classform-group> button typesubmit classbtn btn-primary ${!forumData.currentUser ? disabled : }>发表评论/button> /div> /form> /div> div classcomment-list> h3>评论 (${postComments.length})/h3> `; if (postComments.length 0) { commentsHTML + `p styletext-align: center; color: var(--gray); padding: 20px;>暂无评论/p>`; } else { postComments.forEach(comment > { const commentAuthor forumData.users.find(u > u.id comment.author); const commentDate new Date(comment.date); const timeAgo getTimeAgo(commentDate); commentsHTML + ` div classcomment> div classcomment-header> div classcomment-author onclickshowUserProfile(${comment.author})> div classavatar>${commentAuthor ? commentAuthor.username.charAt(0) : ?}/div> span>${commentAuthor ? commentAuthor.username : 未知用户}/span> /div> span classcomment-time>${timeAgo}/span> ${forumData.currentUser && adminUsers.includes(forumData.currentUser.id) ? `button classbtn btn-danger btn-sm onclickdeleteComment(${comment.id})>删除/button>` : } /div> div classcomment-content> p>${comment.content}/p> /div> /div> `; }); } commentsHTML + `/div>`; commentsSection.innerHTML commentsHTML; // 添加评论表单提交事件 document.getElementById(comment-form).addEventListener(submit, function(e) { e.preventDefault(); addComment(postId); }); } // 添加评论 function addComment(postId) { if (!forumData.currentUser) { alert(请先登录!); showPage(login); return; } const content document.getElementById(comment-content).value.trim(); if (!content) { alert(评论内容不能为空!); return; } const newComment { id: forumData.comments.length > 0 ? Math.max(...forumData.comments.map(c > c.id)) + 1 : 1, postId: postId, author: forumData.currentUser.id, content: content, date: new Date().toISOString() }; forumData.comments.push(newComment); // 更新帖子评论数 const post forumData.posts.find(p > p.id postId); if (post) { post.comments++; } saveForumData(); loadComments(postId); document.getElementById(comment-content).value ; } // 删除评论(管理员功能) function deleteComment(commentId) { if (!forumData.currentUser || !adminUsers.includes(forumData.currentUser.id)) { alert(没有权限!); return; } const comment forumData.comments.find(c > c.id commentId); if (!comment) return; forumData.comments forumData.comments.filter(c > c.id ! commentId); // 更新帖子评论数 const post forumData.posts.find(p > p.id comment.postId); if (post && post.comments > 0) { post.comments--; } saveForumData(); loadComments(comment.postId); } // 点赞/取消点赞 function toggleLike(postId) { if (!forumData.currentUser) { alert(请先登录!); showPage(login); return; } const post forumData.posts.find(p > p.id postId); if (!post) return; const existingLike forumData.likes.find(like > like.userId forumData.currentUser.id && like.postId postId); if (existingLike) { // 取消点赞 forumData.likes forumData.likes.filter(like > !(like.userId forumData.currentUser.id && like.postId postId)); post.likes--; } else { // 点赞 forumData.likes.push({ userId: forumData.currentUser.id, postId: postId }); post.likes++; } saveForumData(); // 刷新当前页面 if (document.getElementById(post-detail).classList.contains(active)) { showPostDetail(postId); } else { loadPosts(); } } // 加载热门话题 function loadTrendingTopics() { const trendingTopics document.getElementById(trending-topics); trendingTopics.innerHTML ; // 获取热门话题(按浏览量排序) const sortedPosts ...forumData.posts.sort((a, b) > b.views - a.views).slice(0, 4); const topics { icon: fas fa-robot, name: 人工智能, count: 256 }, { icon: fas fa-mobile-alt, name: 移动开发, count: 189 }, { icon: fas fa-cloud, name: 云计算, count: 142 }, { icon: fas fa-lock, name: 网络安全, count: 118 } ; topics.forEach(topic > { const topicElement document.createElement(div); topicElement.className topic-card; topicElement.onclick () > { // 在实际应用中,这里应该跳转到对应分类的帖子列表 alert(`跳转到${topic.name}分类`); }; topicElement.innerHTML ` div classtopic-icon> i class${topic.icon}>/i> /div> h4>${topic.name}/h4> p>${topic.count} 讨论/p> `; trendingTopics.appendChild(topicElement); }); } // 加载分类选项 function loadCategoryOptions() { const categorySelect document.getElementById(post-category); categorySelect.innerHTML option value>请选择分类/option>; forumData.categories.forEach(category > { if (category.id ! 1) { // 排除全部帖子 categorySelect.innerHTML + `option value${category.id}>${category.name}/option>`; } }); } // 注册表单提交 document.getElementById(register-form).addEventListener(submit, function(e) { e.preventDefault(); const username document.getElementById(register-username).value; const email document.getElementById(register-email).value; const password document.getElementById(register-password).value; const confirmPassword document.getElementById(register-confirm-password).value; // 验证密码是否匹配 if (password ! confirmPassword) { alert(两次输入的密码不一致!); return; } // 检查用户名是否已存在 if (forumData.users.find(user > user.username username)) { alert(用户名已存在!); return; } // 检查邮箱是否已存在 if (forumData.users.find(user > user.email email)) { alert(邮箱已被注册!); return; } // 创建新用户 const newUser { id: forumData.users.length > 0 ? Math.max(...forumData.users.map(u > u.id)) + 1 : 1, username, email, password, joinDate: new Date().toISOString() }; forumData.users.push(newUser); saveForumData(); alert(注册成功!请登录。); showPage(login); }); // 登录表单提交 document.getElementById(login-form).addEventListener(submit, function(e) { e.preventDefault(); const username document.getElementById(login-username).value; const password document.getElementById(login-password).value; const adminCode document.getElementById(admin-code).value; // 查找用户 const user forumData.users.find(u > u.username username && u.password password); if (user) { // 登录成功 forumData.currentUser user; localStorage.setItem(currentUser, JSON.stringify(user)); // 检查是否输入了管理员激活码 if (adminCode 20090917) { if (!adminUsers.includes(user.id)) { adminUsers.push(user.id); localStorage.setItem(adminUsers, JSON.stringify(adminUsers)); alert(管理员权限激活成功!); } } updateUserInterface(); showPage(home); alert(`欢迎回来,${user.username}!`); } else { alert(用户名或密码错误!); } }); // 发布新帖表单提交 document.getElementById(new-post-form).addEventListener(submit, function(e) { e.preventDefault(); if (!forumData.currentUser) { alert(请先登录!); showPage(login); return; } const title document.getElementById(post-title).value; const category parseInt(document.getElementById(post-category).value); const content document.getElementById(post-content).value; const image document.getElementById(image-preview).src || null; const video document.getElementById(video-preview).src || null; if (!category) { alert(请选择分类!); return; } // 创建新帖子 const newPost { id: forumData.posts.length > 0 ? Math.max(...forumData.posts.map(p > p.id)) + 1 : 1, title, content, category, author: forumData.currentUser.id, date: new Date().toISOString(), views: 0, comments: 0, likes: 0, image, video, pinned: false }; forumData.posts.push(newPost); saveForumData(); alert(帖子发布成功!); document.getElementById(new-post-form).reset(); document.getElementById(image-preview).style.display none; document.getElementById(video-preview).style.display none; showPage(home); }); // 图片上传预览 document.getElementById(post-image).addEventListener(change, function(e) { const file e.target.files0; if (file) { const reader new FileReader(); reader.onload function(e) { const preview document.getElementById(image-preview); preview.src e.target.result; preview.style.display block; }; reader.readAsDataURL(file); } }); // 视频上传预览 document.getElementById(post-video).addEventListener(change, function(e) { const file e.target.files0; if (file) { // 检查文件类型 if (!file.type.startsWith(video/)) { alert(请上传视频文件!); return; } const reader new FileReader(); reader.onload function(e) { const preview document.getElementById(video-preview); preview.src e.target.result; preview.style.display block; }; reader.readAsDataURL(file); } }); // 更新用户界面 function updateUserInterface() { const userInfo document.getElementById(user-info); const guestActions document.getElementById(guest-actions); const newPostBtn document.getElementById(new-post-btn); if (forumData.currentUser) { userInfo.classList.remove(hidden); guestActions.classList.add(hidden); document.getElementById(username-display).textContent forumData.currentUser.username; document.getElementById(user-avatar).textContent forumData.currentUser.username.charAt(0); newPostBtn.classList.remove(hidden); // 更新余额显示 updateBalanceDisplay(); } else { userInfo.classList.add(hidden); guestActions.classList.remove(hidden); newPostBtn.classList.add(hidden); } } // 加载用户个人资料 function loadUserProfile(userId) { const user forumData.users.find(u > u.id userId); if (!user) return; // 更新个人资料 document.getElementById(profile-avatar).textContent user.username.charAt(0); document.getElementById(profile-username).textContent user.username; document.getElementById(profile-email).textContent user.email; // 计算用户数据 const userPosts forumData.posts.filter(p > p.author userId); const userFollowers forumData.follows.filter(f > f.following userId).length; const userFollowing forumData.follows.filter(f > f.follower userId).length; document.getElementById(profile-posts).textContent userPosts.length; document.getElementById(profile-followers).textContent userFollowers; document.getElementById(profile-following).textContent userFollowing; // 加载用户帖子 const userPostsList document.getElementById(user-posts-list); userPostsList.innerHTML ; if (userPosts.length 0) { userPostsList.innerHTML p styletext-align: center; color: var(--gray); padding: 20px;>暂无帖子/p>; } else { userPosts.forEach(post > { const postDate new Date(post.date); const timeAgo getTimeAgo(postDate); const category forumData.categories.find(c > c.id post.category); const postElement document.createElement(div); postElement.className post-card; postElement.onclick () > showPostDetail(post.id); postElement.innerHTML ` div classpost-header> span classpost-category>${category ? category.name : 未知分类}/span> span classpost-time>${timeAgo}/span> /div> h3 classpost-title>${post.title}/h3> p classpost-excerpt>${post.content.substring(0, 150)}.../p> div classpost-footer> div classpost-stats> div classpost-stat>i classfar fa-eye>/i> ${post.views}/div> div classpost-stat>i classfar fa-comment>/i> ${post.comments}/div> div classpost-stat>i classfar fa-heart>/i> ${post.likes}/div> /div> /div> `; userPostsList.appendChild(postElement); }); } // 添加管理员面板和头像上传 initNewFeatures(); } // 显示用户主页 function showUserProfile(userId) { const user forumData.users.find(u > u.id userId); if (!user) return; forumData.viewedUser user; // 更新用户主页 document.getElementById(user-profile-avatar).textContent user.username.charAt(0); document.getElementById(user-profile-username).textContent user.username; // 计算用户数据 const userPosts forumData.posts.filter(p > p.author userId); const userFollowers forumData.follows.filter(f > f.following userId).length; const userFollowing forumData.follows.filter(f > f.follower userId).length; document.getElementById(user-profile-posts).textContent userPosts.length; document.getElementById(user-profile-followers).textContent userFollowers; document.getElementById(user-profile-following).textContent userFollowing; // 更新关注按钮 const isFollowing forumData.currentUser && forumData.follows.some(f > f.follower forumData.currentUser.id && f.following userId); const profileActions document.getElementById(user-profile-actions); profileActions.innerHTML ; if (forumData.currentUser && forumData.currentUser.id ! userId) { profileActions.innerHTML ` button classbtn ${isFollowing ? btn-danger : btn-success} onclicktoggleFollow(${userId})> i classfas fa-${isFollowing ? user-minus : user-plus}>/i> ${isFollowing ? 取消关注 : 关注} /button> button classbtn btn-primary onclicksendPrivateMessageToUser(${userId})> i classfas fa-envelope>/i> 私信 /button> `; } profileActions.innerHTML + ` button classbtn btn-outline home-btn stylecolor: var(--dark); border-color: var(--light-gray); onclickshowPage(home)> i classfas fa-arrow-left>/i> 返回主页 /button> `; // 加载用户帖子 const otherUserPosts document.getElementById(other-user-posts); otherUserPosts.innerHTML ; if (userPosts.length 0) { otherUserPosts.innerHTML p styletext-align: center; color: var(--gray); padding: 20px;>暂无帖子/p>; } else { userPosts.forEach(post > { const postDate new Date(post.date); const timeAgo getTimeAgo(postDate); const category forumData.categories.find(c > c.id post.category); const postElement document.createElement(div); postElement.className post-card; postElement.onclick () > showPostDetail(post.id); postElement.innerHTML ` div classpost-header> span classpost-category>${category ? category.name : 未知分类}/span> span classpost-time>${timeAgo}/span> /div> h3 classpost-title>${post.title}/h3> p classpost-excerpt>${post.content.substring(0, 150)}.../p> div classpost-footer> div classpost-stats> div classpost-stat>i classfar fa-eye>/i> ${post.views}/div> div classpost-stat>i classfar fa-comment>/i> ${post.comments}/div> div classpost-stat>i classfar fa-heart>/i> ${post.likes}/div> /div> /div> `; otherUserPosts.appendChild(postElement); }); } showPage(user-profile); } // 关注/取消关注 function toggleFollow(userId) { if (!forumData.currentUser) { alert(请先登录!); showPage(login); return; } if (forumData.currentUser.id userId) { alert(不能关注自己!); return; } const existingFollow forumData.follows.find(f > f.follower forumData.currentUser.id && f.following userId); if (existingFollow) { // 取消关注 forumData.follows forumData.follows.filter(f > !(f.follower forumData.currentUser.id && f.following userId)); } else { // 关注 forumData.follows.push({ follower: forumData.currentUser.id, following: userId }); } saveForumData(); showUserProfile(userId); } // 退出登录 function logout() { forumData.currentUser null; localStorage.removeItem(currentUser); updateUserInterface(); showPage(home); alert(已退出登录!); } // 更新统计信息 function updateStats() { // 今日帖子数 const today new Date(); today.setHours(0, 0, 0, 0); const todayPosts forumData.posts.filter(post > new Date(post.date) > today).length; document.getElementById(today-posts).textContent todayPosts; // 会员总数 document.getElementById(total-users).textContent forumData.users.length; // 在线用户数(简化处理:随机生成) const onlineUsers Math.floor(Math.random() * 50) + 200; document.getElementById(online-users).textContent onlineUsers; } // 搜索功能 function performSearch() { const searchTerm document.getElementById(search-input).value.trim(); if (!searchTerm) { alert(请输入搜索关键词!); return; } // 在实际应用中,这里应该执行搜索逻辑 // 这里简化处理,只显示提示 alert(`搜索: ${searchTerm}`); } // 获取相对时间 function getTimeAgo(date) { const now new Date(); const diffMs now - date; const diffMins Math.floor(diffMs / (1000 * 60)); const diffHours Math.floor(diffMs / (1000 * 60 * 60)); const diffDays Math.floor(diffMs / (1000 * 60 * 60 * 24)); if (diffMins 1) { return 刚刚; } else if (diffMins 60) { return `${diffMins}分钟前`; } else if (diffHours 24) { return `${diffHours}小时前`; } else if (diffDays 7) { return `${diffDays}天前`; } else { return date.toLocaleDateString(zh-CN); } } // 新增功能代码 // 自定义分类功能(仅管理员) function addCustomCategory() { if (!forumData.currentUser || !adminUsers.includes(forumData.currentUser.id)) { alert(只有管理员可以添加分类!); return; } const categoryName prompt(请输入新分类名称:); if (!categoryName) return; // 检查分类是否已存在 if (forumData.categories.some(cat > cat.name categoryName)) { alert(分类已存在!); return; } const newCategory { id: Math.max(...forumData.categories.map(c > c.id)) + 1, name: categoryName, icon: fas fa-folder, custom: true, creator: forumData.currentUser.id }; forumData.categories.push(newCategory); saveForumData(); loadCategories(); alert(分类添加成功!); } // 余额系统初始化 function initBalanceSystem() { // 确保所有用户都有余额,初始为0 forumData.users.forEach(user > { if (userBalancesuser.id undefined) { userBalancesuser.id 0; // 初始余额为0 } }); localStorage.setItem(userBalances, JSON.stringify(userBalances)); } // 获取用户余额 function getUserBalance(userId) { return userBalancesuserId || 0; } // 更新用户余额显示 function updateBalanceDisplay() { if (forumData.currentUser) { const balance getUserBalance(forumData.currentUser.id); let balanceDisplay document.getElementById(balance-display); if (!balanceDisplay) { balanceDisplay document.createElement(div); balanceDisplay.id balance-display; balanceDisplay.className balance-display; balanceDisplay.innerHTML `余额: span classbalance-amount>${balance}/span> 币`; document.querySelector(.user-info).appendChild(balanceDisplay); } else { balanceDisplay.innerHTML `余额: span classbalance-amount>${balance}/span> 币`; } } } // 打赏系统 function addRewardSystem(postId) { if (!forumData.currentUser) { alert(请先登录!); return; } const amount parseInt(prompt(请输入打赏金额:)); if (!amount || amount 0) { alert(请输入有效的金额!); return; } const currentBalance getUserBalance(forumData.currentUser.id); if (currentBalance amount) { alert(余额不足!); return; } const post forumData.posts.find(p > p.id postId); if (!post) return; // 扣除打赏者余额 userBalancesforumData.currentUser.id - amount; // 增加作者余额 userBalancespost.author (userBalancespost.author || 0) + amount; localStorage.setItem(userBalances, JSON.stringify(userBalances)); // 记录打赏记录 const rewardRecord { from: forumData.currentUser.id, to: post.author, amount: amount, postId: postId, date: new Date().toISOString() }; let rewardRecords JSON.parse(localStorage.getItem(rewardRecords)) || ; rewardRecords.push(rewardRecord); localStorage.setItem(rewardRecords, JSON.stringify(rewardRecords)); alert(`成功打赏 ${amount} 币给作者!`); updateBalanceDisplay(); // 刷新页面显示打赏信息 if (document.getElementById(post-detail).classList.contains(active)) { showPostDetail(postId); } } // 在帖子卡片添加打赏信息 function addRewardInfoToPost(postElement, postId) { const rewardRecords JSON.parse(localStorage.getItem(rewardRecords)) || ; const postRewards rewardRecords.filter(r > r.postId postId); const totalReward postRewards.reduce((sum, r) > sum + r.amount, 0); if (totalReward > 0) { const rewardInfo document.createElement(div); rewardInfo.className post-reward; rewardInfo.innerHTML `i classfas fa-coins>/i> 收到打赏: ${totalReward} 币`; postElement.querySelector(.post-footer).appendChild(rewardInfo); } } // 管理员面板 function addAdminPanel() { if (!forumData.currentUser || !adminUsers.includes(forumData.currentUser.id)) { return; } const adminPanel document.createElement(div); adminPanel.className admin-panel; adminPanel.innerHTML ` h3>管理员面板/h3> div classadmin-actions> button classbtn btn-danger btn-sm onclickshowAdminModal()>管理员功能/button> /div> `; document.getElementById(admin-panel-container).innerHTML ; document.getElementById(admin-panel-container).appendChild(adminPanel); } // 管理员功能模态框 function showAdminModal() { const modal document.createElement(div); modal.className modal; modal.innerHTML ` div classmodal-content> span classclose onclickthis.parentElement.parentElement.remove()>×/span> h3>管理员功能/h3> div classadmin-functions> div classform-group> label>用户ID:/label> input typenumber idadmin-user-id classform-control> /div> div classform-group> label>操作金额:/label> input typenumber idadmin-amount classform-control> /div> div classform-group> label>帖子ID:/label> input typenumber idadmin-post-id classform-control> /div> div classadmin-buttons> button classbtn btn-success onclickadminAddBalance()>增加余额/button> button classbtn btn-warning onclickadminReduceBalance()>减少余额/button> button classbtn btn-danger onclickadminClearBalance()>清空余额/button> button classbtn btn-danger onclickadminDeletePost()>删除帖子/button> button classbtn btn-info onclickadminPinPost()>置顶帖子/button> button classbtn btn-danger onclickadminBanUser()>封禁账户/button> button classbtn btn-warning onclickadminFreezeBalance()>冻结余额/button> /div> /div> /div> `; document.body.appendChild(modal); } // 管理员功能实现 function adminAddBalance() { const userId parseInt(document.getElementById(admin-user-id).value); const amount parseInt(document.getElementById(admin-amount).value); if (!userId || !amount) { alert(请输入有效的用户ID和金额!); return; } userBalancesuserId (userBalancesuserId || 0) + amount; localStorage.setItem(userBalances, JSON.stringify(userBalances)); alert(`成功为用户 ${userId} 增加 ${amount} 币余额`); } function adminReduceBalance() { const userId parseInt(document.getElementById(admin-user-id).value); const amount parseInt(document.getElementById(admin-amount).value); if (!userId || !amount) { alert(请输入有效的用户ID和金额!); return; } if ((userBalancesuserId || 0) amount) { alert(用户余额不足!); return; } userBalancesuserId - amount; localStorage.setItem(userBalances, JSON.stringify(userBalances)); alert(`成功为用户 ${userId} 减少 ${amount} 币余额`); } function adminClearBalance() { const userId parseInt(document.getElementById(admin-user-id).value); if (!userId) { alert(请输入有效的用户ID!); return; } userBalancesuserId 0; localStorage.setItem(userBalances, JSON.stringify(userBalances)); alert(`成功清空用户 ${userId} 的余额`); } function adminDeletePost() { const postId parseInt(document.getElementById(admin-post-id).value); if (!postId) { alert(请输入有效的帖子ID!); return; } forumData.posts forumData.posts.filter(p > p.id ! postId); saveForumData(); alert(`成功删除帖子 ${postId}`); loadPosts(); } function adminPinPost() { const postId parseInt(document.getElementById(admin-post-id).value); if (!postId) { alert(请输入有效的帖子ID!); return; } const post forumData.posts.find(p > p.id postId); if (post) { post.pinned !post.pinned; saveForumData(); alert(`成功${post.pinned ? 置顶 : 取消置顶}帖子 ${postId}`); loadPosts(); } } function adminBanUser() { const userId parseInt(document.getElementById(admin-user-id).value); if (!userId) { alert(请输入有效的用户ID!); return; } if (bannedUsers.includes(userId)) { bannedUsers bannedUsers.filter(id > id ! userId); alert(`成功解封用户 ${userId}`); } else { bannedUsers.push(userId); alert(`成功封禁用户 ${userId}`); } localStorage.setItem(bannedUsers, JSON.stringify(bannedUsers)); } function adminFreezeBalance() { const userId parseInt(document.getElementById(admin-user-id).value); if (!userId) { alert(请输入有效的用户ID!); return; } if (frozenBalancesuserId) { delete frozenBalancesuserId; alert(`成功解冻用户 ${userId} 的余额`); } else { frozenBalancesuserId true; alert(`成功冻结用户 ${userId} 的余额`); } localStorage.setItem(frozenBalances, JSON.stringify(frozenBalances)); } // 私信系统 function sendPrivateMessageToUser(userId) { if (!forumData.currentUser) { alert(请先登录!); return; } // 检查是否互相关注 const isMutualFollow forumData.follows.some(f > f.follower forumData.currentUser.id && f.following userId) && forumData.follows.some(f > f.follower userId && f.following forumData.currentUser.id); if (!isMutualFollow) { alert(需要互相关注才能发送私信!); return; } showPrivateMessages(userId); } function showPrivateMessages(preSelectUserId null) { if (!forumData.currentUser) { alert(请先登录!); return; } const modal document.createElement(div); modal.className modal; modal.innerHTML ` div classmodal-content stylemax-width: 800px;> span classclose onclickthis.parentElement.parentElement.remove()>×/span> h3>私信/h3> div classmessage-container> div classmessage-sidebar> h4>联系人/h4> div idmessage-contacts>/div> /div> div classmessage-main> div idmessage-chat classmessage-chat>/div> div classmessage-input> textarea idmessage-text placeholder输入消息...>/textarea> input typefile idmessage-image acceptimage/*> button classbtn btn-primary onclicksendPrivateMessage()>发送/button> /div> /div> /div> /div> `; document.body.appendChild(modal); loadMessageContacts(); if (preSelectUserId) { setTimeout(() > loadChatHistory(preSelectUserId), 100); } } function loadMessageContacts() { const contactsContainer document.getElementById(message-contacts); const currentUserId forumData.currentUser.id; // 获取互相关注的用户 const mutualFollows forumData.follows.filter(f > f.follower currentUserId && forumData.follows.some(f2 > f2.follower f.following && f2.following currentUserId) ); contactsContainer.innerHTML ; mutualFollows.forEach(follow > { const user forumData.users.find(u > u.id follow.following); if (user) { const contact document.createElement(div); contact.className message-contact; contact.innerHTML ` div classavatar>${user.username.charAt(0)}/div> span>${user.username}/span> `; contact.onclick () > loadChatHistory(user.id); contactsContainer.appendChild(contact); } }); } function loadChatHistory(userId) { const chatContainer document.getElementById(message-chat); const currentUserId forumData.currentUser.id; const chatKey currentUserId, userId.sort().join(_); const messages privateMessageschatKey || ; chatContainer.innerHTML ; messages.forEach(msg > { const messageDiv document.createElement(div); messageDiv.className `message ${msg.sender currentUserId ? sent : received}`; messageDiv.innerHTML ` div classmessage-content> ${msg.image ? `img src${msg.image} classmessage-image>` : } p>${msg.text}/p> ${msg.amount ? `div classmessage-transfer>转账: ${msg.amount} 币/div>` : } /div> `; chatContainer.appendChild(messageDiv); }); // 保存当前聊天对象 chatContainer.dataset.currentChat userId; // 滚动到底部 chatContainer.scrollTop chatContainer.scrollHeight; } function sendPrivateMessage() { const text document.getElementById(message-text).value; const imageInput document.getElementById(message-image); const currentChat document.getElementById(message-chat).dataset.currentChat; if (!text.trim() && !imageInput.files0) { alert(请输入消息或选择图片!); return; } const currentUserId forumData.currentUser.id; const chatKey currentUserId, currentChat.sort().join(_); if (!privateMessageschatKey) { privateMessageschatKey ; } const message { sender: currentUserId, text: text, timestamp: new Date().toISOString() }; // 处理图片 if (imageInput.files0) { const reader new FileReader(); reader.onload function(e) { message.image e.target.result; privateMessageschatKey.push(message); localStorage.setItem(privateMessages, JSON.stringify(privateMessages)); loadChatHistory(currentChat); document.getElementById(message-text).value ; imageInput.value ; }; reader.readAsDataURL(imageInput.files0); } else { privateMessageschatKey.push(message); localStorage.setItem(privateMessages, JSON.stringify(privateMessages)); loadChatHistory(currentChat); document.getElementById(message-text).value ; } } // 头像上传功能 function addAvatarUpload() { const avatarUpload document.createElement(div); avatarUpload.className avatar-upload; avatarUpload.innerHTML ` h3>头像设置/h3> div classcurrent-avatar> img idcurrent-avatar-img src${userAvatarsforumData.currentUser.id || } alt当前头像 stylewidth: 100px; height: 100px; border-radius: 50%; object-fit: cover; margin-bottom: 10px;> /div> input typefile idavatar-file acceptimage/*> button classbtn btn-primary onclickuploadAvatar() stylemargin-top: 10px;>上传头像/button> `; document.getElementById(avatar-upload-container).innerHTML ; document.getElementById(avatar-upload-container).appendChild(avatarUpload); } function uploadAvatar() { const fileInput document.getElementById(avatar-file); if (!fileInput.files0) { alert(请选择头像图片!); return; } const reader new FileReader(); reader.onload function(e) { userAvatarsforumData.currentUser.id e.target.result; localStorage.setItem(userAvatars, JSON.stringify(userAvatars)); document.getElementById(current-avatar-img).src e.target.result; // 更新页面上的所有头像 document.querySelectorAll(.avatar, .profile-avatar).forEach(avatar > { if (!avatar.querySelector(img)) { const img document.createElement(img); img.src e.target.result; img.style.width 100%; img.style.height 100%; img.style.borderRadius 50%; img.style.objectFit cover; avatar.innerHTML ; avatar.appendChild(img); } else { avatar.querySelector(img).src e.target.result; } }); alert(头像上传成功!); }; reader.readAsDataURL(fileInput.files0); } // 初始化所有新功能 function initNewFeatures() { // 更新余额显示 updateBalanceDisplay(); // 添加管理员面板 addAdminPanel(); // 添加头像上传功能(在个人页面) if (document.getElementById(profile) && document.getElementById(profile).classList.contains(active)) { addAvatarUpload(); } // 添加私信按钮到用户操作区 addPrivateMessageButton(); } // 添加私信按钮到用户操作区 function addPrivateMessageButton() { if (!forumData.currentUser) return; let messageBtn document.getElementById(private-message-btn); if (!messageBtn) { messageBtn document.createElement(button); messageBtn.id private-message-btn; messageBtn.className btn btn-primary btn-sm; messageBtn.innerHTML i classfas fa-envelope>/i> 私信; messageBtn.onclick showPrivateMessages; document.querySelector(.user-actions).appendChild(messageBtn); } } // 初始化 document.addEventListener(DOMContentLoaded, function() { initForumData(); // 排序功能 document.getElementById(sort-posts).addEventListener(change, function() { forumData.currentSort this.value; loadPosts(); }); // 搜索功能(回车键) document.getElementById(search-input).addEventListener(keypress, function(e) { if (e.key Enter) { performSearch(); } }); }); /script>/body>/html>
View on OTX
|
View on ThreatMiner
Please enable JavaScript to view the
comments powered by Disqus.
Data with thanks to
AlienVault OTX
,
VirusTotal
,
Malwr
and
others
. [
Sitemap
]