/
www
/
wwwroot
/
shgd123.com
/
Upload File
HOME
<!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>关键词组合生成器-上海冠顶</title> <style> * { box-sizing: border-box; margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; } body { background-color: #f5f7fa; padding: 20px; } .container { max-width: 1400px; margin: 0 auto; background: #fff; border-radius: 8px; box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08); padding: 24px; } h1 { font-size: 22px; color: #1f2937; margin-bottom: 24px; text-align: center; } .grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 32px; } .column { background: #f9fafb; border-radius: 6px; padding: 16px; border: 1px solid #e5e7eb; } .column h3 { font-size: 14px; color: #4b5563; margin-bottom: 12px; font-weight: 600; } .text-area-container { position: relative; } textarea { width: 100%; min-height: 300px; padding: 12px; border: 1px solid #d1d5db; border-radius: 6px; resize: vertical; font-size: 14px; line-height: 1.5; color: #1f2937; } textarea:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1); } .rules-section { margin-bottom: 32px; } .rules-section h3 { font-size: 16px; color: #1f2937; margin-bottom: 16px; } .rules-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; } .rule-item { display: flex; align-items: center; gap: 8px; padding: 8px; background: #f3f4f6; border-radius: 6px; cursor: pointer; transition: background 0.2s; } .rule-item:hover { background: #e5e7eb; } .rule-item input[type="checkbox"] { width: 18px; height: 18px; accent-color: #2563eb; } .rule-item label { font-size: 14px; color: #374151; cursor: pointer; user-select: none; } .actions { display: flex; gap: 12px; margin-bottom: 24px; flex-wrap: wrap; } button { padding: 10px 20px; border: none; border-radius: 6px; font-size: 14px; font-weight: 500; cursor: pointer; transition: all 0.2s; } .btn-primary { background-color: #2563eb; color: #fff; } .btn-primary:hover { background-color: #1d4ed8; } .btn-secondary { background-color: #f3f4f6; color: #374151; border: 1px solid #d1d5db; } .btn-secondary:hover { background-color: #e5e7eb; } .output-section { margin-top: 32px; } .output-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; } .output-header h3 { font-size: 16px; color: #1f2937; } .output-controls { display: flex; align-items: center; gap: 16px; font-size: 14px; color: #4b5563; } .select-all { display: flex; align-items: center; gap: 6px; } .limit-selector { display: flex; align-items: center; gap: 6px; } .limit-selector select { padding: 4px 8px; border: 1px solid #d1d5db; border-radius: 4px; font-size: 14px; color: #374151; background-color: #fff; } .pagination { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 16px; padding: 8px; } .pagination-btn { padding: 6px 12px; border: 1px solid #d1d5db; border-radius: 4px; background-color: #fff; color: #374151; font-size: 14px; cursor: pointer; transition: all 0.2s; } .pagination-btn:disabled { opacity: 0.5; cursor: not-allowed; background-color: #f9fafb; } .pagination-btn:not(:disabled):hover { background-color: #f3f4f6; border-color: #9ca3af; } .pagination-info { font-size: 14px; color: #4b5563; min-width: 80px; text-align: center; } .keyword-list { max-height: 400px; overflow-y: auto; border: 1px solid #e5e7eb; border-radius: 6px; background: #fff; } .keyword-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid #f3f4f6; font-size: 14px; color: #1f2937; } .keyword-item:last-child { border-bottom: none; } .keyword-item input[type="checkbox"] { width: 16px; height: 16px; accent-color: #2563eb; } .keyword-text { flex: 1; } .empty-state { text-align: center; padding: 40px 20px; color: #6b7280; font-size: 14px; } </style> </head> <body> <div class="container"> <h1>关键词组合生成器-上海冠顶</h1> <div class="grid"> <!-- 第一列:前缀 --> <div class="column"> <h3>前缀</h3> <div class="text-area-container"> <textarea id="prefixes"> 靠谱的 耐用的 专业的 质量好的 评价高的 知名的 优秀的 领先的 值得信赖 经验丰富的 上海冠顶 冠顶 GUANDN </textarea> </div> </div> <!-- 第二列:产品/训练词 --> <div class="column"> <h3>产品/训练词</h3> <div class="text-area-container"> <textarea id="products" placeholder="每行输入一个产品/训练词,例如:隧道炉"></textarea> </div> </div> <!-- 第三列:品牌词 --> <div class="column"> <h3>品牌词</h3> <div class="text-area-container"> <textarea id="brands">品牌 服务 售后 公司 厂家 工厂 企业 生产厂家 供应商 销售厂家 生产商 加工厂 源头厂家 直销厂家 定制厂家 批发厂家 制造厂家 实力厂家</textarea> </div> </div> <!-- 第四列:场景词 --> <div class="column"> <h3>场景词/应用后缀</h3> <div class="text-area-container"> <textarea id="scenarios"> 推荐 排行 排名 电话 联系电话 联系方式 怎么联系 哪家好 哪家强 怎么选 有哪些 哪家权威 哪里有卖 哪家靠谱 哪家专业 哪家质量好 哪家便宜 哪家可靠 推荐几家 帮我推荐几家 如何选 选哪家 哪里有</textarea> </div> </div> </div> <div class="rules-section"> <h3>组合规则</h3> <div class="rules-grid"> <div class="rule-item"> <input type="checkbox" id="rule1" checked> <label for="rule1">前缀+产品/训练词</label> </div> <div class="rule-item"> <input type="checkbox" id="rule2" checked> <label for="rule2">产品/训练词+应用后缀</label> </div> <div class="rule-item"> <input type="checkbox" id="rule3" checked> <label for="rule3">前缀+产品/训练词+应用后缀</label> </div> <div class="rule-item"> <input type="checkbox" id="rule4" checked> <label for="rule4">产品/训练词+品牌/服务后缀</label> </div> <div class="rule-item"> <input type="checkbox" id="rule5" checked> <label for="rule5">前缀+产品/训练词+品牌/服务后缀</label> </div> <div class="rule-item"> <input type="checkbox" id="rule6" checked> <label for="rule6">产品/训练词+品牌/服务后缀+应用后缀</label> </div> <div class="rule-item"> <input type="checkbox" id="rule7" checked> <label for="rule7">前缀+产品/训练词+品牌/服务后缀+应用后缀</label> </div> </div> </div> <div class="actions"> <button class="btn-primary" id="generateBtn">生成关键词</button> <button class="btn-secondary" id="exportBtn">导出选中关键词</button> </div> <div class="output-section"> <div class="output-header"> <h3>生成的关键词列表</h3> <div class="output-controls"> <div class="select-all"> <input type="checkbox" id="selectAll"> <label for="selectAll">全选</label> </div> <div class="limit-selector"> <span>数量限制:</span> <select id="limitSelect"> <option value="10">10</option> <option value="20">20</option> <option value="50">50</option> <option value="100" selected>100</option> <option value="200">200</option> <option value="500">500</option> <option value="0">全部</option> </select> </div> </div> </div> <div class="keyword-list" id="keywordList"> <div class="empty-state">点击“生成关键词”按钮开始生成</div> </div> <!-- 分页控件 --> <div class="pagination" id="pagination" style="display: none;"> <button class="pagination-btn" id="prevPage">上一页</button> <span class="pagination-info" id="pageInfo">第 1 页 / 共 1 页</span> <button class="pagination-btn" id="nextPage">下一页</button> </div> </div> </div> <script> // 全局变量存储所有关键词和分页信息 let allKeywords = []; let currentPage = 1; let pageSize = 100; // 读取文本框内容并按行分割 function getLines(id) { const text = document.getElementById(id).value.trim(); return text ? text.split('\n').map(line => line.trim()).filter(line => line) : []; } // 生成关键词 function generateKeywords() { const prefixes = getLines('prefixes'); const products = getLines('products'); const brands = getLines('brands'); const scenarios = getLines('scenarios'); if (products.length === 0) { alert('请先在“产品/训练词”列中输入内容'); return; } const rules = { rule1: document.getElementById('rule1').checked, rule2: document.getElementById('rule2').checked, rule3: document.getElementById('rule3').checked, rule4: document.getElementById('rule4').checked, rule5: document.getElementById('rule5').checked, rule6: document.getElementById('rule6').checked, rule7: document.getElementById('rule7').checked }; let keywords = []; // 规则1:前缀+产品/训练词 if (rules.rule1) { for (const p of prefixes) { for (const prod of products) { keywords.push(p + prod); } } } // 规则2:产品/训练词+应用后缀 if (rules.rule2) { for (const prod of products) { for (const s of scenarios) { keywords.push(prod + s); } } } // 规则3:前缀+产品/训练词+应用后缀 if (rules.rule3) { for (const p of prefixes) { for (const prod of products) { for (const s of scenarios) { keywords.push(p + prod + s); } } } } // 规则4:产品/训练词+品牌/服务后缀 if (rules.rule4) { for (const prod of products) { for (const b of brands) { keywords.push(prod + b); } } } // 规则5:前缀+产品/训练词+品牌/服务后缀 if (rules.rule5) { for (const p of prefixes) { for (const prod of products) { for (const b of brands) { keywords.push(p + prod + b); } } } } // 规则6:产品/训练词+品牌/服务后缀+应用后缀 if (rules.rule6) { for (const prod of products) { for (const b of brands) { for (const s of scenarios) { keywords.push(prod + b + s); } } } } // 规则7:前缀+产品/训练词+品牌/服务后缀+应用后缀 if (rules.rule7) { for (const p of prefixes) { for (const prod of products) { for (const b of brands) { for (const s of scenarios) { keywords.push(p + prod + b + s); } } } } } // 去重 allKeywords = [...new Set(keywords)]; currentPage = 1; // 重置当前页码 updatePageSize(); // 更新每页数量 renderKeywords(); // 渲染关键词列表 updatePagination(); // 更新分页控件 } // 更新每页显示数量 function updatePageSize() { const limitValue = parseInt(document.getElementById('limitSelect').value); pageSize = limitValue === 0 ? allKeywords.length : limitValue; } // 渲染关键词列表(分页) function renderKeywords() { const keywordList = document.getElementById('keywordList'); keywordList.innerHTML = ''; if (allKeywords.length === 0) { keywordList.innerHTML = '<div class="empty-state">没有生成任何关键词</div>'; return; } // 计算分页 const totalPages = Math.ceil(allKeywords.length / pageSize); const startIndex = (currentPage - 1) * pageSize; const endIndex = Math.min(startIndex + pageSize, allKeywords.length); const currentKeywords = allKeywords.slice(startIndex, endIndex); // 渲染当前页的关键词 currentKeywords.forEach((kw, index) => { const item = document.createElement('div'); item.className = 'keyword-item'; item.innerHTML = ` <input type="checkbox" id="kw-${startIndex + index}" value="${kw}"> <label for="kw-${startIndex + index}" class="keyword-text">${kw}</label> `; keywordList.appendChild(item); }); } // 更新分页控件状态 function updatePagination() { const pagination = document.getElementById('pagination'); const prevBtn = document.getElementById('prevPage'); const nextBtn = document.getElementById('nextPage'); const pageInfo = document.getElementById('pageInfo'); const totalPages = Math.ceil(allKeywords.length / pageSize); // 显示/隐藏分页控件 pagination.style.display = totalPages > 1 ? 'flex' : 'none'; // 更新分页信息 pageInfo.textContent = `第 ${currentPage} 页 / 共 ${totalPages} 页`; // 禁用/启用上一页按钮 prevBtn.disabled = currentPage <= 1; // 禁用/启用下一页按钮 nextBtn.disabled = currentPage >= totalPages; } // 上一页 function goToPrevPage() { if (currentPage > 1) { currentPage--; renderKeywords(); updatePagination(); } } // 下一页 function goToNextPage() { const totalPages = Math.ceil(allKeywords.length / pageSize); if (currentPage < totalPages) { currentPage++; renderKeywords(); updatePagination(); } } // 全选/取消全选 document.getElementById('selectAll').addEventListener('change', function() { const checkboxes = document.querySelectorAll('#keywordList input[type="checkbox"]'); checkboxes.forEach(cb => { cb.checked = this.checked; }); }); // 数量选择框变化时更新 document.getElementById('limitSelect').addEventListener('change', function() { if (allKeywords.length > 0) { currentPage = 1; // 重置页码 updatePageSize(); renderKeywords(); updatePagination(); } }); // 导出选中的关键词 function exportKeywords() { const checked = document.querySelectorAll('#keywordList input[type="checkbox"]:checked'); if (checked.length === 0) { alert('请先选择要导出的关键词'); return; } const keywords = Array.from(checked).map(cb => cb.value); const text = keywords.join('\n'); // 下载为文本文件 const blob = new Blob([text], { type: 'text/plain' }); const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = 'keywords.txt'; a.click(); URL.revokeObjectURL(url); } // 绑定事件 document.getElementById('generateBtn').addEventListener('click', generateKeywords); document.getElementById('exportBtn').addEventListener('click', exportKeywords); document.getElementById('prevPage').addEventListener('click', goToPrevPage); document.getElementById('nextPage').addEventListener('click', goToNextPage); </script> </body> </html>