diff --git a/zlt-web/react-web/pom.xml b/zlt-web/react-web/pom.xml index 517906d4..6861d4de 100644 --- a/zlt-web/react-web/pom.xml +++ b/zlt-web/react-web/pom.xml @@ -10,10 +10,115 @@ 4.0.0 react-web + React前端 - 8 - 8 + v16.13.2 + v1.22.19 + + + org.springframework.boot + spring-boot-starter-web + + + + + + com.github.eirslett + frontend-maven-plugin + 1.12.1 + + + install node and yarn + + install-node-and-yarn + + + ${node.version} + ${yarn.version} + src/main/frontend + + + + yarn install + generate-resources + + yarn + + + install + src/main/frontend + + + + yarn run build + compile + + yarn + + + run build + src/main/frontend + + + + + + org.apache.maven.plugins + maven-resources-plugin + 3.3.0 + + true + + + + copy + compile + + resources + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + repackage + + + + + + + + src/main/resources + + + src/main/frontend/dist + META-INF/central-platform-ui + false + + + + + + noNode + + + + com.github.eirslett + frontend-maven-plugin + + true + + + + + + \ No newline at end of file diff --git a/zlt-web/react-web/src/main/frontend/src/global.less b/zlt-web/react-web/src/main/frontend/src/global.less index 66537a98..14cb3e84 100644 --- a/zlt-web/react-web/src/main/frontend/src/global.less +++ b/zlt-web/react-web/src/main/frontend/src/global.less @@ -19,7 +19,12 @@ body, .hightligh{ - background-color: @yellow-2 !important; + background-color: @yellow-2 !important; +} + +mark { + background-color: @gold-3; + padding: 0; } canvas { @@ -46,11 +51,7 @@ ol { } } -.audit-log { - mark { - background-color: @gold-3; - } -} + @media (max-width: @screen-xs) { .ant-table { diff --git a/zlt-web/react-web/src/main/frontend/src/pages/search/User/index.tsx b/zlt-web/react-web/src/main/frontend/src/pages/search/User/index.tsx index 5120bca2..0459fb2a 100644 --- a/zlt-web/react-web/src/main/frontend/src/pages/search/User/index.tsx +++ b/zlt-web/react-web/src/main/frontend/src/pages/search/User/index.tsx @@ -1,4 +1,4 @@ -import { user } from '@/services/system/api'; +import { searchUser } from '@/services/system/api'; import type { ProColumns } from '@ant-design/pro-components'; import { ProFormSelect, @@ -10,7 +10,7 @@ import { import React, { useState } from 'react'; const TableList: React.FC = () => { - const [params, setParams] = useState>({ }); + const [params, setParams] = useState>({}); const columns: ProColumns[] = [ { @@ -24,23 +24,27 @@ const TableList: React.FC = () => { { title: '账号', dataIndex: 'username', + render: (_, entity) => , }, { title: '用户名', dataIndex: 'nickname', + render: (_, entity) => , }, { title: '手机号', dataIndex: 'mobile', + render: (_, entity) => , }, { title: '性别', dataIndex: 'sex', - render: (value) => (value === 0 ? '男' : '女'), + render: (_, entity) => , }, { title: '类别', dataIndex: 'type', + render: (_, entity) => , }, { title: '创建时间', @@ -55,7 +59,7 @@ const TableList: React.FC = () => { defaultCollapsed split className="query-filter" - initialValues={{searchKey:"none"}} + initialValues={{ searchKey: 'none' }} // onFinish={async (values) => setParams(values)} onFinish={async (values) => { let queryStr = ''; @@ -88,7 +92,7 @@ const TableList: React.FC = () => { rowKey="id" headerTitle="用户管理" - request={user} + request={searchUser} columns={columns} search={false} params={params} diff --git a/zlt-web/react-web/src/main/frontend/src/services/system/api.ts b/zlt-web/react-web/src/main/frontend/src/services/system/api.ts index b4d35262..43a5bda2 100644 --- a/zlt-web/react-web/src/main/frontend/src/services/system/api.ts +++ b/zlt-web/react-web/src/main/frontend/src/services/system/api.ts @@ -12,6 +12,15 @@ export async function user(params?: { [key: string]: string | number }) { return { data: result.data, total: result.count }; } +export async function searchUser(params?: { [key: string]: string | number }) { + const { current, pageSize, ...rest } = params ?? {}; + const result = await request>('/api-user/users/search', { + method: 'GET', + params: { page: current, limit: pageSize, ...rest }, + }); + return { data: result.data, total: result.count }; +} + export async function saveOrUpdateUser(data: SYSTEM.User): Promise> { const result = await request>('/api-user/users/saveOrUpdate', { method: 'POST', diff --git a/zlt-web/react-web/src/main/java/ui/UiBootApplication.java b/zlt-web/react-web/src/main/java/ui/ReactUiBootApplication.java similarity index 67% rename from zlt-web/react-web/src/main/java/ui/UiBootApplication.java rename to zlt-web/react-web/src/main/java/ui/ReactUiBootApplication.java index 902d079a..cd498fb6 100644 --- a/zlt-web/react-web/src/main/java/ui/UiBootApplication.java +++ b/zlt-web/react-web/src/main/java/ui/ReactUiBootApplication.java @@ -4,10 +4,10 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication -public class UiBootApplication { +public class ReactUiBootApplication { public static void main(String[] args) { - SpringApplication.run(UiBootApplication.class, args); + SpringApplication.run(ReactUiBootApplication.class, args); } } diff --git a/zlt-web/src/access.ts b/zlt-web/src/access.ts deleted file mode 100644 index e823e24b..00000000 --- a/zlt-web/src/access.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * @see https://umijs.org/zh-CN/plugins/plugin-access - * */ -export default function access(initialState: { currentUser?: API.CurrentUser } | undefined) { - const { currentUser } = initialState ?? {}; - return { - canAdmin: currentUser && currentUser.access === 'admin', - }; -} diff --git a/zlt-web/src/app.tsx b/zlt-web/src/app.tsx deleted file mode 100644 index f3c68f30..00000000 --- a/zlt-web/src/app.tsx +++ /dev/null @@ -1,302 +0,0 @@ -import Footer from '@/components/Footer'; -import RightContent from '@/components/RightContent'; -import { - AppstoreOutlined, - MenuOutlined, - TeamOutlined, - SettingOutlined, - UserOutlined, - CaretDownFilled, - SmileOutlined, -} from '@ant-design/icons'; -import type { MenuDataItem, Settings as LayoutSettings } from '@ant-design/pro-components'; -import { PageLoading, SettingDrawer } from '@ant-design/pro-components'; -import { Divider, Dropdown, Menu, Space } from 'antd'; -import type { RequestConfig, RunTimeLayoutConfig } from 'umi'; -import { history } from 'umi'; -import defaultSettings from '../config/defaultSettings'; -import { currentUser as queryCurrentUser, fetchMenuData } from './services/ant-design-pro/api'; - -const isDev = process.env.NODE_ENV === 'development'; -const loginPath = '/user/login'; - -/** 获取用户信息比较慢的时候会展示一个 loading */ -export const initialStateConfig = { - loading: , -}; - -/** - * @see https://umijs.org/zh-CN/plugins/plugin-initial-state - * */ -export async function getInitialState(): Promise<{ - settings?: Partial; - currentUser?: API.CurrentUser; - loading?: boolean; - fetchUserInfo?: () => Promise; -}> { - const fetchUserInfo = async () => { - try { - const msg = await queryCurrentUser(); - // TODO - return msg.datas; - } catch (error) { - history.push(loginPath); - } - return undefined; - }; - // 如果不是登录页面,执行 - if (history.location.pathname !== loginPath) { - const currentUser = await fetchUserInfo(); - return { - fetchUserInfo, - currentUser, - settings: defaultSettings, - }; - } - return { - fetchUserInfo, - settings: defaultSettings, - }; -} - -// ProLayout 支持的api https://procomponents.ant.design/components/layout -export const layout: RunTimeLayoutConfig = ({ initialState, setInitialState }) => { - return { - rightContentRender: () => , - disableContentMargin: false, - waterMarkProps: { - content: initialState?.currentUser?.username, - }, - footerRender: () =>