1
0

feat(web): 使用模块化js 增加账号改密、注销

This commit is contained in:
2024-11-18 18:51:55 +08:00
parent 05f4ad5b57
commit c466e5e49f
14 changed files with 393 additions and 150 deletions

View File

@@ -23,23 +23,20 @@
<div id="root"></div>
</body>
<script src="assets/sdk/sdk.js"></script>
<script src="assets/component/constants.js"></script>
<script src="assets/component/common.js"></script>
<script src="assets/component/pages/overview-tab.js"></script>
<script src="assets/component/pages/user-tab.js"></script>
<script>
<script type="module">
import {information} from './assets/component/constants.js'
import {userChangePasswordDialog} from './assets/component/pages/user/dialog-user-change-password'
import {tabUser} from './assets/component/pages/tab-user.js'
import {tabOverview} from './assets/component/pages/tab-overview.js'
import {apiGet} from "./assets/component/common.js";
(function () {
let amis = amisRequire('amis/embed')
let amisJSON = {
id: 'header-service',
className: 'h-full',
type: 'service',
api: {
method: 'get',
url: '${base}/user/state',
headers: {
token: '${token}'
},
},
api: apiGet('${base}/user/state'),
onEvent: {
fetchInited: {
actions: [
@@ -48,6 +45,7 @@
actionType: 'url',
args: {
url: '/login.html',
blank: false,
}
}
]
@@ -66,10 +64,14 @@
trigger: 'hover',
buttons: [
{
label: '个人资料',
label: '修改密码',
...userChangePasswordDialog(),
},
{
label: '退出登陆',
actionType: 'ajax',
api: apiGet('${base}/user/logout'),
reload: 'header-service',
}
]
}
@@ -80,14 +82,13 @@
type: 'tabs',
tabsMode: 'vertical',
tabs: [
userTab(),
overviewTab(),
tabOverview(),
tabUser(),
]
},
}
]
}
let debug = false
amis.embed(
'#root',
amisJSON,
@@ -98,10 +99,10 @@
},
{
theme: 'antd',
enableAMISDebug: debug,
enableAMISDebug: information.debug,
},
);
if (debug) {
if (information.debug) {
console.log('Source', amisJSON)
}
})()