.
This commit is contained in:
14
Web/public/doc-code/api/setting.js
Normal file
14
Web/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
Web/public/doc-code/api/usage.js
Normal file
25
Web/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 */
|
||||
}
|
||||
}
|
||||
35
Web/public/doc-code/application/dto.cs
Normal file
35
Web/public/doc-code/application/dto.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Ewide.Application
|
||||
{
|
||||
// 继承PageInputBase,可以直接使用一些通用的查询和分页字段
|
||||
public class DtoPageInput : Core.PageInputBase {}
|
||||
|
||||
// 可定义一个主键Dto
|
||||
public class DtoKeyInput
|
||||
{
|
||||
public virtual string Id { get; set; }
|
||||
}
|
||||
|
||||
// 可定义一个必传主键的Dto
|
||||
public class DtoKeyRequiredInput : DtoKeyInput
|
||||
{
|
||||
[Required]
|
||||
public override string Id { get; set; }
|
||||
}
|
||||
|
||||
public class DtoAddInput
|
||||
{
|
||||
[MaxLength(100)]
|
||||
[Required]
|
||||
public string RequiredString { get; set; }
|
||||
}
|
||||
|
||||
public class DtoUpdateInput : DtoAddInput
|
||||
{
|
||||
[Required]
|
||||
public override string Id { get; set; }
|
||||
}
|
||||
|
||||
public class DtoDeleteInput: DtoKeyInput {}
|
||||
}
|
||||
26
Web/public/doc-code/application/entity.cs
Normal file
26
Web/public/doc-code/application/entity.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Ewide.Application
|
||||
{
|
||||
// Table特性设定表在数据库中的表名
|
||||
[Table("bs_table_name")]
|
||||
[Comment("表名")]
|
||||
// 这里继承Core.DEntityBase,会自动添加Id及一些常用字段
|
||||
public class BsTableName : Core.DEntityBase
|
||||
{
|
||||
// Comment特性用于生成字段说明
|
||||
[Comment("字符字段")]
|
||||
// MaxLength特性用于限定字段值长度,可以不设置
|
||||
[MaxLength(50)]
|
||||
// Required特性设置字段是否不为空
|
||||
[Required]
|
||||
public string StringField { get; set; }
|
||||
|
||||
[Comment("整形字段")]
|
||||
[MaxLength(3)]
|
||||
[Required]
|
||||
public int IntField { get; set; }
|
||||
}
|
||||
}
|
||||
15
Web/public/doc-code/application/interface.cs
Normal file
15
Web/public/doc-code/application/interface.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ewide.Application.Service
|
||||
{
|
||||
public interface Interface
|
||||
{
|
||||
Task<dynamic> Page(DtoPageInput input);
|
||||
|
||||
Task Add(DtoAddInput input);
|
||||
|
||||
Task Update(DtoUpdateInput input);
|
||||
|
||||
Task Delete(DtoDeleteInput input);
|
||||
}
|
||||
}
|
||||
90
Web/public/doc-code/application/service.cs
Normal file
90
Web/public/doc-code/application/service.cs
Normal file
@@ -0,0 +1,90 @@
|
||||
using Dapper;
|
||||
using Ewide.Core;
|
||||
using Ewide.Core.Extension;
|
||||
using Furion.DatabaseAccessor;
|
||||
using Furion.DependencyInjection;
|
||||
using Furion.DynamicApiController;
|
||||
|
||||
namespace Ewide.Application.Service
|
||||
{
|
||||
[ApiDescriptionSettings(Name = "ServiceDoc")]
|
||||
public class Service : Interface, IDynamicApiController, ITransient
|
||||
{
|
||||
// Dapper仓储
|
||||
private readonly IDapperRepository _dapperRep;
|
||||
|
||||
// 用户信息
|
||||
private readonly IUserManager _userManager;
|
||||
|
||||
// 数据(实体Entity)仓储
|
||||
private readonly IRepository<Entity> _entityRep;
|
||||
|
||||
public Service(
|
||||
IDapperRepository dapperRep,
|
||||
|
||||
IUserManager userManager,
|
||||
|
||||
IRepository<Entity> entityRep
|
||||
)
|
||||
{
|
||||
_dapperRep = dapperRep;
|
||||
|
||||
_userManager = userManager;
|
||||
|
||||
_entityRep = entityRep;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询 - EF方式
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<dynamic> Page(DtoPageInput input)
|
||||
{
|
||||
var data = await _entityRep.DetachedEntities.ToPageData(input);
|
||||
return PageDataResult<Entity>.PageResult(data);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询 - Dapper方式
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<dynamic> Page(DtoPageInput input)
|
||||
{
|
||||
var sql = "...";
|
||||
var data = await _dapperRep.QueryPageDataDynamic(sql, input);
|
||||
return data;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 新增
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
public async Task Add(DtoAddInput input)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 编辑
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
public async Task Update(DtoUpdateInput input)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
public async Task Delete(DtoDeleteInput input)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
51
Web/public/doc-code/auth/index.txt
Normal file
51
Web/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
Web/public/doc-code/util/dic/index.js
Normal file
10
Web/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
Web/public/doc-code/util/query/index.js
Normal file
32
Web/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: '<' }
|
||||
]
|
||||
BIN
Web/public/favicon.ico
Normal file
BIN
Web/public/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
44
Web/public/index.html
Normal file
44
Web/public/index.html
Normal file
@@ -0,0 +1,44 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="theme-color" content="#000000" />
|
||||
<meta
|
||||
name="description"
|
||||
content="Web site created using create-react-app"
|
||||
/>
|
||||
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
|
||||
<!--
|
||||
manifest.json provides metadata used when your web app is installed on a
|
||||
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
||||
-->
|
||||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
|
||||
<!--
|
||||
Notice the use of %PUBLIC_URL% in the tags above.
|
||||
It will be replaced with the URL of the `public` folder during the build.
|
||||
Only files inside the `public` folder can be referenced from the HTML.
|
||||
|
||||
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
|
||||
work correctly both with client-side routing and a non-root public URL.
|
||||
Learn how to configure a non-root public URL by running `npm run build`.
|
||||
-->
|
||||
<title>宽易科技</title>
|
||||
<script src="https://webapi.amap.com/maps?v=2.0&key=c6a4832b8afbde0361b36630a3fc5bdc&plugin=Map3D,AMap.DistrictSearch,AMap.Geocoder,AMap.AutoComplete,AMap.PlaceSearch"></script>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
<div id="root"></div>
|
||||
<!--
|
||||
This HTML file is a template.
|
||||
If you open it directly in the browser, you will see an empty page.
|
||||
|
||||
You can add webfonts, meta tags, or analytics to this file.
|
||||
The build step will place the bundled scripts into the <body> tag.
|
||||
|
||||
To begin the development, run `npm start` or `yarn start`.
|
||||
To create a production bundle, use `npm run build` or `yarn build`.
|
||||
-->
|
||||
</body>
|
||||
</html>
|
||||
BIN
Web/public/logo192.png
Normal file
BIN
Web/public/logo192.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.2 KiB |
BIN
Web/public/logo512.png
Normal file
BIN
Web/public/logo512.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.4 KiB |
25
Web/public/manifest.json
Normal file
25
Web/public/manifest.json
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"short_name": "React App",
|
||||
"name": "Create React App Sample",
|
||||
"icons": [
|
||||
{
|
||||
"src": "favicon.ico",
|
||||
"sizes": "64x64 32x32 24x24 16x16",
|
||||
"type": "image/x-icon"
|
||||
},
|
||||
{
|
||||
"src": "logo192.png",
|
||||
"type": "image/png",
|
||||
"sizes": "192x192"
|
||||
},
|
||||
{
|
||||
"src": "logo512.png",
|
||||
"type": "image/png",
|
||||
"sizes": "512x512"
|
||||
}
|
||||
],
|
||||
"start_url": ".",
|
||||
"display": "standalone",
|
||||
"theme_color": "#000000",
|
||||
"background_color": "#ffffff"
|
||||
}
|
||||
3
Web/public/robots.txt
Normal file
3
Web/public/robots.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
# https://www.robotstxt.org/robotstxt.html
|
||||
User-agent: *
|
||||
Disallow:
|
||||
Reference in New Issue
Block a user