feat: add amis jssdk page

Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
2019-12-25 15:41:27 +08:00
parent cabf6cf613
commit aed21b2ff6
27 changed files with 522 additions and 66 deletions

View File

@@ -0,0 +1,30 @@
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<title>编辑器</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<link rel="stylesheet" href="https://houtai.baidu.com/v2/csssdk">
<style>
html,
body,
.app-wrapper {
position: relative;
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<div id="root" class="app-wrapper"></div>
<script src="https://houtai.baidu.com/v2/jssdk"></script>
<script src="index.js"></script>
</body>
</html>

View File

@@ -0,0 +1,51 @@
(async function() {
var amis = amisRequire('amis/embed');
amis.embed('#root', {
definitions: {
"editor-page": {
"position": "right",
"resizable": true,
"title": `<% if (data.name) { print('页面 '+data.name+' 详情') } else { print ('新增页面') } %>`,
"size": "lg",
"body": {
"type": "form",
"submitText": '',
"title": "",
"controls": [
{
"name": "name",
"type": "text",
},
{
"name": "content",
"type": "editor",
"language": "json",
"editorTheme": "vs-dark",
"height": "800",
"label": false
},
{
"type": "button",
"label": "保存",
"actionType": "ajax",
"api": {
"url": "/page/manager/${_id}",
"data": {
"name": "${name}",
"content": "${content}"
}
}
}
]
}
}
},
type: 'page',
title: '页面管理',
body: {
name: "editor",
type: "service",
schemaApi: "get:/page/manager/editor"
}
});
})();