为什么都没了
This commit is contained in:
14
framework/web-react/public/doc-code/api/setting.js
Normal file
14
framework/web-react/public/doc-code/api/setting.js
Normal file
@@ -0,0 +1,14 @@
|
||||
export default {
|
||||
/* 自定义的接口名称 */
|
||||
apiName: [
|
||||
/* 接口地址 */
|
||||
url,
|
||||
/* 请求类型 [get | post] */
|
||||
'get',
|
||||
/* axios所需的设置参数 */
|
||||
options,
|
||||
],
|
||||
|
||||
/* 默认为get接口 */
|
||||
apiPostName: getUrl
|
||||
}
|
||||
25
framework/web-react/public/doc-code/api/usage.js
Normal file
25
framework/web-react/public/doc-code/api/usage.js
Normal file
@@ -0,0 +1,25 @@
|
||||
import { api } from 'common/api'
|
||||
|
||||
api.apiName(params)
|
||||
.then(res => {
|
||||
/* ... */
|
||||
})
|
||||
.catch(error => {
|
||||
/* catch */
|
||||
})
|
||||
.finally(() => {
|
||||
/* finally */
|
||||
})
|
||||
|
||||
|
||||
// 或者采用异步
|
||||
async function foo() {
|
||||
try {
|
||||
const res = await api.apiName(params)
|
||||
/* ... */
|
||||
} catch (error) {
|
||||
/* catch */
|
||||
} finally {
|
||||
/* finally */
|
||||
}
|
||||
}
|
||||
51
framework/web-react/public/doc-code/auth/index.txt
Normal file
51
framework/web-react/public/doc-code/auth/index.txt
Normal file
@@ -0,0 +1,51 @@
|
||||
import { Auth } from 'components'
|
||||
import auth from 'components/authorized/handler'
|
||||
|
||||
/**
|
||||
* 简单的权限标识
|
||||
*/
|
||||
function foo1() {
|
||||
return (
|
||||
<Auth auth="permissions:name">
|
||||
<a>连接</a>
|
||||
</Auth>
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 多个并且关系的权限标识
|
||||
*/
|
||||
function foo2() {
|
||||
return (
|
||||
<Auth auth={['permissions:name1', 'permissions:name2']}>
|
||||
<a>连接</a>
|
||||
</Auth>
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 多个或者关系的权限标识
|
||||
*/
|
||||
function foo3() {
|
||||
return (
|
||||
<Auth auth={[['permissions:name1'], ['permissions:name2']]}>
|
||||
<a>连接</a>
|
||||
</Auth>
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 前缀简化
|
||||
*/
|
||||
function foo4() {
|
||||
return (
|
||||
<Auth auth={{ permissions: ['name1', 'name2'] }}>
|
||||
<a>连接</a>
|
||||
</Auth>
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 纯js
|
||||
*/
|
||||
const flag = auth('permissions:name') // => Boolean
|
||||
10
framework/web-react/public/doc-code/util/dic/index.js
Normal file
10
framework/web-react/public/doc-code/util/dic/index.js
Normal file
@@ -0,0 +1,10 @@
|
||||
import getDictData from 'util/dic'
|
||||
|
||||
async function foo() {
|
||||
const code = await getDictData('dic_code_one', 'dic_code_two')
|
||||
// =>
|
||||
// code = {
|
||||
// dicCodeOne: [],
|
||||
// dicCodeTwo: [],
|
||||
// }
|
||||
}
|
||||
32
framework/web-react/public/doc-code/util/query/index.js
Normal file
32
framework/web-react/public/doc-code/util/query/index.js
Normal file
@@ -0,0 +1,32 @@
|
||||
import { QueryType, getSearchDateRange, getSearchInfo } from 'util/query'
|
||||
|
||||
getSearchInfo({
|
||||
query: {
|
||||
value: '123',
|
||||
text: '123',
|
||||
code: 'abc',
|
||||
check: ['1', '2', '3'],
|
||||
range: [1, 10],
|
||||
dateRange: getSearchDateRange(['2021-01-01', '2021-01-10'])
|
||||
},
|
||||
queryType: {
|
||||
text: QueryType.Equal,
|
||||
code: QueryType.Like,
|
||||
check: QueryType.Equal,
|
||||
range: [QueryType.GreaterThanOrEqual, QueryType.LessThan],
|
||||
dateRange: [QueryType.GreaterThanOrEqual, QueryType.LessThan]
|
||||
}
|
||||
})
|
||||
|
||||
// =>
|
||||
|
||||
[
|
||||
{ field: 'value', value: ['123'] },
|
||||
{ field: 'text', value: ['123'], type: '=' },
|
||||
{ field: 'code', value: ['abc'], type: 'like' },
|
||||
{ field: 'check', value: ['1', '2', '3'], type: '=' },
|
||||
{ field: 'range', value: [1], type: '>=' },
|
||||
{ field: 'range', value: [10], type: '<' },
|
||||
{ field: 'dateRange', value: ['2021-01-01'], type: '>=' },
|
||||
{ field: 'dateRange', value: ['2021-01-11'], type: '<' }
|
||||
]
|
||||
Reference in New Issue
Block a user