parent
f288af73a7
commit
fde7c06444
@ -1,116 +1,4 @@
|
|||||||
# Logs
|
/node_modules
|
||||||
logs
|
/package-lock.json
|
||||||
*.log
|
/gh-pages
|
||||||
npm-debug.log*
|
/.idea
|
||||||
yarn-debug.log*
|
|
||||||
yarn-error.log*
|
|
||||||
lerna-debug.log*
|
|
||||||
|
|
||||||
# Diagnostic reports (https://nodejs.org/api/report.html)
|
|
||||||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
|
||||||
|
|
||||||
# Runtime data
|
|
||||||
pids
|
|
||||||
*.pid
|
|
||||||
*.seed
|
|
||||||
*.pid.lock
|
|
||||||
|
|
||||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
|
||||||
lib-cov
|
|
||||||
|
|
||||||
# Coverage directory used by tools like istanbul
|
|
||||||
coverage
|
|
||||||
*.lcov
|
|
||||||
|
|
||||||
# nyc test coverage
|
|
||||||
.nyc_output
|
|
||||||
|
|
||||||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
|
||||||
.grunt
|
|
||||||
|
|
||||||
# Bower dependency directory (https://bower.io/)
|
|
||||||
bower_components
|
|
||||||
|
|
||||||
# node-waf configuration
|
|
||||||
.lock-wscript
|
|
||||||
|
|
||||||
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
|
||||||
build/Release
|
|
||||||
|
|
||||||
# Dependency directories
|
|
||||||
node_modules/
|
|
||||||
jspm_packages/
|
|
||||||
|
|
||||||
# Snowpack dependency directory (https://snowpack.dev/)
|
|
||||||
web_modules/
|
|
||||||
|
|
||||||
# TypeScript cache
|
|
||||||
*.tsbuildinfo
|
|
||||||
|
|
||||||
# Optional npm cache directory
|
|
||||||
.npm
|
|
||||||
|
|
||||||
# Optional eslint cache
|
|
||||||
.eslintcache
|
|
||||||
|
|
||||||
# Microbundle cache
|
|
||||||
.rpt2_cache/
|
|
||||||
.rts2_cache_cjs/
|
|
||||||
.rts2_cache_es/
|
|
||||||
.rts2_cache_umd/
|
|
||||||
|
|
||||||
# Optional REPL history
|
|
||||||
.node_repl_history
|
|
||||||
|
|
||||||
# Output of 'npm pack'
|
|
||||||
*.tgz
|
|
||||||
|
|
||||||
# Yarn Integrity file
|
|
||||||
.yarn-integrity
|
|
||||||
|
|
||||||
# dotenv environment variables file
|
|
||||||
.env
|
|
||||||
.env.test
|
|
||||||
|
|
||||||
# parcel-bundler cache (https://parceljs.org/)
|
|
||||||
.cache
|
|
||||||
.parcel-cache
|
|
||||||
|
|
||||||
# Next.js build output
|
|
||||||
.next
|
|
||||||
out
|
|
||||||
|
|
||||||
# Nuxt.js build / generate output
|
|
||||||
.nuxt
|
|
||||||
dist
|
|
||||||
|
|
||||||
# Gatsby files
|
|
||||||
.cache/
|
|
||||||
# Comment in the public line in if your project uses Gatsby and not Next.js
|
|
||||||
# https://nextjs.org/blog/next-9-1#public-directory-support
|
|
||||||
# public
|
|
||||||
|
|
||||||
# vuepress build output
|
|
||||||
.vuepress/dist
|
|
||||||
|
|
||||||
# Serverless directories
|
|
||||||
.serverless/
|
|
||||||
|
|
||||||
# FuseBox cache
|
|
||||||
.fusebox/
|
|
||||||
|
|
||||||
# DynamoDB Local files
|
|
||||||
.dynamodb/
|
|
||||||
|
|
||||||
# TernJS port file
|
|
||||||
.tern-port
|
|
||||||
|
|
||||||
# Stores VSCode versions used for testing VSCode extensions
|
|
||||||
.vscode-test
|
|
||||||
|
|
||||||
# yarn v2
|
|
||||||
.yarn/cache
|
|
||||||
.yarn/unplugged
|
|
||||||
.yarn/build-state.yml
|
|
||||||
.yarn/install-state.gz
|
|
||||||
.pnp.*
|
|
||||||
|
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"printWidth": 80,
|
||||||
|
"tabWidth": 2,
|
||||||
|
"useTabs": false,
|
||||||
|
"singleQuote": true,
|
||||||
|
"semi": true,
|
||||||
|
"trailingComma": "none",
|
||||||
|
"bracketSpacing": false,
|
||||||
|
"quoteProps": "consistent",
|
||||||
|
"arrowParens": "avoid",
|
||||||
|
"jsxBracketSameLine": false
|
||||||
|
}
|
@ -0,0 +1,198 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<title>amis admin</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"
|
||||||
|
title="default"
|
||||||
|
href="https://unpkg.com/amis@beta/sdk/sdk.css"
|
||||||
|
/>
|
||||||
|
<link
|
||||||
|
rel="stylesheet"
|
||||||
|
href="https://unpkg.com/amis@beta/sdk/helper.css"
|
||||||
|
/>
|
||||||
|
<script src="https://unpkg.com/amis@beta/sdk/sdk.js"></script>
|
||||||
|
<script src="https://unpkg.com/vue@2"></script>
|
||||||
|
<script src="https://unpkg.com/history@4.10.1
|
||||||
|
/umd/history.js"></script>
|
||||||
|
<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>
|
||||||
|
(function () {
|
||||||
|
let amis = amisRequire('amis/embed');
|
||||||
|
const match = amisRequire('path-to-regexp').match;
|
||||||
|
|
||||||
|
// 如果想用 browserHistory 请切换下这处代码, 其他不用变
|
||||||
|
// const history = History.createBrowserHistory();
|
||||||
|
const history = History.createHashHistory();
|
||||||
|
|
||||||
|
const app = {
|
||||||
|
type: 'app',
|
||||||
|
brandName: 'Admin',
|
||||||
|
logo: '/public/logo.png',
|
||||||
|
header: {
|
||||||
|
type: 'tpl',
|
||||||
|
inline: false,
|
||||||
|
className: 'w-full',
|
||||||
|
tpl: '<div class="flex justify-between"><div>顶部区域左侧</div><div>顶部区域右侧</div></div>'
|
||||||
|
},
|
||||||
|
// footer: '<div class="p-2 text-center bg-light">底部区域</div>',
|
||||||
|
// asideBefore: '<div class="p-2 text-center">菜单前面区域</div>',
|
||||||
|
// asideAfter: '<div class="p-2 text-center">菜单后面区域</div>',
|
||||||
|
api: '/pages/site.json'
|
||||||
|
};
|
||||||
|
|
||||||
|
function normalizeLink(to, location = history.location) {
|
||||||
|
to = to || '';
|
||||||
|
|
||||||
|
if (to && to[0] === '#') {
|
||||||
|
to = location.pathname + location.search + to;
|
||||||
|
} else if (to && to[0] === '?') {
|
||||||
|
to = location.pathname + to;
|
||||||
|
}
|
||||||
|
|
||||||
|
const idx = to.indexOf('?');
|
||||||
|
const idx2 = to.indexOf('#');
|
||||||
|
let pathname = ~idx
|
||||||
|
? to.substring(0, idx)
|
||||||
|
: ~idx2
|
||||||
|
? to.substring(0, idx2)
|
||||||
|
: to;
|
||||||
|
let search = ~idx ? to.substring(idx, ~idx2 ? idx2 : undefined) : '';
|
||||||
|
let hash = ~idx2 ? to.substring(idx2) : location.hash;
|
||||||
|
|
||||||
|
if (!pathname) {
|
||||||
|
pathname = location.pathname;
|
||||||
|
} else if (pathname[0] != '/' && !/^https?\:\/\//.test(pathname)) {
|
||||||
|
let relativeBase = location.pathname;
|
||||||
|
const paths = relativeBase.split('/');
|
||||||
|
paths.pop();
|
||||||
|
let m;
|
||||||
|
while ((m = /^\.\.?\//.exec(pathname))) {
|
||||||
|
if (m[0] === '../') {
|
||||||
|
paths.pop();
|
||||||
|
}
|
||||||
|
pathname = pathname.substring(m[0].length);
|
||||||
|
}
|
||||||
|
pathname = paths.concat(pathname).join('/');
|
||||||
|
}
|
||||||
|
|
||||||
|
return pathname + search + hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
function isCurrentUrl(to, ctx) {
|
||||||
|
if (!to) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const pathname = history.location.pathname;
|
||||||
|
const link = normalizeLink(to, {
|
||||||
|
...location,
|
||||||
|
pathname,
|
||||||
|
hash: ''
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!~link.indexOf('http') && ~link.indexOf(':')) {
|
||||||
|
let strict = ctx && ctx.strict;
|
||||||
|
return match(link, {
|
||||||
|
decode: decodeURIComponent,
|
||||||
|
strict: typeof strict !== 'undefined' ? strict : true
|
||||||
|
})(pathname);
|
||||||
|
}
|
||||||
|
|
||||||
|
return decodeURI(pathname) === link;
|
||||||
|
}
|
||||||
|
|
||||||
|
let amisInstance = amis.embed(
|
||||||
|
'#root',
|
||||||
|
app,
|
||||||
|
{
|
||||||
|
location: history.location
|
||||||
|
},
|
||||||
|
{
|
||||||
|
// watchRouteChange: fn => {
|
||||||
|
// return history.listen(fn);
|
||||||
|
// },
|
||||||
|
updateLocation: (location, replace) => {
|
||||||
|
location = normalizeLink(location);
|
||||||
|
if (location === 'goBack') {
|
||||||
|
return history.goBack();
|
||||||
|
} else if (
|
||||||
|
(!/^https?\:\/\//.test(location) &&
|
||||||
|
location ===
|
||||||
|
history.location.pathname + history.location.search) ||
|
||||||
|
location === history.location.href
|
||||||
|
) {
|
||||||
|
// 目标地址和当前地址一样,不处理,免得重复刷新
|
||||||
|
return;
|
||||||
|
} else if (/^https?\:\/\//.test(location) || !history) {
|
||||||
|
return (window.location.href = location);
|
||||||
|
}
|
||||||
|
|
||||||
|
history[replace ? 'replace' : 'push'](location);
|
||||||
|
},
|
||||||
|
jumpTo: (to, action) => {
|
||||||
|
if (to === 'goBack') {
|
||||||
|
return history.goBack();
|
||||||
|
}
|
||||||
|
|
||||||
|
to = normalizeLink(to);
|
||||||
|
|
||||||
|
if (isCurrentUrl(to)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (action && action.actionType === 'url') {
|
||||||
|
action.blank === false
|
||||||
|
? (window.location.href = to)
|
||||||
|
: window.open(to, '_blank');
|
||||||
|
return;
|
||||||
|
} else if (action && action.blank) {
|
||||||
|
window.open(to, '_blank');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (/^https?:\/\//.test(to)) {
|
||||||
|
window.location.href = to;
|
||||||
|
} else if (
|
||||||
|
(!/^https?\:\/\//.test(to) &&
|
||||||
|
to === history.pathname + history.location.search) ||
|
||||||
|
to === history.location.href
|
||||||
|
) {
|
||||||
|
// do nothing
|
||||||
|
} else {
|
||||||
|
history.push(to);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
isCurrentUrl: isCurrentUrl,
|
||||||
|
theme: 'cxd'
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
history.listen(state => {
|
||||||
|
amisInstance.updateProps({
|
||||||
|
location: state.location || state
|
||||||
|
});
|
||||||
|
});
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"verbose": true,
|
||||||
|
"ignore": ["node_modules/*"]
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
"name": "amis-boilerplate",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "基于 amis 的项目模板",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1",
|
||||||
|
"start": "node server.js",
|
||||||
|
"gh-pages": "rm -rf gh-pages && fis3 release gh-pages -c",
|
||||||
|
"deploy-gh-pages": "git subtree push --prefix gh-pages origin gh-pages"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"amis",
|
||||||
|
"boilerplate",
|
||||||
|
"admin",
|
||||||
|
"react"
|
||||||
|
],
|
||||||
|
"author": "fex",
|
||||||
|
"license": "MIT",
|
||||||
|
"devDependencies": {
|
||||||
|
"body-parser": "^1.19.0",
|
||||||
|
"express": "^4.17.1",
|
||||||
|
"morgan": "^1.10.0",
|
||||||
|
"nodemon": "^2.0.7",
|
||||||
|
"reload": "^3.1.1"
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"type": "page",
|
||||||
|
"title": "Dashboard",
|
||||||
|
"body": "body..."
|
||||||
|
}
|
@ -0,0 +1,274 @@
|
|||||||
|
{
|
||||||
|
"type": "page",
|
||||||
|
"title": "复杂表单",
|
||||||
|
"subTitle": "展示表格编辑、联动等等",
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "form",
|
||||||
|
"mode": "horizontal",
|
||||||
|
"title": "",
|
||||||
|
"affixFooter": true,
|
||||||
|
"api": "https://3xsw4ap8wah59.cfc-execute.bj.baidubce.com/api/amis-mock/form/save",
|
||||||
|
"actions": [
|
||||||
|
{
|
||||||
|
"label": "保存",
|
||||||
|
"type": "submit",
|
||||||
|
"level": "success"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"controls": [
|
||||||
|
{
|
||||||
|
"type": "fieldSet",
|
||||||
|
"title": "基本配置",
|
||||||
|
"controls": [
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"label": "任务名称",
|
||||||
|
"name": "title",
|
||||||
|
"size": "md",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"type": "textarea",
|
||||||
|
"label": "任务描述",
|
||||||
|
"name": "description",
|
||||||
|
"size": "md"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"label": "任务频率",
|
||||||
|
"type": "radios",
|
||||||
|
"name": "repeat",
|
||||||
|
"inline": true,
|
||||||
|
"value": "none",
|
||||||
|
"required": true,
|
||||||
|
"options": [
|
||||||
|
{
|
||||||
|
"label": "不重复",
|
||||||
|
"value": "none"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"label": "每天",
|
||||||
|
"value": "day"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"label": "每周",
|
||||||
|
"value": "week"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"label": "每月",
|
||||||
|
"value": "month"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"label": "每天几点",
|
||||||
|
"type": "select",
|
||||||
|
"name": "time",
|
||||||
|
"multiple": true,
|
||||||
|
"required": true,
|
||||||
|
"extractValue": true,
|
||||||
|
"visibleOn": "this.repeat == \"day\"",
|
||||||
|
"inline": true,
|
||||||
|
"options": [
|
||||||
|
{"value": 0, "label": "0:00"},
|
||||||
|
{"value": 1, "label": "1:00"},
|
||||||
|
{"value": 2, "label": "2:00"},
|
||||||
|
{"value": 3, "label": "3:00"},
|
||||||
|
{"value": 4, "label": "4:00"},
|
||||||
|
{"value": 5, "label": "5:00"},
|
||||||
|
{"value": 6, "label": "6:00"},
|
||||||
|
{"value": 7, "label": "7:00"},
|
||||||
|
{"value": 8, "label": "8:00"},
|
||||||
|
{"value": 9, "label": "9:00"},
|
||||||
|
{"value": 10, "label": "10:00"},
|
||||||
|
{"value": 11, "label": "11:00"},
|
||||||
|
{"value": 12, "label": "12:00"},
|
||||||
|
{"value": 13, "label": "13:00"},
|
||||||
|
{"value": 14, "label": "14:00"},
|
||||||
|
{"value": 15, "label": "15:00"},
|
||||||
|
{"value": 16, "label": "16:00"},
|
||||||
|
{"value": 17, "label": "17:00"},
|
||||||
|
{"value": 18, "label": "18:00"},
|
||||||
|
{"value": 19, "label": "19:00"},
|
||||||
|
{"value": 20, "label": "20:00"},
|
||||||
|
{"value": 21, "label": "21:00"},
|
||||||
|
{"value": 22, "label": "22:00"},
|
||||||
|
{"value": 23, "label": "23:00"}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"label": "每周几执行",
|
||||||
|
"type": "button-group",
|
||||||
|
"name": "weekdays",
|
||||||
|
"size": "md",
|
||||||
|
"visibleOn": "this.repeat == \"week\"",
|
||||||
|
"clearable": true,
|
||||||
|
"multiple": true,
|
||||||
|
"required": true,
|
||||||
|
"extractValue": true,
|
||||||
|
"maxLength": 7,
|
||||||
|
"options": [
|
||||||
|
{
|
||||||
|
"label": "周一",
|
||||||
|
"value": "0"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"label": "周二",
|
||||||
|
"value": "1"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"label": "周三",
|
||||||
|
"value": "2"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"label": "周四",
|
||||||
|
"value": "3"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"label": "周五",
|
||||||
|
"value": "4"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"label": "周六",
|
||||||
|
"value": "5"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"label": "周日",
|
||||||
|
"value": "6"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"label": "每月几号执行",
|
||||||
|
"type": "list",
|
||||||
|
"name": "monthday",
|
||||||
|
"size": "md",
|
||||||
|
"visibleOn": "this.repeat == \"month\"",
|
||||||
|
"required": true,
|
||||||
|
"maxLength": 31,
|
||||||
|
"clearable": true,
|
||||||
|
"multiple": true,
|
||||||
|
"extractValue": true,
|
||||||
|
"options": [
|
||||||
|
{"value": 0, "label": "01"},
|
||||||
|
{"value": 1, "label": "02"},
|
||||||
|
{"value": 2, "label": "03"},
|
||||||
|
{"value": 3, "label": "04"},
|
||||||
|
{"value": 4, "label": "05"},
|
||||||
|
{"value": 5, "label": "06"},
|
||||||
|
{"value": 6, "label": "07"},
|
||||||
|
{"value": 7, "label": "08"},
|
||||||
|
{"value": 8, "label": "09"},
|
||||||
|
{"value": 9, "label": "10"},
|
||||||
|
{"value": 10, "label": "11"},
|
||||||
|
{"value": 11, "label": "12"},
|
||||||
|
{"value": 12, "label": "13"},
|
||||||
|
{"value": 13, "label": "14"},
|
||||||
|
{"value": 14, "label": "15"},
|
||||||
|
{"value": 15, "label": "16"},
|
||||||
|
{"value": 16, "label": "17"},
|
||||||
|
{"value": 17, "label": "18"},
|
||||||
|
{"value": 18, "label": "19"},
|
||||||
|
{"value": 19, "label": "20"},
|
||||||
|
{"value": 20, "label": "21"},
|
||||||
|
{"value": 21, "label": "22"},
|
||||||
|
{"value": 22, "label": "23"},
|
||||||
|
{"value": 23, "label": "24"},
|
||||||
|
{"value": 24, "label": "25"},
|
||||||
|
{"value": 25, "label": "26"},
|
||||||
|
{"value": 26, "label": "27"},
|
||||||
|
{"value": 27, "label": "28"},
|
||||||
|
{"value": 28, "label": "29"},
|
||||||
|
{"value": 29, "label": "30"},
|
||||||
|
{"value": 30, "label": "31"}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"type": "fieldSet",
|
||||||
|
"title": "其他信息",
|
||||||
|
"collapsable": true,
|
||||||
|
"controls": [
|
||||||
|
{
|
||||||
|
"type": "combo",
|
||||||
|
"name": "admins",
|
||||||
|
"label": "用户列表",
|
||||||
|
"value": [""],
|
||||||
|
"description": "请输入用户信息,不要重复。",
|
||||||
|
"multiple": true,
|
||||||
|
"inline": true,
|
||||||
|
"controls": [
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"name": "name",
|
||||||
|
"unique": true
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"type": "select",
|
||||||
|
"name": "perm",
|
||||||
|
"value": "read",
|
||||||
|
"options": [
|
||||||
|
{
|
||||||
|
"label": "可读",
|
||||||
|
"value": "read"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"label": "可写",
|
||||||
|
"value": "write"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "新增一行",
|
||||||
|
"type": "button",
|
||||||
|
"actionType": "add",
|
||||||
|
"target": "thetable",
|
||||||
|
"level": "info"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "thetable",
|
||||||
|
"type": "table",
|
||||||
|
"label": "任务参数",
|
||||||
|
"editable": true,
|
||||||
|
"addable": true,
|
||||||
|
"removable": true,
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"label": "参数名",
|
||||||
|
"name": "key",
|
||||||
|
"quickEdit": true
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"label": "参数值",
|
||||||
|
"name": "value",
|
||||||
|
"quickEdit": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,64 @@
|
|||||||
|
{
|
||||||
|
"type": "page",
|
||||||
|
"title": "修改 ${params.id}",
|
||||||
|
"remark": null,
|
||||||
|
"toolbar": [
|
||||||
|
{
|
||||||
|
"type": "button",
|
||||||
|
"actionType": "link",
|
||||||
|
"link": "/crud/list",
|
||||||
|
"label": "返回列表"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "form",
|
||||||
|
"initApi": "https://3xsw4ap8wah59.cfc-execute.bj.baidubce.com/api/amis-mock/sample/${params.id}",
|
||||||
|
"api": "https://3xsw4ap8wah59.cfc-execute.bj.baidubce.com/api/amis-mock/sample/$id",
|
||||||
|
"redirect": "/crud/list",
|
||||||
|
"controls": [
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"name": "engine",
|
||||||
|
"label": "Engine",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "divider"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"name": "browser",
|
||||||
|
"label": "Browser",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "divider"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"name": "platform",
|
||||||
|
"label": "Platform(s)",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "divider"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"name": "version",
|
||||||
|
"label": "Engine version"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "divider"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "select",
|
||||||
|
"name": "grade",
|
||||||
|
"label": "CSS grade",
|
||||||
|
"options": ["A", "B", "C", "D", "X"]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,149 @@
|
|||||||
|
{
|
||||||
|
"type": "page",
|
||||||
|
"title": "列表.",
|
||||||
|
"remark": null,
|
||||||
|
"name": "page-demo",
|
||||||
|
"toolbar": [
|
||||||
|
{
|
||||||
|
"type": "button",
|
||||||
|
"actionType": "link",
|
||||||
|
"link": "/crud/new",
|
||||||
|
"label": "新增",
|
||||||
|
"primary": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "crud",
|
||||||
|
"name": "sample",
|
||||||
|
"api": "https://3xsw4ap8wah59.cfc-execute.bj.baidubce.com/api/amis-mock/sample",
|
||||||
|
"filter": {
|
||||||
|
"title": "",
|
||||||
|
"mode": "inline",
|
||||||
|
"wrapWithPanel": false,
|
||||||
|
"submitText": "",
|
||||||
|
"controls": [
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"name": "keywords",
|
||||||
|
"placeholder": "通过关键字搜索",
|
||||||
|
"addOn": {
|
||||||
|
"label": "搜索",
|
||||||
|
"type": "submit",
|
||||||
|
"className": "btn-success"
|
||||||
|
},
|
||||||
|
"clearable": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"className": "m-b-sm"
|
||||||
|
},
|
||||||
|
"bulkActions": [
|
||||||
|
{
|
||||||
|
"label": "批量修改",
|
||||||
|
"type": "button",
|
||||||
|
"actionType": "dialog",
|
||||||
|
"level": "primary",
|
||||||
|
"dialog": {
|
||||||
|
"title": "批量编辑",
|
||||||
|
"name": "sample-bulk-edit",
|
||||||
|
"body": {
|
||||||
|
"type": "form",
|
||||||
|
"api": "https://3xsw4ap8wah59.cfc-execute.bj.baidubce.com/api/amis-mock/sample/bulkUpdate2",
|
||||||
|
"controls": [
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"name": "engine",
|
||||||
|
"label": "Engine"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "批量删除",
|
||||||
|
"type": "button",
|
||||||
|
"level": "danger",
|
||||||
|
"actionType": "ajax",
|
||||||
|
"api": "delete:https://3xsw4ap8wah59.cfc-execute.bj.baidubce.com/api/amis-mock/sample/$ids",
|
||||||
|
"confirmText": "确定要批量删除?"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"name": "engine",
|
||||||
|
"label": "Rendering engine",
|
||||||
|
"sortable": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "id",
|
||||||
|
"label": "ID",
|
||||||
|
"width": 20,
|
||||||
|
"sortable": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "browser",
|
||||||
|
"label": "Browser",
|
||||||
|
"sortable": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "platform",
|
||||||
|
"label": "Platform(s)",
|
||||||
|
"sortable": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "version",
|
||||||
|
"label": "Engine version"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "grade",
|
||||||
|
"label": "CSS grade"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "operation",
|
||||||
|
"label": "操作",
|
||||||
|
"width": "",
|
||||||
|
"buttons": [
|
||||||
|
{
|
||||||
|
"type": "button-group",
|
||||||
|
"buttons": [
|
||||||
|
{
|
||||||
|
"type": "button",
|
||||||
|
"label": "查看",
|
||||||
|
"level": "primary",
|
||||||
|
"actionType": "link",
|
||||||
|
"link": "/crud/${id}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "button",
|
||||||
|
"label": "修改",
|
||||||
|
"level": "info",
|
||||||
|
"actionType": "link",
|
||||||
|
"link": "/crud/${id}/edit"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "button",
|
||||||
|
"label": "删除",
|
||||||
|
"level": "danger",
|
||||||
|
"actionType": "ajax",
|
||||||
|
"confirmText": "您确认要删除?",
|
||||||
|
"api": "delete:https://3xsw4ap8wah59.cfc-execute.bj.baidubce.com/api/amis-mock/sample/$id"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"placeholder": "-",
|
||||||
|
"fixed": "right"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"affixHeader": true,
|
||||||
|
"columnsTogglable": "auto",
|
||||||
|
"placeholder": "暂无数据",
|
||||||
|
"tableClassName": "table-db table-striped",
|
||||||
|
"headerClassName": "crud-table-header",
|
||||||
|
"footerClassName": "crud-table-footer",
|
||||||
|
"toolbarClassName": "crud-table-toolbar",
|
||||||
|
"combineNum": 0,
|
||||||
|
"bodyClassName": "panel-default"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,69 @@
|
|||||||
|
{
|
||||||
|
"type": "page",
|
||||||
|
"title": "新增",
|
||||||
|
"remark": null,
|
||||||
|
"toolbar": [
|
||||||
|
{
|
||||||
|
"type": "button",
|
||||||
|
"actionType": "link",
|
||||||
|
"link": "/crud/list",
|
||||||
|
"label": "返回列表"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"title": "",
|
||||||
|
"type": "form",
|
||||||
|
"redirect": "/crud/list",
|
||||||
|
"name": "sample-edit-form",
|
||||||
|
"api": "https://3xsw4ap8wah59.cfc-execute.bj.baidubce.com/api/amis-mock/sample",
|
||||||
|
"controls": [
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"name": "engine",
|
||||||
|
"label": "Engine",
|
||||||
|
"required": true,
|
||||||
|
"inline": false,
|
||||||
|
"description": "",
|
||||||
|
"descriptionClassName": "help-block",
|
||||||
|
"placeholder": "",
|
||||||
|
"addOn": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "divider"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"name": "browser",
|
||||||
|
"label": "Browser",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "divider"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"name": "platform",
|
||||||
|
"label": "Platform(s)",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "divider"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"name": "version",
|
||||||
|
"label": "Engine version"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "divider"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"name": "grade",
|
||||||
|
"label": "CSS grade"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"type": "page",
|
||||||
|
"title": "代码编辑器",
|
||||||
|
"subTitle": "使用的monaco-editor,用到了 worker, 如果控制台没有报错,说明一起正常。",
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "form",
|
||||||
|
"controls": [
|
||||||
|
{
|
||||||
|
"type": "editor",
|
||||||
|
"name": "js",
|
||||||
|
"label": "Javascript",
|
||||||
|
"size": "md"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
(function() {
|
||||||
|
const response = {
|
||||||
|
data: {
|
||||||
|
type: "page",
|
||||||
|
title: "标题",
|
||||||
|
body: "this result is from jsonp"
|
||||||
|
},
|
||||||
|
status: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
window.jsonpCallback && window.jsonpCallback(response);
|
||||||
|
})();
|
@ -0,0 +1,127 @@
|
|||||||
|
{
|
||||||
|
"status": 0,
|
||||||
|
"msg": "",
|
||||||
|
"data": {
|
||||||
|
"pages": [
|
||||||
|
{
|
||||||
|
"label": "Home",
|
||||||
|
"url": "/",
|
||||||
|
"redirect": "/index/1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "示例",
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"label": "页面A",
|
||||||
|
"url": "index",
|
||||||
|
"schema": {
|
||||||
|
"type": "page",
|
||||||
|
"title": "页面A",
|
||||||
|
"body": "页面A"
|
||||||
|
},
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"label": "页面A-1",
|
||||||
|
"url": "1",
|
||||||
|
"schema": {
|
||||||
|
"type": "page",
|
||||||
|
"title": "页面A-1",
|
||||||
|
"body": "页面A-1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "页面A-2",
|
||||||
|
"url": "2",
|
||||||
|
"schema": {
|
||||||
|
"type": "page",
|
||||||
|
"title": "页面A-2",
|
||||||
|
"body": "页面A-2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "页面A-3",
|
||||||
|
"url": "3",
|
||||||
|
"schema": {
|
||||||
|
"type": "page",
|
||||||
|
"title": "页面A-3",
|
||||||
|
"body": "页面A-3"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "页面B",
|
||||||
|
"schema": {
|
||||||
|
"type": "page",
|
||||||
|
"title": "页面B",
|
||||||
|
"body": "页面B"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "页面C",
|
||||||
|
"schema": {
|
||||||
|
"type": "page",
|
||||||
|
"title": "页面C",
|
||||||
|
"body": "页面C"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "列表示例",
|
||||||
|
"url": "/crud",
|
||||||
|
"rewrite": "/crud/list",
|
||||||
|
"icon": "fa fa-cube",
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"label": "列表",
|
||||||
|
"url": "/crud/list",
|
||||||
|
"icon": "fa fa-list",
|
||||||
|
"schemaApi": "get:/pages/crud-list.json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "新增",
|
||||||
|
"url": "/crud/new",
|
||||||
|
"icon": "fa fa-plus",
|
||||||
|
"schemaApi": "get:/pages/crud-new.json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "查看",
|
||||||
|
"url": "/crud/:id",
|
||||||
|
"schemaApi": "get:/pages/crud-view.json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "修改",
|
||||||
|
"url": "/crud/:id/edit",
|
||||||
|
"schemaApi": "get:/pages/crud-edit.json"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "分组2",
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"label": "用户管理",
|
||||||
|
"schema": {
|
||||||
|
"type": "page",
|
||||||
|
"title": "用户管理",
|
||||||
|
"body": "页面C"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "外部链接",
|
||||||
|
"link": "http://baidu.gitee.io/amis"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "部门管理",
|
||||||
|
"schemaApi": "https://3xsw4ap8wah59.cfc-execute.bj.baidubce.com/api/amis-mock/mock2/service/form?tpl=tpl3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "jsonp 返回示例",
|
||||||
|
"schemaApi": "jsonp:/pages/jsonp.js?callback=jsonpCallback"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,105 @@
|
|||||||
|
{
|
||||||
|
"type": "page",
|
||||||
|
"title": "表单向导",
|
||||||
|
"subTitle": "可以通过表单向导,将一个超长的表单页面拆分成多个步骤,一步一步指引用户完成。",
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "wizard",
|
||||||
|
"actionFinishLabel": "确认",
|
||||||
|
"api": "https://3xsw4ap8wah59.cfc-execute.bj.baidubce.com/api/amis-mock/saveWizard",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"title": "填写活动信息",
|
||||||
|
"controls": [
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"name": "title",
|
||||||
|
"label": "活动标题",
|
||||||
|
"required": true,
|
||||||
|
"size": "md"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"type": "date",
|
||||||
|
"name": "date",
|
||||||
|
"label": "举办时间",
|
||||||
|
"size": "md"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"type": "number",
|
||||||
|
"name": "num",
|
||||||
|
"label": "参与人数",
|
||||||
|
"value": 10,
|
||||||
|
"size": "md"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"title": "填写赞助商信息",
|
||||||
|
"controls": [
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"name": "company",
|
||||||
|
"label": "公司名称",
|
||||||
|
"required": true,
|
||||||
|
"size": "md"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"name": "money",
|
||||||
|
"label": "赞助金额",
|
||||||
|
"addOn": {
|
||||||
|
"type": "text",
|
||||||
|
"label": "¥"
|
||||||
|
},
|
||||||
|
"size": "md"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"title": "确认",
|
||||||
|
"mode": "horizontal",
|
||||||
|
"horizontal": {
|
||||||
|
"leftFixed": "sm"
|
||||||
|
},
|
||||||
|
"controls": [
|
||||||
|
{
|
||||||
|
"type": "static",
|
||||||
|
"name": "company",
|
||||||
|
"label": "活动标题",
|
||||||
|
"labelClassName": "text-muted"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "static-date",
|
||||||
|
"name": "date",
|
||||||
|
"label": "举办时间",
|
||||||
|
"labelClassName": "text-muted"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "static",
|
||||||
|
"name": "num",
|
||||||
|
"label": "参与人数",
|
||||||
|
"labelClassName": "text-muted"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "static",
|
||||||
|
"name": "company",
|
||||||
|
"label": "公司名称",
|
||||||
|
"labelClassName": "text-muted"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "static",
|
||||||
|
"name": "money",
|
||||||
|
"label": "赞助金额",
|
||||||
|
"labelClassName": "text-muted"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
After Width: | Height: | Size: 6.1 KiB |
@ -0,0 +1,40 @@
|
|||||||
|
const express = require('express');
|
||||||
|
const http = require('http');
|
||||||
|
const path = require('path');
|
||||||
|
const reload = require('reload');
|
||||||
|
const bodyParser = require('body-parser');
|
||||||
|
const logger = require('morgan');
|
||||||
|
|
||||||
|
const app = express();
|
||||||
|
|
||||||
|
app.set('port', process.env.PORT || 3000);
|
||||||
|
app.use(logger('dev'));
|
||||||
|
app.use(bodyParser.json()); // Parses json, multi-part (file), url-encoded
|
||||||
|
|
||||||
|
app.use('/public', express.static('public'));
|
||||||
|
app.use('/pages', express.static('pages'));
|
||||||
|
|
||||||
|
app.get('/*', function (req, res) {
|
||||||
|
res.sendFile(path.join(__dirname, 'index.html'));
|
||||||
|
});
|
||||||
|
|
||||||
|
const server = http.createServer(app);
|
||||||
|
|
||||||
|
// Reload code here
|
||||||
|
reload(app)
|
||||||
|
.then(function (reloadReturned) {
|
||||||
|
// reloadReturned is documented in the returns API in the README
|
||||||
|
|
||||||
|
// Reload started, start web server
|
||||||
|
server.listen(app.get('port'), function () {
|
||||||
|
console.log(
|
||||||
|
'Web server listening on port http://localhost:' + app.get('port')
|
||||||
|
);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(function (err) {
|
||||||
|
console.error(
|
||||||
|
'Reload could not start, could not start server/sample app',
|
||||||
|
err
|
||||||
|
);
|
||||||
|
});
|
Loading…
Reference in new issue