1
0

feat(web): 使用vite重新组织前端代码

This commit is contained in:
2024-11-19 17:52:34 +08:00
parent 7ccc602406
commit 9a01d74d78
138 changed files with 1141 additions and 443 deletions

View File

@@ -0,0 +1,25 @@
<!doctype html>
<html lang="zh">
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title></title>
<link href="/assets/sdk/antd.css" rel="stylesheet"/>
<link href="/assets/sdk/helper.css" rel="stylesheet"/>
<link href="/assets/sdk/iconfont.css" rel="stylesheet"/>
<style>
html, body, #app {
position: relative;
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<div id="app"></div>
<script src="/assets/sdk/sdk.js"></script>
<script type="module" src="./main.js"></script>
</body>
</html>

View File

@@ -0,0 +1,64 @@
import {apiGet, useAmis} from '../../components/constants.js'
import {userChangePasswordDialog} from "../../components/user/dialog-user-change-password.js";
import {tabUser} from "./tab-user.js";
import {tabOverview} from "./tab-overview.js";
useAmis(information => {
return {
id: 'header-service',
className: 'h-full',
type: 'service',
api: apiGet('${base}/user/state'),
onEvent: {
fetchInited: {
actions: [
{
expression: '${!event.data.responseData.token}',
actionType: 'url',
args: {
url: '/pages/login/index.html',
blank: false,
}
}
]
}
},
body: [
{
type: 'page',
title: information.title,
subTitle: '提供合法合规的数据要素可信供给工具',
toolbar: [
{
type: 'dropdown-button',
label: '${username}',
align: 'right',
trigger: 'hover',
buttons: [
{
label: '修改密码',
...userChangePasswordDialog(),
},
{
label: '退出登陆',
actionType: 'ajax',
api: apiGet('${base}/user/logout'),
reload: 'header-service',
}
]
}
],
bodyClassName: 'p-0',
body: {
className: 'h-full border-0',
type: 'tabs',
tabsMode: 'vertical',
tabs: [
tabOverview(),
tabUser(),
]
},
}
]
}
})

View File

@@ -0,0 +1,9 @@
export function tabOverview() {
return {
title: '概览',
icon: 'fa fa-house',
body: [
'hello world'
]
}
}

View File

@@ -0,0 +1,95 @@
import {apiGet, crudCommonOptions, mappingField, userRoleMapping, userStateMapping} from '../../components/constants.js'
import {userCheckDialog} from "../../components/user/dialog-user-check.js";
import {userAdministratorRegisterDialog} from "../../components/user/dialog-user-register.js";
export function tabUser() {
return {
visibleOn: '${role === "ADMINISTRATOR"}',
title: '用户管理',
icon: 'fa fa-user',
body: [
{
id: '9200849e-a8e9-4752-b4fc-ae52dc46a205',
type: 'crud',
api: apiGet('${base}/user_management/list'),
...crudCommonOptions(),
headerToolbar: [
'reload',
{
type: 'action',
icon: 'fa fa-plus',
tooltip: '新增账号',
...userAdministratorRegisterDialog(),
},
],
columns: [
{
name: 'username',
label: '邮箱',
},
{
label: '角色',
width: 120,
...mappingField('role', userRoleMapping)
},
{
label: '账号状态',
width: 80,
...mappingField('state', userStateMapping)
},
{
label: '创建时间',
width: 150,
type: 'tpl',
tpl: '${DATETOSTR(createTime)}'
},
{
label: '更新时间',
width: 150,
type: 'tpl',
tpl: '${DATETOSTR(updateTime)}'
},
{
label: '操作',
width: 100,
type: 'operation',
fixed: 'right',
className: 'nowrap',
buttons: [
{
visibleOn: "${state === 'CHECKING'}",
label: '审核',
icon: 'fa fa-fingerprint',
level: 'primary',
size: 'xs',
...userCheckDialog(),
},
{
visibleOn: "${state === 'NORMAL' && role !== 'ADMINISTRATOR'}",
label: '禁用',
icon: 'fa fa-ban',
level: 'danger',
size: 'xs',
confirmText: '确认禁用账号${username}',
confirmTitle: '禁用账号',
actionType: 'ajax',
api: apiGet('${base}/user_management/disable/${username}'),
},
{
visibleOn: "${state === 'DISABLED' && role !== 'ADMINISTRATOR'}",
label: '启用',
icon: 'fa fa-check',
level: 'success',
size: 'xs',
confirmText: '确认启用账号${username}',
confirmTitle: '启用账号',
actionType: 'ajax',
api: apiGet('${base}/user_management/enable/${username}'),
}
]
},
]
}
]
}
}

View File

@@ -0,0 +1,25 @@
<!doctype html>
<html lang="zh">
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title></title>
<link href="/assets/sdk/antd.css" rel="stylesheet"/>
<link href="/assets/sdk/helper.css" rel="stylesheet"/>
<link href="/assets/sdk/iconfont.css" rel="stylesheet"/>
<style>
html, body, #app {
position: relative;
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<div id="app"></div>
<script src="/assets/sdk/sdk.js"></script>
<script type="module" src="./main.js"></script>
</body>
</html>

View File

@@ -0,0 +1,77 @@
import {useAmis} from '../../components/constants.js'
import {userRegisterDialog} from '../../components/user/dialog-user-register.js'
useAmis(information => {
return {
type: 'page',
title: information.title,
subTitle: '统一登陆入口',
body: [
{
type: 'grid',
columns: [
{
xs: 0,
sm: 0,
md: 4,
body: [],
},
{
xs: 12,
sm: 12,
md: 4,
body: [
{
type: 'form',
title: '用户登陆',
api: '${base}/user/login',
redirect: '/pages/index/index.html?token=${token}',
mode: 'horizontal',
horizontal: {
left: 2,
},
actions: [
{
type: 'action',
label: '注册',
...userRegisterDialog(),
},
{
type: 'action',
actionType: 'submit',
label: '登陆',
level: 'primary',
},
],
body: [
{
type: 'input-email',
name: 'username',
label: '邮箱',
placeholder: '请输入邮箱',
required: true,
clearable: true,
clearValueOnEmpty: true,
},
{
type: 'input-password',
name: 'password',
label: '密码',
placeholder: '请再次输入密码',
required: true,
},
],
},
],
},
{
xs: 0,
sm: 0,
md: 4,
body: [],
},
],
},
],
}
})