jmash-core-mp 0.1.19 → 0.1.20
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/lib/api/auth/index.d.ts +1 -3
- package/lib/api/auth/index.js +28 -19
- package/lib/api/cms/index.d.ts +1 -3
- package/lib/api/cms/index.js +2 -5
- package/lib/api/dict/index.d.ts +1 -3
- package/lib/api/dict/index.js +2 -5
- package/lib/api/files/index.d.ts +1 -3
- package/lib/api/files/index.js +10 -9
- package/lib/api/region/index.d.ts +1 -3
- package/lib/api/region/index.js +2 -5
- package/lib/api/storage/index.d.ts +1 -3
- package/lib/api/storage/index.js +8 -8
- package/package.json +1 -1
- package/src/api/auth/index.ts +28 -19
- package/src/api/cms/index.ts +2 -5
- package/src/api/dict/index.ts +2 -5
- package/src/api/files/index.ts +10 -9
- package/src/api/region/index.ts +2 -5
- package/src/api/storage/index.ts +8 -8
- package/src/app.mpx +1 -2
- package/lib/components/auth-user/jmash-user.mpx.d.ts +0 -1
- package/lib/components/cms/jmash-cms-article-view.mpx.d.ts +0 -1
- package/lib/components/core/jmash-login.mpx.d.ts +0 -1
package/lib/api/auth/index.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { ResponseData
|
|
1
|
+
import { ResponseData } from "../../api/types";
|
|
2
2
|
import type { LoginReq, LoginRes, RolesPerms, WebLoginReq, TokenModel, PhoneRegisterReq, PhoneReplaceReq, UpdateUserReq, UserInfoReq, UserInfo } from "./types";
|
|
3
3
|
declare class AuthApi {
|
|
4
|
-
config: AppConfig;
|
|
5
|
-
constructor();
|
|
6
4
|
mpLogin(data: LoginReq): Promise<ResponseData<LoginRes>>;
|
|
7
5
|
mpPhoneRegister(data: PhoneRegisterReq): Promise<ResponseData<LoginRes>>;
|
|
8
6
|
replaceBindphone(data: PhoneReplaceReq): Promise<ResponseData<string>>;
|
package/lib/api/auth/index.js
CHANGED
|
@@ -3,10 +3,6 @@ import { db } from "../../utils/db";
|
|
|
3
3
|
import { grpc } from "../../utils/grpc";
|
|
4
4
|
import mpx from "@mpxjs/core";
|
|
5
5
|
class AuthApi {
|
|
6
|
-
config;
|
|
7
|
-
constructor() {
|
|
8
|
-
this.config = getApp().globalData.config;
|
|
9
|
-
}
|
|
10
6
|
// 小程序静默登录
|
|
11
7
|
mpLogin(data) {
|
|
12
8
|
if (__mpx_mode__ === "wx") {
|
|
@@ -15,8 +11,9 @@ class AuthApi {
|
|
|
15
11
|
if (__mpx_mode__ === "ali") {
|
|
16
12
|
data.opensType = OpensType.ali_pay;
|
|
17
13
|
}
|
|
14
|
+
const config = getApp().globalData.config;
|
|
18
15
|
return mpx.xfetch.fetch({
|
|
19
|
-
url: "/v1/front/rbac/miniapp_login/" +
|
|
16
|
+
url: "/v1/front/rbac/miniapp_login/" + config.tenant,
|
|
20
17
|
method: "POST",
|
|
21
18
|
data,
|
|
22
19
|
header: {
|
|
@@ -33,8 +30,9 @@ class AuthApi {
|
|
|
33
30
|
if (__mpx_mode__ === "ali") {
|
|
34
31
|
data.opensType = OpensType.ali_pay;
|
|
35
32
|
}
|
|
33
|
+
const config = getApp().globalData.config;
|
|
36
34
|
return mpx.xfetch.fetch({
|
|
37
|
-
url: "/v1/front/rbac/miniapp_phonenumber/" +
|
|
35
|
+
url: "/v1/front/rbac/miniapp_phonenumber/" + config.tenant,
|
|
38
36
|
method: "POST",
|
|
39
37
|
data: data,
|
|
40
38
|
header: {
|
|
@@ -44,7 +42,8 @@ class AuthApi {
|
|
|
44
42
|
}
|
|
45
43
|
// 已登陆状态小程序更换绑定手机号
|
|
46
44
|
replaceBindphone(data) {
|
|
47
|
-
|
|
45
|
+
const config = getApp().globalData.config;
|
|
46
|
+
data.tenant = config.tenant;
|
|
48
47
|
if (__mpx_mode__ === "wx") {
|
|
49
48
|
data.opensType = OpensType.wechat;
|
|
50
49
|
}
|
|
@@ -60,9 +59,10 @@ class AuthApi {
|
|
|
60
59
|
}
|
|
61
60
|
//web登录.
|
|
62
61
|
webLogin(data) {
|
|
63
|
-
|
|
62
|
+
const config = getApp().globalData.config;
|
|
63
|
+
data.tenant = config.tenant;
|
|
64
64
|
data.directoryId = "user";
|
|
65
|
-
data.clientId =
|
|
65
|
+
data.clientId = config.appId ? config.appId : "h5";
|
|
66
66
|
data.captchaId = "1";
|
|
67
67
|
data.captchaCode = "1";
|
|
68
68
|
return mpx.xfetch.fetch({
|
|
@@ -76,42 +76,47 @@ class AuthApi {
|
|
|
76
76
|
}
|
|
77
77
|
// 刷新token
|
|
78
78
|
refreshToken() {
|
|
79
|
+
const config = getApp().globalData.config;
|
|
79
80
|
return mpx.xfetch.fetch({
|
|
80
81
|
url: "/v1/front/rbac/auth/refresh_token",
|
|
81
82
|
method: "POST",
|
|
82
83
|
data: {
|
|
83
84
|
refreshToken: db.getRefreshToken(),
|
|
84
|
-
tenant:
|
|
85
|
-
clientId:
|
|
85
|
+
tenant: config.tenant,
|
|
86
|
+
clientId: config.appId,
|
|
86
87
|
},
|
|
87
88
|
header: { "content-type": "application/json" },
|
|
88
89
|
});
|
|
89
90
|
}
|
|
90
91
|
// 获取当前会话用户
|
|
91
92
|
userInfo() {
|
|
93
|
+
const config = getApp().globalData.config;
|
|
92
94
|
return mpx.xfetch.fetch({
|
|
93
|
-
url: "/v1/rbac/auth/user?tenant=" +
|
|
95
|
+
url: "/v1/rbac/auth/user?tenant=" + config.tenant,
|
|
94
96
|
method: "GET",
|
|
95
97
|
});
|
|
96
98
|
}
|
|
97
99
|
// 当前用户角色权限
|
|
98
100
|
userRolesPerms() {
|
|
101
|
+
const config = getApp().globalData.config;
|
|
99
102
|
return mpx.xfetch.fetch({
|
|
100
|
-
url: "/v1/rbac/auth/roles_perms?tenant=" +
|
|
103
|
+
url: "/v1/rbac/auth/roles_perms?tenant=" + config.tenant,
|
|
101
104
|
method: "GET",
|
|
102
105
|
});
|
|
103
106
|
}
|
|
104
107
|
// 允许切换身份的用户列表
|
|
105
108
|
allowRunAsUser() {
|
|
109
|
+
const config = getApp().globalData.config;
|
|
106
110
|
return mpx.xfetch.fetch({
|
|
107
|
-
url: "/v1/rbac/auth/allow_run_as_user?tenant=" +
|
|
111
|
+
url: "/v1/rbac/auth/allow_run_as_user?tenant=" + config.tenant,
|
|
108
112
|
method: "GET",
|
|
109
113
|
});
|
|
110
114
|
}
|
|
111
115
|
// 运行某种身份
|
|
112
116
|
runAsUser(userId) {
|
|
117
|
+
const config = getApp().globalData.config;
|
|
113
118
|
const data = {
|
|
114
|
-
tenant:
|
|
119
|
+
tenant: config.tenant,
|
|
115
120
|
userId: userId,
|
|
116
121
|
};
|
|
117
122
|
return mpx.xfetch.fetch({
|
|
@@ -143,8 +148,9 @@ class AuthApi {
|
|
|
143
148
|
}
|
|
144
149
|
// 部门Tree
|
|
145
150
|
deptTree(deptId, tenant) {
|
|
151
|
+
const config = getApp().globalData.config;
|
|
146
152
|
const query = {
|
|
147
|
-
tenant: tenant ? tenant :
|
|
153
|
+
tenant: tenant ? tenant : config.tenant,
|
|
148
154
|
excludeId: deptId,
|
|
149
155
|
};
|
|
150
156
|
return mpx.xfetch.fetch({
|
|
@@ -155,8 +161,9 @@ class AuthApi {
|
|
|
155
161
|
}
|
|
156
162
|
// 职务Tree
|
|
157
163
|
jobTree(jobId, tenant) {
|
|
164
|
+
const config = getApp().globalData.config;
|
|
158
165
|
const query = {
|
|
159
|
-
tenant: tenant ? tenant :
|
|
166
|
+
tenant: tenant ? tenant : config.tenant,
|
|
160
167
|
roleType: "job",
|
|
161
168
|
hasRoleType: true,
|
|
162
169
|
excludeId: jobId,
|
|
@@ -169,7 +176,8 @@ class AuthApi {
|
|
|
169
176
|
}
|
|
170
177
|
// 修改个人信息
|
|
171
178
|
updateUserInfo(data) {
|
|
172
|
-
|
|
179
|
+
const config = getApp().globalData.config;
|
|
180
|
+
data.tenant = config.tenant;
|
|
173
181
|
grpc.clearEmpty(data);
|
|
174
182
|
return mpx.xfetch.fetch({
|
|
175
183
|
url: "/v1/rbac/auth/user",
|
|
@@ -179,7 +187,8 @@ class AuthApi {
|
|
|
179
187
|
}
|
|
180
188
|
// 获取当前会话用户的信息
|
|
181
189
|
findUserInfo(data) {
|
|
182
|
-
|
|
190
|
+
const config = getApp().globalData.config;
|
|
191
|
+
data.tenant = config.tenant;
|
|
183
192
|
return mpx.xfetch.fetch({
|
|
184
193
|
url: "/v1/front/rbac/auth/user",
|
|
185
194
|
method: "GET",
|
package/lib/api/cms/index.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
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
|
|
2
|
+
import { ResponseData } from "../../api/types";
|
|
3
3
|
declare class CmsApiImpl {
|
|
4
|
-
config: AppConfig;
|
|
5
|
-
constructor();
|
|
6
4
|
findCmsSiteList(tenant: string): Promise<ResponseData<CmsSiteList>>;
|
|
7
5
|
findCmsSite(data: CmsSiteKey): Promise<ResponseData<CmsSiteModel>>;
|
|
8
6
|
findCmsChannelList(data: CmsChannelReq): Promise<ResponseData<CmsChannelList>>;
|
package/lib/api/cms/index.js
CHANGED
|
@@ -2,10 +2,6 @@ import { grpc } from "../../utils/grpc";
|
|
|
2
2
|
import mpx from "@mpxjs/core";
|
|
3
3
|
// 获取网站内容信息
|
|
4
4
|
class CmsApiImpl {
|
|
5
|
-
config;
|
|
6
|
-
constructor() {
|
|
7
|
-
this.config = getApp().globalData.config;
|
|
8
|
-
}
|
|
9
5
|
// 查询企业官网、微网站列表
|
|
10
6
|
findCmsSiteList(tenant) {
|
|
11
7
|
return mpx.xfetch.fetch({
|
|
@@ -49,7 +45,8 @@ class CmsApiImpl {
|
|
|
49
45
|
}
|
|
50
46
|
// 根据栏目别名查询翻页信息信息主表-单页栏目内容
|
|
51
47
|
findCmsContentInfo(data) {
|
|
52
|
-
|
|
48
|
+
const config = getApp().globalData.config;
|
|
49
|
+
data.tenant = data.tenant || config.tenant;
|
|
53
50
|
grpc.clearEmpty(data);
|
|
54
51
|
return mpx.xfetch.fetch({
|
|
55
52
|
url: `/v1/front/cms/cms_info/alias/${data.tenant}/${data.siteId}/${data.channelAlias}`,
|
package/lib/api/dict/index.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { ResponseData
|
|
1
|
+
import { ResponseData } from "../../api/types";
|
|
2
2
|
import { EnumRes, DictEntryReq, DictEntryList } from "./types";
|
|
3
3
|
declare class DictApiImpl {
|
|
4
|
-
config: AppConfig;
|
|
5
|
-
constructor();
|
|
6
4
|
/**
|
|
7
5
|
* 枚举
|
|
8
6
|
* @param data 查询条件
|
package/lib/api/dict/index.js
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import mpx from "@mpxjs/core";
|
|
2
2
|
class DictApiImpl {
|
|
3
|
-
config;
|
|
4
|
-
constructor() {
|
|
5
|
-
this.config = getApp().globalData.config;
|
|
6
|
-
}
|
|
7
3
|
/**
|
|
8
4
|
* 枚举
|
|
9
5
|
* @param data 查询条件
|
|
@@ -26,8 +22,9 @@ class DictApiImpl {
|
|
|
26
22
|
if (data) {
|
|
27
23
|
data.hasEnable = data.enable !== undefined;
|
|
28
24
|
}
|
|
25
|
+
const config = getApp().globalData.config;
|
|
29
26
|
return mpx.xfetch.fetch({
|
|
30
|
-
url: "/v1/dict/dict_entry/list/" +
|
|
27
|
+
url: "/v1/dict/dict_entry/list/" + config.tenant,
|
|
31
28
|
method: "GET",
|
|
32
29
|
data,
|
|
33
30
|
});
|
package/lib/api/files/index.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { FileInfo, FileBase64Req, FileDownInfo, FileWebReq } from "./types";
|
|
2
|
-
import { ResponseData
|
|
2
|
+
import { ResponseData } from "../../api/types";
|
|
3
3
|
declare class FileApi {
|
|
4
|
-
config: AppConfig;
|
|
5
|
-
constructor();
|
|
6
4
|
baseApiUrl(): string;
|
|
7
5
|
uploadUrl(): string;
|
|
8
6
|
/**
|
package/lib/api/files/index.js
CHANGED
|
@@ -2,12 +2,9 @@ import { db } from "../../utils/db";
|
|
|
2
2
|
import { grpc } from "../../utils/grpc";
|
|
3
3
|
import mpx from "@mpxjs/core";
|
|
4
4
|
class FileApi {
|
|
5
|
-
config;
|
|
6
|
-
constructor() {
|
|
7
|
-
this.config = getApp().globalData.config;
|
|
8
|
-
}
|
|
9
5
|
baseApiUrl() {
|
|
10
|
-
|
|
6
|
+
const config = getApp().globalData.config;
|
|
7
|
+
let currentBaseURL = config.baseUrl;
|
|
11
8
|
// 使用 slice() 方法
|
|
12
9
|
if (currentBaseURL.slice(-1) === "/") {
|
|
13
10
|
currentBaseURL = currentBaseURL.slice(0, -1);
|
|
@@ -16,7 +13,8 @@ class FileApi {
|
|
|
16
13
|
}
|
|
17
14
|
// 上传Url
|
|
18
15
|
uploadUrl() {
|
|
19
|
-
|
|
16
|
+
const config = getApp().globalData.config;
|
|
17
|
+
return this.baseApiUrl() + "/v1/file/upload?tenant=" + config.tenant;
|
|
20
18
|
}
|
|
21
19
|
/**
|
|
22
20
|
* url 获取图片Full路径
|
|
@@ -40,9 +38,10 @@ class FileApi {
|
|
|
40
38
|
* @param type resize 等比例缩放,white 补白,trans 补透明,clip 裁剪
|
|
41
39
|
*/
|
|
42
40
|
imageIdUrl(imageId, width = 0, height = 0, type = "clip") {
|
|
41
|
+
const config = getApp().globalData.config;
|
|
43
42
|
return (this.baseApiUrl() +
|
|
44
43
|
"/v1/file/image_id/" +
|
|
45
|
-
|
|
44
|
+
config.tenant +
|
|
46
45
|
`/${type}/${width}/${height}/` +
|
|
47
46
|
imageId);
|
|
48
47
|
}
|
|
@@ -52,11 +51,13 @@ class FileApi {
|
|
|
52
51
|
}
|
|
53
52
|
// Id 获取文件Full路径
|
|
54
53
|
fileIdUrl(fileId) {
|
|
55
|
-
|
|
54
|
+
const config = getApp().globalData.config;
|
|
55
|
+
return this.baseApiUrl() + "/v1/file/id/" + config.tenant + fileId;
|
|
56
56
|
}
|
|
57
57
|
// 上传文件
|
|
58
58
|
uploadBase64File(base64) {
|
|
59
|
-
|
|
59
|
+
const config = getApp().globalData.config;
|
|
60
|
+
base64.tenant = config.tenant;
|
|
60
61
|
grpc.clearEmpty(base64);
|
|
61
62
|
return mpx.xfetch.fetch({
|
|
62
63
|
url: "/v1/file/base64upload",
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { DictRegionList, DictRegionReq } from "./types";
|
|
2
|
-
import { ResponseData
|
|
2
|
+
import { ResponseData } from "../../api/types";
|
|
3
3
|
declare class RegionApiImpl {
|
|
4
|
-
config: AppConfig;
|
|
5
|
-
constructor();
|
|
6
4
|
findList(query?: DictRegionReq): Promise<ResponseData<DictRegionList>>;
|
|
7
5
|
}
|
|
8
6
|
declare const regionApi: RegionApiImpl;
|
package/lib/api/region/index.js
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
import { grpc } from "../../utils/grpc";
|
|
2
2
|
import mpx from "@mpxjs/core";
|
|
3
3
|
class RegionApiImpl {
|
|
4
|
-
config;
|
|
5
|
-
constructor() {
|
|
6
|
-
this.config = getApp().globalData.config;
|
|
7
|
-
}
|
|
8
4
|
// 查询列表信息地区信息
|
|
9
5
|
findList(query) {
|
|
10
6
|
if (query) {
|
|
11
7
|
query.hasEnable = query.enable !== undefined;
|
|
12
8
|
}
|
|
13
9
|
grpc.clearEmpty(query);
|
|
10
|
+
const config = getApp().globalData.config;
|
|
14
11
|
return mpx.xfetch.fetch({
|
|
15
|
-
url: "/v1/region/dict_region/list/" +
|
|
12
|
+
url: "/v1/region/dict_region/list/" + config.tenant,
|
|
16
13
|
method: "GET",
|
|
17
14
|
data: query,
|
|
18
15
|
});
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { ResponseData
|
|
1
|
+
import { ResponseData } from "../../api/types";
|
|
2
2
|
import { StorageOrganInfoReq, StorageOrganInfoList, StorageOrganBrowserUpdateReq, StorageOrganBrowserModel } from "./types";
|
|
3
3
|
declare class StorageApiImpl {
|
|
4
|
-
config: AppConfig;
|
|
5
|
-
constructor();
|
|
6
4
|
findMyOrganList(data: StorageOrganInfoReq): Promise<ResponseData<StorageOrganInfoList>>;
|
|
7
5
|
findStorageBrowserOrganList(data: StorageOrganInfoReq): Promise<ResponseData<StorageOrganInfoList>>;
|
|
8
6
|
findStorageOrganInfoList(data: StorageOrganInfoReq): Promise<ResponseData<StorageOrganInfoList>>;
|
package/lib/api/storage/index.js
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
import mpx from "@mpxjs/core";
|
|
2
2
|
import { grpc } from "../../utils/grpc";
|
|
3
3
|
class StorageApiImpl {
|
|
4
|
-
config;
|
|
5
|
-
constructor() {
|
|
6
|
-
this.config = getApp().globalData.config;
|
|
7
|
-
}
|
|
8
4
|
// 查询我的组织列表
|
|
9
5
|
findMyOrganList(data) {
|
|
10
6
|
grpc.clearEmpty(data);
|
|
7
|
+
const config = getApp().globalData.config;
|
|
11
8
|
return mpx.xfetch.fetch({
|
|
12
|
-
url: `/v1/storage/storage_organ/my_list/${
|
|
9
|
+
url: `/v1/storage/storage_organ/my_list/${config.tenant}?&serviceType[]=${data.serviceType}`,
|
|
13
10
|
method: "GET",
|
|
14
11
|
});
|
|
15
12
|
}
|
|
16
13
|
// 查询列表信息店铺用户浏览信息
|
|
17
14
|
findStorageBrowserOrganList(data) {
|
|
15
|
+
const config = getApp().globalData.config;
|
|
18
16
|
return mpx.xfetch.fetch({
|
|
19
|
-
url: `/v1/front/storage/storage_organ_browser/my_list/${
|
|
17
|
+
url: `/v1/front/storage/storage_organ_browser/my_list/${config.tenant}?&serviceType[]=${data.serviceType}`,
|
|
20
18
|
method: "GET",
|
|
21
19
|
});
|
|
22
20
|
}
|
|
23
21
|
// 查询列表信息店铺用户浏览信息
|
|
24
22
|
findStorageOrganInfoList(data) {
|
|
23
|
+
const config = getApp().globalData.config;
|
|
25
24
|
return mpx.xfetch.fetch({
|
|
26
|
-
url: `/v1/storage/storage_organ_info/list/${
|
|
25
|
+
url: `/v1/storage/storage_organ_info/list/${config.tenant}?&serviceType[]=${data.serviceType}`,
|
|
27
26
|
method: "GET",
|
|
28
27
|
data: data,
|
|
29
28
|
});
|
|
30
29
|
}
|
|
31
30
|
// 修改组织浏览信息
|
|
32
31
|
updateStorageOrganBrowser(data) {
|
|
33
|
-
|
|
32
|
+
const config = getApp().globalData.config;
|
|
33
|
+
data.tenant = config.tenant;
|
|
34
34
|
grpc.clearEmpty(data);
|
|
35
35
|
return mpx.xfetch.fetch({
|
|
36
36
|
url: "/v1/front/storage/storage_organ_browser/browse",
|
package/package.json
CHANGED
package/src/api/auth/index.ts
CHANGED
|
@@ -17,10 +17,6 @@ import { grpc } from "../../utils/grpc";
|
|
|
17
17
|
import mpx from "@mpxjs/core";
|
|
18
18
|
|
|
19
19
|
class AuthApi {
|
|
20
|
-
config: AppConfig;
|
|
21
|
-
constructor() {
|
|
22
|
-
this.config = getApp().globalData.config;
|
|
23
|
-
}
|
|
24
20
|
// 小程序静默登录
|
|
25
21
|
mpLogin(data: LoginReq): Promise<ResponseData<LoginRes>> {
|
|
26
22
|
if (__mpx_mode__ === "wx") {
|
|
@@ -29,8 +25,9 @@ class AuthApi {
|
|
|
29
25
|
if (__mpx_mode__ === "ali") {
|
|
30
26
|
data.opensType = OpensType.ali_pay;
|
|
31
27
|
}
|
|
28
|
+
const config = getApp().globalData.config;
|
|
32
29
|
return mpx.xfetch.fetch({
|
|
33
|
-
url: "/v1/front/rbac/miniapp_login/" +
|
|
30
|
+
url: "/v1/front/rbac/miniapp_login/" + config.tenant,
|
|
34
31
|
method: "POST",
|
|
35
32
|
data,
|
|
36
33
|
header: {
|
|
@@ -48,8 +45,9 @@ class AuthApi {
|
|
|
48
45
|
if (__mpx_mode__ === "ali") {
|
|
49
46
|
data.opensType = OpensType.ali_pay;
|
|
50
47
|
}
|
|
48
|
+
const config = getApp().globalData.config;
|
|
51
49
|
return mpx.xfetch.fetch({
|
|
52
|
-
url: "/v1/front/rbac/miniapp_phonenumber/" +
|
|
50
|
+
url: "/v1/front/rbac/miniapp_phonenumber/" + config.tenant,
|
|
53
51
|
method: "POST",
|
|
54
52
|
data: data,
|
|
55
53
|
header: {
|
|
@@ -60,7 +58,8 @@ class AuthApi {
|
|
|
60
58
|
|
|
61
59
|
// 已登陆状态小程序更换绑定手机号
|
|
62
60
|
replaceBindphone(data: PhoneReplaceReq): Promise<ResponseData<string>> {
|
|
63
|
-
|
|
61
|
+
const config = getApp().globalData.config;
|
|
62
|
+
data.tenant = config.tenant;
|
|
64
63
|
if (__mpx_mode__ === "wx") {
|
|
65
64
|
data.opensType = OpensType.wechat;
|
|
66
65
|
}
|
|
@@ -77,9 +76,10 @@ class AuthApi {
|
|
|
77
76
|
|
|
78
77
|
//web登录.
|
|
79
78
|
webLogin(data: WebLoginReq): Promise<ResponseData<TokenModel>> {
|
|
80
|
-
|
|
79
|
+
const config = getApp().globalData.config;
|
|
80
|
+
data.tenant = config.tenant;
|
|
81
81
|
data.directoryId = "user";
|
|
82
|
-
data.clientId =
|
|
82
|
+
data.clientId = config.appId ? config.appId : "h5";
|
|
83
83
|
data.captchaId = "1";
|
|
84
84
|
data.captchaCode = "1";
|
|
85
85
|
return mpx.xfetch.fetch({
|
|
@@ -94,13 +94,14 @@ class AuthApi {
|
|
|
94
94
|
|
|
95
95
|
// 刷新token
|
|
96
96
|
refreshToken(): Promise<ResponseData<TokenModel>> {
|
|
97
|
+
const config = getApp().globalData.config;
|
|
97
98
|
return mpx.xfetch.fetch({
|
|
98
99
|
url: "/v1/front/rbac/auth/refresh_token",
|
|
99
100
|
method: "POST",
|
|
100
101
|
data: {
|
|
101
102
|
refreshToken: db.getRefreshToken(),
|
|
102
|
-
tenant:
|
|
103
|
-
clientId:
|
|
103
|
+
tenant: config.tenant,
|
|
104
|
+
clientId: config.appId,
|
|
104
105
|
},
|
|
105
106
|
header: { "content-type": "application/json" },
|
|
106
107
|
});
|
|
@@ -108,31 +109,35 @@ class AuthApi {
|
|
|
108
109
|
|
|
109
110
|
// 获取当前会话用户
|
|
110
111
|
userInfo(): Promise<ResponseData<UserInfo>> {
|
|
112
|
+
const config = getApp().globalData.config;
|
|
111
113
|
return mpx.xfetch.fetch({
|
|
112
|
-
url: "/v1/rbac/auth/user?tenant=" +
|
|
114
|
+
url: "/v1/rbac/auth/user?tenant=" + config.tenant,
|
|
113
115
|
method: "GET",
|
|
114
116
|
});
|
|
115
117
|
}
|
|
116
118
|
|
|
117
119
|
// 当前用户角色权限
|
|
118
120
|
userRolesPerms(): Promise<ResponseData<RolesPerms>> {
|
|
121
|
+
const config = getApp().globalData.config;
|
|
119
122
|
return mpx.xfetch.fetch({
|
|
120
|
-
url: "/v1/rbac/auth/roles_perms?tenant=" +
|
|
123
|
+
url: "/v1/rbac/auth/roles_perms?tenant=" + config.tenant,
|
|
121
124
|
method: "GET",
|
|
122
125
|
});
|
|
123
126
|
}
|
|
124
127
|
// 允许切换身份的用户列表
|
|
125
128
|
allowRunAsUser(): Promise<ResponseData<any[]>> {
|
|
129
|
+
const config = getApp().globalData.config;
|
|
126
130
|
return mpx.xfetch.fetch({
|
|
127
|
-
url: "/v1/rbac/auth/allow_run_as_user?tenant=" +
|
|
131
|
+
url: "/v1/rbac/auth/allow_run_as_user?tenant=" + config.tenant,
|
|
128
132
|
method: "GET",
|
|
129
133
|
});
|
|
130
134
|
}
|
|
131
135
|
|
|
132
136
|
// 运行某种身份
|
|
133
137
|
runAsUser(userId: string): Promise<ResponseData<any>> {
|
|
138
|
+
const config = getApp().globalData.config;
|
|
134
139
|
const data = {
|
|
135
|
-
tenant:
|
|
140
|
+
tenant: config.tenant,
|
|
136
141
|
userId: userId,
|
|
137
142
|
};
|
|
138
143
|
return mpx.xfetch.fetch({
|
|
@@ -168,8 +173,9 @@ class AuthApi {
|
|
|
168
173
|
}
|
|
169
174
|
// 部门Tree
|
|
170
175
|
deptTree(deptId?: string, tenant?: string): Promise<ResponseData<any[]>> {
|
|
176
|
+
const config = getApp().globalData.config;
|
|
171
177
|
const query = {
|
|
172
|
-
tenant: tenant ? tenant :
|
|
178
|
+
tenant: tenant ? tenant : config.tenant,
|
|
173
179
|
excludeId: deptId,
|
|
174
180
|
};
|
|
175
181
|
return mpx.xfetch.fetch({
|
|
@@ -181,8 +187,9 @@ class AuthApi {
|
|
|
181
187
|
|
|
182
188
|
// 职务Tree
|
|
183
189
|
jobTree(jobId?: string, tenant?: string): Promise<ResponseData<any[]>> {
|
|
190
|
+
const config = getApp().globalData.config;
|
|
184
191
|
const query = {
|
|
185
|
-
tenant: tenant ? tenant :
|
|
192
|
+
tenant: tenant ? tenant : config.tenant,
|
|
186
193
|
roleType: "job",
|
|
187
194
|
hasRoleType: true,
|
|
188
195
|
excludeId: jobId,
|
|
@@ -195,7 +202,8 @@ class AuthApi {
|
|
|
195
202
|
}
|
|
196
203
|
// 修改个人信息
|
|
197
204
|
updateUserInfo(data: UpdateUserReq): Promise<ResponseData<UserInfo>> {
|
|
198
|
-
|
|
205
|
+
const config = getApp().globalData.config;
|
|
206
|
+
data.tenant = config.tenant;
|
|
199
207
|
grpc.clearEmpty(data);
|
|
200
208
|
return mpx.xfetch.fetch({
|
|
201
209
|
url: "/v1/rbac/auth/user",
|
|
@@ -206,7 +214,8 @@ class AuthApi {
|
|
|
206
214
|
|
|
207
215
|
// 获取当前会话用户的信息
|
|
208
216
|
findUserInfo(data: UserInfoReq): Promise<ResponseData<UserInfo>> {
|
|
209
|
-
|
|
217
|
+
const config = getApp().globalData.config;
|
|
218
|
+
data.tenant = config.tenant;
|
|
210
219
|
return mpx.xfetch.fetch({
|
|
211
220
|
url: "/v1/front/rbac/auth/user",
|
|
212
221
|
method: "GET",
|
package/src/api/cms/index.ts
CHANGED
|
@@ -30,10 +30,6 @@ import mpx from "@mpxjs/core";
|
|
|
30
30
|
|
|
31
31
|
// 获取网站内容信息
|
|
32
32
|
class CmsApiImpl {
|
|
33
|
-
config: AppConfig;
|
|
34
|
-
constructor() {
|
|
35
|
-
this.config = getApp().globalData.config;
|
|
36
|
-
}
|
|
37
33
|
// 查询企业官网、微网站列表
|
|
38
34
|
findCmsSiteList(tenant: string): Promise<ResponseData<CmsSiteList>> {
|
|
39
35
|
return mpx.xfetch.fetch({
|
|
@@ -87,7 +83,8 @@ class CmsApiImpl {
|
|
|
87
83
|
findCmsContentInfo(
|
|
88
84
|
data: CmsContentInfoReq
|
|
89
85
|
): Promise<ResponseData<CmsContentInfoModel>> {
|
|
90
|
-
|
|
86
|
+
const config = getApp().globalData.config;
|
|
87
|
+
data.tenant = data.tenant || config.tenant;
|
|
91
88
|
grpc.clearEmpty(data);
|
|
92
89
|
return mpx.xfetch.fetch({
|
|
93
90
|
url: `/v1/front/cms/cms_info/alias/${data.tenant}/${data.siteId}/${data.channelAlias}`,
|
package/src/api/dict/index.ts
CHANGED
|
@@ -3,10 +3,6 @@ import { EnumEntryReq, EnumRes, DictEntryReq, DictEntryList } from "./types";
|
|
|
3
3
|
import mpx from "@mpxjs/core";
|
|
4
4
|
|
|
5
5
|
class DictApiImpl {
|
|
6
|
-
config: AppConfig;
|
|
7
|
-
constructor() {
|
|
8
|
-
this.config = getApp().globalData.config;
|
|
9
|
-
}
|
|
10
6
|
/**
|
|
11
7
|
* 枚举
|
|
12
8
|
* @param data 查询条件
|
|
@@ -34,8 +30,9 @@ class DictApiImpl {
|
|
|
34
30
|
if (data) {
|
|
35
31
|
data.hasEnable = data.enable !== undefined;
|
|
36
32
|
}
|
|
33
|
+
const config = getApp().globalData.config;
|
|
37
34
|
return mpx.xfetch.fetch({
|
|
38
|
-
url: "/v1/dict/dict_entry/list/" +
|
|
35
|
+
url: "/v1/dict/dict_entry/list/" + config.tenant,
|
|
39
36
|
method: "GET",
|
|
40
37
|
data,
|
|
41
38
|
});
|
package/src/api/files/index.ts
CHANGED
|
@@ -5,12 +5,9 @@ import { grpc } from "../../utils/grpc";
|
|
|
5
5
|
import mpx from "@mpxjs/core";
|
|
6
6
|
|
|
7
7
|
class FileApi {
|
|
8
|
-
config: AppConfig;
|
|
9
|
-
constructor() {
|
|
10
|
-
this.config = getApp().globalData.config;
|
|
11
|
-
}
|
|
12
8
|
baseApiUrl(): string {
|
|
13
|
-
|
|
9
|
+
const config = getApp().globalData.config;
|
|
10
|
+
let currentBaseURL = config.baseUrl as string;
|
|
14
11
|
// 使用 slice() 方法
|
|
15
12
|
if (currentBaseURL.slice(-1) === "/") {
|
|
16
13
|
currentBaseURL = currentBaseURL.slice(0, -1);
|
|
@@ -20,7 +17,8 @@ class FileApi {
|
|
|
20
17
|
|
|
21
18
|
// 上传Url
|
|
22
19
|
uploadUrl(): string {
|
|
23
|
-
|
|
20
|
+
const config = getApp().globalData.config;
|
|
21
|
+
return this.baseApiUrl() + "/v1/file/upload?tenant=" + config.tenant;
|
|
24
22
|
}
|
|
25
23
|
|
|
26
24
|
/**
|
|
@@ -59,10 +57,11 @@ class FileApi {
|
|
|
59
57
|
height: number = 0,
|
|
60
58
|
type: string = "clip"
|
|
61
59
|
): string {
|
|
60
|
+
const config = getApp().globalData.config;
|
|
62
61
|
return (
|
|
63
62
|
this.baseApiUrl() +
|
|
64
63
|
"/v1/file/image_id/" +
|
|
65
|
-
|
|
64
|
+
config.tenant +
|
|
66
65
|
`/${type}/${width}/${height}/` +
|
|
67
66
|
imageId
|
|
68
67
|
);
|
|
@@ -75,12 +74,14 @@ class FileApi {
|
|
|
75
74
|
|
|
76
75
|
// Id 获取文件Full路径
|
|
77
76
|
fileIdUrl(fileId?: string): string {
|
|
78
|
-
|
|
77
|
+
const config = getApp().globalData.config;
|
|
78
|
+
return this.baseApiUrl() + "/v1/file/id/" + config.tenant + fileId;
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
// 上传文件
|
|
82
82
|
uploadBase64File(base64: FileBase64Req): Promise<ResponseData<FileInfo>> {
|
|
83
|
-
|
|
83
|
+
const config = getApp().globalData.config;
|
|
84
|
+
base64.tenant = config.tenant;
|
|
84
85
|
grpc.clearEmpty(base64);
|
|
85
86
|
return mpx.xfetch.fetch({
|
|
86
87
|
url: "/v1/file/base64upload",
|
package/src/api/region/index.ts
CHANGED
|
@@ -4,18 +4,15 @@ import { grpc } from "../../utils/grpc";
|
|
|
4
4
|
import mpx from "@mpxjs/core";
|
|
5
5
|
|
|
6
6
|
class RegionApiImpl {
|
|
7
|
-
config: AppConfig;
|
|
8
|
-
constructor() {
|
|
9
|
-
this.config = getApp().globalData.config;
|
|
10
|
-
}
|
|
11
7
|
// 查询列表信息地区信息
|
|
12
8
|
findList(query?: DictRegionReq): Promise<ResponseData<DictRegionList>> {
|
|
13
9
|
if (query) {
|
|
14
10
|
query.hasEnable = query.enable !== undefined;
|
|
15
11
|
}
|
|
16
12
|
grpc.clearEmpty(query);
|
|
13
|
+
const config = getApp().globalData.config;
|
|
17
14
|
return mpx.xfetch.fetch({
|
|
18
|
-
url: "/v1/region/dict_region/list/" +
|
|
15
|
+
url: "/v1/region/dict_region/list/" + config.tenant,
|
|
19
16
|
method: "GET",
|
|
20
17
|
data: query,
|
|
21
18
|
});
|
package/src/api/storage/index.ts
CHANGED
|
@@ -9,17 +9,14 @@ import {
|
|
|
9
9
|
} from "./types";
|
|
10
10
|
|
|
11
11
|
class StorageApiImpl {
|
|
12
|
-
config: AppConfig;
|
|
13
|
-
constructor() {
|
|
14
|
-
this.config = getApp().globalData.config;
|
|
15
|
-
}
|
|
16
12
|
// 查询我的组织列表
|
|
17
13
|
findMyOrganList(
|
|
18
14
|
data: StorageOrganInfoReq
|
|
19
15
|
): Promise<ResponseData<StorageOrganInfoList>> {
|
|
20
16
|
grpc.clearEmpty(data);
|
|
17
|
+
const config = getApp().globalData.config;
|
|
21
18
|
return mpx.xfetch.fetch({
|
|
22
|
-
url: `/v1/storage/storage_organ/my_list/${
|
|
19
|
+
url: `/v1/storage/storage_organ/my_list/${config.tenant}?&serviceType[]=${data.serviceType}`,
|
|
23
20
|
method: "GET",
|
|
24
21
|
});
|
|
25
22
|
}
|
|
@@ -28,8 +25,9 @@ class StorageApiImpl {
|
|
|
28
25
|
findStorageBrowserOrganList(
|
|
29
26
|
data: StorageOrganInfoReq
|
|
30
27
|
): Promise<ResponseData<StorageOrganInfoList>> {
|
|
28
|
+
const config = getApp().globalData.config;
|
|
31
29
|
return mpx.xfetch.fetch({
|
|
32
|
-
url: `/v1/front/storage/storage_organ_browser/my_list/${
|
|
30
|
+
url: `/v1/front/storage/storage_organ_browser/my_list/${config.tenant}?&serviceType[]=${data.serviceType}`,
|
|
33
31
|
method: "GET",
|
|
34
32
|
});
|
|
35
33
|
}
|
|
@@ -38,8 +36,9 @@ class StorageApiImpl {
|
|
|
38
36
|
findStorageOrganInfoList(
|
|
39
37
|
data: StorageOrganInfoReq
|
|
40
38
|
): Promise<ResponseData<StorageOrganInfoList>> {
|
|
39
|
+
const config = getApp().globalData.config;
|
|
41
40
|
return mpx.xfetch.fetch({
|
|
42
|
-
url: `/v1/storage/storage_organ_info/list/${
|
|
41
|
+
url: `/v1/storage/storage_organ_info/list/${config.tenant}?&serviceType[]=${data.serviceType}`,
|
|
43
42
|
method: "GET",
|
|
44
43
|
data: data,
|
|
45
44
|
});
|
|
@@ -49,7 +48,8 @@ class StorageApiImpl {
|
|
|
49
48
|
updateStorageOrganBrowser(
|
|
50
49
|
data: StorageOrganBrowserUpdateReq
|
|
51
50
|
): Promise<ResponseData<StorageOrganBrowserModel>> {
|
|
52
|
-
|
|
51
|
+
const config = getApp().globalData.config;
|
|
52
|
+
data.tenant = config.tenant;
|
|
53
53
|
grpc.clearEmpty(data);
|
|
54
54
|
return mpx.xfetch.fetch({
|
|
55
55
|
url: "/v1/front/storage/storage_organ_browser/browse",
|
package/src/app.mpx
CHANGED
|
@@ -7,8 +7,7 @@ mpx.use(apiProxy, { usePromise: true })
|
|
|
7
7
|
import { createPinia } from '@mpxjs/pinia';
|
|
8
8
|
createPinia();
|
|
9
9
|
//网络请求和App配置
|
|
10
|
-
import { mpxFetch } from "./
|
|
11
|
-
import { config, initConfig } from "./utils/config";
|
|
10
|
+
import { mpxFetch, config, initConfig } from "./index";
|
|
12
11
|
mpx.use(mpxFetch);
|
|
13
12
|
|
|
14
13
|
createApp({
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|