jmash-core-mp 0.1.76 → 0.1.78
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/.editorconfig +9 -9
- package/.gitignore +8 -0
- package/.npmignore +44 -0
- package/README.md +60 -60
- package/babel.config.json +34 -34
- package/eslint.config.mjs +7 -7
- package/lib/api/auth/index.d.ts +22 -22
- package/lib/api/auth/index.js +211 -211
- package/lib/api/auth/types.d.ts +90 -90
- package/lib/api/auth/types.js +9 -9
- package/lib/api/cms/index.d.ts +20 -20
- package/lib/api/cms/index.js +161 -161
- package/lib/api/cms/types.d.ts +201 -201
- package/lib/api/cms/types.js +1 -1
- package/lib/api/constant.d.ts +6 -6
- package/lib/api/constant.js +8 -8
- package/lib/api/dict/index.d.ts +24 -24
- package/lib/api/dict/index.js +51 -51
- package/lib/api/dict/types.d.ts +40 -40
- package/lib/api/dict/types.js +1 -1
- package/lib/api/dicts.d.ts +32 -32
- package/lib/api/dicts.js +118 -118
- package/lib/api/files/index.d.ts +25 -25
- package/lib/api/files/index.js +134 -134
- package/lib/api/files/types.d.ts +38 -38
- package/lib/api/files/types.js +1 -1
- package/lib/api/index.d.ts +5 -5
- package/lib/api/index.js +8 -8
- package/lib/api/myorgan/index.d.ts +8 -8
- package/lib/api/myorgan/index.js +24 -24
- package/lib/api/myorgan/types.d.ts +22 -22
- package/lib/api/myorgan/types.js +1 -1
- package/lib/api/region/index.d.ts +7 -7
- package/lib/api/region/index.js +20 -20
- package/lib/api/region/types.d.ts +19 -19
- package/lib/api/region/types.js +1 -1
- package/lib/api/shop/index.d.ts +11 -11
- package/lib/api/shop/index.js +53 -53
- package/lib/api/shop/types.d.ts +123 -123
- package/lib/api/shop/types.js +1 -1
- package/lib/api/storage/index.d.ts +11 -11
- package/lib/api/storage/index.js +53 -53
- package/lib/api/storage/types.d.ts +39 -39
- package/lib/api/storage/types.js +1 -1
- package/lib/api/types.d.ts +43 -43
- package/lib/api/types.js +1 -1
- package/lib/components/organ/browser-organ-list.mpx.d.ts +1 -1
- package/lib/components/organ/my-organ-list.mpx.d.ts +1 -1
- package/lib/components/{auth-user/jmash-update-user.mpx.d.ts → organ/organ-search.mpx.d.ts} +1 -1
- package/lib/components/{auth-user/jmash-user.mpx.d.ts → shop/branch-search.mpx.d.ts} +1 -1
- package/lib/components/{core/jmash-login.mpx.d.ts → shop/shop-search.mpx.d.ts} +1 -1
- package/lib/index.d.ts +28 -28
- package/lib/index.js +23 -23
- package/lib/{packages/pages/auth/setting-page.mpx.d.ts → pages/branch-search.mpx.d.ts} +1 -1
- package/lib/pages/organ-search.mpx.d.ts +1 -0
- package/lib/pages/organ.mpx.d.ts +1 -1
- package/lib/pages/shop-search.mpx.d.ts +1 -0
- package/lib/store/organ.d.ts +19 -19
- package/lib/store/organ.js +83 -83
- package/lib/store/shop.d.ts +18 -18
- package/lib/store/shop.js +104 -104
- package/lib/store/user.d.ts +35 -35
- package/lib/store/user.js +243 -243
- package/lib/utils/common.d.ts +37 -35
- package/lib/utils/common.js +178 -165
- package/lib/utils/config.d.ts +5 -5
- package/lib/utils/config.js +36 -36
- package/lib/utils/db.d.ts +52 -52
- package/lib/utils/db.js +202 -202
- package/lib/utils/grpc.d.ts +5 -5
- package/lib/utils/grpc.js +20 -20
- package/lib/utils/net.d.ts +7 -7
- package/lib/utils/net.js +15 -15
- package/lib/utils/request.d.ts +2 -2
- package/lib/utils/request.js +114 -114
- package/lib/utils/share.d.ts +16 -16
- package/lib/utils/share.js +196 -196
- package/mpx.config.js +38 -38
- package/package.json +1 -1
- package/pnpm-workspace.yaml +5 -0
- package/postcss.config.js +11 -11
- package/project.config.json +24 -24
- package/project.private.config.json +13 -13
- package/public/index.html +15 -15
- package/src/api/auth/index.ts +241 -241
- package/src/api/auth/types.ts +173 -173
- package/src/api/cms/index.ts +218 -218
- package/src/api/cms/types.ts +385 -385
- package/src/api/constant.ts +8 -8
- package/src/api/dict/index.ts +68 -68
- package/src/api/dict/types.ts +73 -73
- package/src/api/dicts.ts +132 -132
- package/src/api/files/index.ts +162 -162
- package/src/api/files/types.ts +67 -67
- package/src/api/index.ts +15 -15
- package/src/api/myorgan/index.ts +29 -29
- package/src/api/myorgan/types.ts +42 -42
- package/src/api/region/index.ts +24 -24
- package/src/api/region/types.ts +36 -36
- package/src/api/shop/index.ts +74 -74
- package/src/api/shop/types.ts +244 -244
- package/src/api/storage/index.ts +74 -74
- package/src/api/storage/types.ts +74 -74
- package/src/api/types.ts +74 -74
- package/src/app.mpx +78 -78
- package/src/components/auth-user/jmash-logout.mpx +93 -93
- package/src/components/auth-user/jmash-update-user.mpx +387 -387
- package/src/components/auth-user/jmash-update-user.web.mpx +367 -367
- package/src/components/auth-user/jmash-user.mpx +310 -310
- package/src/components/cms/jmash-cms-activity-item.mpx +207 -207
- package/src/components/cms/jmash-cms-activity-list.mpx +357 -357
- package/src/components/cms/jmash-cms-article-item.mpx +221 -221
- package/src/components/cms/jmash-cms-article-list.mpx +248 -248
- package/src/components/cms/jmash-cms-article-view.mpx +131 -131
- package/src/components/cms/jmash-cms-article.mpx +231 -231
- package/src/components/cms/jmash-cms-like.mpx +151 -151
- package/src/components/cms/jmash-cms-location-list.mpx +286 -286
- package/src/components/cms/jmash-cms-location.mpx +256 -256
- package/src/components/cms/jmash-cms-product-item.mpx +185 -185
- package/src/components/cms/jmash-cms-product-list.mpx +230 -230
- package/src/components/common/jmash-avatar-edit.mpx +154 -154
- package/src/components/common/jmash-cascader-region.mpx +118 -118
- package/src/components/common/jmash-cell-group.mpx +206 -206
- package/src/components/common/jmash-code-interest-popup.mpx +223 -223
- package/src/components/common/jmash-form-cell.mpx +491 -525
- package/src/components/common/jmash-menu.mpx +129 -129
- package/src/components/common/jmash-none-data.mpx +95 -95
- package/src/components/common/jmash-pic-swiper.mpx +72 -72
- package/src/components/common/jmash-popup.mpx +138 -138
- package/src/components/common/jmash-search.mpx +130 -130
- package/src/components/common/jmash-single-btn.mpx +53 -53
- package/src/components/common/jmash-stepper.mpx +236 -236
- package/src/components/common/jmash-swipe-cell.mpx +153 -153
- package/src/components/common/jmash-tab-bar.mpx +58 -58
- package/src/components/common/jmash-textarea.mpx +88 -88
- package/src/components/common/jmash-top-navigation.mpx +203 -203
- package/src/components/common/jmash-upload-picture.mpx +199 -199
- package/src/components/core/jmash-cms-protocol.mpx +72 -72
- package/src/components/core/jmash-login.ali.mpx +284 -284
- package/src/components/core/jmash-login.mpx +378 -378
- package/src/components/core/jmash-login.web.mpx +420 -420
- package/src/components/core/jmash-popup-login.ali.mpx +312 -312
- package/src/components/core/jmash-popup-login.mpx +414 -416
- package/src/components/core/jmash-popup-login.web.mpx +389 -389
- package/src/components/organ/browser-organ-list.mpx +66 -66
- package/src/components/organ/my-organ-list.mpx +67 -67
- package/src/components/organ/organ-item.mpx +124 -124
- package/src/components/organ/organ-search.mpx +148 -148
- package/src/components/organ/organ-selected-item.mpx +88 -88
- package/src/components/shop/branch-item.mpx +111 -111
- package/src/components/shop/branch-search.mpx +142 -142
- package/src/components/shop/shop-item.mpx +112 -112
- package/src/components/shop/shop-search.mpx +142 -142
- package/src/components/shop/shop-selected-item.mpx +89 -89
- package/src/custom-tab-bar/index.mpx +10 -10
- package/src/global.d.ts +11 -11
- package/src/index.ts +94 -94
- package/src/packages/index.mpx +16 -16
- package/src/packages/pages/auth/cms-protocol.mpx +35 -35
- package/src/packages/pages/auth/login.mpx +62 -62
- package/src/packages/pages/auth/setting-page.mpx +134 -134
- package/src/packages/pages/auth/update-user.mpx +17 -17
- package/src/packages/pages/cms/cms-activity-list.mpx +86 -86
- package/src/packages/pages/cms/cms-article-list.mpx +88 -88
- package/src/packages/pages/cms/cms-article.mpx +32 -32
- package/src/packages/pages/cms/cms-location-list.mpx +83 -83
- package/src/packages/pages/cms/cms-location.mpx +32 -32
- package/src/packages/pages/cms/cms-product-list.mpx +88 -88
- package/src/packages/pages/share/scan.mpx +103 -103
- package/src/pages/basic-component.mpx +30 -30
- package/src/pages/branch-search.mpx +60 -60
- package/src/pages/half-home.mpx +58 -58
- package/src/pages/home.mpx +54 -54
- package/src/pages/home2.mpx +45 -45
- package/src/pages/index.mpx +43 -43
- package/src/pages/organ-search.mpx +60 -60
- package/src/pages/organ.mpx +105 -105
- package/src/pages/shop-search.mpx +60 -60
- package/src/pages/tabbar/home.mpx +114 -114
- package/src/pages/tabbar/mall.mpx +87 -87
- package/src/pages/tabbar/my.mpx +79 -79
- package/src/pages/tabbar/organ.mpx +86 -86
- package/src/store/organ.ts +100 -100
- package/src/store/shop.ts +130 -130
- package/src/store/user.ts +288 -288
- package/src/styles/index.scss +20 -20
- package/src/styles/vars.scss +27 -27
- package/src/utils/common.ts +196 -178
- package/src/utils/config.ts +43 -43
- package/src/utils/db.ts +229 -229
- package/src/utils/grpc.ts +21 -21
- package/src/utils/net.ts +18 -18
- package/src/utils/request.ts +126 -126
- package/src/utils/share.ts +194 -194
- package/static/ali/mini.project.json +4 -4
- package/static/dd/project.config.json +15 -15
- package/static/swan/project.swan.json +14 -14
- package/static/tt/project.config.json +11 -11
- package/static/wx/project.config.json +40 -40
- package/uno.config.js +9 -9
- package/lib/packages/pages/share/scan.mpx.d.ts +0 -1
package/lib/api/auth/index.js
CHANGED
|
@@ -1,211 +1,211 @@
|
|
|
1
|
-
import { OpensType } from "./types";
|
|
2
|
-
import { db } from "../../utils/db";
|
|
3
|
-
import { grpc } from "../../utils/grpc";
|
|
4
|
-
import mpx from "@mpxjs/core";
|
|
5
|
-
class AuthApi {
|
|
6
|
-
// 小程序静默登录
|
|
7
|
-
mpLogin(data) {
|
|
8
|
-
if (__mpx_mode__ === "wx") {
|
|
9
|
-
data.opensType = OpensType.wechat;
|
|
10
|
-
}
|
|
11
|
-
if (__mpx_mode__ === "ali") {
|
|
12
|
-
data.opensType = OpensType.ali_pay;
|
|
13
|
-
}
|
|
14
|
-
const config = getApp().globalData.config;
|
|
15
|
-
return mpx.xfetch.fetch({
|
|
16
|
-
url: "/v1/front/rbac/miniapp_login/" + config.tenant,
|
|
17
|
-
method: "POST",
|
|
18
|
-
data,
|
|
19
|
-
header: {
|
|
20
|
-
"content-type": "application/json",
|
|
21
|
-
Authorization: false,
|
|
22
|
-
},
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
// 手机号注册登录
|
|
26
|
-
mpPhoneRegister(data) {
|
|
27
|
-
if (__mpx_mode__ === "wx") {
|
|
28
|
-
data.opensType = OpensType.wechat;
|
|
29
|
-
}
|
|
30
|
-
if (__mpx_mode__ === "ali") {
|
|
31
|
-
data.opensType = OpensType.ali_pay;
|
|
32
|
-
}
|
|
33
|
-
const config = getApp().globalData.config;
|
|
34
|
-
return mpx.xfetch.fetch({
|
|
35
|
-
url: "/v1/front/rbac/miniapp_phonenumber/" + config.tenant,
|
|
36
|
-
method: "POST",
|
|
37
|
-
data: data,
|
|
38
|
-
header: {
|
|
39
|
-
Authorization: false,
|
|
40
|
-
},
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
// 已登陆状态小程序更换绑定手机号
|
|
44
|
-
replaceBindphone(data) {
|
|
45
|
-
const config = getApp().globalData.config;
|
|
46
|
-
data.tenant = config.tenant;
|
|
47
|
-
if (__mpx_mode__ === "wx") {
|
|
48
|
-
data.opensType = OpensType.wechat;
|
|
49
|
-
}
|
|
50
|
-
if (__mpx_mode__ === "ali") {
|
|
51
|
-
data.opensType = OpensType.ali_pay;
|
|
52
|
-
}
|
|
53
|
-
grpc.clearEmpty(data);
|
|
54
|
-
return mpx.xfetch.fetch({
|
|
55
|
-
url: "/v1/front/rbac/miniapp_bindphone",
|
|
56
|
-
method: "POST",
|
|
57
|
-
data: data,
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
//web登录.
|
|
61
|
-
webLogin(data) {
|
|
62
|
-
const config = getApp().globalData.config;
|
|
63
|
-
data.tenant = config.tenant;
|
|
64
|
-
data.directoryId = "user";
|
|
65
|
-
data.clientId = config.appId ? config.appId : "h5";
|
|
66
|
-
data.captchaId = "1";
|
|
67
|
-
data.captchaCode = "1";
|
|
68
|
-
return mpx.xfetch.fetch({
|
|
69
|
-
url: "/v1/rbac/auth/login",
|
|
70
|
-
method: "POST",
|
|
71
|
-
data: data,
|
|
72
|
-
header: {
|
|
73
|
-
Authorization: false,
|
|
74
|
-
},
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
// 刷新token
|
|
78
|
-
refreshToken() {
|
|
79
|
-
const config = getApp().globalData.config;
|
|
80
|
-
return mpx.xfetch.fetch({
|
|
81
|
-
url: "/v1/front/rbac/auth/refresh_token",
|
|
82
|
-
method: "POST",
|
|
83
|
-
data: {
|
|
84
|
-
refreshToken: db.getRefreshToken(),
|
|
85
|
-
tenant: config.tenant,
|
|
86
|
-
clientId: config.appId,
|
|
87
|
-
},
|
|
88
|
-
header: { "content-type": "application/json" },
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
// 获取当前会话用户
|
|
92
|
-
userInfo() {
|
|
93
|
-
const config = getApp().globalData.config;
|
|
94
|
-
return mpx.xfetch.fetch({
|
|
95
|
-
url: "/v1/rbac/auth/user?tenant=" + config.tenant,
|
|
96
|
-
method: "GET",
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
// 当前用户角色权限
|
|
100
|
-
userRolesPerms() {
|
|
101
|
-
const config = getApp().globalData.config;
|
|
102
|
-
return mpx.xfetch.fetch({
|
|
103
|
-
url: "/v1/rbac/auth/roles_perms?tenant=" + config.tenant,
|
|
104
|
-
method: "GET",
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
// 允许切换身份的用户列表
|
|
108
|
-
allowRunAsUser() {
|
|
109
|
-
const config = getApp().globalData.config;
|
|
110
|
-
return mpx.xfetch.fetch({
|
|
111
|
-
url: "/v1/rbac/auth/allow_run_as_user?tenant=" + config.tenant,
|
|
112
|
-
method: "GET",
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
// 运行某种身份
|
|
116
|
-
runAsUser(userId) {
|
|
117
|
-
const config = getApp().globalData.config;
|
|
118
|
-
const data = {
|
|
119
|
-
tenant: config.tenant,
|
|
120
|
-
userId: userId,
|
|
121
|
-
};
|
|
122
|
-
return mpx.xfetch.fetch({
|
|
123
|
-
url: "/v1/rbac/auth/run_as",
|
|
124
|
-
method: "POST",
|
|
125
|
-
data: data,
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
// 更新用户
|
|
129
|
-
updateUser(data) {
|
|
130
|
-
return mpx.xfetch.fetch({
|
|
131
|
-
url: "/v1/rbac/auth/user",
|
|
132
|
-
method: "PATCH",
|
|
133
|
-
data: data,
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
// 修改密码
|
|
137
|
-
updatePwd(encodeOldPwd, encodeNewPwd) {
|
|
138
|
-
const data = {
|
|
139
|
-
tenant: db.getUserTenant(),
|
|
140
|
-
encodeOldPwd: encodeOldPwd,
|
|
141
|
-
encodeNewPwd: encodeNewPwd,
|
|
142
|
-
};
|
|
143
|
-
return mpx.xfetch.fetch({
|
|
144
|
-
url: "/v1/rbac/auth/change_pwd",
|
|
145
|
-
method: "PATCH",
|
|
146
|
-
data: data,
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
// 部门Tree
|
|
150
|
-
deptTree(deptId, tenant) {
|
|
151
|
-
const config = getApp().globalData.config;
|
|
152
|
-
const query = {
|
|
153
|
-
tenant: tenant ? tenant : config.tenant,
|
|
154
|
-
excludeId: deptId,
|
|
155
|
-
};
|
|
156
|
-
return mpx.xfetch.fetch({
|
|
157
|
-
url: "/v1/rbac/dept/treelist",
|
|
158
|
-
method: "GET",
|
|
159
|
-
data: query,
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
// 职务Tree
|
|
163
|
-
jobTree(jobId, tenant) {
|
|
164
|
-
const config = getApp().globalData.config;
|
|
165
|
-
const query = {
|
|
166
|
-
tenant: tenant ? tenant : config.tenant,
|
|
167
|
-
roleType: "job",
|
|
168
|
-
hasRoleType: true,
|
|
169
|
-
excludeId: jobId,
|
|
170
|
-
};
|
|
171
|
-
return mpx.xfetch.fetch({
|
|
172
|
-
url: "/v1/rbac/role/treelist",
|
|
173
|
-
method: "GET",
|
|
174
|
-
data: query,
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
// 修改个人信息
|
|
178
|
-
updateUserInfo(data) {
|
|
179
|
-
const config = getApp().globalData.config;
|
|
180
|
-
data.tenant = config.tenant;
|
|
181
|
-
grpc.clearEmpty(data);
|
|
182
|
-
return mpx.xfetch.fetch({
|
|
183
|
-
url: "/v1/rbac/auth/user",
|
|
184
|
-
method: "PATCH",
|
|
185
|
-
data: data,
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
// 获取当前会话用户的信息
|
|
189
|
-
findUserInfo(data) {
|
|
190
|
-
const config = getApp().globalData.config;
|
|
191
|
-
data.tenant = config.tenant;
|
|
192
|
-
return mpx.xfetch.fetch({
|
|
193
|
-
url: "/v1/front/rbac/auth/user",
|
|
194
|
-
method: "GET",
|
|
195
|
-
data,
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
// 判断当前用户是否关注某公众号
|
|
199
|
-
findUserIsSubscribe(data) {
|
|
200
|
-
const config = getApp().globalData.config;
|
|
201
|
-
data.tenant = config.tenant;
|
|
202
|
-
grpc.clearEmpty(data);
|
|
203
|
-
return mpx.xfetch.fetch({
|
|
204
|
-
url: `/v1/front/rbac/gzh/subscribe/${data.tenant}`,
|
|
205
|
-
method: "GET",
|
|
206
|
-
data,
|
|
207
|
-
header: { "grpc-metadata-tenant": data.tenant },
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
export const authApi = new AuthApi();
|
|
1
|
+
import { OpensType } from "./types";
|
|
2
|
+
import { db } from "../../utils/db";
|
|
3
|
+
import { grpc } from "../../utils/grpc";
|
|
4
|
+
import mpx from "@mpxjs/core";
|
|
5
|
+
class AuthApi {
|
|
6
|
+
// 小程序静默登录
|
|
7
|
+
mpLogin(data) {
|
|
8
|
+
if (__mpx_mode__ === "wx") {
|
|
9
|
+
data.opensType = OpensType.wechat;
|
|
10
|
+
}
|
|
11
|
+
if (__mpx_mode__ === "ali") {
|
|
12
|
+
data.opensType = OpensType.ali_pay;
|
|
13
|
+
}
|
|
14
|
+
const config = getApp().globalData.config;
|
|
15
|
+
return mpx.xfetch.fetch({
|
|
16
|
+
url: "/v1/front/rbac/miniapp_login/" + config.tenant,
|
|
17
|
+
method: "POST",
|
|
18
|
+
data,
|
|
19
|
+
header: {
|
|
20
|
+
"content-type": "application/json",
|
|
21
|
+
Authorization: false,
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
// 手机号注册登录
|
|
26
|
+
mpPhoneRegister(data) {
|
|
27
|
+
if (__mpx_mode__ === "wx") {
|
|
28
|
+
data.opensType = OpensType.wechat;
|
|
29
|
+
}
|
|
30
|
+
if (__mpx_mode__ === "ali") {
|
|
31
|
+
data.opensType = OpensType.ali_pay;
|
|
32
|
+
}
|
|
33
|
+
const config = getApp().globalData.config;
|
|
34
|
+
return mpx.xfetch.fetch({
|
|
35
|
+
url: "/v1/front/rbac/miniapp_phonenumber/" + config.tenant,
|
|
36
|
+
method: "POST",
|
|
37
|
+
data: data,
|
|
38
|
+
header: {
|
|
39
|
+
Authorization: false,
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
// 已登陆状态小程序更换绑定手机号
|
|
44
|
+
replaceBindphone(data) {
|
|
45
|
+
const config = getApp().globalData.config;
|
|
46
|
+
data.tenant = config.tenant;
|
|
47
|
+
if (__mpx_mode__ === "wx") {
|
|
48
|
+
data.opensType = OpensType.wechat;
|
|
49
|
+
}
|
|
50
|
+
if (__mpx_mode__ === "ali") {
|
|
51
|
+
data.opensType = OpensType.ali_pay;
|
|
52
|
+
}
|
|
53
|
+
grpc.clearEmpty(data);
|
|
54
|
+
return mpx.xfetch.fetch({
|
|
55
|
+
url: "/v1/front/rbac/miniapp_bindphone",
|
|
56
|
+
method: "POST",
|
|
57
|
+
data: data,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
//web登录.
|
|
61
|
+
webLogin(data) {
|
|
62
|
+
const config = getApp().globalData.config;
|
|
63
|
+
data.tenant = config.tenant;
|
|
64
|
+
data.directoryId = "user";
|
|
65
|
+
data.clientId = config.appId ? config.appId : "h5";
|
|
66
|
+
data.captchaId = "1";
|
|
67
|
+
data.captchaCode = "1";
|
|
68
|
+
return mpx.xfetch.fetch({
|
|
69
|
+
url: "/v1/rbac/auth/login",
|
|
70
|
+
method: "POST",
|
|
71
|
+
data: data,
|
|
72
|
+
header: {
|
|
73
|
+
Authorization: false,
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
// 刷新token
|
|
78
|
+
refreshToken() {
|
|
79
|
+
const config = getApp().globalData.config;
|
|
80
|
+
return mpx.xfetch.fetch({
|
|
81
|
+
url: "/v1/front/rbac/auth/refresh_token",
|
|
82
|
+
method: "POST",
|
|
83
|
+
data: {
|
|
84
|
+
refreshToken: db.getRefreshToken(),
|
|
85
|
+
tenant: config.tenant,
|
|
86
|
+
clientId: config.appId,
|
|
87
|
+
},
|
|
88
|
+
header: { "content-type": "application/json" },
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
// 获取当前会话用户
|
|
92
|
+
userInfo() {
|
|
93
|
+
const config = getApp().globalData.config;
|
|
94
|
+
return mpx.xfetch.fetch({
|
|
95
|
+
url: "/v1/rbac/auth/user?tenant=" + config.tenant,
|
|
96
|
+
method: "GET",
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
// 当前用户角色权限
|
|
100
|
+
userRolesPerms() {
|
|
101
|
+
const config = getApp().globalData.config;
|
|
102
|
+
return mpx.xfetch.fetch({
|
|
103
|
+
url: "/v1/rbac/auth/roles_perms?tenant=" + config.tenant,
|
|
104
|
+
method: "GET",
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
// 允许切换身份的用户列表
|
|
108
|
+
allowRunAsUser() {
|
|
109
|
+
const config = getApp().globalData.config;
|
|
110
|
+
return mpx.xfetch.fetch({
|
|
111
|
+
url: "/v1/rbac/auth/allow_run_as_user?tenant=" + config.tenant,
|
|
112
|
+
method: "GET",
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
// 运行某种身份
|
|
116
|
+
runAsUser(userId) {
|
|
117
|
+
const config = getApp().globalData.config;
|
|
118
|
+
const data = {
|
|
119
|
+
tenant: config.tenant,
|
|
120
|
+
userId: userId,
|
|
121
|
+
};
|
|
122
|
+
return mpx.xfetch.fetch({
|
|
123
|
+
url: "/v1/rbac/auth/run_as",
|
|
124
|
+
method: "POST",
|
|
125
|
+
data: data,
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
// 更新用户
|
|
129
|
+
updateUser(data) {
|
|
130
|
+
return mpx.xfetch.fetch({
|
|
131
|
+
url: "/v1/rbac/auth/user",
|
|
132
|
+
method: "PATCH",
|
|
133
|
+
data: data,
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
// 修改密码
|
|
137
|
+
updatePwd(encodeOldPwd, encodeNewPwd) {
|
|
138
|
+
const data = {
|
|
139
|
+
tenant: db.getUserTenant(),
|
|
140
|
+
encodeOldPwd: encodeOldPwd,
|
|
141
|
+
encodeNewPwd: encodeNewPwd,
|
|
142
|
+
};
|
|
143
|
+
return mpx.xfetch.fetch({
|
|
144
|
+
url: "/v1/rbac/auth/change_pwd",
|
|
145
|
+
method: "PATCH",
|
|
146
|
+
data: data,
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
// 部门Tree
|
|
150
|
+
deptTree(deptId, tenant) {
|
|
151
|
+
const config = getApp().globalData.config;
|
|
152
|
+
const query = {
|
|
153
|
+
tenant: tenant ? tenant : config.tenant,
|
|
154
|
+
excludeId: deptId,
|
|
155
|
+
};
|
|
156
|
+
return mpx.xfetch.fetch({
|
|
157
|
+
url: "/v1/rbac/dept/treelist",
|
|
158
|
+
method: "GET",
|
|
159
|
+
data: query,
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
// 职务Tree
|
|
163
|
+
jobTree(jobId, tenant) {
|
|
164
|
+
const config = getApp().globalData.config;
|
|
165
|
+
const query = {
|
|
166
|
+
tenant: tenant ? tenant : config.tenant,
|
|
167
|
+
roleType: "job",
|
|
168
|
+
hasRoleType: true,
|
|
169
|
+
excludeId: jobId,
|
|
170
|
+
};
|
|
171
|
+
return mpx.xfetch.fetch({
|
|
172
|
+
url: "/v1/rbac/role/treelist",
|
|
173
|
+
method: "GET",
|
|
174
|
+
data: query,
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
// 修改个人信息
|
|
178
|
+
updateUserInfo(data) {
|
|
179
|
+
const config = getApp().globalData.config;
|
|
180
|
+
data.tenant = config.tenant;
|
|
181
|
+
grpc.clearEmpty(data);
|
|
182
|
+
return mpx.xfetch.fetch({
|
|
183
|
+
url: "/v1/rbac/auth/user",
|
|
184
|
+
method: "PATCH",
|
|
185
|
+
data: data,
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
// 获取当前会话用户的信息
|
|
189
|
+
findUserInfo(data) {
|
|
190
|
+
const config = getApp().globalData.config;
|
|
191
|
+
data.tenant = config.tenant;
|
|
192
|
+
return mpx.xfetch.fetch({
|
|
193
|
+
url: "/v1/front/rbac/auth/user",
|
|
194
|
+
method: "GET",
|
|
195
|
+
data,
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
// 判断当前用户是否关注某公众号
|
|
199
|
+
findUserIsSubscribe(data) {
|
|
200
|
+
const config = getApp().globalData.config;
|
|
201
|
+
data.tenant = config.tenant;
|
|
202
|
+
grpc.clearEmpty(data);
|
|
203
|
+
return mpx.xfetch.fetch({
|
|
204
|
+
url: `/v1/front/rbac/gzh/subscribe/${data.tenant}`,
|
|
205
|
+
method: "GET",
|
|
206
|
+
data,
|
|
207
|
+
header: { "grpc-metadata-tenant": data.tenant },
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
export const authApi = new AuthApi();
|
package/lib/api/auth/types.d.ts
CHANGED
|
@@ -1,90 +1,90 @@
|
|
|
1
|
-
export interface TokenModel {
|
|
2
|
-
accessToken: string;
|
|
3
|
-
expiresIn: number;
|
|
4
|
-
refreshToken: string;
|
|
5
|
-
tokenType: string;
|
|
6
|
-
}
|
|
7
|
-
export declare enum OpensType {
|
|
8
|
-
wechat = 0,
|
|
9
|
-
ali_pay = 1,
|
|
10
|
-
union_pay = 2
|
|
11
|
-
}
|
|
12
|
-
export interface LoginReq {
|
|
13
|
-
appId: string;
|
|
14
|
-
loginCode: string;
|
|
15
|
-
componentAppid?: string;
|
|
16
|
-
opensType?: OpensType;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* 登录请求参数
|
|
20
|
-
*/
|
|
21
|
-
export interface WebLoginReq {
|
|
22
|
-
tenant?: string;
|
|
23
|
-
directoryId?: string;
|
|
24
|
-
scope?: string;
|
|
25
|
-
userName: string;
|
|
26
|
-
encodePwd: string;
|
|
27
|
-
captchaId?: string;
|
|
28
|
-
captchaCode?: string;
|
|
29
|
-
clientId?: string;
|
|
30
|
-
}
|
|
31
|
-
export interface LoginRes {
|
|
32
|
-
cacheKey?: string;
|
|
33
|
-
token: TokenModel;
|
|
34
|
-
status: boolean;
|
|
35
|
-
message: string;
|
|
36
|
-
}
|
|
37
|
-
export interface PhoneRegisterReq {
|
|
38
|
-
tenant?: string;
|
|
39
|
-
appId: string;
|
|
40
|
-
loginCode?: string;
|
|
41
|
-
phoneCode: string;
|
|
42
|
-
nickName?: string;
|
|
43
|
-
avatar?: string;
|
|
44
|
-
componentAppid?: string;
|
|
45
|
-
opensType?: OpensType;
|
|
46
|
-
}
|
|
47
|
-
export interface PhoneReplaceReq {
|
|
48
|
-
tenant?: string;
|
|
49
|
-
appId: string;
|
|
50
|
-
phoneCode: string;
|
|
51
|
-
componentAppid?: string;
|
|
52
|
-
opensType?: OpensType;
|
|
53
|
-
}
|
|
54
|
-
export interface RefreshTokenReq {
|
|
55
|
-
tenant: string;
|
|
56
|
-
refreshToken: string;
|
|
57
|
-
clientId: string;
|
|
58
|
-
}
|
|
59
|
-
export interface UserInfo {
|
|
60
|
-
userId: string;
|
|
61
|
-
loginName: string;
|
|
62
|
-
nickName: string;
|
|
63
|
-
realName: string;
|
|
64
|
-
avatar: string;
|
|
65
|
-
mobilePhone: string;
|
|
66
|
-
mobilePhoneIns: string;
|
|
67
|
-
storage: string;
|
|
68
|
-
unifiedId: string;
|
|
69
|
-
}
|
|
70
|
-
export interface RolesPerms {
|
|
71
|
-
roleCodes: string[];
|
|
72
|
-
permCodes: string[];
|
|
73
|
-
}
|
|
74
|
-
export interface UpdateUserReq {
|
|
75
|
-
tenant?: string;
|
|
76
|
-
requestId?: string;
|
|
77
|
-
updateMask?: string;
|
|
78
|
-
nickName?: string;
|
|
79
|
-
avatar?: string;
|
|
80
|
-
realName?: string;
|
|
81
|
-
gender?: string;
|
|
82
|
-
birthDate?: string;
|
|
83
|
-
}
|
|
84
|
-
export interface UserInfoReq {
|
|
85
|
-
tenant?: string;
|
|
86
|
-
}
|
|
87
|
-
export interface GzhSubscribeCheckReq {
|
|
88
|
-
tenant?: string;
|
|
89
|
-
appId: string;
|
|
90
|
-
}
|
|
1
|
+
export interface TokenModel {
|
|
2
|
+
accessToken: string;
|
|
3
|
+
expiresIn: number;
|
|
4
|
+
refreshToken: string;
|
|
5
|
+
tokenType: string;
|
|
6
|
+
}
|
|
7
|
+
export declare enum OpensType {
|
|
8
|
+
wechat = 0,
|
|
9
|
+
ali_pay = 1,
|
|
10
|
+
union_pay = 2
|
|
11
|
+
}
|
|
12
|
+
export interface LoginReq {
|
|
13
|
+
appId: string;
|
|
14
|
+
loginCode: string;
|
|
15
|
+
componentAppid?: string;
|
|
16
|
+
opensType?: OpensType;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* 登录请求参数
|
|
20
|
+
*/
|
|
21
|
+
export interface WebLoginReq {
|
|
22
|
+
tenant?: string;
|
|
23
|
+
directoryId?: string;
|
|
24
|
+
scope?: string;
|
|
25
|
+
userName: string;
|
|
26
|
+
encodePwd: string;
|
|
27
|
+
captchaId?: string;
|
|
28
|
+
captchaCode?: string;
|
|
29
|
+
clientId?: string;
|
|
30
|
+
}
|
|
31
|
+
export interface LoginRes {
|
|
32
|
+
cacheKey?: string;
|
|
33
|
+
token: TokenModel;
|
|
34
|
+
status: boolean;
|
|
35
|
+
message: string;
|
|
36
|
+
}
|
|
37
|
+
export interface PhoneRegisterReq {
|
|
38
|
+
tenant?: string;
|
|
39
|
+
appId: string;
|
|
40
|
+
loginCode?: string;
|
|
41
|
+
phoneCode: string;
|
|
42
|
+
nickName?: string;
|
|
43
|
+
avatar?: string;
|
|
44
|
+
componentAppid?: string;
|
|
45
|
+
opensType?: OpensType;
|
|
46
|
+
}
|
|
47
|
+
export interface PhoneReplaceReq {
|
|
48
|
+
tenant?: string;
|
|
49
|
+
appId: string;
|
|
50
|
+
phoneCode: string;
|
|
51
|
+
componentAppid?: string;
|
|
52
|
+
opensType?: OpensType;
|
|
53
|
+
}
|
|
54
|
+
export interface RefreshTokenReq {
|
|
55
|
+
tenant: string;
|
|
56
|
+
refreshToken: string;
|
|
57
|
+
clientId: string;
|
|
58
|
+
}
|
|
59
|
+
export interface UserInfo {
|
|
60
|
+
userId: string;
|
|
61
|
+
loginName: string;
|
|
62
|
+
nickName: string;
|
|
63
|
+
realName: string;
|
|
64
|
+
avatar: string;
|
|
65
|
+
mobilePhone: string;
|
|
66
|
+
mobilePhoneIns: string;
|
|
67
|
+
storage: string;
|
|
68
|
+
unifiedId: string;
|
|
69
|
+
}
|
|
70
|
+
export interface RolesPerms {
|
|
71
|
+
roleCodes: string[];
|
|
72
|
+
permCodes: string[];
|
|
73
|
+
}
|
|
74
|
+
export interface UpdateUserReq {
|
|
75
|
+
tenant?: string;
|
|
76
|
+
requestId?: string;
|
|
77
|
+
updateMask?: string;
|
|
78
|
+
nickName?: string;
|
|
79
|
+
avatar?: string;
|
|
80
|
+
realName?: string;
|
|
81
|
+
gender?: string;
|
|
82
|
+
birthDate?: string;
|
|
83
|
+
}
|
|
84
|
+
export interface UserInfoReq {
|
|
85
|
+
tenant?: string;
|
|
86
|
+
}
|
|
87
|
+
export interface GzhSubscribeCheckReq {
|
|
88
|
+
tenant?: string;
|
|
89
|
+
appId: string;
|
|
90
|
+
}
|
package/lib/api/auth/types.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export var OpensType;
|
|
2
|
-
(function (OpensType) {
|
|
3
|
-
//微信
|
|
4
|
-
OpensType[OpensType["wechat"] = 0] = "wechat";
|
|
5
|
-
//支付宝
|
|
6
|
-
OpensType[OpensType["ali_pay"] = 1] = "ali_pay";
|
|
7
|
-
//云闪付
|
|
8
|
-
OpensType[OpensType["union_pay"] = 2] = "union_pay";
|
|
9
|
-
})(OpensType || (OpensType = {}));
|
|
1
|
+
export var OpensType;
|
|
2
|
+
(function (OpensType) {
|
|
3
|
+
//微信
|
|
4
|
+
OpensType[OpensType["wechat"] = 0] = "wechat";
|
|
5
|
+
//支付宝
|
|
6
|
+
OpensType[OpensType["ali_pay"] = 1] = "ali_pay";
|
|
7
|
+
//云闪付
|
|
8
|
+
OpensType[OpensType["union_pay"] = 2] = "union_pay";
|
|
9
|
+
})(OpensType || (OpensType = {}));
|
package/lib/api/cms/index.d.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { CmsSiteKey, CmsSiteList, CmsSiteModel, CmsChannelReq, CmsChannelList, CmsInfoReq, CmsInfoPage, CmsInfoKey, CmsInfoModel, CmsInfoContentReq, CmsInfoContentList, CmsContentInfoReq, CmsContentInfoModel, CmsInfoFileReq, CmsInfoFileList, FrontInteractKey, FrontInteractModel, FrontLikeKey, FrontLikeModel, FrontLikeCreateReq, FrontBrowseRecordCreateReq, FrontBrowseRecordModel, CmsChannelKey, CmsChannelModel } from "./types";
|
|
2
|
-
import { ResponseData } from "../../api/types";
|
|
3
|
-
declare class CmsApiImpl {
|
|
4
|
-
findCmsSiteList(tenant: string): Promise<ResponseData<CmsSiteList>>;
|
|
5
|
-
findCmsSite(data: CmsSiteKey): Promise<ResponseData<CmsSiteModel>>;
|
|
6
|
-
findCmsChannelList(data: CmsChannelReq): Promise<ResponseData<CmsChannelList>>;
|
|
7
|
-
findCmsChannelById(data: CmsChannelKey): Promise<ResponseData<CmsChannelModel>>;
|
|
8
|
-
findCmsContentInfo(data: CmsContentInfoReq): Promise<ResponseData<CmsContentInfoModel>>;
|
|
9
|
-
findCmsSingleInfo(data: CmsChannelKey): Promise<ResponseData<CmsInfoModel>>;
|
|
10
|
-
findCmsInfoPage(data: CmsInfoReq): Promise<ResponseData<CmsInfoPage>>;
|
|
11
|
-
findCmsInfoById(data: CmsInfoKey): Promise<ResponseData<CmsInfoModel>>;
|
|
12
|
-
findCmsInfoContent(data: CmsInfoContentReq): Promise<ResponseData<CmsInfoContentList>>;
|
|
13
|
-
cmsInfoFile(data: CmsInfoFileReq): Promise<ResponseData<CmsInfoFileList>>;
|
|
14
|
-
cmsInfoInteractId(data: FrontInteractKey): Promise<ResponseData<FrontInteractModel>>;
|
|
15
|
-
isLike(data: FrontLikeKey): Promise<ResponseData<string>>;
|
|
16
|
-
frontLike(data: FrontLikeCreateReq): Promise<ResponseData<FrontLikeModel>>;
|
|
17
|
-
createfrontBrowseRecord(data: FrontBrowseRecordCreateReq): Promise<ResponseData<FrontBrowseRecordModel>>;
|
|
18
|
-
}
|
|
19
|
-
declare const cmsApi: CmsApiImpl;
|
|
20
|
-
export { cmsApi };
|
|
1
|
+
import { CmsSiteKey, CmsSiteList, CmsSiteModel, CmsChannelReq, CmsChannelList, CmsInfoReq, CmsInfoPage, CmsInfoKey, CmsInfoModel, CmsInfoContentReq, CmsInfoContentList, CmsContentInfoReq, CmsContentInfoModel, CmsInfoFileReq, CmsInfoFileList, FrontInteractKey, FrontInteractModel, FrontLikeKey, FrontLikeModel, FrontLikeCreateReq, FrontBrowseRecordCreateReq, FrontBrowseRecordModel, CmsChannelKey, CmsChannelModel } from "./types";
|
|
2
|
+
import { ResponseData } from "../../api/types";
|
|
3
|
+
declare class CmsApiImpl {
|
|
4
|
+
findCmsSiteList(tenant: string): Promise<ResponseData<CmsSiteList>>;
|
|
5
|
+
findCmsSite(data: CmsSiteKey): Promise<ResponseData<CmsSiteModel>>;
|
|
6
|
+
findCmsChannelList(data: CmsChannelReq): Promise<ResponseData<CmsChannelList>>;
|
|
7
|
+
findCmsChannelById(data: CmsChannelKey): Promise<ResponseData<CmsChannelModel>>;
|
|
8
|
+
findCmsContentInfo(data: CmsContentInfoReq): Promise<ResponseData<CmsContentInfoModel>>;
|
|
9
|
+
findCmsSingleInfo(data: CmsChannelKey): Promise<ResponseData<CmsInfoModel>>;
|
|
10
|
+
findCmsInfoPage(data: CmsInfoReq): Promise<ResponseData<CmsInfoPage>>;
|
|
11
|
+
findCmsInfoById(data: CmsInfoKey): Promise<ResponseData<CmsInfoModel>>;
|
|
12
|
+
findCmsInfoContent(data: CmsInfoContentReq): Promise<ResponseData<CmsInfoContentList>>;
|
|
13
|
+
cmsInfoFile(data: CmsInfoFileReq): Promise<ResponseData<CmsInfoFileList>>;
|
|
14
|
+
cmsInfoInteractId(data: FrontInteractKey): Promise<ResponseData<FrontInteractModel>>;
|
|
15
|
+
isLike(data: FrontLikeKey): Promise<ResponseData<string>>;
|
|
16
|
+
frontLike(data: FrontLikeCreateReq): Promise<ResponseData<FrontLikeModel>>;
|
|
17
|
+
createfrontBrowseRecord(data: FrontBrowseRecordCreateReq): Promise<ResponseData<FrontBrowseRecordModel>>;
|
|
18
|
+
}
|
|
19
|
+
declare const cmsApi: CmsApiImpl;
|
|
20
|
+
export { cmsApi };
|