2025年4月1日15:50:44

master
qmstyle 2025-04-01 15:53:02 +08:00
parent f0a6466feb
commit 36b85cb41d
16 changed files with 565 additions and 14 deletions

View File

@ -1,6 +1,7 @@
package com.zhangmeng.online.exam.ui.api; package com.zhangmeng.online.exam.ui.api;
import com.zhangmeng.online.exam.ui.admin.IndexPage; import com.zhangmeng.online.exam.ui.admin.IndexPage;
import com.zhangmeng.online.exam.ui.api.form.QuestionForm;
import com.zhangmeng.online.exam.ui.api.form.RoleForm; import com.zhangmeng.online.exam.ui.api.form.RoleForm;
import com.zhangmeng.online.exam.ui.api.form.UserForm; import com.zhangmeng.online.exam.ui.api.form.UserForm;
import com.zhangmeng.online.exam.ui.api.model.*; import com.zhangmeng.online.exam.ui.api.model.*;
@ -12,8 +13,11 @@ import javafx.beans.property.SimpleMapProperty;
import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.SimpleStringProperty;
import javafx.scene.control.ContextMenu; import javafx.scene.control.ContextMenu;
import javafx.scene.control.MenuItem; import javafx.scene.control.MenuItem;
import javafx.scene.control.TabPane;
import javafx.scene.control.TableView; import javafx.scene.control.TableView;
import com.alibaba.fastjson2.*; import com.alibaba.fastjson2.*;
import javafx.scene.layout.BorderPane;
import java.util.*; import java.util.*;
/** /**
@ -76,6 +80,7 @@ public class ApiUtils {
public static DataView getQuestionList() { public static DataView getQuestionList() {
DataLoad dataLoad = new QuestionDataLoad(); DataLoad dataLoad = new QuestionDataLoad();
dataLoad.setForm(new QuestionForm());
return dataLoad.loadData(PAGE_NUM,PAGE_SIZE); return dataLoad.loadData(PAGE_NUM,PAGE_SIZE);
} }
@ -99,10 +104,16 @@ public class ApiUtils {
return dataLoad.loadData(PAGE_NUM,PAGE_SIZE); return dataLoad.loadData(PAGE_NUM,PAGE_SIZE);
} }
public static DataView getProfessionList() {
DataLoad dataLoad = new ProfessionDataLoad();
return dataLoad.loadData(PAGE_NUM,PAGE_SIZE);
}
public static Map<String, SimpleStringProperty> selectedItem(MenuItem menuItem){ public static Map<String, SimpleStringProperty> selectedItem(MenuItem menuItem){
ContextMenu parentPopup = menuItem.getParentPopup(); ContextMenu parentPopup = menuItem.getParentPopup();
IndexPage indexPage = (IndexPage)parentPopup.getStyleableParent(); BorderPane indexPage = (BorderPane)parentPopup.getStyleableParent();
DynamicTableComponent center = (DynamicTableComponent)indexPage.getCenter(); TabPane tabPane = (TabPane)indexPage.getCenter();
DynamicTableComponent center = (DynamicTableComponent)tabPane.getSelectionModel().getSelectedItem().getContent();
TableView<Map<String, SimpleStringProperty>> tableView = center.getTableView(); TableView<Map<String, SimpleStringProperty>> tableView = center.getTableView();
return tableView.getSelectionModel().getSelectedItem(); return tableView.getSelectionModel().getSelectedItem();
} }
@ -111,6 +122,8 @@ public class ApiUtils {
System.out.println(context); System.out.println(context);
} }
public static class DataView { public static class DataView {
private List<String> keys; private List<String> keys;

View File

@ -0,0 +1,24 @@
package com.zhangmeng.online.exam.ui.api.form;
import com.zhangmeng.online.exam.ui.api.form.base.Form;
import javafx.fxml.FXMLLoader;
import java.io.IOException;
/**
* @author zm
* @date 2025/4/1 11:35
* @version: 1.0
*/
public class QuestionForm extends Form {
public QuestionForm() {
try {
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/fxml/question-edit.fxml"));
this.getChildren().add(fxmlLoader.load());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}

View File

@ -19,6 +19,7 @@ import javafx.scene.Parent;
import javafx.scene.control.ContextMenu; import javafx.scene.control.ContextMenu;
import javafx.scene.control.MenuItem; import javafx.scene.control.MenuItem;
import javafx.scene.control.TableView; import javafx.scene.control.TableView;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage; import javafx.stage.Stage;
import java.util.*; import java.util.*;
@ -146,7 +147,7 @@ public class PaperDataLoad implements DataLoad {
String id = map.get("id").getValue(); String id = map.get("id").getValue();
// AlertUtils.alert_msg("组卷正在开发中..." + id); // AlertUtils.alert_msg("组卷正在开发中..." + id);
ContextMenu parentPopup = group_volumes.getParentPopup(); ContextMenu parentPopup = group_volumes.getParentPopup();
IndexPage indexPage = (IndexPage) parentPopup.getStyleableParent(); BorderPane indexPage = (BorderPane) parentPopup.getStyleableParent();
Stage stage = (Stage) indexPage.getScene().getWindow(); Stage stage = (Stage) indexPage.getScene().getWindow();
Map<String, Object> context = new HashMap<>(); Map<String, Object> context = new HashMap<>();

View File

@ -0,0 +1,137 @@
package com.zhangmeng.online.exam.ui.api.model;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.zhangmeng.online.exam.ui.api.ApiUtils;
import com.zhangmeng.online.exam.ui.api.DataLoad;
import com.zhangmeng.online.exam.ui.api.form.UserForm;
import com.zhangmeng.online.exam.ui.utils.AlertUtils;
import com.zhangmeng.online.exam.ui.utils.HttpUtils;
import javafx.beans.property.SimpleStringProperty;
import javafx.scene.Parent;
import javafx.scene.control.MenuItem;
import javafx.stage.Stage;
import java.util.*;
/**
* @author zm
* @date 2025/4/1 11:26
* @version: 1.0
*/
public class ProfessionDataLoad implements DataLoad {
private Parent form;
@Override
public ApiUtils.DataView loadData(Integer pageNum, Integer pageSize) {
Map<String, Object> params = new HashMap<>();
params.put("pageNum", pageNum.toString());
params.put("pageSize", pageSize.toString());
String userListData = HttpUtils.GET(ApiUtils.API_URL + "/profession/list", params);
JSONObject jsonObject = JSON.parseObject(userListData);
JSONArray data = jsonObject.getJSONArray("data");
int total = jsonObject.getIntValue("total");
List<Map<String, SimpleStringProperty>> professionMapList = new ArrayList<>();
for (Object datum : data) {
JSONObject user = (JSONObject) datum;
Map<String, SimpleStringProperty> userMap = new HashMap<>();
userMap.put("序号", new SimpleStringProperty(user.getString("id")));
userMap.put("职业名称", new SimpleStringProperty(user.getString("name")));
userMap.put("职业名称_name", new SimpleStringProperty(user.getString("name")));
userMap.put("id", new SimpleStringProperty(user.getString("id")));
professionMapList.add(userMap);
}
ApiUtils.DataView dataView = new ApiUtils.DataView(Arrays.asList("序号", "职业名称" ), professionMapList).setDataLoad(this).setPageNum(pageNum).setPageSize(pageSize).setTotal(total);
dataView.setDataLoad(this);
return dataView;
}
@Override
public void setForm(Parent view) {
this.form = view;
}
@Override
public Parent getForm() {
return this.form;
}
@Override
public Map<String, Object> saveForm(Map<String, Object> map) {
String result = HttpUtils.POST(ApiUtils.API_URL + "/profession/save", map);
JSONObject jsonObject = JSON.parseObject(result);
if (jsonObject.getIntValue("code") == 200){
AlertUtils.alert_msg("保存成功!");
}else {
AlertUtils.alert_warning("保存失败!");
}
return null;
}
@Override
public void deleteData(String id) {
Map<String, Object> map = new HashMap<>();
map.put("id", id);
String result = HttpUtils.POST(ApiUtils.API_URL + "/profession/delete", map);
JSONObject jsonObject = JSON.parseObject(result);
if (jsonObject.getIntValue("code") == 200){
AlertUtils.alert_msg("删除成功!");
}else {
AlertUtils.alert_warning("删除失败!");
}
}
@Override
public void editData(String id, Stage stage) {
UserForm userForm = new UserForm(true);
Map<String, Object> map = new HashMap<>();
map.put("id", id);
String result = HttpUtils.GET(ApiUtils.API_URL + "/profession/getProfession", map);
JSONObject jsonObject = JSON.parseObject(result);
JSONObject data = jsonObject.getJSONObject("data");
String username = data.getString("username");
userForm.getUsername_field().setText(username);
String email = data.getString("email");
userForm.getEmail_field().setText(email);
String phone = data.getString("phone");
userForm.getPhone_field().setText(phone);
String password = data.getString("password");
userForm.getPassword_field().setText(password);
AlertUtils.alert("编辑用户信息", (Parent) userForm, stage);
}
@Override
public void updateData(String id, String name, String oldValue, String newValue) {
// System.out.println("修改前:" + oldValue + ",修改后:" + newValue);
Map<String, Object> map = new HashMap<>();
map.put("id", id);
map.put("fieldName", name);
map.put("oldValue", oldValue);
map.put("newValue", newValue);
String result = HttpUtils.POST(ApiUtils.API_URL + "/profession/update", map);
JSONObject jsonObject = JSON.parseObject(result);
if (jsonObject.getIntValue("code") == 200){
AlertUtils.alert_msg("更新成功!");
}else {
AlertUtils.alert_warning("更新失败!");
}
}
@Override
public List<MenuItem> getContextMenu() {
return null;
}
@Override
public ApiUtils.DataView searchData(Map<String, Object> searchText, int pageNum, int pageSize) {
return null;
}
}

View File

@ -5,6 +5,7 @@ import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.zhangmeng.online.exam.ui.api.ApiUtils; import com.zhangmeng.online.exam.ui.api.ApiUtils;
import com.zhangmeng.online.exam.ui.api.DataLoad; import com.zhangmeng.online.exam.ui.api.DataLoad;
import com.zhangmeng.online.exam.ui.utils.AlertUtils;
import com.zhangmeng.online.exam.ui.utils.HttpUtils; import com.zhangmeng.online.exam.ui.utils.HttpUtils;
import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.SimpleStringProperty;
import javafx.scene.Parent; import javafx.scene.Parent;
@ -21,6 +22,9 @@ import static com.zhangmeng.online.exam.ui.api.ApiUtils.API_URL;
* @version: 1.0 * @version: 1.0
*/ */
public class QuestionDataLoad implements DataLoad { public class QuestionDataLoad implements DataLoad {
private Parent form;
@Override @Override
public ApiUtils.DataView loadData(Integer pageNum, Integer pageSize) { public ApiUtils.DataView loadData(Integer pageNum, Integer pageSize) {
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
@ -41,8 +45,8 @@ public class QuestionDataLoad implements DataLoad {
userMap.put("所属学科", new SimpleStringProperty(permission.getString("subject"))); userMap.put("所属学科", new SimpleStringProperty(permission.getString("subject")));
userMap.put("分值", new SimpleStringProperty(permission.getString("score"))); userMap.put("分值", new SimpleStringProperty(permission.getString("score")));
userMap.put("id", new SimpleStringProperty(permission.getString("id"))); userMap.put("id", new SimpleStringProperty(permission.getString("id")));
userMap.put("score", new SimpleStringProperty(permission.getString("score"))); userMap.put("分值_score", new SimpleStringProperty(permission.getString("score")));
userMap.put("type", new SimpleStringProperty(permission.getString("type"))); userMap.put("题目_name", new SimpleStringProperty(permission.getString("name")));
questionMapList.add(userMap); questionMapList.add(userMap);
} }
return new ApiUtils.DataView(Arrays.asList("序号", "题目", "题目类型", "所属学科", "分值"), questionMapList).setDataLoad(this).setPageNum(pageNum).setPageSize(pageSize).setTotal(total); return new ApiUtils.DataView(Arrays.asList("序号", "题目", "题目类型", "所属学科", "分值"), questionMapList).setDataLoad(this).setPageNum(pageNum).setPageSize(pageSize).setTotal(total);
@ -51,12 +55,12 @@ public class QuestionDataLoad implements DataLoad {
@Override @Override
public void setForm(Parent view) { public void setForm(Parent view) {
this.form = view;
} }
@Override @Override
public Parent getForm() { public Parent getForm() {
return null; return this.form;
} }
@Override @Override
@ -76,7 +80,18 @@ public class QuestionDataLoad implements DataLoad {
@Override @Override
public void updateData(String id, String name, String oldValue, String newValue) { public void updateData(String id, String name, String oldValue, String newValue) {
Map<String, Object> map = new HashMap<>();
map.put("id", id);
map.put("fieldName", name);
map.put("oldValue", oldValue);
map.put("newValue", newValue);
String result = HttpUtils.POST(ApiUtils.API_URL + "/question/update", map);
JSONObject jsonObject = JSON.parseObject(result);
if (jsonObject.getIntValue("code") == 200){
AlertUtils.alert_msg("更新成功!");
}else {
AlertUtils.alert_warning("更新失败!");
}
} }

View File

@ -84,6 +84,7 @@ public class LoginController {
if (jsonObject.getIntValue("code") == 2001) { if (jsonObject.getIntValue("code") == 2001) {
Map<String, Object> data = (Map<String, Object>) jsonObject.get("data"); Map<String, Object> data = (Map<String, Object>) jsonObject.get("data");
Object token = data.get("token"); Object token = data.get("token");
System.out.println("token:" + token);
HttpUtils.USER_INFO.put("token", token); HttpUtils.USER_INFO.put("token", token);
User user = new User(); User user = new User();

View File

@ -130,12 +130,13 @@ public class MainController {
// 根据标题加载不同的内容 // 根据标题加载不同的内容
Node content = switch (menuData.getUrl()) { Node content = switch (menuData.getUrl()) {
case "/user/list" -> init_table( ApiUtils.getUserList()); case "/user/list" -> init_table( ApiUtils.getUserList());
case "添加用户" -> FXMLLoader.load(getClass().getResource("/fxml/user-edit.fxml")); case "/paper/list" -> init_table(ApiUtils.getExamPaper());
case "角色列表" -> FXMLLoader.load(getClass().getResource("/fxml/role-list.fxml")); case "/role/list" -> init_table(ApiUtils.getRoleList());
case "权限分配" -> FXMLLoader.load(getClass().getResource("/fxml/role-permission.fxml")); case "/question/list" -> init_table(ApiUtils.getQuestionList());
case "基本设置" -> FXMLLoader.load(getClass().getResource("/fxml/setting.fxml")); case "/subject/list" -> init_table(ApiUtils.getSubjectList());
case "日志查看" -> FXMLLoader.load(getClass().getResource("/fxml/log.fxml")); case "/questionOption/list" -> init_table(ApiUtils.getQuestionOptionList());
case "公告列表" -> FXMLLoader.load(getClass().getResource("/fxml/notice-list.fxml")); case "/permission/list" -> init_table(ApiUtils.getPermissionList());
case "/profession/list" -> init_table(ApiUtils.getProfessionList());
case "发布公告" -> FXMLLoader.load(getClass().getResource("/fxml/notice-edit.fxml")); case "发布公告" -> FXMLLoader.load(getClass().getResource("/fxml/notice-edit.fxml"));
case "在线用户" -> FXMLLoader.load(getClass().getResource("/fxml/monitor-online.fxml")); case "在线用户" -> FXMLLoader.load(getClass().getResource("/fxml/monitor-online.fxml"));
case "系统日志" -> FXMLLoader.load(getClass().getResource("/fxml/monitor-log.fxml")); case "系统日志" -> FXMLLoader.load(getClass().getResource("/fxml/monitor-log.fxml"));

View File

@ -0,0 +1,84 @@
package com.zhangmeng.online.exam.ui.controller;
import com.zhangmeng.online.exam.ui.module.QuestionType;
import com.zhangmeng.online.exam.ui.module.SubjectType;
import com.zhangmeng.online.exam.ui.service.QuestionService;
import com.zhangmeng.online.exam.ui.service.SubjectService;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.Parent;
import javafx.scene.control.*;
import javafx.util.Callback;
import javafx.util.StringConverter;
import java.util.List;
/**
* @author zm
* @date 2025/4/1 12:00
* @version: 1.0
*/
public class QuestionEditController {
@FXML
public TextField scoreField;
@FXML
public TextField explanationField;
@FXML
public ComboBox<QuestionType> typeComboBox;
public ComboBox<SubjectType> subjectComboBox;
@FXML
private TextField questionField;
@FXML
public void initialize() {
typeComboBox.getItems().addAll(QuestionService.getALLQuestionType());
typeComboBox.getSelectionModel().selectFirst();
typeComboBox.setConverter(new StringConverter<QuestionType>() {
@Override
public String toString(QuestionType object) {
return object.getDesc();
}
@Override
public QuestionType fromString(String string) {
return null;
}
});
subjectComboBox.getItems().addAll(SubjectService.getALLSubjectType());
subjectComboBox.getSelectionModel().selectFirst();
subjectComboBox.setConverter(new StringConverter<SubjectType>() {
@Override
public String toString(SubjectType object) {
return object.getName();
}
@Override
public SubjectType fromString(String string) {
return null;
}
});
}
public void handleSave(ActionEvent actionEvent) {
QuestionType questionType = typeComboBox.getSelectionModel().getSelectedItem();
SubjectType subjectType = subjectComboBox.getSelectionModel().getSelectedItem();
String question = questionField.getText();
String score = scoreField.getText();
String explanation = explanationField.getText();
QuestionService.saveQuestion(questionType.getType(), subjectType.getId(), question, score, explanation);
}
public void handleCancel(ActionEvent actionEvent) {
}
}

View File

@ -0,0 +1,44 @@
package com.zhangmeng.online.exam.ui.module;
/**
* @author zm
* @date 2025/4/1 12:07
* @version: 1.0
*/
public class QuestionType {
private String type;
private String desc;
private int index;
public QuestionType(String type, String desc, int index) {
this.type = type;
this.desc = desc;
this.index = index;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public int getIndex() {
return index;
}
public void setIndex(int index) {
this.index = index;
}
}

View File

@ -0,0 +1,74 @@
package com.zhangmeng.online.exam.ui.module;
/**
* @author zm
* @date 2025/4/1 12:12
* @version: 1.0
*/
public class SubjectType {
/**
* map.put("index", subject.getId());
* map.put("name", subject.getName());
* map.put("code", subject.getCode());
* map.put("desc",subject.getDescription());
* map.put("profession",subject.getProfession().getName());
*/
private Long id;
private String name;
private String code;
private String desc;
private String profession;
public SubjectType() {
}
public SubjectType(Long id, String name, String code, String desc, String profession) {
this.id = id;
this.name = name;
this.code = code;
this.desc = desc;
this.profession = profession;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public String getProfession() {
return profession;
}
public void setProfession(String profession) {
this.profession = profession;
}
}

View File

@ -0,0 +1,54 @@
package com.zhangmeng.online.exam.ui.service;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.zhangmeng.online.exam.ui.api.ApiUtils;
import com.zhangmeng.online.exam.ui.module.QuestionType;
import com.zhangmeng.online.exam.ui.utils.AlertUtils;
import com.zhangmeng.online.exam.ui.utils.HttpUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author zm
* @date 2025/4/1 12:04
* @version: 1.0
*/
public class QuestionService {
public static List<QuestionType> getALLQuestionType() {
Map<String, Object> params = new HashMap<>();
params.put("token", UserService.getCurrentUser().getToken());
// params.put("token", HttpUtils.Token);
String response = HttpUtils.GET(ApiUtils.API_URL + "/question/getAllQuestionType", params);
JSONObject jsonObject = JSONObject.parseObject(response);
List<QuestionType> questionTypes = new ArrayList<>();
if (jsonObject.getIntValue("code") == 200) {
questionTypes = JSONArray.parseArray(jsonObject.getString("data"), QuestionType.class);
}
return questionTypes;
}
public static void saveQuestion(String type, Long id, String question, String score, String explanation) {
Map<String, Object> params = new HashMap<>();
params.put("token", UserService.getCurrentUser().getToken());
params.put("type", type);
params.put("id", id);
params.put("question", question);
params.put("score", score);
params.put("explanation", explanation);
String response = HttpUtils.POST(ApiUtils.API_URL + "/question/saveQuestion", params);
JSONObject jsonObject = JSONObject.parseObject(response);
if (jsonObject.getIntValue("code") == 200) {
AlertUtils.alert_msg("保存成功");
} else {
AlertUtils.alert_warning("保存失败");
}
}
}

View File

@ -0,0 +1,34 @@
package com.zhangmeng.online.exam.ui.service;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.zhangmeng.online.exam.ui.api.ApiUtils;
import com.zhangmeng.online.exam.ui.module.QuestionType;
import com.zhangmeng.online.exam.ui.module.SubjectType;
import com.zhangmeng.online.exam.ui.utils.HttpUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author zm
* @date 2025/4/1 14:37
* @version: 1.0
*/
public class SubjectService {
public static List<SubjectType> getALLSubjectType() {
Map<String, Object> params = new HashMap<>();
params.put("token", UserService.getCurrentUser().getToken());
// params.put("token", HttpUtils.Token);
String response = HttpUtils.GET(ApiUtils.API_URL + "/subject/getALLSubjectType", params);
JSONObject jsonObject = JSONObject.parseObject(response);
List<SubjectType> questionTypes = new ArrayList<>();
if (jsonObject.getIntValue("code") == 200) {
questionTypes = JSONArray.parseArray(jsonObject.getString("data"), SubjectType.class);
}
return questionTypes;
}
}

View File

@ -1,5 +1,6 @@
package com.zhangmeng.online.exam.ui.utils; package com.zhangmeng.online.exam.ui.utils;
import com.zhangmeng.online.exam.ui.api.form.QuestionForm;
import com.zhangmeng.online.exam.ui.api.form.RoleForm; import com.zhangmeng.online.exam.ui.api.form.RoleForm;
import com.zhangmeng.online.exam.ui.api.form.UserForm; import com.zhangmeng.online.exam.ui.api.form.UserForm;
import com.zhangmeng.online.exam.ui.api.form.base.Form; import com.zhangmeng.online.exam.ui.api.form.base.Form;
@ -22,6 +23,7 @@ public class FxUtils {
public final static double DEFAULT_HEIGHT = 720; public final static double DEFAULT_HEIGHT = 720;
public static void alert(String title, Parent node, Stage primaryStage) { public static void alert(String title, Parent node, Stage primaryStage) {
Form form = (Form) node; Form form = (Form) node;
if (form instanceof UserForm) { if (form instanceof UserForm) {
form = new UserForm(true); form = new UserForm(true);
@ -30,6 +32,10 @@ public class FxUtils {
form = new RoleForm(); form = new RoleForm();
} }
if (form instanceof QuestionForm){
form = new QuestionForm();
}
Scene scene = new Scene(form); Scene scene = new Scene(form);
Stage dialogStage = new Stage(); Stage dialogStage = new Stage();
dialogStage.setTitle(title); dialogStage.setTitle(title);

View File

@ -20,6 +20,8 @@ import java.util.Map;
public class HttpUtils<T> { public class HttpUtils<T> {
public static final String Token = "eyJhbGciOiJIUzI1NiJ9.eyJMT0dJTl9VU0VSX0tFWSI6ImUwZWI0MDk2LTRjYzctNDAzOC1iZWI4LTY4OWEzMzZjN2FiNSJ9.BcM1VxIBXDgpu1fzSSRGFPeaOXEzdPJQPr8Mh8PL-UU";
public static Map<String, Object> USER_INFO = new HashMap<>(); public static Map<String, Object> USER_INFO = new HashMap<>();
public static <T> T GET(String url, Class<T> clazz) { public static <T> T GET(String url, Class<T> clazz) {

View File

@ -12,4 +12,5 @@ module com.zhangmeng.onlineexamui {
opens com.zhangmeng.online.exam.ui.controller to javafx.fxml; opens com.zhangmeng.online.exam.ui.controller to javafx.fxml;
exports com.zhangmeng.online.exam.ui.controller; exports com.zhangmeng.online.exam.ui.controller;
exports com.zhangmeng.online.exam.ui.module;
} }

View File

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.ComboBox?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.layout.VBox?>
<VBox prefHeight="236.0" prefWidth="600.0" spacing="10" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.zhangmeng.online.exam.ui.controller.QuestionEditController">
<padding>
<Insets bottom="10" left="10" right="10" top="10" />
</padding>
<GridPane hgap="10" vgap="10">
<columnConstraints>
<ColumnConstraints minWidth="80" prefWidth="100" />
<ColumnConstraints hgrow="ALWAYS" />
</columnConstraints>
<Label text="问题:" GridPane.columnIndex="0" GridPane.rowIndex="0" />
<TextField fx:id="questionField" GridPane.columnIndex="1" GridPane.rowIndex="0" />
<Label text="分值:" GridPane.columnIndex="0" GridPane.rowIndex="1" />
<TextField fx:id="scoreField" GridPane.columnIndex="1" GridPane.rowIndex="1" />
<Label text="问题解析:" GridPane.columnIndex="0" GridPane.rowIndex="2" />
<TextField fx:id="explanationField" GridPane.columnIndex="1" GridPane.rowIndex="2" />
<Label text="类型:" GridPane.columnIndex="0" GridPane.rowIndex="3" />
<ComboBox fx:id="typeComboBox" GridPane.columnIndex="1" GridPane.rowIndex="3" />
<Label text="所属学科:" GridPane.columnIndex="0" GridPane.rowIndex="4" />
<ComboBox fx:id="subjectComboBox" GridPane.columnIndex="1" GridPane.rowIndex="4" />
<rowConstraints>
<RowConstraints />
<RowConstraints />
<RowConstraints />
<RowConstraints />
<RowConstraints />
</rowConstraints>
</GridPane>
<HBox alignment="CENTER_RIGHT" spacing="10">
<Button defaultButton="true" onAction="#handleSave" text="保存" />
<Button cancelButton="true" onAction="#handleCancel" text="取消" />
<VBox.margin>
<Insets top="14.0" />
</VBox.margin>
</HBox>
</VBox>