Skip to content

Commit 924c7d8

Browse files
committed
add doc
1 parent 1bdfc02 commit 924c7d8

File tree

2 files changed

+75
-77
lines changed

2 files changed

+75
-77
lines changed

frontend/weekly-communication/simple-query-page.md

Lines changed: 63 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -74,68 +74,6 @@
7474
- 统一使用 ReactiveForms 禁止使用 Template-driven forms
7575
- 若操作按钮过多,建议另起一行 用 nz-row 包裹
7676

77-
## 页面样式
78-
79-
为了保持系统的整体性和统一行,非特殊的查询展示页统一使用: `class="page-header-small"` `class="form-small"` `class="table-text-center table-small"`
80-
以上样式定义在 index.less 中 便于统一修改
81-
**_注意_**:本样式只适用于后台页面,前台请自行定义
82-
83-
```less
84-
.page-header-small {
85-
padding: 6px 24px 0px 24px;
86-
margin-bottom: 6px;
87-
}
88-
89-
.page-header-small.ad-ph .title,
90-
.page-header-small.ad-ph .action {
91-
margin-bottom: 6px;
92-
}
93-
94-
.form-small {
95-
border: 1px solid #d9d9d9;
96-
border-radius: 4px;
97-
padding: 6px;
98-
margin-bottom: 6px;
99-
100-
.ant-input {
101-
padding: 1px 7px;
102-
height: 24px;
103-
}
104-
105-
.ant-form-item {
106-
margin-bottom: 0;
107-
}
108-
109-
.ant-select-selection--multiple,
110-
.ant-select-selection--single {
111-
height: 24px;
112-
}
113-
114-
.ant-select-selection__rendered {
115-
line-height: 22px;
116-
margin: 0 7px;
117-
}
118-
}
119-
120-
.table-text-center {
121-
table th,
122-
table td {
123-
text-align: center !important;
124-
}
125-
}
126-
127-
.table-small {
128-
table th,
129-
table td {
130-
padding: 2px;
131-
height: 47px;
132-
}
133-
table td {
134-
background-color: white;
135-
}
136-
}
137-
```
138-
13977
## 基本逻辑代码
14078

14179
```ts
@@ -157,10 +95,8 @@ export class BillListComponent implements OnInit {
15795
buttons: [
15896
{
15997
text: "详情",
160-
click: (record: BillSummaryResponse) => {
161-
this.log.debug(record);
98+
click: (record: BillSummaryResponse) =>
16299
this.routerService.toDetail(record.billId);
163-
}
164100
}
165101
]
166102
}
@@ -272,3 +208,65 @@ export class BillListComponent implements OnInit {
272208
}
273209
}
274210
```
211+
212+
## 页面样式
213+
214+
为了保持系统的整体性和统一行,非特殊的查询展示页统一使用: `class="page-header-small"` `class="form-small"` `class="table-text-center table-small"`
215+
以上样式定义在 index.less 中 便于统一修改
216+
**_注意_**:本样式只适用于后台页面,前台请自行定义
217+
218+
```less
219+
.page-header-small {
220+
padding: 6px 24px 0px 24px;
221+
margin-bottom: 6px;
222+
}
223+
224+
.page-header-small.ad-ph .title,
225+
.page-header-small.ad-ph .action {
226+
margin-bottom: 6px;
227+
}
228+
229+
.form-small {
230+
border: 1px solid #d9d9d9;
231+
border-radius: 4px;
232+
padding: 6px;
233+
margin-bottom: 6px;
234+
235+
.ant-input {
236+
padding: 1px 7px;
237+
height: 24px;
238+
}
239+
240+
.ant-form-item {
241+
margin-bottom: 0;
242+
}
243+
244+
.ant-select-selection--multiple,
245+
.ant-select-selection--single {
246+
height: 24px;
247+
}
248+
249+
.ant-select-selection__rendered {
250+
line-height: 22px;
251+
margin: 0 7px;
252+
}
253+
}
254+
255+
.table-text-center {
256+
table th,
257+
table td {
258+
text-align: center !important;
259+
}
260+
}
261+
262+
.table-small {
263+
table th,
264+
table td {
265+
padding: 2px;
266+
height: 47px;
267+
}
268+
table td {
269+
background-color: white;
270+
}
271+
}
272+
```

