@k3000/s1 0.3.6 → 0.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -39,6 +39,14 @@ npm run jwt # 用户身份校验(必要)
39
39
  npm run store1 # 存储服务(必要)
40
40
  npm run proxy # http转发服务(必要)
41
41
  ```
42
+ #### 4、后台管理系统web页面开发
43
+
44
+ 进入`ui-dev`文件夹
45
+
46
+ ```
47
+ > bot update # 初始化目录
48
+ > npm run dev # 执行
49
+ ```
42
50
 
43
51
  #### 4、发布
44
52
 
package/admin/README.MD CHANGED
@@ -0,0 +1,47 @@
1
+ 主要用到的类`Admin`、`AdminAuth`和`AdminAuthPerm`。
2
+
3
+ `Admin`普通的管理系统类。
4
+
5
+ `AdminAuth`这个类需要登录授权后才能访问。
6
+
7
+ `AdminAuthPerm`这个类在登录的基础上需要有特定的权限关键字才能访问。
8
+
9
+ ```
10
+ export class User extends AdminAuthPerm {
11
+
12
+ pk = 'userId'
13
+ set = 'sysUser'
14
+ route = '/system/user'
15
+ except = ['deptTree', 'authRole', 'changeStatus']
16
+
17
+ GET(...arg) {
18
+ // 调用默认的GET方法
19
+ const result = this.call(...arg)
20
+ // 这个是处理没有get方法的情况,如请求为/system/user或者/system/user/
21
+ if (result === NoActionParams) return store1.getPostUserList().then(this.addCode200)
22
+ // 这个是处理请求为/system/user/:action但是没有实现action()的情况
23
+ if (NoActionHandle.is(result)) return store1.getUserInfoById(Number.parseInt(result))
24
+ .then(this.addCode200)
25
+
26
+ return result
27
+ }
28
+
29
+ POST(body, ...arg) {
30
+ // 调用默认的POST方法
31
+ const action = this.call(body, ...arg)
32
+ // 满足该条件表示已有相应方法处理,后续不需要再处理
33
+ if (action !== NoActionParams && !NoActionHandle.is(action)) return action
34
+
35
+ ......
36
+ }
37
+
38
+ list(query, {req, res}) {
39
+
40
+ ......
41
+
42
+ return this.page(query, undefined)
43
+ }
44
+ // 非默认方法(GET、POST、PUT、……)可以这样赋值
45
+ resetPwd = store1.resetUserPwd
46
+ }
47
+ ```
package/admin/service.mjs CHANGED
@@ -2,7 +2,7 @@ import createServer from '@k3000/server'
2
2
  import {adminUdpPort as port} from "../common/config.mjs";
3
3
  import {service as pools} from '../common/service.mjs'
4
4
 
5
- /*const service = */createServer({port, type: "udp"}, pools)
5
+ createServer({port, type: "udp"}, pools)
6
6
 
7
7
  console.log('running on ' + port)
8
8
 
@@ -24,7 +24,7 @@ export class User extends AdminAuthPerm {
24
24
 
25
25
  const action = this.call(body, ...arg)
26
26
 
27
- if (action !== NoActionParams || NoActionHandle.is(action)) return action
27
+ if (action !== NoActionParams && !NoActionHandle.is(action)) return action
28
28
 
29
29
  body.createBy = body.userInfo.userName
30
30
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@k3000/s1",
3
- "version": "0.3.6",
3
+ "version": "0.3.7",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "sync": "npm link",