获取登录页面
GET
/login请求参数
无
示例代码
返回响应
成功(200)
失败(404)
HTTP 状态码: 200
内容格式: JSONapplication/json
数据结构
No schema defined
示例
{
"type": "page",
"className": "login-bg",
"css": {
".captcha-box .cxd-Image--thumb": {
"padding": "0",
"cursor": "pointer",
"border": "var(--Form-input-borderWidth) solid var(--Form-input-borderColor)",
"border-top-right-radius": "4px",
"border-bottom-right-radius": "4px"
},
".cxd-Image-thumb": {
"width": "auto"
},
".login-bg": {
"background": "var(--owl-body-bg)"
}
},
"body": {
"type": "wrapper",
"className": "h-screen w-full flex items-center justify-center",
"body": {
"type": "card",
"className": "w-96 m:w-full",
"body": [
{
"type": "flex",
"justify": "space-between",
"className": "px-2.5 pb-2.5",
"items": [
{
"type": "image",
"src": "http://localhost/admin-assets/logo.png",
"width": 40,
"height": 40
},
{
"type": "tpl",
"className": "font-medium",
"tpl": "<div style=\"font-size: 24px\">Owl Admin</div>"
}
]
},
{
"type": "form",
"panelClassName": "border-none",
"id": "login-form",
"title": "",
"api": "/login",
"initApi": "/no-content",
"body": [
{
"type": "input-text",
"name": "username",
"placeholder": "Username",
"required": true
},
{
"type": "input-password",
"name": "password",
"placeholder": "Password",
"required": true
},
null,
{
"type": "checkbox",
"name": "remember_me",
"option": "Remember me",
"value": true
},
{
"type": "button",
"actionType": "submit",
"label": "Login",
"level": "primary",
"className": "w-full"
}
],
"actions": [],
"onEvent": {
"inited": {
"actions": [
{
"actionType": "custom",
"script": "let loginParams = localStorage.getItem(window.$owl.getCacheKey('loginParams'))\nif(loginParams){\n loginParams = JSON.parse(decodeURIComponent(window.atob(loginParams)))\n doAction({\n actionType: 'setValue',\n componentId: 'login-form',\n args: { value: loginParams }\n })\n}"
}
]
},
"submitSucc": {
"actions": [
{
"actionType": "custom",
"script": "let _data = {}\nif(event.data.remember_me){\n _data = { username: event.data.username, password: event.data.password }\n}\nwindow.$owl.afterLoginSuccess(_data, event.data.result.data.token)"
}
]
}
}
}
]
}
}
}
最后修改时间: 7 个月前