html> zh-CN"> ="UTF-8"> "content="width=device-width, initial-scale=1.0"> 优化:聚焦游戏攻略,优化描述 --> (\(title)?> - 纯文字游戏攻略 - SITE_NAME?> description" content="chars(\)preview_text)?> - 专注纯文字老游戏攻略,无图无下载,仅作学习参考!"> body {margin:0;padding:0;background:#f5f5f5;font-family:"微软雅黑", "PingFang SC", sans-serif;} .container {max-width:800px;margin:30px auto;padding:20px;} .detail {background:#fff;padding:30px;border-radius:8px;box-shadow:0 2px 10px rgba (0,0,0,0.05);} .detail-title {font-size:24px;margin:0 0 20px;color:#333;line-height:1.3;} .price {color:#E53E3E;font-size:20px;margin-left:10px;font-weight:bold;} .preview { background:#f9f9f9; padding:15px; border-left:4px solid #07c160; margin:20px 0; line-height:1.7; color:#444; border-radius:4px; } /* 完整内容预览样式:优化滚动体验 / .full-content{ background:#fff; border:1px solid #eee; padding:20px; margin:20px 0; line-height:1.8; color:#333; white-space: pre-wrap; / 保留 TXT 换行格式 / word-break: break-all; max-height:800px; overflow-y:auto; border-radius:4px; } .pdf-preview{ width:100%; height:800px; border:none; border-radius:4px; } .lock-tip{ background:#fff8e1; padding:15px; border-left:4px solid #ffb74d; margin:20px 0; color:#ff8f00; line-height:1.7; border-radius:4px; } .btn{display:inline-block;padding:12px 30px;background:#07c160;color:#fff;text-decoration:none;border-radius:6px;margin-top:20px;font-size:16px;transition:background 0.3s;} .btn:hover{background:#05a853;} .btn-download{background:#1677ff!important;} .btn-download:hover{background:#0f62d9!important;} .back{margin-top:20px;} .back a{color:#07c160;text-decoration:none;font-size:14px;} .back a:hover{text-decoration:underline;} .risk-tip{font-size:12px;color:#999;margin-top:15px;line-height:1.5;} / 移动端适配优化 */ @media (max-width: 768px) { .container {padding:15px;} .detail {padding:20px;} .detail-title {font-size:22px;} .full-content, .pdf-preview {max-height:600px;} } 价格 --> 1 class="detail-title"> (\(title)?> =\)price_text?> 🔥 SEO 预览区域(前 200 字) ====================== --> = 🔥 完整内容预览区域(已购买才显示) ====================== --> id) : ?> == 'txt') : ?> 完整预览 --> 合规声明:适配游戏攻略场景 --> :优化链接和样式 --> back">← 返回攻略列表 :修复所有跳转问题,优化体验 --> let file = "=htmlspecialchars($file)?>"; let paidOrders = JSON.parse(localStorage.getItem('paidOrders') || '[]'); let hasPaid = paidOrders.some(o => o.file === file); // 同步页面按钮状态(防止缓存导致的显示异常) if (hasPaid) { document.getElementById ('buyBtn').style.display = 'none'; document.getElementById ('downloadBtn').style.display = 'inline-block'; } else { document.getElementById ('buyBtn').style.display = 'inline-block'; document.getElementById ('downloadBtn').style.display = 'none'; } // 购买跳转:完整拼接参数,确保支付正常 document.getElementById ('buyBtn').onclick = function (){ const url = "/pay.php?file=&title==rawurlencode($title)?>&price=price?>"; location.href = url; }; // 下载跳转:优化错误处理 document.getElementById ('downloadBtn').onclick = function (){ let order = paidOrders.find (o => o.file === file); if (order){ const downloadUrl = "/download.php?file="+ encodeURIComponent (file) +"&order_no=" + order.order_no; location.href = downloadUrl; } else { alert ("未找到购买记录,请重新下载或联系客服!"); location.href = "ITE_URL?>/re_download.php?file=rawurlencode ($file)?>"; } }; // 购买记录同步:优化 Cookie 存储和 URL 参数,确保刷新后状态保留 if (hasPaid) { // 存储到 Cookie(有效期 1 年) document.cookie = "paidOrders=" + JSON.stringify (paidOrders) + "; path=/; max-age=31536000; SameSite=Lax"; // 更新 URL 参数(避免刷新后丢失状态) const newUrl = window.location.pathname + "?file=" + encodeURIComponent (file) + "&localStorageOrders=" + encodeURIComponent (JSON.stringify (paidOrders)); window.history.replaceState ({}, document.title, newUrl); }