Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/vipshop/ams into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
jun85.li committed Dec 22, 2019
2 parents 3bac153 + 96b8ad8 commit f9fc9ff
Show file tree
Hide file tree
Showing 125 changed files with 1,655 additions and 292 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ build
node_modules
examples/router/node_modules
packages/*/node_modules
packages/cdn
lib
dist
test
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ module.exports = {
// 这里填入你的项目需要的全局变量
// 这里值为 false 表示这个全局变量不允许被重新赋值,比如:
//
// Vue: false
ams: false,
define: false
},
rules: {
'no-throw-literal': 'off',
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,4 @@ package-lock.json
/packages/*/lib
/material-list.json
/test/_coverage
.scannerwork/
/plugins/vscode/*.vsix
5 changes: 5 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
/backup
package-lock.json
dist

2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"node-sass": "^4.12.0",
"sass-loader": "^7.1.0",
"vue-highlight.js": "^3.1.0",
"vuepress": "^1.0.4"
"vuepress": "^1.2.0"
},
"devDependencies": {
"vuepress-plugin-flowchart": "^1.4.3"
Expand Down
120 changes: 120 additions & 0 deletions docs/zh-CN/.vuepress/components/block/drawer/block.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
export default {
defaultDrawer: {
type: 'component',
operations: {
addItem: {
type: 'button',
label: '点击打开弹窗',
event: 'adminAddDrawer.show'
}
},
blocks: {
adminAddDrawer: {
type: 'drawer',
data: {
title: '我是标题'
},
props: {
'before-close': function(done){
this.$confirm('确认关闭?')
.then(_ => {
done();
})
.catch(_ => {});
}
},
operations: {
submit: {
type: 'button',
label: '提交',
props: {
type: 'primary'
}
},
hide: {
type: 'button',
label: '关闭'
}
},
actions: {
submit() {
this.$message('你点击了提交按钮')
}
},
blocks: {
dialogText: {
type: 'component',
options: {
is: 'div',
text: "我是弹窗内容"
}
}
}
}
}
},
drawer: {
type: 'component',
operations: {
addItem: {
type: 'button',
label: '点击打开弹窗',
event: 'adminDrawer.show'
}
},
blocks: {
adminDrawer: {
type: 'drawer',
data: {
title: '添加'
},
blocks: {
addDrawerForm: {
ctx: 'edit',
type: 'form',
style: {
paddingRight: '20px'
},
resource: {
fields: {
text: {
label: '新文本',
type: 'text'
},
password: {
type: 'password',
label: '密码'
}
}
},
operations: {
submit: {
type: 'button',
label: '提交',
props: {
type: 'primary'
}
},
hide: {
type: 'button',
label: '关闭'
}
},
events: {
submit: '@validate @add @adminDrawer.hide @clear'
},
actions: {
add(){
this.callAction('@adminListView.add', {item: this.data})
},
clear() {
// 清空表单数据
this.data = {}
}
}
}
}
}
}
}
}
40 changes: 40 additions & 0 deletions docs/zh-CN/.vuepress/components/block/drawer/demo.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<template>
<el-card shadow="hover" class="demo demo-card">
<ams-block v-if="init" :name="blockName" class="demo-card-preview"/>
<div :class="`demo-card-config ${showConfig ? 'open': ''}`">
<highlight-code lang="javascript">
{{ configCode }}
</highlight-code>
</div>
<div class="demo-card-config-btn" @click="toggleDemoCofig">
<i :class="`el-icon-caret-${showConfig ? 'top': 'bottom'}`"></i>
{{ showConfig ? '隐藏' : '显示'}}配置
<el-link v-if="onlineDemo" :href="onlineDemo" target="_blank" type="success">在线运行</el-link>
</div>
</el-card>
</template>

<script>
import demoMixins from '../../demo/demo-mixin'
import block from './block'
import stringify from '@ams-team/json-stringify'
import beautify from 'js-beautify'
export default {
mixins: [demoMixins],
mounted(){
const stringConfig = stringify(block[this.blockName])
this.configCode = beautify(stringConfig, { indent_size: 2, space_in_empty_paren: true })
// 如果已经注册过则不再注册
if (ams && ams.blocks && ams.blocks[this.blockName]) {
this.init = true;
return;
}
ams.block(this.blockName, block[this.blockName])
this.init = true
}
}
</script>
40 changes: 40 additions & 0 deletions docs/zh-CN/.vuepress/components/block/grid/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,46 @@ export default {
}
}
},
unsupportGrid: {
type: 'grid',
style: {
height: '200px'
},
blocks: {
unsupportGridheaderTitle1: { // 第一列
type: 'card',
options: {
headerTitle: '卡片类型自带的标题'
},
style: {
width: 'calc(50% - 10px)',
height: '100%',
'margin-right': '10px'
},
blocks: {
emptyCardText: {
type: 'component',
options: {
is: 'div',
text: '自定义内容'
}
}
}
},
unsupportGridheaderTitle2: { // 第二列
type: 'card',
options: {
headerTitle: '卡片类型自带的标题'
},
style: {
width: 'calc(50% - 10px)',
height: '100%',
'margin-left': '10px'
},
blocks: ['emptyCardText']
}
}
},
grid3: {
type: 'grid',
style: {
Expand Down
8 changes: 8 additions & 0 deletions docs/zh-CN/.vuepress/components/block/router/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,14 @@ export default {
},
slot: 'menuTop'
},
navRouterLeft: {
slot: 'nav-left',
type: 'component',
options: {
is: 'div',
text: '导航左侧插槽'
}
},
navRouterTitle: {
"type": "component",
"options": {
Expand Down
30 changes: 27 additions & 3 deletions docs/zh-CN/.vuepress/components/changelog/logs.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,38 @@
// 更新日志
export default [
{
version: '0.20.2',
date: '2019.11.7',
version: '0.21.6',
date: '2019.12.3',
log: [
'feat: text的view组件添加on事件',
'feat: theme-vipshop主题修改',
'feat: block-list的操作按钮context增加数据index',
'feat: block-imagelist增加显示角标信息',
'feat: 添加nav-left插槽',
'feat: 新增drawer抽屉block',
'feat: array-simple数据更换',
'fix: field-image兼容接口通过data直接返回图片地址的情况',
'fix: 修复block-list的表头操作栏样式问题',
'fix: field-image删除previewUrl'
]
},
{
version: '0.20.10',
date: '2019.11.18',
log: [
'feat:增加事件销毁机制,tabs增加监听resize事件',
'feat:block-chart添加loading',
'feat: block-imagelist增加支持插入分类名称和隐藏标题信息块',
'feat: operations支持配置换行展示',
'feat: 增加block默认data机制',
'feat: 把field-headimage整合到field-image,并删除field-headimage',
'feat: block-card、block-component、block-dialog、block-imagelist、block-tabs增加loading效果,可以在该区块的action通过this.showLoading和this.hideLoading来控制',
'feat:增加图标ams-icon-user',
'feat: 增加图标ams-icon-user',
'fix: 修复field-select在view状态下,无法匹配值为空的选项',
'fix: block-chart的图例icon设置为默认图标',
'fix: block-imagelist支持搜索换行',
'fix: block-grid兼容低级浏览器',
'fix: block-imagelist标题块高度不一致、删除title逻辑判断',
'fix: 路由菜单样式',
'fix: fieldChange无法获取不在资源声明的field的name',
'fix: 修复列表在有操作按钮的时候,行距过高的问题'
Expand Down
2 changes: 1 addition & 1 deletion docs/zh-CN/.vuepress/components/entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ ams.config({
withCredentials: false
}
}
})
})
1 change: 1 addition & 0 deletions docs/zh-CN/.vuepress/components/try/config.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion docs/zh-CN/.vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
const dest = 'dist'

module.exports = {
title: 'AMS',
title: 'AMS文档',
base: '/ams/',
description: '基于JSON配置来快速搭建管理后台前端页面的JavaScript框架',
dest: dest, // 指定 vuepress build 的输出目录, 默认值: .vuepress/dist
Expand Down Expand Up @@ -144,6 +144,7 @@ module.exports = {
'imagelist',
'table',
'dialog',
'drawer',
'error',
'router',
'collapse',
Expand Down
Binary file modified docs/zh-CN/.vuepress/public/index/banner-bg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/zh-CN/.vuepress/public/index/banner-left.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/zh-CN/.vuepress/public/index/banner-right01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/zh-CN/.vuepress/public/index/banner-right02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/zh-CN/.vuepress/public/index/banner-right03-03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/zh-CN/.vuepress/public/index/banner-right03-04.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/zh-CN/.vuepress/public/index/banner-right03-05.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/zh-CN/.vuepress/public/index/banner-right03-06.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/zh-CN/.vuepress/public/index/banner-right03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/zh-CN/.vuepress/public/index/footer-01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/zh-CN/.vuepress/public/index/footer-02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/zh-CN/.vuepress/public/index/git.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/zh-CN/.vuepress/public/index/start.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions docs/zh-CN/api/ams-ams.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ action调用显式的返回值,会自动更新 `$prevReturn`,用于action参

返回将post数据 data序列化为`x-www-form-urlencoded`格式

## ams.createApiAction(params)
## ams.createApiAction(params)
- 参数:
- params: `object`
- getOptions: `async Function` 请求参数获取回调
Expand All @@ -152,7 +152,7 @@ action调用显式的返回值,会自动更新 `$prevReturn`,用于action参

## ams.request(opt)
- 参数:
- opt: `object
- opt: `object`
- opt.method:'get' | 'post'
- url:string
- data:object
Expand Down
2 changes: 1 addition & 1 deletion docs/zh-CN/api/default-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ DefaultConfig: DefaultConfig 简化配置

通过简化配置可以将一些常用的配置用`常量`标识,减少重复代码的编写。可以使用ams内部继承的配置,也可以在项目自行配置,在文末自定义有使用说明。

在ams内部目前集成了以下几种简化配置,通过在`Console控制台`打印`ams.configs`也可以查看
在ams内部目前集成了以下几种简化配置,通过在浏览器控制台`console面板`打印`ams.configs`也可以查看

## FORM_SUBMIT

Expand Down
5 changes: 4 additions & 1 deletion docs/zh-CN/api/resource.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ ams.resource(name: String, config: Object)

```js
ams.resource('demo-resource', {
key: 'id', // 【非必须】标识该resource的keyName
key: 'id',
foreignKeys: ['testArrays'],
api: { // 数据接口相关
prefix: '//rap2api.taobao.org/app/mock/231578/ams/mock/',
create: 'create',
Expand Down Expand Up @@ -50,6 +51,8 @@ ams.resource('demo-resource', {

- `key`: 【非必须】标识该resource的`keyName`,有些场景需要通过 `queryString` 传入,通过解析 `key=value` 获取

- `foreignKeys`: 发起resource里的api接口时,可以附带传的参数,接收数组的字段格式,同`key`一样会通过`queryString` 传入

- `api`: 对resource的一些内置方法,`prefix`为接口地址,目前提供了`create` `update` `read` `delete` `list` 几个内置请求方法

- `fields`: resource里的详细的字段描述,点击前往[更深入的了解fields](/api/field.html)
Expand Down
Loading

0 comments on commit f9fc9ff

Please sign in to comment.