diff --git a/public/survey.html b/public/survey.html index e40d165..8543096 100644 --- a/public/survey.html +++ b/public/survey.html @@ -13,69 +13,501 @@ } body { - background-color: #f5f7fa; + background: linear-gradient(135deg, #ff7e5f 0%, #feb47b 100%); color: #333; - padding: 20px; + margin: 0; + padding: 0; line-height: 1.6; + min-height: 100vh; } .container { width: 100%; - max-width: 1200px; - margin: 0 auto; - background: white; - border-radius: 12px; - box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1); + background: transparent; overflow: hidden; + min-height: 100vh; } .header { - background: linear-gradient(135deg, #ff7e5f 0%, #feb47b 50%, #ff7e5f 100%); + background: linear-gradient(135deg, #ff7e5f 0%, #feb47b 100%); color: white; - padding: 30px; + padding: 80px 40px 60px; position: relative; overflow: hidden; - box-shadow: 0 4px 20px rgba(255, 126, 95, 0.3); text-align: center; } - .header h1 { - font-size: 32px; - margin-bottom: 10px; + .header::before { + content: ''; + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E") repeat; + } + + .header-content { position: relative; z-index: 2; + max-width: 600px; + margin: 0 auto; + } + + .header h1 { + font-size: 42px; + font-weight: 700; + margin-bottom: 16px; + letter-spacing: -0.5px; + background: linear-gradient(135deg, #ffffff 0%, #f0f0f0 100%); + -webkit-background-clip: text; + -webkit-text-fill-color: transparent; + background-clip: text; } .header p { - position: relative; - z-index: 2; + font-size: 18px; opacity: 0.9; + line-height: 1.6; + margin-bottom: 0; } .config-section { - padding: 30px; - background: #f8f9fa; - border-bottom: 1px solid #e9ecef; + padding: 0; + background: #ffffff; + margin-top: -60px; + position: relative; + z-index: 10; } - .config-grid { - display: grid; - grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); - gap: 20px; - margin-bottom: 20px; - } - - .config-card { + .unified-config { + width: 100%; + max-width: 1000px; + margin: 0 auto; background: white; - padding: 20px; - border-radius: 10px; - box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); + border-radius: 24px 24px 0 0; + box-shadow: 0 -10px 40px rgba(255, 126, 95, 0.15); + overflow: hidden; + animation: slideUp 0.8s ease-out; } - .config-card h3 { - color: #2d5a3d; - margin-bottom: 15px; + @keyframes slideUp { + from { + opacity: 0; + transform: translateY(40px); + } + to { + opacity: 1; + transform: translateY(0); + } + } + + .config-intro { + background: linear-gradient(135deg, rgba(255, 126, 95, 0.1) 0%, rgba(254, 180, 123, 0.1) 100%); + padding: 40px; + text-align: center; + border-bottom: 1px solid rgba(255, 126, 95, 0.1); + } + + .intro-icon { + font-size: 48px; + margin-bottom: 16px; + display: block; + } + + .config-intro h2 { + font-size: 28px; + font-weight: 600; + color: #2d3748; + margin-bottom: 12px; + letter-spacing: -0.5px; + } + + .config-intro p { + font-size: 16px; + color: #718096; + line-height: 1.6; + max-width: 600px; + margin: 0 auto; + } + + .form-container { + padding: 40px; + } + + .form-section { + margin-bottom: 40px; + } + + .form-section:last-child { + margin-bottom: 0; + } + + .section-header { + display: flex; + align-items: center; + margin-bottom: 24px; + } + + .section-icon { + font-size: 24px; + margin-right: 12px; + width: 40px; + height: 40px; + display: flex; + align-items: center; + justify-content: center; + background: linear-gradient(135deg, #f8f9fa, #e9ecef); + border-radius: 12px; + } + + .section-header h3 { + font-size: 20px; + font-weight: 600; + color: #2d3748; + margin: 0; + } + + .section-divider { + flex: 1; + height: 1px; + background: linear-gradient(90deg, #e2e8f0, transparent); + margin-left: 20px; + } + + .form-row { + display: grid; + grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); + gap: 20px; + } + + .form-field { + position: relative; + } + + .form-field.full-width { + grid-column: 1 / -1; + } + + .field-label { + display: flex; + align-items: center; + margin-bottom: 8px; + font-weight: 500; + } + + .label-text { + color: #4a5568; + font-size: 14px; + } + + .required { + color: #e53e3e; + margin-left: 4px; + font-size: 12px; + } + + .optional { + color: #a0aec0; + margin-left: 8px; + font-size: 12px; + background: #f7fafc; + padding: 2px 8px; + border-radius: 12px; + } + + .modern-input { + width: 100%; + padding: 12px 16px; + border: 2px solid #e2e8f0; + border-radius: 12px; + font-size: 16px; + transition: all 0.3s ease; + background: white; + } + + .modern-input:focus { + outline: none; + border-color: #ff7e5f; + box-shadow: 0 0 0 3px rgba(255, 126, 95, 0.1); + transform: translateY(-1px); + } + + .modern-input::placeholder { + color: #a0aec0; + } + + .select-wrapper { + position: relative; + } + + .modern-select { + width: 100%; + padding: 12px 40px 12px 16px; + border: 2px solid #e2e8f0; + border-radius: 12px; + font-size: 16px; + background: white; + appearance: none; + cursor: pointer; + transition: all 0.3s ease; + } + + .modern-select:focus { + outline: none; + border-color: #ff7e5f; + box-shadow: 0 0 0 3px rgba(255, 126, 95, 0.1); + transform: translateY(-1px); + } + + .select-arrow { + position: absolute; + right: 16px; + top: 50%; + transform: translateY(-50%); + color: #a0aec0; + font-size: 12px; + pointer-events: none; + transition: transform 0.3s ease; + } + + .modern-select:focus + .select-arrow { + transform: translateY(-50%) rotate(180deg); + } + + .field-hint { + margin-top: 6px; + font-size: 13px; + color: #718096; + } + + .rules-grid { + display: grid; + grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); + gap: 20px; + } + + .rule-card { + background: #f8fafc; + border: 2px solid #e2e8f0; + border-radius: 16px; + padding: 24px; + transition: all 0.3s ease; + position: relative; + overflow: hidden; + } + + .rule-card::before { + content: ''; + position: absolute; + top: 0; + left: 0; + right: 0; + height: 4px; + background: linear-gradient(90deg, #ff7e5f, #feb47b); + } + + .rule-card:hover { + transform: translateY(-2px); + box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1); + border-color: #cbd5e0; + } + + .rule-header { + display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: 16px; + } + + .rule-type { + padding: 6px 12px; + border-radius: 20px; + font-size: 12px; + font-weight: 600; + text-transform: uppercase; + letter-spacing: 0.5px; + } + + .rule-type.basic { + background: #c6f6d5; + color: #22543d; + } + + .rule-type.advanced { + background: #fed7aa; + color: #7c2d12; + } + + .rule-type.competition { + background: #fed7e2; + color: #702459; + } + + .rule-points { + font-size: 12px; + color: #718096; + background: white; + padding: 4px 8px; + border-radius: 8px; + } + + .rule-input-area { + margin-bottom: 12px; + } + + .rule-number-input { + width: 100%; + padding: 12px 16px; + border: 2px solid #e2e8f0; + border-radius: 12px; font-size: 18px; + font-weight: 600; + text-align: center; + transition: all 0.3s ease; + background: white; + } + + .rule-number-input:focus { + outline: none; + border-color: #ff7e5f; + box-shadow: 0 0 0 3px rgba(255, 126, 95, 0.1); + transform: scale(1.02); + } + + .rule-calculation { + text-align: center; + margin-top: 8px; + font-size: 14px; + color: #4a5568; + font-weight: 500; + } + + .rule-status { + text-align: center; + font-size: 12px; + } + + .status-text { + color: #718096; + } + + .status-text.success { + color: #38a169; + } + + .status-text.error { + color: #e53e3e; + } + + .config-summary { + background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%); + padding: 40px; + border-top: 1px solid #e2e8f0; + } + + .summary-content { + display: flex; + justify-content: space-between; + align-items: center; + background: white; + padding: 30px; + border-radius: 16px; + box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05); + border: 1px solid #e2e8f0; + } + + .summary-stats { + display: flex; + align-items: center; + gap: 32px; + } + + .stat-item { + text-align: center; + } + + .stat-value { + font-size: 36px; + font-weight: 700; + line-height: 1; + margin-bottom: 8px; + background: linear-gradient(135deg, #ff7e5f 0%, #feb47b 100%); + -webkit-background-clip: text; + -webkit-text-fill-color: transparent; + background-clip: text; + } + + .stat-label { + font-size: 14px; + color: #718096; + font-weight: 500; + } + + .stat-divider { + width: 2px; + height: 50px; + background: linear-gradient(180deg, #e2e8f0, transparent); + border-radius: 1px; + } + + .start-button { + background: linear-gradient(135deg, #ff7e5f 0%, #feb47b 100%); + color: white; + border: none; + padding: 18px 36px; + border-radius: 16px; + font-size: 16px; + font-weight: 600; + cursor: pointer; + transition: all 0.3s ease; + display: flex; + align-items: center; + gap: 10px; + box-shadow: 0 4px 15px rgba(255, 126, 95, 0.3); + position: relative; + overflow: hidden; + } + + .start-button::before { + content: ''; + position: absolute; + top: 0; + left: -100%; + width: 100%; + height: 100%; + background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent); + transition: left 0.6s ease; + } + + .start-button:hover:not(:disabled) { + transform: translateY(-3px); + box-shadow: 0 8px 25px rgba(255, 126, 95, 0.4); + } + + .start-button:hover:not(:disabled)::before { + left: 100%; + } + + .start-button:disabled { + background: #e2e8f0; + color: #a0aec0; + cursor: not-allowed; + transform: none; + box-shadow: none; + } + + .start-button:disabled::before { + display: none; + } + + .button-arrow { + transition: transform 0.3s ease; + font-size: 18px; + } + + .start-button:hover:not(:disabled) .button-arrow { + transform: translateX(6px); } .rule-item { @@ -97,6 +529,117 @@ color: #666; } + .rules-config { + display: flex; + flex-direction: column; + gap: 20px; + } + + .rule-input-group { + background: #f8f9fa; + border: 2px solid #e9ecef; + border-radius: 12px; + padding: 20px; + transition: all 0.3s ease; + } + + .rule-input-group:hover { + border-color: #ff7e5f; + box-shadow: 0 4px 15px rgba(255, 126, 95, 0.1); + } + + .rule-header { + display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: 15px; + } + + .rule-label { + font-weight: 600; + color: #2d5a3d; + font-size: 16px; + } + + .rule-score { + background: linear-gradient(135deg, #fff8f3, #ffffff); + color: #ff7e5f; + padding: 4px 12px; + border-radius: 20px; + font-size: 12px; + font-weight: 500; + border: 1px solid #ff7e5f; + } + + .rule-input-wrapper { + display: flex; + align-items: center; + gap: 10px; + margin-bottom: 12px; + } + + .rule-input { + flex: 1; + padding: 12px 15px; + border: 2px solid #e9ecef; + border-radius: 8px; + font-size: 16px; + font-weight: 600; + transition: all 0.3s ease; + background: white; + } + + .rule-input:focus { + outline: none; + border-color: #ff7e5f; + box-shadow: 0 0 0 3px rgba(255, 126, 95, 0.1); + } + + .input-unit { + color: #666; + font-weight: 500; + font-size: 14px; + } + + .rule-calculation { + color: #666; + font-size: 14px; + padding: 8px 12px; + background: white; + border-radius: 6px; + border-left: 4px solid #4CAF50; + } + + .rule-summary { + margin-top: 20px; + padding: 20px; + background: linear-gradient(135deg, #e3f2fd, #f8f9fa); + border-radius: 12px; + border: 2px solid #2196F3; + display: flex; + justify-content: space-between; + align-items: center; + } + + .summary-item { + display: flex; + flex-direction: column; + align-items: center; + gap: 5px; + } + + .summary-label { + font-size: 14px; + color: #666; + font-weight: 500; + } + + .summary-value { + font-size: 20px; + font-weight: 700; + color: #2196F3; + } + .tag-filter { margin: 15px 0; } @@ -598,20 +1141,172 @@ background: #f9f9f9; } + @media (max-width: 768px) { + .header { + padding: 40px 20px 30px; + } + + .header h1 { + font-size: 32px; + } + + .header p { + font-size: 16px; + } + + .config-section { + margin-top: -40px; + } + + .unified-config { + border-radius: 20px 20px 0 0; + } + + .config-intro { + padding: 30px 20px; + } + + .intro-icon { + font-size: 40px; + } + + .config-intro h2 { + font-size: 24px; + } + + .config-intro p { + font-size: 14px; + } + + .form-container { + padding: 30px 20px; + } + + .form-section { + margin-bottom: 30px; + } + + .section-header { + flex-direction: column; + align-items: flex-start; + margin-bottom: 20px; + } + + .section-icon { + margin-bottom: 12px; + } + + .section-divider { + display: none; + } + + .form-row { + grid-template-columns: 1fr; + gap: 16px; + } + + .rules-grid { + grid-template-columns: 1fr; + gap: 16px; + } + + .rule-card { + padding: 20px; + } + + .rule-number-input { + font-size: 16px; + } + + .config-summary { + padding: 30px 20px; + } + + .summary-content { + flex-direction: column; + gap: 24px; + padding: 24px; + } + + .summary-stats { + justify-content: center; + } + + .stat-value { + font-size: 28px; + } + + .start-button { + width: 100%; + justify-content: center; + } + } + + @media (max-width: 480px) { + .header { + padding: 30px 15px 20px; + } + + .header h1 { + font-size: 28px; + } + + .header p { + font-size: 14px; + } + + .config-section { + margin-top: -30px; + } + + .unified-config { + border-radius: 16px 16px 0 0; + } + + .config-intro { + padding: 25px 15px; + } + + .intro-icon { + font-size: 36px; + margin-bottom: 12px; + } + + .config-intro h2 { + font-size: 22px; + } + + .form-container { + padding: 25px 15px; + } + + .rule-card { + padding: 16px; + } + + .config-summary { + padding: 25px 15px; + } + + .summary-content { + padding: 20px; + } + + .stat-value { + font-size: 24px; + } + } + @media (max-width: 768px) { .container { margin: 10px; border-radius: 10px; } - .header, .config-section, .survey-content, .results-section { + .header, .survey-content, .results-section { padding: 20px; } - .config-grid { - grid-template-columns: 1fr; - } - .question-text { font-size: 16px; } @@ -669,76 +1364,159 @@
-

🎯 学科能力测评问卷

-

基于科学的题目分类和标签筛选系统

+
+

🎯 学科能力测评问卷

+

基于科学的题目分类和标签筛选系统,精准评估您的学科能力

+
-
-
-

👤 学员信息

-
-
- - +
+
+
📝
+

开始测评

+

填写基本信息,配置答题规则,即可开始您的学科能力测评之旅

+
+ +
+ +
+
+
👤
+

学员信息

+
-
- - +
+
+ + +
+
+ + +
+
+ + +
-
- - +
+ + +
+
+
🏷️
+

题目筛选

+
+
+
+
+ +
+ +
+
+
+ 未选择标签,将使用全部题目 +
+
+
+
+ + +
+
+
📋
+

抽题规则

+
+
+
+
+
+
基础题
+
5分/题
+
+
+ +
+ 共 50 分 +
+
+
+ 可用题目加载中... +
+
+ +
+
+
进阶题
+
10分/题
+
+
+ +
+ 共 20 分 +
+
+
+ 可用题目加载中... +
+
+ +
+
+
竞赛题
+
15分/题
+
+
+ +
+ 共 30 分 +
+
+
+ 可用题目加载中... +
+
-
-

📋 抽题规则配置

-
-
-
规则 1 - 基础题
-
10题 × 5分 = 50分
+ +
+
+
+
+
14
+
总题数
+
+
+
+
100
+
总分数
+
-
-
规则 2 - 进阶题
-
2题 × 10分 = 20分
-
-
-
规则 3 - 竞赛题
-
2题 × 15分 = 30分
-
-
-
- 总题数: 14题 | 总分数: 100分 +
- -
-
-

🏷️ 标签筛选

-
- - -
- 已选择的标签: -
-
-
- -
-

⚙️ 高级设置

-
- - -
-
-
- -
@@ -805,6 +1583,7 @@ await this.loadTags(); this.initializeTagSelectors(); this.bindEvents(); + this.updateRulesFromInputs(); this.updateConfigDisplay(); } catch (error) { this.showError('系统初始化失败: ' + error.message); @@ -887,8 +1666,10 @@ // 年级标签下拉菜单事件 document.getElementById('gradeFilter').addEventListener('change', () => this.updateSelectedTags()); - // 自定义规则监听 - document.getElementById('customRules').addEventListener('input', () => this.updateCustomRules()); + // 新的抽题规则输入事件 + document.getElementById('basicQuestions').addEventListener('input', () => this.updateRulesFromInputs()); + document.getElementById('advancedQuestions').addEventListener('input', () => this.updateRulesFromInputs()); + document.getElementById('competitionQuestions').addEventListener('input', () => this.updateRulesFromInputs()); // 测评报告相关事件 document.getElementById('viewReportBtn').addEventListener('click', () => this.showReportModal()); @@ -922,19 +1703,37 @@ } } - updateCustomRules() { - const customRulesText = document.getElementById('customRules').value.trim(); - if (customRulesText) { - try { - const customRules = JSON.parse(customRulesText); - if (customRules && typeof customRules === 'object') { - this.currentRules = { ...this.currentRules, ...customRules }; - this.updateConfigDisplay(); - } - } catch (error) { - console.error('自定义规则解析失败:', error); - } - } + updateRulesFromInputs() { + const basicQuestions = parseInt(document.getElementById('basicQuestions').value) || 0; + const advancedQuestions = parseInt(document.getElementById('advancedQuestions').value) || 0; + const competitionQuestions = parseInt(document.getElementById('competitionQuestions').value) || 0; + + this.currentRules = { + "基础题": basicQuestions, + "进阶题": advancedQuestions, + "竞赛题": competitionQuestions + }; + + this.updateRuleCalculations(); + this.updateConfigDisplay(); + } + + updateRuleCalculations() { + const basicQuestions = parseInt(document.getElementById('basicQuestions').value) || 0; + const advancedQuestions = parseInt(document.getElementById('advancedQuestions').value) || 0; + const competitionQuestions = parseInt(document.getElementById('competitionQuestions').value) || 0; + + // 更新各项计算 + document.getElementById('basicScore').textContent = basicQuestions * 5; + document.getElementById('advancedScore').textContent = advancedQuestions * 10; + document.getElementById('competitionScore').textContent = competitionQuestions * 15; + + // 更新总计 + const totalQuestions = basicQuestions + advancedQuestions + competitionQuestions; + const totalScore = (basicQuestions * 5) + (advancedQuestions * 10) + (competitionQuestions * 15); + + document.getElementById('summaryTotalQuestions').textContent = totalQuestions; + document.getElementById('summaryTotalScore').textContent = totalScore; } filterQuestionsByTags(selectedTag) { @@ -993,60 +1792,68 @@ updateConfigDisplay() { this.filteredQuestions = this.filterQuestionsByTags(this.selectedTag); - let totalQuestions = 0; - let totalScore = 0; - let rulesHTML = ''; - - Object.keys(this.currentRules).forEach((type, index) => { - const count = this.currentRules[type]; - const available = this.filteredQuestions[type]?.length || 0; - const scorePerQuestion = type === '基础题' ? 5 : type === '进阶题' ? 10 : 15; - const ruleScore = count * scorePerQuestion; - - totalQuestions += count; - totalScore += ruleScore; - - const availabilityClass = available >= count ? '✅' : '❌'; - rulesHTML += ` -
-
规则 ${index + 1} - ${type} ${availabilityClass}
-
${count}题 × ${scorePerQuestion}分 = ${ruleScore}分 (可用: ${available}题)
-
- `; - }); - - document.getElementById('rulesList').innerHTML = rulesHTML; + // 更新输入框的可选性(显示当前可用题目数量) + const basicAvailable = this.filteredQuestions['基础题']?.length || 0; + const advancedAvailable = this.filteredQuestions['进阶题']?.length || 0; + const competitionAvailable = this.filteredQuestions['竞赛题']?.length || 0; - const rulesList = document.getElementById('rulesList').parentElement; - const summaryDiv = rulesList.querySelector('.rule-details[style*="background"]'); - const summaryText = `总题数: ${totalQuestions}题 | 总分数: ${totalScore}分`; + // 更新输入框的最大值和可用性显示 + const basicInput = document.getElementById('basicQuestions'); + const advancedInput = document.getElementById('advancedQuestions'); + const competitionInput = document.getElementById('competitionQuestions'); - if (summaryDiv) { - summaryDiv.innerHTML = summaryText; - } else { - rulesList.innerHTML += ` -
- ${summaryText} -
- `; - } - - // 检查是否有足够的题目 - const canStart = Object.keys(this.currentRules).every(type => { - const needed = this.currentRules[type]; - const available = this.filteredQuestions[type]?.length || 0; - return available >= needed; - }); + basicInput.max = basicAvailable; + advancedInput.max = advancedAvailable; + competitionInput.max = competitionAvailable; + + // 检查当前设置是否超出可用题目数量 + const basicQuestions = parseInt(basicInput.value) || 0; + const advancedQuestions = parseInt(advancedInput.value) || 0; + const competitionQuestions = parseInt(competitionInput.value) || 0; + + // 添加可用性警告样式 + this.updateInputAvailability(basicInput, basicQuestions, basicAvailable); + this.updateInputAvailability(advancedInput, advancedQuestions, advancedAvailable); + this.updateInputAvailability(competitionInput, competitionQuestions, competitionAvailable); + + // 检查是否有足够的题目开始答题 + const canStart = basicQuestions <= basicAvailable && + advancedQuestions <= advancedAvailable && + competitionQuestions <= competitionAvailable && + (basicQuestions + advancedQuestions + competitionQuestions) > 0; const startBtn = document.getElementById('startSurvey'); startBtn.disabled = !canStart; if (!canStart) { - startBtn.textContent = '题目不足,无法开始'; - startBtn.style.background = '#ccc'; + if ((basicQuestions + advancedQuestions + competitionQuestions) === 0) { + startBtn.querySelector('.button-text').textContent = '请设置题目数量'; + } else { + startBtn.querySelector('.button-text').textContent = '题目不足,无法开始'; + } + startBtn.disabled = true; } else { - startBtn.textContent = '开始答题'; - startBtn.style.background = ''; + startBtn.querySelector('.button-text').textContent = '开始答题'; + startBtn.disabled = false; + } + } + + updateInputAvailability(input, requested, available) { + const ruleCard = input.closest('.rule-card'); + const statusElement = ruleCard.querySelector('.status-text'); + + if (requested > available) { + input.style.borderColor = '#e53e3e'; + statusElement.className = 'status-text error'; + statusElement.textContent = `题目不足:仅${available}题可用`; + } else if (requested === 0) { + input.style.borderColor = '#e2e8f0'; + statusElement.className = 'status-text'; + statusElement.textContent = `共${available}题可用`; + } else { + input.style.borderColor = '#48bb78'; + statusElement.className = 'status-text success'; + statusElement.textContent = `✓ 已选择${requested}题,共${available}题可用`; } } @@ -1076,8 +1883,8 @@ // 禁用按钮并显示加载状态 const startBtn = document.getElementById('startSurvey'); - const originalText = startBtn.textContent; - startBtn.textContent = '正在创建答题会话...'; + const originalText = startBtn.querySelector('.button-text').textContent; + startBtn.querySelector('.button-text').textContent = '正在创建答题会话...'; startBtn.disabled = true; // 调用后端API创建会话 @@ -1118,7 +1925,7 @@ // 恢复按钮状态 const startBtn = document.getElementById('startSurvey'); - startBtn.textContent = '开始答题'; + startBtn.querySelector('.button-text').textContent = '开始答题'; startBtn.disabled = false; } }