|
|
@@ -4,240 +4,25 @@
|
|
|
<?import javafx.scene.control.*?>
|
|
|
<?import javafx.scene.layout.*?>
|
|
|
|
|
|
-<BorderPane xmlns="http://javafx.com/javafx/23" xmlns:fx="http://javafx.com/fxml/1" fx:controller="space.anyi.client.controller.MainController" prefWidth="1000" prefHeight="700">
|
|
|
+<BorderPane xmlns="http://javafx.com/javafx/23" xmlns:fx="http://javafx.com/fxml/1" fx:controller="space.anyi.client.controller.MainController" prefWidth="1100" prefHeight="720">
|
|
|
<top>
|
|
|
- <HBox alignment="CENTER_LEFT" spacing="10" style="-fx-background-color: #2c3e50; -fx-padding: 10 15;">
|
|
|
- <Label fx:id="welcomeLabel" text="欢迎" style="-fx-text-fill: white; -fx-font-size: 16px;" HBox.hgrow="ALWAYS"/>
|
|
|
- <Button text="退出登录" onAction="#handleLogout" styleClass="btn,btn-danger"/>
|
|
|
+ <HBox alignment="CENTER_LEFT" styleClass="navbar" spacing="0">
|
|
|
+ <padding><Insets left="8" right="20"/></padding>
|
|
|
+ <Hyperlink fx:id="navBrowse" text="📖 浏览书籍" onAction="#handleNavBrowse" style="-fx-padding: 16px 18px; -fx-font-size: 14px;"/>
|
|
|
+ <Hyperlink fx:id="navTrans" text="📄 我的交易" onAction="#handleNavTrans" style="-fx-padding: 16px 18px; -fx-font-size: 14px;"/>
|
|
|
+ <Hyperlink fx:id="navSeller" text="🏪 卖家中心" onAction="#handleNavSeller" style="-fx-padding: 16px 18px; -fx-font-size: 14px;"/>
|
|
|
+ <Hyperlink fx:id="navStats" text="📊 数据统计" onAction="#handleNavStats" style="-fx-padding: 16px 18px; -fx-font-size: 14px;"/>
|
|
|
+ <Hyperlink fx:id="navAdmin" text="⚙️ 管理" onAction="#handleNavAdmin" style="-fx-padding: 16px 18px; -fx-font-size: 14px;"/>
|
|
|
+ <Region HBox.hgrow="ALWAYS"/>
|
|
|
+ <MenuButton fx:id="userMenu" style="-fx-font-size: 13px; -fx-padding: 0 12px;">
|
|
|
+ <items>
|
|
|
+ <MenuItem text="👤 个人信息" onAction="#handleNavProfile"/>
|
|
|
+ <MenuItem text="退出登录" onAction="#handleLogout"/>
|
|
|
+ </items>
|
|
|
+ </MenuButton>
|
|
|
</HBox>
|
|
|
</top>
|
|
|
<center>
|
|
|
- <TabPane>
|
|
|
- <Tab text="浏览书籍" closable="false">
|
|
|
- <VBox spacing="10">
|
|
|
- <padding><Insets top="10" right="10" bottom="10" left="10"/></padding>
|
|
|
- <HBox spacing="10">
|
|
|
- <TextField fx:id="searchField" promptText="搜索书名/作者..." HBox.hgrow="ALWAYS"/>
|
|
|
- <ComboBox fx:id="categoryCombo" prefWidth="150"/>
|
|
|
- <Button text="搜索" onAction="#handleSearch" styleClass="btn,btn-info"/>
|
|
|
- </HBox>
|
|
|
- <SplitPane dividerPositions="0.6" VBox.vgrow="ALWAYS">
|
|
|
- <TableView fx:id="bookTable">
|
|
|
- <columns>
|
|
|
- <TableColumn fx:id="bookIdCol" text="编号" prefWidth="50"/>
|
|
|
- <TableColumn fx:id="titleCol" text="书名" prefWidth="200"/>
|
|
|
- <TableColumn fx:id="authorCol" text="作者" prefWidth="120"/>
|
|
|
- <TableColumn fx:id="categoryCol" text="分类" prefWidth="100"/>
|
|
|
- <TableColumn fx:id="priceCol" text="价格" prefWidth="80"/>
|
|
|
- <TableColumn fx:id="stockCol" text="库存" prefWidth="60"/>
|
|
|
- </columns>
|
|
|
- </TableView>
|
|
|
- <VBox spacing="10" alignment="TOP_CENTER">
|
|
|
- <padding><Insets top="10"/></padding>
|
|
|
- <Label text="书籍详情"
|
|
|
- style="-fx-font-weight: bold; -fx-font-size: 16px;"/>
|
|
|
- <Label fx:id="detailTitle" text="-"/>
|
|
|
- <Label fx:id="detailAuthor" text="-"/>
|
|
|
- <Label fx:id="detailCategory" text="-"/>
|
|
|
- <Label fx:id="detailPrice" text="-"/>
|
|
|
- <Label fx:id="detailStock" text="-"/>
|
|
|
- <TextField fx:id="quantityField" promptText="数量" maxWidth="100"/>
|
|
|
- <Button text="购买" onAction="#handlePurchase" styleClass="btn,btn-success"/>
|
|
|
- </VBox>
|
|
|
- </SplitPane>
|
|
|
- </VBox>
|
|
|
- </Tab>
|
|
|
- <Tab text="我的交易" closable="false">
|
|
|
- <VBox spacing="10">
|
|
|
- <padding><Insets top="10" right="10" bottom="10" left="10"/></padding>
|
|
|
- <Button text="刷新" onAction="#handleLoadTransactions" styleClass="btn,btn-secondary"/>
|
|
|
- <TableView fx:id="transTable" VBox.vgrow="ALWAYS">
|
|
|
- <columns>
|
|
|
- <TableColumn fx:id="transIdCol" text="交易编号" prefWidth="80"/>
|
|
|
- <TableColumn fx:id="transBookIdCol" text="书籍编号" prefWidth="80"/>
|
|
|
- <TableColumn fx:id="transNumCol" text="数量" prefWidth="80"/>
|
|
|
- <TableColumn fx:id="transPriceCol" text="总价" prefWidth="100"/>
|
|
|
- <TableColumn fx:id="transTimeCol" text="时间" prefWidth="200"/>
|
|
|
- </columns>
|
|
|
- </TableView>
|
|
|
- </VBox>
|
|
|
- </Tab>
|
|
|
- <Tab text="个人信息" closable="false">
|
|
|
- <VBox spacing="12" maxWidth="400">
|
|
|
- <padding><Insets top="20" right="20" bottom="20" left="20"/></padding>
|
|
|
- <Label text="个人信息"
|
|
|
- style="-fx-font-weight: bold; -fx-font-size: 16px;"/>
|
|
|
- <HBox spacing="10"><Label text="用户名:" prefWidth="100"/><TextField fx:id="profileUsername" editable="false"/></HBox>
|
|
|
- <HBox spacing="10"><Label text="昵称:" prefWidth="100"/><TextField fx:id="profileNickname"/></HBox>
|
|
|
- <HBox spacing="10"><Label text="邮箱:" prefWidth="100"/><TextField fx:id="profileEmail"/></HBox>
|
|
|
- <HBox spacing="10"><Label text="电话:" prefWidth="100"/><TextField fx:id="profilePhone"/></HBox>
|
|
|
- <HBox spacing="10"><Label text="院系:" prefWidth="100"/><TextField fx:id="profileDept"/></HBox>
|
|
|
- <HBox spacing="10"><Label text="信用分:" prefWidth="100"/><Label fx:id="profileCredit"/></HBox>
|
|
|
- <Button text="保存修改" onAction="#handleUpdateProfile" styleClass="btn,btn-primary"/>
|
|
|
- </VBox>
|
|
|
- </Tab>
|
|
|
- <Tab fx:id="sellerTab" text="卖家中心" closable="false">
|
|
|
- <VBox spacing="10">
|
|
|
- <padding><Insets top="10" right="10" bottom="10" left="10"/></padding>
|
|
|
- <Label text="我的书籍" style="-fx-font-weight: bold;"/>
|
|
|
- <Button text="刷新" onAction="#handleLoadMyBooks" styleClass="btn,btn-secondary"/>
|
|
|
- <TableView fx:id="myBookTable" VBox.vgrow="ALWAYS">
|
|
|
- <columns>
|
|
|
- <TableColumn fx:id="myBookIdCol" text="编号" prefWidth="50"/>
|
|
|
- <TableColumn fx:id="myBookTitleCol" text="书名" prefWidth="250"/>
|
|
|
- <TableColumn fx:id="myBookPriceCol" text="价格" prefWidth="80"/>
|
|
|
- <TableColumn fx:id="myBookStockCol" text="库存" prefWidth="60"/>
|
|
|
- </columns>
|
|
|
- </TableView>
|
|
|
- <HBox spacing="10">
|
|
|
- <Button text="编辑选中" onAction="#handleEditBook" styleClass="btn,btn-warning"/>
|
|
|
- <Button text="查看销售记录" onAction="#handleViewSales" styleClass="btn,btn-info"/>
|
|
|
- <Button text="删除选中" onAction="#handleDeleteBook" styleClass="btn,btn-danger"/>
|
|
|
- </HBox>
|
|
|
- <TitledPane fx:id="bookFormPane" text="添加新书" expanded="false">
|
|
|
- <GridPane hgap="10" vgap="8">
|
|
|
- <padding><Insets top="10" right="10" bottom="10" left="10"/></padding>
|
|
|
- <Label text="书名" GridPane.rowIndex="0" GridPane.columnIndex="0"/><TextField fx:id="newTitle" GridPane.rowIndex="0" GridPane.columnIndex="1"/>
|
|
|
- <Label text="作者" GridPane.rowIndex="1" GridPane.columnIndex="0"/><TextField fx:id="newAuthor" GridPane.rowIndex="1" GridPane.columnIndex="1"/>
|
|
|
- <Label text="分类" GridPane.rowIndex="2" GridPane.columnIndex="0"/><TextField fx:id="newCategory" GridPane.rowIndex="2" GridPane.columnIndex="1"/>
|
|
|
- <Label text="原价" GridPane.rowIndex="3" GridPane.columnIndex="0"/><TextField fx:id="newOriginalPrice" GridPane.rowIndex="3" GridPane.columnIndex="1"/>
|
|
|
- <Label text="售价" GridPane.rowIndex="4" GridPane.columnIndex="0"/><TextField fx:id="newSellingPrice" GridPane.rowIndex="4" GridPane.columnIndex="1"/>
|
|
|
- <Label text="库存" GridPane.rowIndex="5" GridPane.columnIndex="0"/><TextField fx:id="newStock" GridPane.rowIndex="5" GridPane.columnIndex="1"/>
|
|
|
- <Button fx:id="saveBookBtn" text="添加书籍" onAction="#handleAddBook" GridPane.rowIndex="6" GridPane.columnIndex="1" styleClass="btn,btn-success"/>
|
|
|
- </GridPane>
|
|
|
- </TitledPane>
|
|
|
- </VBox>
|
|
|
- </Tab>
|
|
|
- <Tab text="数据统计" closable="false">
|
|
|
- <ScrollPane fitToWidth="true">
|
|
|
- <VBox spacing="15">
|
|
|
- <padding><Insets top="15" right="15" bottom="15" left="15"/></padding>
|
|
|
- <Button text="刷新数据" onAction="#handleLoadStatistics" maxWidth="200" styleClass="btn,btn-secondary"/>
|
|
|
- <TitledPane text="总览" expanded="true">
|
|
|
- <HBox spacing="40">
|
|
|
- <padding><Insets top="10" right="10" bottom="10" left="10"/></padding>
|
|
|
- <VBox spacing="5">
|
|
|
- <Label text="交易总金额" style="-fx-font-weight: bold;"/>
|
|
|
- <Label fx:id="statTotalAmount" text="-" style="-fx-font-size: 20px; -fx-text-fill: #27ae60;"/>
|
|
|
- </VBox>
|
|
|
- <VBox spacing="5">
|
|
|
- <Label text="交易总笔数" style="-fx-font-weight: bold;"/>
|
|
|
- <Label fx:id="statTotalCount" text="-" style="-fx-font-size: 20px;"/>
|
|
|
- </VBox>
|
|
|
- </HBox>
|
|
|
- </TitledPane>
|
|
|
- <TitledPane text="热门院系(销量前三)" expanded="true">
|
|
|
- <TableView fx:id="deptTable" prefHeight="150">
|
|
|
- <columns>
|
|
|
- <TableColumn fx:id="deptNameCol" text="院系" prefWidth="250"/>
|
|
|
- <TableColumn fx:id="deptSalesCol" text="销售额" prefWidth="200"/>
|
|
|
- </columns>
|
|
|
- </TableView>
|
|
|
- </TitledPane>
|
|
|
- <TitledPane text="热门书籍(前五)" expanded="true">
|
|
|
- <TableView fx:id="hotBookTable" prefHeight="150">
|
|
|
- <columns>
|
|
|
- <TableColumn fx:id="hotBookIdCol" text="编号" prefWidth="50"/>
|
|
|
- <TableColumn fx:id="hotBookTitleCol" text="书名" prefWidth="250"/>
|
|
|
- <TableColumn fx:id="hotBookAuthorCol" text="作者" prefWidth="120"/>
|
|
|
- <TableColumn fx:id="hotBookSoldCol" text="销量" prefWidth="80"/>
|
|
|
- </columns>
|
|
|
- </TableView>
|
|
|
- </TitledPane>
|
|
|
- <TitledPane text="各院系平均折扣率" expanded="true">
|
|
|
- <TableView fx:id="discountTable" prefHeight="150">
|
|
|
- <columns>
|
|
|
- <TableColumn fx:id="discountDeptCol" text="院系" prefWidth="250"/>
|
|
|
- <TableColumn fx:id="discountRateCol" text="平均折扣率" prefWidth="200"/>
|
|
|
- </columns>
|
|
|
- </TableView>
|
|
|
- </TitledPane>
|
|
|
- </VBox>
|
|
|
- </ScrollPane>
|
|
|
- </Tab>
|
|
|
- <Tab fx:id="adminTab" text="管理" closable="false">
|
|
|
- <ScrollPane fitToWidth="true">
|
|
|
- <VBox spacing="10">
|
|
|
- <padding><Insets top="10" right="10" bottom="10" left="10"/></padding>
|
|
|
- <Label text="用户管理" style="-fx-font-weight: bold; -fx-font-size: 16px;"/>
|
|
|
- <Button text="刷新用户" onAction="#handleLoadAllUsers" styleClass="btn,btn-secondary"/>
|
|
|
- <TableView fx:id="userTable" prefHeight="150">
|
|
|
- <columns>
|
|
|
- <TableColumn fx:id="userIdCol" text="编号" prefWidth="50"/>
|
|
|
- <TableColumn fx:id="userNameCol" text="用户名" prefWidth="120"/>
|
|
|
- <TableColumn fx:id="userNicknameCol" text="昵称" prefWidth="120"/>
|
|
|
- <TableColumn fx:id="userDeptCol" text="院系" prefWidth="150"/>
|
|
|
- <TableColumn fx:id="userCreditCol" text="信用分" prefWidth="60"/>
|
|
|
- <TableColumn fx:id="userRoleCol" text="角色" prefWidth="60"/>
|
|
|
- <TableColumn fx:id="userSellerCol" text="卖家" prefWidth="60"/>
|
|
|
- </columns>
|
|
|
- </TableView>
|
|
|
- <HBox spacing="10">
|
|
|
- <Button text="编辑选中" onAction="#handleEditUser" styleClass="btn,btn-warning"/>
|
|
|
- <Button text="重置密码" onAction="#handleResetPassword" styleClass="btn,btn-secondary"/>
|
|
|
- <Button text="修改信用分" onAction="#handleEditCredit" styleClass="btn,btn-info"/>
|
|
|
- <Button text="删除选中用户" onAction="#handleDeleteUser" styleClass="btn,btn-danger"/>
|
|
|
- </HBox>
|
|
|
- <TitledPane fx:id="userFormPane" text="添加用户" expanded="false">
|
|
|
- <GridPane hgap="10" vgap="8">
|
|
|
- <padding><Insets top="10" right="10" bottom="10" left="10"/></padding>
|
|
|
- <Label text="用户名" GridPane.rowIndex="0" GridPane.columnIndex="0"/><TextField fx:id="adminUsername" GridPane.rowIndex="0" GridPane.columnIndex="1"/>
|
|
|
- <Label text="密码" GridPane.rowIndex="1" GridPane.columnIndex="0"/><PasswordField fx:id="adminPassword" GridPane.rowIndex="1" GridPane.columnIndex="1"/>
|
|
|
- <Label text="昵称" GridPane.rowIndex="2" GridPane.columnIndex="0"/><TextField fx:id="adminNickname" GridPane.rowIndex="2" GridPane.columnIndex="1"/>
|
|
|
- <Label text="邮箱" GridPane.rowIndex="3" GridPane.columnIndex="0"/><TextField fx:id="adminEmail" GridPane.rowIndex="3" GridPane.columnIndex="1"/>
|
|
|
- <Label text="电话" GridPane.rowIndex="4" GridPane.columnIndex="0"/><TextField fx:id="adminPhone" GridPane.rowIndex="4" GridPane.columnIndex="1"/>
|
|
|
- <Label text="院系" GridPane.rowIndex="5" GridPane.columnIndex="0"/><TextField fx:id="adminDept" GridPane.rowIndex="5" GridPane.columnIndex="1"/>
|
|
|
- <Button fx:id="saveUserBtn" text="保存" onAction="#handleSaveUser" GridPane.rowIndex="6" GridPane.columnIndex="1" styleClass="btn,btn-success"/>
|
|
|
- </GridPane>
|
|
|
- </TitledPane>
|
|
|
- <Label text="书籍管理" style="-fx-font-weight: bold; -fx-font-size: 16px;"/>
|
|
|
- <Button text="刷新书籍" onAction="#handleLoadAllBooksAdmin" styleClass="btn,btn-secondary"/>
|
|
|
- <TableView fx:id="adminBookTable" prefHeight="150">
|
|
|
- <columns>
|
|
|
- <TableColumn fx:id="adminBookIdCol" text="编号" prefWidth="50"/>
|
|
|
- <TableColumn fx:id="adminBookTitleCol" text="书名" prefWidth="200"/>
|
|
|
- <TableColumn fx:id="adminBookAuthorCol" text="作者" prefWidth="120"/>
|
|
|
- <TableColumn fx:id="adminBookCategoryCol" text="分类" prefWidth="80"/>
|
|
|
- <TableColumn fx:id="adminBookPriceCol" text="售价" prefWidth="80"/>
|
|
|
- <TableColumn fx:id="adminBookStockCol" text="库存" prefWidth="60"/>
|
|
|
- <TableColumn fx:id="adminBookSellerCol" text="卖家ID" prefWidth="60"/>
|
|
|
- </columns>
|
|
|
- </TableView>
|
|
|
- <Button text="删除选中书籍" onAction="#handleDeleteBookAdmin" styleClass="btn,btn-danger"/>
|
|
|
- <Label text="待审核书籍" style="-fx-font-weight: bold; -fx-font-size: 16px;"/>
|
|
|
- <Button text="刷新" onAction="#handleLoadPendingBooks" styleClass="btn,btn-secondary"/>
|
|
|
- <TableView fx:id="pendingBookTable" prefHeight="150">
|
|
|
- <columns>
|
|
|
- <TableColumn fx:id="pendingBookIdCol" text="编号" prefWidth="50"/>
|
|
|
- <TableColumn fx:id="pendingBookTitleCol" text="书名" prefWidth="200"/>
|
|
|
- <TableColumn fx:id="pendingBookAuthorCol" text="作者" prefWidth="120"/>
|
|
|
- <TableColumn fx:id="pendingBookSellerCol" text="卖家ID" prefWidth="60"/>
|
|
|
- <TableColumn fx:id="pendingBookPriceCol" text="售价" prefWidth="80"/>
|
|
|
- </columns>
|
|
|
- </TableView>
|
|
|
- <HBox spacing="10">
|
|
|
- <Button text="通过" onAction="#handleApproveBook" styleClass="btn,btn-success"/>
|
|
|
- <Button text="拒绝" onAction="#handleRejectBook" styleClass="btn,btn-danger"/>
|
|
|
- </HBox>
|
|
|
- <Label text="全部交易" style="-fx-font-weight: bold; -fx-font-size: 16px;"/>
|
|
|
- <Button text="刷新交易" onAction="#handleLoadAllTransactions" styleClass="btn,btn-secondary"/>
|
|
|
- <TableView fx:id="allTransTable" prefHeight="150">
|
|
|
- <columns>
|
|
|
- <TableColumn fx:id="allTransIdCol" text="交易编号" prefWidth="60"/>
|
|
|
- <TableColumn fx:id="allTransBookIdCol" text="书籍编号" prefWidth="60"/>
|
|
|
- <TableColumn fx:id="allTransBuyerIdCol" text="买家编号" prefWidth="60"/>
|
|
|
- <TableColumn fx:id="allTransNumCol" text="数量" prefWidth="40"/>
|
|
|
- <TableColumn fx:id="allTransPriceCol" text="价格" prefWidth="100"/>
|
|
|
- <TableColumn fx:id="allTransTimeCol" text="时间" prefWidth="200"/>
|
|
|
- </columns>
|
|
|
- </TableView>
|
|
|
- <Button text="删除选中交易" onAction="#handleDeleteTransaction" styleClass="btn,btn-danger"/>
|
|
|
- <Label text="AI 分析" style="-fx-font-weight: bold; -fx-font-size: 16px;"/>
|
|
|
- <Button text="生成分析报告" onAction="#handleGenerateAnalysis" styleClass="btn,btn-primary"/>
|
|
|
- <TextArea fx:id="analysisResult" editable="false" wrapText="true" prefHeight="250"/>
|
|
|
- </VBox>
|
|
|
- </ScrollPane>
|
|
|
- </Tab>
|
|
|
- </TabPane>
|
|
|
+ <StackPane fx:id="contentArea"/>
|
|
|
</center>
|
|
|
</BorderPane>
|