gaokao-site/ai-tool.html

327 lines
15 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AI智能推荐 - 河南高考志愿导航</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: #0a0a0f; color: #e0e0e0; min-height: 100vh; line-height: 1.6; }
.header { background: rgba(20,20,30,0.95); backdrop-filter: blur(20px); border-bottom: 1px solid rgba(255,255,255,0.08); padding: 14px 0; position: sticky; top: 0; z-index: 100; }
.header-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.logo { font-size: 1.3rem; font-weight: 700; color: #fff; text-decoration: none; }
.logo span { color: #667eea; }
.nav-links { display: flex; gap: 20px; list-style: none; flex-wrap: wrap; }
.nav-links a { color: #a0a0a0; text-decoration: none; font-size: 0.9rem; transition: color 0.3s; }
.nav-links a:hover { color: #667eea; }
.nav-links a.highlight { color: #667eea; font-weight: 600; }
.container { max-width: 800px; margin: 0 auto; padding: 0 20px; }
.header h1 { font-size: 1.1rem; color: #fff; }
.hero { text-align: center; margin-bottom: 40px; }
.hero h2 { font-size: 2rem; color: #fff; margin-bottom: 10px; }
.hero p { color: #888; font-size: 1rem; }
.hero .tag { display: inline-block; background: linear-gradient(135deg, #667eea, #764ba2); color: #fff; padding: 4px 14px; border-radius: 20px; font-size: 0.85rem; margin-bottom: 15px; }
.form-card { background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.08); border-radius: 20px; padding: 35px; margin-bottom: 30px; }
.form-title { font-size: 1.1rem; color: #fff; margin-bottom: 25px; border-bottom: 1px solid rgba(255,255,255,0.06); padding-bottom: 15px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.form-row.full { grid-template-columns: 1fr; }
.form-group { display: flex; flex-direction: column; gap: 8px; }
.form-group label { font-size: 0.9rem; color: #aaa; }
.form-group input, .form-group select {
padding: 14px 18px; border: 1px solid rgba(255,255,255,0.12);
border-radius: 12px; background: rgba(255,255,255,0.04);
color: #fff; font-size: 1rem; outline: none;
transition: border-color 0.3s; appearance: none;
}
.form-group input:focus, .form-group select:focus { border-color: #667eea; }
.form-group input::placeholder { color: #555; }
.form-group select option { background: #1a1a2e; color: #fff; }
.score-input-wrap { position: relative; }
.score-input-wrap input { width: 100%; padding-right: 50px; }
.score-unit { position: absolute; right: 18px; top: 50%; transform: translateY(-50%); color: #667eea; font-size: 1rem; pointer-events: none; }
.submit-btn {
width: 100%; padding: 16px; border: none; border-radius: 14px;
background: linear-gradient(135deg, #667eea, #764ba2);
color: #fff; font-size: 1.05rem; font-weight: 600;
cursor: pointer; margin-top: 10px; transition: opacity 0.3s;
}
.submit-btn:hover { opacity: 0.9; }
.submit-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.result-card { display: none; margin-top: 30px; }
.result-card.show { display: block; }
.result-summary {
background: rgba(102,126,234,0.1); border: 1px solid rgba(102,126,234,0.25);
border-radius: 16px; padding: 24px; margin-bottom: 25px;
}
.result-summary h3 { color: #667eea; font-size: 0.9rem; margin-bottom: 8px; }
.result-summary p { color: #c0c0c0; font-size: 1rem; line-height: 1.7; }
.result-section { margin-bottom: 25px; }
.result-section-title { font-size: 1rem; color: #fff; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.result-section-title .badge {
font-size: 0.75rem; padding: 3px 10px; border-radius: 10px; font-weight: 600;
}
.badge-chong { background: rgba(239,68,68,0.15); color: #ef4444; }
.badge-wen { background: rgba(245,158,11,0.15); color: #f59e0b; }
.badge-bao { background: rgba(34,197,94,0.15); color: #22c55e; }
.school-item {
background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.07);
border-radius: 12px; padding: 18px 20px; margin-bottom: 10px;
}
.school-item h4 { color: #fff; font-size: 1rem; margin-bottom: 6px; }
.school-item .reason { color: #aaa; font-size: 0.88rem; margin-bottom: 5px; }
.school-item .risk { color: #f59e0b; font-size: 0.85rem; }
.tuition-tag {
display: inline-block;
background: rgba(102,126,234,0.18);
color: #a5b4fc;
border: 1px solid rgba(102,126,234,0.3);
border-radius: 20px;
padding: 2px 10px;
font-size: 0.78rem;
font-weight: 600;
vertical-align: middle;
margin-left: 8px;
}
.tips-section { margin-top: 25px; }
.tips-title { color: #fff; font-size: 1rem; margin-bottom: 12px; }
.tips-list { list-style: none; }
.tips-list li { color: #aaa; font-size: 0.9rem; padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,0.04); display: flex; gap: 10px; }
.tips-list li:before { content: '💡'; flex-shrink: 0; }
.loading { display: none; text-align: center; padding: 50px 0; }
.loading.show { display: block; }
.spinner {
width: 40px; height: 40px; border: 3px solid rgba(102,126,234,0.2);
border-top-color: #667eea; border-radius: 50%;
animation: spin 0.8s linear infinite; margin: 0 auto 15px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading p { color: #888; font-size: 0.95rem; }
.error-msg { display: none; background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); border-radius: 12px; padding: 16px; color: #ef4444; text-align: center; margin-top: 15px; }
.error-msg.show { display: block; }
.footer { text-align: center; padding: 40px 20px 20px; color: #555; font-size: 0.85rem; border-top: 1px solid rgba(255,255,255,0.05); margin-top: 60px; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } .form-card { padding: 24px 20px; } .hero h2 { font-size: 1.6rem; } }
</style>
</head>
<body>
<header class="header">
<div class="header-inner">
<a href="/" class="logo">高考志愿<span>助手</span></a>
<nav>
<ul class="nav-links">
<li><a href="/">首页</a></li>
<li><a href="/school.html">查院校</a></li>
<li><a href="/major.html">查专业</a></li>
<li><a href="/qa.html">招生章程</a></li>
<li><a href="/ai-chat.html">AI对话</a></li>
<li><a href="/ai-tool.html" class="highlight">AI推荐</a></li>
<li><a href="/plan.html">志愿草表</a></li>
</ul>
</nav>
</div>
</header>
<div class="container">
<div class="hero">
<div class="tag">🎯 AI驱动</div>
<h2>智能推荐志愿方案</h2>
<p>输入分数AI分析冲/稳/保院校组合</p>
</div>
<div class="form-card">
<div class="form-title">填写考生信息</div>
<div class="form-row full">
<div class="form-group">
<label>高考分数(理科/文科)</label>
<div class="score-input-wrap">
<input type="number" id="scoreInput" min="100" max="800" placeholder="请输入高考分数" />
<span class="score-unit"></span>
</div>
</div>
</div>
<div class="form-row">
<div class="form-group">
<label>科类</label>
<select id="categorySelect">
<option value="理科">理科</option>
<option value="文科">文科</option>
</select>
</div>
<div class="form-group">
<label>报考批次</label>
<select id="batchSelect">
<option value="本科一批">本科一批</option>
<option value="本科二批">本科二批</option>
</select>
</div>
</div>
<button class="submit-btn" id="submitBtn" onclick="getRecommendation()">
🚀 获取AI推荐方案
</button>
<div class="error-msg" id="errorMsg"></div>
</div>
<div class="loading" id="loading">
<div class="spinner"></div>
<p>AI正在分析院校数据…</p>
<p style="color:#555;font-size:0.85rem;margin-top:8px">预计10-30秒完成</p>
</div>
<div class="result-card" id="resultCard">
<div class="result-summary">
<h3>📊 分数段分析</h3>
<p id="summaryText"></p>
</div>
<div class="result-section" id="chongSection">
<div class="result-section-title">
<span class="badge badge-chong"></span>
<span style="color:#aaa;font-size:0.85rem">录取概率30%-50%高于分数5-15分</span>
</div>
<div id="chongList"></div>
</div>
<div class="result-section" id="wenSection">
<div class="result-section-title">
<span class="badge badge-wen"></span>
<span style="color:#aaa;font-size:0.85rem">录取概率60%-80%,分数附近</span>
</div>
<div id="wenList"></div>
</div>
<div class="result-section" id="baoSection">
<div class="result-section-title">
<span class="badge badge-bao"></span>
<span style="color:#aaa;font-size:0.85rem">录取概率85%以上低于分数15分以上</span>
</div>
<div id="baoList"></div>
</div>
<div class="tips-section">
<div class="tips-title">📌 志愿填报注意事项</div>
<ul class="tips-list" id="tipsList"></ul>
</div>
</div>
<div class="footer">
<p>AI推荐仅供参考最终以官方公布数据为准</p>
<p style="margin-top:5px;color:#444">Powered by NVIDIA NIM · minimax-m2.7</p>
</div>
</div>
<script>
async function getRecommendation() {
var score = parseInt(document.getElementById('scoreInput').value);
var category = document.getElementById('categorySelect').value;
var batch = document.getElementById('batchSelect').value;
var btn = document.getElementById('submitBtn');
var loading = document.getElementById('loading');
var resultCard = document.getElementById('resultCard');
var errorMsg = document.getElementById('errorMsg');
if (!score || score < 100 || score > 800) {
showError('请输入有效的分数100-800');
return;
}
btn.disabled = true;
btn.textContent = '分析中…';
loading.classList.add('show');
resultCard.classList.remove('show');
errorMsg.classList.remove('show');
try {
var resp = await fetch('/api/recommend', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ score: score, category: category, batch: batch })
});
var data = await resp.json();
if (!resp.ok) {
showError(data.error || '服务暂时不可用,请稍后重试');
return;
}
renderResult(data);
resultCard.classList.add('show');
} catch (e) {
showError('网络错误,请检查网络连接后重试');
} finally {
btn.disabled = false;
btn.textContent = '🚀 获取AI推荐方案';
loading.classList.remove('show');
}
}
function renderResult(data) {
document.getElementById('summaryText').textContent = data.summary || '';
renderSchoolList('chongList', data.chong || []);
renderSchoolList('wenList', data.wen || []);
renderSchoolList('baoList', data.bao || []);
var tipsList = document.getElementById('tipsList');
tipsList.innerHTML = '';
(data.tips || []).forEach(function(tip) {
var li = document.createElement('li');
li.textContent = tip;
tipsList.appendChild(li);
});
}
function renderSchoolList(containerId, schools) {
var container = document.getElementById(containerId);
container.innerHTML = '';
schools.forEach(function(s) {
var div = document.createElement('div');
div.className = 'school-item';
// 计算概率颜色
var probColor = s.prob >= 80 ? '#22c55e' : s.prob >= 50 ? '#f59e0b' : '#ef4444';
var probLabel = s.prob >= 80 ? '较稳' : s.prob >= 50 ? '可冲' : '有风险';
// 学费显示
var tuitionHtml = s.tuition_annual
? '<span class="tuition-tag">' + s.tuition_annual.toLocaleString() + '元/年</span>'
: '';
div.innerHTML =
'<h4>' + s.school + ' ' + tuitionHtml + '</h4>' +
'<div class="reason">' +
'<span>' + (s.req || '') + '</span> · ' +
'<span>' + s.score + '分</span> · ' +
'<span>位次' + (s.rank || '') + '</span> · ' +
'<span style="color:' + probColor + ';font-weight:600">' +
s.prob + '% ' + probLabel +
'</span>' +
'</div>' +
(s.diff !== undefined ? '<div class="risk">批次线差:+' + s.diff + '分</div>' : '');
container.appendChild(div);
});
}
function showError(msg) {
var el = document.getElementById('errorMsg');
el.textContent = msg;
el.classList.add('show');
document.getElementById('loading').classList.remove('show');
}
</script>
</body>
</html>