frontend/weekly-communication/summary.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# 每周前端小组内部沟通内容 汇总
1+
# 每周前端小组内部沟通内容汇总
22

33
## 2018-11-30
44

@@ -35,35 +35,35 @@
3535

3636
> 使用时需要注意下面两点
3737
38-
- 它会在 ngOnInit 前调用,官方有可能会在下个版本修改此行为,使用时需注意
38+
- 它会在 `ngOnInit` 前调用,官方有可能会在下个版本修改此行为,使用时需注意
3939

4040
- 为了提高变化检测的性能,对于对象比较,Angular 内部直接使用 `===` 运算符进行值比较。因此当输入属性是引用类型,当改变对象内部属性时,是不会调用 `ngOnChanges` 生命周期钩子的
4141

4242
### 复杂表单验证需小心
4343

4444
> 统一使用 reactive form, 使用时需要注意以下几点.
4545
46-
- 针对复杂表单(表单项的验证规则是可变的情况),使用 from.valid/invalid 判断时,需要注意是否是最新的状态,因为可能某个表单项改变了验证规则,但是没有更新.
46+
- 针对复杂表单(表单项的验证规则是可变的情况),使用 `from.valid/invalid` 判断时,需要注意是否是最新的状态,因为可能某个表单项改变了验证规则,但是没有更新.
4747
- 对于大范围改变表单验证规则的情况,可以考虑重新 init form, 但需要小心(注意 html 中需要用 ngif 把不需要的表单 remove 掉).
4848
- 把定义和获取 control 的代码放到最后 `get controlName() { return this.form.get('controlName')}`, 以更方便 review .
4949
- 如果一个验证规则被重复多次使用,请使用类似 `const pattern = Validators.pattern(moneyRegex)` ,让代码变得更简洁.
5050

5151
## 2018-12-07
5252

53-
- 使用插件 document this 进行代码注释
53+
- 使用插件 `document this` 进行代码注释
5454

55-
- 表单 control 统一使用 touched 进行错误提示
55+
- 表单 `control` 统一使用 `touched` 进行错误提示
5656

57-
- 使用 Object.keys(xxx).forEach() 代替 for in
57+
- 使用 `Object.keys(xxx).forEach()` 代替 `for in`
5858

59-
- 简单查询条件 form 统一使用 shf-item 组件,较复杂(需要我们自己控制布局 长短的)统一使用 nz row + nz col
59+
- 简单查询条件 `form` 统一使用 `shf-item` 组件,较复杂(需要我们自己控制布局 长短的)统一使用 `nz row + nz col`
6060

61-
- spin 统一使用 BehaviorSubject, 定义一个 showSpin/hideSpin 方法, 如果需要改变 nzTip 则 showSpin(nzTip)
61+
- `spin` 统一使用 `BehaviorSubject`, 定义一个 `showSpin/hideSpin` 方法, 如果需要改变 `nzTip``showSpin(nzTip)`
6262

63-
- Component 中 方法名可以简单query add update delete,但是必须有注释
63+
- `Component` 中 方法名可以简单 `query add update delete` ,但是必须有注释
6464

65-
- Http Service 中方法名参照 Api 命名, 且必须有注释。命名风格 xxxApi
65+
- `Http Service` 中方法名参照 Api 命名, 且必须有注释。命名风格 `const getXxxApi = admin/xxx/getXxx`
6666

67-
- 统一使用 Router Service 进行页面跳转,并且保证 一个 module 一个 router
67+
- 统一使用 `Router Service` 进行页面跳转,并且保证 一个 module 一个 router
6868

69-
- 单一实体服务用 root,各个模块或组件直接 constructor 注入,但必须保证只能用本目录或者父级目录的 service , 如果需要跨目录使用,请提取到相应级别的 Shared 目录。如果不是单例的 service , 则用 provider 和 constructor 注入。
69+
- 单一实体服务用 `root`,各个模块或组件直接 `constructor` 注入,但必须保证只能用本目录或者父级目录的 service , 如果需要跨目录使用,请提取到相应级别的 Shared 目录。如果不是单例的 service , 则用 `provider``constructor` 注入。

0 commit comments

Comments
 (0)