From 466b1c9cd9780e9cce4f25abcba53f80ec71b492 Mon Sep 17 00:00:00 2001 From: pk4wt2yal <1330800687@qq.com> Date: Mon, 25 Nov 2024 12:15:08 +0800 Subject: [PATCH] Delete 'src/my-online-judge-master/MYOJ/OJ_server/OJ_view.hpp' --- .../MYOJ/OJ_server/OJ_view.hpp | 71 ------------------- 1 file changed, 71 deletions(-) delete mode 100644 src/my-online-judge-master/MYOJ/OJ_server/OJ_view.hpp diff --git a/src/my-online-judge-master/MYOJ/OJ_server/OJ_view.hpp b/src/my-online-judge-master/MYOJ/OJ_server/OJ_view.hpp deleted file mode 100644 index 5825d95..0000000 --- a/src/my-online-judge-master/MYOJ/OJ_server/OJ_view.hpp +++ /dev/null @@ -1,71 +0,0 @@ -// 通常是拿到数据之后,进行构建网页,渲染网络内容,展示给用户的(浏览器功能) -#pragma once - -#include -#include -#include - -#include "../comm/Comm_model_MySQL.hpp" - -namespace ns_view -{ - using namespace std; - using namespace ns_model_MySQL; - - const string template_path = "/home/zzy1/2024/my-online-judge/MYOJ/OJ_server/template_html/"; - - class View - { - public: - View() - { - } - ~View() - { - } - - public: - void AllExpandHtml(const vector &questions, string *html) - { - // 题目的编号 题目的标题 题目的难度 - // 推荐使用表格显示 - // 1. 形成路径 - string src_html = template_path + "all_questions.html"; - // 2. 形成数据字典 - ctemplate::TemplateDictionary root("all_questions"); - for (const auto &q : questions) - { - ctemplate::TemplateDictionary *sub = root.AddSectionDictionary("question_list"); - sub->SetValue("number", q.number); - sub->SetValue("title", q.title); - sub->SetValue("star", q.star); - } - - // 3. 获取被渲染的html - ctemplate::Template *tpl = ctemplate::Template::GetTemplate(src_html, ctemplate::DO_NOT_STRIP); - - // 4. 开始完成渲染功能 - tpl->Expand(html, &root); - } - - void OneExpandHtml(const Question &q, string *html) - { - // 1. 形成路径 - string src_html = template_path + "one_question.html"; - - // 2. 形成数据字典(不需要循环了,只有一个题目) - ctemplate::TemplateDictionary root("one_question"); - root.SetValue("number", q.number); - root.SetValue("title", q.title); - root.SetValue("star", q.star); - root.SetValue("desc", q.desc); - root.SetValue("pre_code", q.header); - - // 3. 获取被渲染的html - ctemplate::Template *tpl = ctemplate::Template::GetTemplate(src_html, ctemplate::DO_NOT_STRIP); - - // 4. 开始完成渲染功能 - tpl->Expand(html, &root); - } - }; -} \ No newline at end of file