/**
* ClassName:ExamHtmlGenerator
* Description:
*
* @Author:独酌
* @Create:2025/3/30 10:40
*/
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
public class ExamHtmlGenerator {
// 选择题类
static class ChoiceQuestion {
String question;
Integer score;
List<String> options;
private ChoiceQuestion(String question, List<String> options ,Integer score) {
this.question = question;
this.options = options;
this.score = score;
}
}
// 填空题类
static class FillQuestion {
String question;
Integer score;
private FillQuestion(String question ,Integer score) {
this.question = question;
this.score = score;
}
}
// 简答题类
static class ShortQuestion {
String question;
Integer score;
private ShortQuestion(String question ,Integer score) {
this.question = question;
this.score = score;
}
}
// 编程题类
static class programmingQuestion {
String question;
Integer score;
private programmingQuestion(String question ,Integer score) {
this.question = question;
this.score = score;
}
}
public static String generateExamHtml(List<ChoiceQuestion> choiceQuestions, List<FillQuestion> fillQuestions, List<ShortQuestion> shortQuestions, List<programmingQuestion> programmingQuestions) {
StringBuilder html = new StringBuilder();
html.append("<!DOCTYPE html>\n");
html.append("<html lang=\"zh-CN\">\n");
html.append("<head>\n");
html.append(" <meta charset=\"UTF-8\">\n");
html.append(" <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n");
html.append(" <title>考核答题</title>\n");
html.append(" <!-- 引入 MathJax 库 -->\n");
html.append(" <script id=\"MathJax-script\" async src=\"https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js\"></script>\n");
html.append(" <style>\n");
html.append(" body {\n" +
" font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;\n" +
" background-color: #f4f4f9;\n" +
" display: flex;\n" +
" justify-content: center;\n" +
" align-items: center;\n" +
" min-height: 100vh;\n" +
" margin: 0;\n" +
" }\n" +
"\n" +
" .exam-container {\n" +
" background-color: #fff;\n" +
" border-radius: 10px;\n" +
" box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);\n" +
" padding: 40px;\n" +
" width: 90%;\n" +
" max-width: 800px;\n" +
" }\n" +
"\n" +
" h1 {\n" +
" text-align: center;\n" +
" color: #333;\n" +
" margin-bottom: 30px;\n" +
" }\n" +
"\n" +
" h2 {\n" +
" color: #555;\n" +
" margin-top: 30px;\n" +
" margin-bottom: 15px;\n" +
" }\n" +
"\n" +
" .question {\n" +
" margin-bottom: 20px;\n" +
" border-bottom: 1px solid #eee;\n" +
" padding-bottom: 20px;\n" +
" }\n" +
"\n" +
" .question p {\n" +
" font-weight: bold;\n" +
" color: #444;\n" +
" }\n" +
"\n" +
" input[type=\"radio\"],\n" +
" input[type=\"text\"],\n" +
" textarea {\n" +
" margin-top: 5px;\n" +
" margin-
项目经历-手写调查文档生成代码(小功能)
手写调查文档生成代码项目经历
于 2025-03-31 08:35:51 首次发布

最低0.47元/天 解锁文章
1152

被折叠的 条评论
为什么被折叠?



