jmash-core-mp 0.1.0
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 -0
- package/README.md +49 -0
- package/babel.config.json +34 -0
- package/eslint.config.mjs +7 -0
- package/mpx.config.js +27 -0
- package/package.json +69 -0
- package/postcss.config.js +11 -0
- package/project.config.json +25 -0
- package/project.private.config.json +14 -0
- package/public/index.html +15 -0
- package/src/api/auth/index.ts +166 -0
- package/src/api/auth/types.ts +115 -0
- package/src/api/cms/index.ts +58 -0
- package/src/api/cms/types.ts +137 -0
- package/src/api/constant.ts +6 -0
- package/src/api/dict/index.ts +44 -0
- package/src/api/dict/types.ts +50 -0
- package/src/api/dicts.ts +72 -0
- package/src/api/files/index.ts +177 -0
- package/src/api/files/types.ts +68 -0
- package/src/api/index.ts +11 -0
- package/src/api/myorgan/index.ts +0 -0
- package/src/api/myorgan/types.ts +43 -0
- package/src/app.mpx +62 -0
- package/src/components/auth-user/jmash-update-user/index.mpx +31 -0
- package/src/components/auth-user/jmash-user.mpx +119 -0
- package/src/components/common/auth-avatar/avatar-edit/index.mpx +31 -0
- package/src/components/common/auth-search/index.mpx +31 -0
- package/src/components/common/jmash-tab-bar.mpx +50 -0
- package/src/components/core/jmash-cms-protocol.mpx +67 -0
- package/src/components/core/jmash-login.mpx +343 -0
- package/src/components/core/jmash-popup-login.mpx +414 -0
- package/src/custom-tab-bar/index.mpx +11 -0
- package/src/global.d.ts +4 -0
- package/src/index.ts +9 -0
- package/src/packages/index.mpx +8 -0
- package/src/packages/pages/auth/cms-protocol.mpx +31 -0
- package/src/packages/pages/auth/login.mpx +53 -0
- package/src/pages/basic-component.mpx +31 -0
- package/src/pages/half-home.mpx +58 -0
- package/src/pages/home.mpx +38 -0
- package/src/pages/index.mpx +45 -0
- package/src/pages/tabbar/home.mpx +69 -0
- package/src/pages/tabbar/my.mpx +40 -0
- package/src/stores/setup.js +15 -0
- package/src/styles/index.scss +27 -0
- package/src/types/core.ts +41 -0
- package/src/utils/auth.ts +270 -0
- package/src/utils/config.ts +31 -0
- package/src/utils/db.ts +100 -0
- package/src/utils/grpc.ts +21 -0
- package/src/utils/request.ts +123 -0
- package/static/ali/mini.project.json +4 -0
- package/static/dd/project.config.json +15 -0
- package/static/swan/project.swan.json +14 -0
- package/static/tt/project.config.json +11 -0
- package/static/wx/project.config.json +41 -0
- package/uno.config.js +9 -0
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
// 网站站点列表
|
|
2
|
+
export interface CmsSiteList {
|
|
3
|
+
// 当前内容
|
|
4
|
+
results: Array<CmsSiteModel>;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
// 网站站点实体
|
|
8
|
+
export interface CmsSiteModel {
|
|
9
|
+
// 站点ID
|
|
10
|
+
siteId?: string;
|
|
11
|
+
// 站点名称
|
|
12
|
+
siteName?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// 网站栏目查询
|
|
16
|
+
export interface CmsChannelReq {
|
|
17
|
+
// 租户
|
|
18
|
+
tenant?: string;
|
|
19
|
+
// 站点ID
|
|
20
|
+
siteId?: string;
|
|
21
|
+
// 别名
|
|
22
|
+
alias?: string;
|
|
23
|
+
// 是否启用
|
|
24
|
+
status?: boolean;
|
|
25
|
+
// 是否包含状态
|
|
26
|
+
hasStatus?: boolean;
|
|
27
|
+
// 是否开放访问
|
|
28
|
+
isOpen?: boolean;
|
|
29
|
+
// 是否包含开放访问
|
|
30
|
+
hasIsOpen?: boolean;
|
|
31
|
+
// 栏目ID
|
|
32
|
+
channelId?: string;
|
|
33
|
+
}
|
|
34
|
+
// 网站栏目实体
|
|
35
|
+
export interface CmsChannelModel {
|
|
36
|
+
// 栏目ID
|
|
37
|
+
channelId: string;
|
|
38
|
+
// 站点ID
|
|
39
|
+
siteId?: string;
|
|
40
|
+
// 模型代码
|
|
41
|
+
modelCode?: string;
|
|
42
|
+
// 栏目名称
|
|
43
|
+
channelName: string;
|
|
44
|
+
// 别名
|
|
45
|
+
alias?: string;
|
|
46
|
+
// 父栏目ID
|
|
47
|
+
parentId?: string;
|
|
48
|
+
// SEOTITLE(标题)
|
|
49
|
+
seoTitle?: string;
|
|
50
|
+
// SEODESCRIPTION(描述)
|
|
51
|
+
seoDescription?: string;
|
|
52
|
+
// 是否启用
|
|
53
|
+
status?: boolean;
|
|
54
|
+
// 子栏目
|
|
55
|
+
children?: Array<CmsChannelModel>;
|
|
56
|
+
// 是否开放访问
|
|
57
|
+
isOpen?: boolean;
|
|
58
|
+
// 是否被选择
|
|
59
|
+
isSelect?: boolean;
|
|
60
|
+
// 栏目展示图片路径 静态资源路径
|
|
61
|
+
url: string;
|
|
62
|
+
// 类型
|
|
63
|
+
type?: string;
|
|
64
|
+
}
|
|
65
|
+
// 网站栏目列表
|
|
66
|
+
export interface CmsChannelList {
|
|
67
|
+
// 当前页内容
|
|
68
|
+
results: Array<CmsChannelModel>;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// 根据栏目别名查询翻页信息信息主表-单页栏目内容
|
|
72
|
+
export interface CmsContentInfoReq {
|
|
73
|
+
// 租户
|
|
74
|
+
tenant?: string;
|
|
75
|
+
// 站点ID
|
|
76
|
+
siteId?: string;
|
|
77
|
+
// 栏目别名
|
|
78
|
+
channelAlias: string;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// 文章详细信息
|
|
82
|
+
export interface CmsContentInfoModel {
|
|
83
|
+
// cms信息
|
|
84
|
+
cmsInfo?: CmsInfoModel;
|
|
85
|
+
// 内容信息
|
|
86
|
+
infoContentResults?: Array<CmsInfoContentModel>;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// 信息主表实体
|
|
90
|
+
export interface CmsInfoModel {
|
|
91
|
+
// 内容ID
|
|
92
|
+
infoId?: string;
|
|
93
|
+
// 信息模型
|
|
94
|
+
modelCode?: string;
|
|
95
|
+
// 内容标题
|
|
96
|
+
infoTitle: string;
|
|
97
|
+
// 封面图片
|
|
98
|
+
imgUrl?: string;
|
|
99
|
+
// 作者
|
|
100
|
+
author?: string;
|
|
101
|
+
// 摘要
|
|
102
|
+
intro?: string;
|
|
103
|
+
// 是否置顶
|
|
104
|
+
top?: number;
|
|
105
|
+
// 文章状态
|
|
106
|
+
status?: string;
|
|
107
|
+
// 发布时间
|
|
108
|
+
publishDate?: string;
|
|
109
|
+
// 到期时间
|
|
110
|
+
dueTime?: string;
|
|
111
|
+
// 栏目ID
|
|
112
|
+
channelId: Array<string>;
|
|
113
|
+
// 来源名称
|
|
114
|
+
sourceName?: string;
|
|
115
|
+
// 站点Id
|
|
116
|
+
siteId: string;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// 信息内容实体
|
|
120
|
+
export interface CmsInfoContentModel {
|
|
121
|
+
// 图片数组
|
|
122
|
+
imagePath?: Array<string>;
|
|
123
|
+
// 视频数组
|
|
124
|
+
videoPath?: Array<string>;
|
|
125
|
+
// 内容ID
|
|
126
|
+
contentId?: string;
|
|
127
|
+
// 信息ID
|
|
128
|
+
infoId?: string;
|
|
129
|
+
// 信息内容
|
|
130
|
+
infoContent?: string;
|
|
131
|
+
// 内容类型
|
|
132
|
+
infoType?: string;
|
|
133
|
+
// 排序
|
|
134
|
+
orderBy?: number;
|
|
135
|
+
// 信息内容数组
|
|
136
|
+
infoContentList?: { path: string }[];
|
|
137
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ResponseData } from "../../types/core";
|
|
2
|
+
import { EnumEntryReq, EnumRes, DictEntryReq, DictEntryList } from "./types";
|
|
3
|
+
import { config } from "../../utils/config";
|
|
4
|
+
import mpx from "@mpxjs/core";
|
|
5
|
+
|
|
6
|
+
class DictApiImpl {
|
|
7
|
+
/**
|
|
8
|
+
* 枚举
|
|
9
|
+
* @param data 查询条件
|
|
10
|
+
* @returns 返回Promise<Entry[]>的对象
|
|
11
|
+
*/
|
|
12
|
+
enumApi(
|
|
13
|
+
module: string,
|
|
14
|
+
className: string,
|
|
15
|
+
type?: number
|
|
16
|
+
): Promise<ResponseData<EnumRes>> {
|
|
17
|
+
const data: EnumEntryReq = { className, type };
|
|
18
|
+
return mpx.xfetch.fetch<EnumRes>({
|
|
19
|
+
url: "/v1/" + module + "/enum/entry",
|
|
20
|
+
method: "GET",
|
|
21
|
+
data,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* 普通字典
|
|
27
|
+
* @param data 查询条件
|
|
28
|
+
* @returns 返回Promise<Entry[]>的对象
|
|
29
|
+
*/
|
|
30
|
+
dictEntryApi(data: DictEntryReq): Promise<ResponseData<DictEntryList>> {
|
|
31
|
+
if (data) {
|
|
32
|
+
data.hasEnable = data.enable !== undefined;
|
|
33
|
+
}
|
|
34
|
+
return mpx.xfetch.fetch({
|
|
35
|
+
url: "/v1/dict/dict_entry/list/" + config.tenant,
|
|
36
|
+
method: "GET",
|
|
37
|
+
data,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const dictApi = new DictApiImpl();
|
|
43
|
+
|
|
44
|
+
export { dictApi };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// Entry
|
|
2
|
+
export interface Entry {
|
|
3
|
+
// 键
|
|
4
|
+
key?: string
|
|
5
|
+
// 值
|
|
6
|
+
value?: string
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
// 枚举
|
|
10
|
+
export interface EnumEntryReq {
|
|
11
|
+
className?: string;
|
|
12
|
+
type?: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface EnumRes {
|
|
16
|
+
values: Array<Entry>;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// 数据字典实体
|
|
20
|
+
export interface DictEntryModel {
|
|
21
|
+
// 字典类型编码
|
|
22
|
+
typeCode?: string;
|
|
23
|
+
// 字典编码
|
|
24
|
+
dictCode?: string;
|
|
25
|
+
// 字典名称
|
|
26
|
+
dictName?: string;
|
|
27
|
+
// 排序
|
|
28
|
+
listOrder?: number;
|
|
29
|
+
// 是否启用
|
|
30
|
+
enable?: boolean;
|
|
31
|
+
// 描述
|
|
32
|
+
description?: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// 数据字典列表
|
|
36
|
+
export interface DictEntryList {
|
|
37
|
+
// 内容
|
|
38
|
+
results: Array<DictEntryModel>;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// 普通数据字典查询
|
|
42
|
+
export interface DictEntryReq {
|
|
43
|
+
typeCode?: string;
|
|
44
|
+
// 字典编码
|
|
45
|
+
dictCode?: string;
|
|
46
|
+
// 是否包含启用
|
|
47
|
+
hasEnable?: boolean;
|
|
48
|
+
// 是否启用
|
|
49
|
+
enable?: boolean;
|
|
50
|
+
}
|
package/src/api/dicts.ts
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { Entry, DictEntryModel, DictEntryReq } from "./dict/types";
|
|
2
|
+
import { dictApi } from "./dict/index";
|
|
3
|
+
//枚举字典类.
|
|
4
|
+
export class EnumDict {
|
|
5
|
+
//模块名
|
|
6
|
+
module: string;
|
|
7
|
+
//枚举类名
|
|
8
|
+
enumClass: string;
|
|
9
|
+
//枚举类型
|
|
10
|
+
type: number;
|
|
11
|
+
//枚举值
|
|
12
|
+
values: Entry[] = [];
|
|
13
|
+
constructor(module: string, enumClass: string, type: number = 0) {
|
|
14
|
+
this.module = module;
|
|
15
|
+
this.enumClass = enumClass;
|
|
16
|
+
this.type = type;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
useEnumValues(): Promise<Entry[]> {
|
|
20
|
+
return new Promise<Entry[]>((resolve) => {
|
|
21
|
+
dictApi
|
|
22
|
+
.enumApi(this.module, this.enumClass, this.type)
|
|
23
|
+
.then(({ data }) => {
|
|
24
|
+
this.values.length = 0;
|
|
25
|
+
this.values.push(...data.values);
|
|
26
|
+
resolve(this.values);
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
getEnumValue(key: string): string {
|
|
32
|
+
for (const obj of this.values) {
|
|
33
|
+
if (obj.key === key) {
|
|
34
|
+
return obj.value as string;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return "";
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// 普通字典类
|
|
42
|
+
export class EntryDict {
|
|
43
|
+
typeCode: string;
|
|
44
|
+
enable?: boolean;
|
|
45
|
+
values: DictEntryModel[] = [];
|
|
46
|
+
constructor(typeCode: string, enable: boolean = true) {
|
|
47
|
+
// 字典类型编码
|
|
48
|
+
this.typeCode = typeCode;
|
|
49
|
+
// 是否启用
|
|
50
|
+
this.enable = enable;
|
|
51
|
+
}
|
|
52
|
+
// 加载数据字典
|
|
53
|
+
useDictValues(): Promise<DictEntryModel[]> {
|
|
54
|
+
return new Promise((resolve) => {
|
|
55
|
+
const req = {
|
|
56
|
+
typeCode: this.typeCode,
|
|
57
|
+
enable: this.enable,
|
|
58
|
+
} as DictEntryReq;
|
|
59
|
+
dictApi.dictEntryApi(req).then(({ data }) => {
|
|
60
|
+
this.values.length = 0;
|
|
61
|
+
this.values.push(...data.results);
|
|
62
|
+
resolve(this.values);
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
//获取字典值
|
|
68
|
+
getDictValue(key: string): string {
|
|
69
|
+
const entry = this.values.find((entrys) => entrys.dictCode === key);
|
|
70
|
+
return entry?.dictName ? entry.dictName : "";
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { FileInfo, FileBase64Req, FileDownInfo, FileWebReq } from "./types";
|
|
2
|
+
import { ResponseData } from "../../types/core";
|
|
3
|
+
import { db } from "../../utils/db";
|
|
4
|
+
import { grpc } from "../../utils/grpc";
|
|
5
|
+
import { config } from "../../utils/config";
|
|
6
|
+
import mpx from "@mpxjs/core";
|
|
7
|
+
|
|
8
|
+
class FileApi {
|
|
9
|
+
baseApiUrl(): string {
|
|
10
|
+
let currentBaseURL = config.baseUrl as string;
|
|
11
|
+
// 使用 slice() 方法
|
|
12
|
+
if (currentBaseURL.slice(-1) === "/") {
|
|
13
|
+
currentBaseURL = currentBaseURL.slice(0, -1);
|
|
14
|
+
}
|
|
15
|
+
return currentBaseURL;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// 上传Url
|
|
19
|
+
uploadUrl(): string {
|
|
20
|
+
return this.baseApiUrl() + "/v1/file/upload?tenant=" + config.tenant;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* url 获取图片Full路径
|
|
25
|
+
* @param type resize 等比例缩放,white 补白,trans 补透明,clip 裁剪
|
|
26
|
+
*/
|
|
27
|
+
imageUrl(
|
|
28
|
+
imageUrl: string,
|
|
29
|
+
width: number = 0,
|
|
30
|
+
height: number = 0,
|
|
31
|
+
type: string = "clip"
|
|
32
|
+
): string {
|
|
33
|
+
const regular = /^\//;
|
|
34
|
+
if (regular.test(imageUrl)) {
|
|
35
|
+
return (
|
|
36
|
+
this.baseApiUrl() +
|
|
37
|
+
`/v1/file/image/${type}/${width}/${height}` +
|
|
38
|
+
imageUrl
|
|
39
|
+
);
|
|
40
|
+
} else {
|
|
41
|
+
return (
|
|
42
|
+
this.baseApiUrl() +
|
|
43
|
+
`/v1/file/image/${type}/${width}/${height}/` +
|
|
44
|
+
imageUrl
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Id 获取图片Full路径
|
|
51
|
+
* @param type resize 等比例缩放,white 补白,trans 补透明,clip 裁剪
|
|
52
|
+
*/
|
|
53
|
+
imageIdUrl(
|
|
54
|
+
imageId: string,
|
|
55
|
+
width: number = 0,
|
|
56
|
+
height: number = 0,
|
|
57
|
+
type: string = "clip"
|
|
58
|
+
): string {
|
|
59
|
+
return (
|
|
60
|
+
this.baseApiUrl() +
|
|
61
|
+
"/v1/file/image_id/" +
|
|
62
|
+
config.tenant +
|
|
63
|
+
`/${type}/${width}/${height}/` +
|
|
64
|
+
imageId
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// url 获取文件Full路径
|
|
69
|
+
fileUrl(fileUrl?: string): string {
|
|
70
|
+
return this.baseApiUrl() + "/v1/file/path/" + fileUrl;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Id 获取文件Full路径
|
|
74
|
+
fileIdUrl(fileId?: string): string {
|
|
75
|
+
return this.baseApiUrl() + "/v1/file/id/" + config.tenant + fileId;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// 上传文件
|
|
79
|
+
uploadBase64File(base64: FileBase64Req): Promise<ResponseData<FileInfo>> {
|
|
80
|
+
base64.tenant = config.tenant;
|
|
81
|
+
grpc.clearEmpty(base64);
|
|
82
|
+
return mpx.xfetch.fetch({
|
|
83
|
+
url: "/v1/file/base64upload",
|
|
84
|
+
method: "POST",
|
|
85
|
+
data: base64,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// 上传文件
|
|
90
|
+
uploadFile(file: string): Promise<FileInfo> {
|
|
91
|
+
const that = this;
|
|
92
|
+
return new Promise((resolve, reject) => {
|
|
93
|
+
wx.uploadFile({
|
|
94
|
+
url: that.uploadUrl(),
|
|
95
|
+
filePath: file,
|
|
96
|
+
name: "file",
|
|
97
|
+
header: {
|
|
98
|
+
"Content-Type": "multipart/form-data",
|
|
99
|
+
Authorization: db.getBearerToken(),
|
|
100
|
+
},
|
|
101
|
+
success(response) {
|
|
102
|
+
if (response.statusCode === 200) {
|
|
103
|
+
resolve({
|
|
104
|
+
code: response.statusCode,
|
|
105
|
+
message: response.errMsg,
|
|
106
|
+
data: JSON.parse(response.data),
|
|
107
|
+
} as any);
|
|
108
|
+
} else if (response.statusCode === 401) {
|
|
109
|
+
//TODO console.log("token过期....")
|
|
110
|
+
// 清理登录信息
|
|
111
|
+
wx.clearStorage();
|
|
112
|
+
} else {
|
|
113
|
+
mpx.showToast({
|
|
114
|
+
title: response.errMsg,
|
|
115
|
+
icon: "none",
|
|
116
|
+
duration: 2000,
|
|
117
|
+
});
|
|
118
|
+
resolve({
|
|
119
|
+
code: response.statusCode,
|
|
120
|
+
message: response.errMsg,
|
|
121
|
+
data: JSON.parse(response.data),
|
|
122
|
+
} as any);
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
fail(error) {
|
|
126
|
+
reject(error);
|
|
127
|
+
},
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// 上传文件
|
|
133
|
+
downloadFile(url: string): Promise<FileDownInfo> {
|
|
134
|
+
return new Promise((resolve, reject) => {
|
|
135
|
+
wx.downloadFile({
|
|
136
|
+
url: url,
|
|
137
|
+
header: {
|
|
138
|
+
Authorization: db.getBearerToken(),
|
|
139
|
+
},
|
|
140
|
+
success(response) {
|
|
141
|
+
resolve({
|
|
142
|
+
statusCode: response.statusCode,
|
|
143
|
+
tempFilePath: response.tempFilePath,
|
|
144
|
+
filePath: response.tempFilePath,
|
|
145
|
+
} as FileDownInfo);
|
|
146
|
+
},
|
|
147
|
+
fail(error) {
|
|
148
|
+
reject(error);
|
|
149
|
+
},
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// 上传文件
|
|
155
|
+
uploadWebFile(data: FileWebReq): Promise<ResponseData<FileInfo>> {
|
|
156
|
+
// data.tenant = data.tenant ? config.tenant;
|
|
157
|
+
grpc.clearEmpty(data);
|
|
158
|
+
return mpx.xfetch.fetch({
|
|
159
|
+
url: "/v1/file/webupload",
|
|
160
|
+
method: "POST",
|
|
161
|
+
data: data,
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// 删除文件
|
|
166
|
+
deleteFile(filePath?: string) {
|
|
167
|
+
return mpx.xfetch.fetch({
|
|
168
|
+
url: "/api/v1/files",
|
|
169
|
+
method: "DELETE",
|
|
170
|
+
data: { filePath: filePath },
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
const fileApi = new FileApi();
|
|
176
|
+
|
|
177
|
+
export { fileApi };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 文件API类型声明
|
|
3
|
+
*/
|
|
4
|
+
export interface FileInfo {
|
|
5
|
+
// 文件ID
|
|
6
|
+
fileId: string;
|
|
7
|
+
// 文件存放路径
|
|
8
|
+
fileSrc: string;
|
|
9
|
+
// 内容类型
|
|
10
|
+
contentType: string;
|
|
11
|
+
// 文件后缀
|
|
12
|
+
fileExt: string;
|
|
13
|
+
// 图片/视频宽度
|
|
14
|
+
fileWidth: number;
|
|
15
|
+
// 图片/视频高度
|
|
16
|
+
fileHeight: number;
|
|
17
|
+
// 文件大小
|
|
18
|
+
fileSize: number;
|
|
19
|
+
// File sha256
|
|
20
|
+
hashSha256: string;
|
|
21
|
+
// File SM3信息摘要
|
|
22
|
+
hashSm3: string;
|
|
23
|
+
// 创建时间
|
|
24
|
+
createDate: string;
|
|
25
|
+
// 相对路径
|
|
26
|
+
tempFilePath: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface FileBase64Req {
|
|
30
|
+
// 租户
|
|
31
|
+
tenant?: string;
|
|
32
|
+
// Base64文件内容
|
|
33
|
+
base64?: string;
|
|
34
|
+
// 文件名称
|
|
35
|
+
fileName?: string;
|
|
36
|
+
// 内容类型
|
|
37
|
+
contentType?: string;
|
|
38
|
+
// 保存路径
|
|
39
|
+
fileDir?: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface FileDownInfo {
|
|
43
|
+
// 临时文件路径 (本地路径)。没传入 filePath 指定文件存储路径时会返回,下载后的文件会存储到一个临时文件
|
|
44
|
+
tempFilePath: string;
|
|
45
|
+
// 用户文件路径 (本地路径)。传入 filePath 时会返回,跟传入的 filePath 一致
|
|
46
|
+
filePath: string;
|
|
47
|
+
// 开发者服务器返回的 HTTP 状态码
|
|
48
|
+
statusCode: number;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface FileWebReq {
|
|
52
|
+
// 租户
|
|
53
|
+
tenant?: string;
|
|
54
|
+
// 文件内容
|
|
55
|
+
body?: string;
|
|
56
|
+
// 文件名称
|
|
57
|
+
fileName?: string;
|
|
58
|
+
// 内容类型
|
|
59
|
+
contentType?: string;
|
|
60
|
+
// 保存路径
|
|
61
|
+
fileDir?: string;
|
|
62
|
+
// 文件大小
|
|
63
|
+
fileSize?: number;
|
|
64
|
+
// 文件唯一ID
|
|
65
|
+
requestId?: string;
|
|
66
|
+
// 文件部分
|
|
67
|
+
filePart?:number;
|
|
68
|
+
}
|
package/src/api/index.ts
ADDED
|
File without changes
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// 基础组织信息列表
|
|
2
|
+
export interface BaseOrganModel {
|
|
3
|
+
// 组织ID
|
|
4
|
+
organId?: string;
|
|
5
|
+
// 组织名称
|
|
6
|
+
organName?: string;
|
|
7
|
+
// 组织编码
|
|
8
|
+
organCode?: string;
|
|
9
|
+
// 拼音
|
|
10
|
+
pinYin?: string;
|
|
11
|
+
// 用户Id
|
|
12
|
+
userId?: string;
|
|
13
|
+
// 组织简称
|
|
14
|
+
shortName?: string;
|
|
15
|
+
// 组织类别(个体、企业、政府、其他组织)
|
|
16
|
+
organType?: string;
|
|
17
|
+
// 上级组织ID
|
|
18
|
+
parentId?: string;
|
|
19
|
+
// Logo图片
|
|
20
|
+
logoUrl?: string;
|
|
21
|
+
// 所属行业
|
|
22
|
+
industry?: string;
|
|
23
|
+
// 详细地址
|
|
24
|
+
address?: string;
|
|
25
|
+
// 经度
|
|
26
|
+
geoLongitude?: string;
|
|
27
|
+
// 纬度
|
|
28
|
+
geoLatitude?: string;
|
|
29
|
+
// 联系人
|
|
30
|
+
contactPerson?: string;
|
|
31
|
+
// 联系电话
|
|
32
|
+
contactPersonMobile?: string;
|
|
33
|
+
// 联系电话脱敏
|
|
34
|
+
contactPersonMobileIns?: string;
|
|
35
|
+
// 是否完善
|
|
36
|
+
perfectStatus?: boolean;
|
|
37
|
+
// 状态(正常、试用、停用、欠费)
|
|
38
|
+
status?: string;
|
|
39
|
+
// 组织租户
|
|
40
|
+
tenant: string;
|
|
41
|
+
// 是否可以邀请员工
|
|
42
|
+
memberInviteStatus: boolean;
|
|
43
|
+
}
|
package/src/app.mpx
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import mpx, { createApp } from '@mpxjs/core';
|
|
3
|
+
//状态管理
|
|
4
|
+
import { createPinia } from '@mpxjs/pinia';
|
|
5
|
+
createPinia();
|
|
6
|
+
//网络请求和App配置
|
|
7
|
+
import { mpxFetch, config } from "./index";
|
|
8
|
+
mpx.use(mpxFetch);
|
|
9
|
+
//api代理
|
|
10
|
+
import apiProxy from '@mpxjs/api-proxy';
|
|
11
|
+
mpx.use(apiProxy, { usePromise: true })
|
|
12
|
+
createApp({
|
|
13
|
+
globalData: {
|
|
14
|
+
config: config
|
|
15
|
+
}
|
|
16
|
+
})
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<style></style>
|
|
20
|
+
|
|
21
|
+
<script type="application/json">
|
|
22
|
+
{
|
|
23
|
+
"pages": [
|
|
24
|
+
"./pages/index",
|
|
25
|
+
"./pages/home",
|
|
26
|
+
"./pages/half-home",
|
|
27
|
+
"./pages/basic-component",
|
|
28
|
+
"./pages/tabbar/home",
|
|
29
|
+
"./pages/tabbar/my",
|
|
30
|
+
],
|
|
31
|
+
"packages": [
|
|
32
|
+
"./packages/index?root=jmash"
|
|
33
|
+
],
|
|
34
|
+
"tabBar": {
|
|
35
|
+
"custom": true,
|
|
36
|
+
"color": "#86909C",
|
|
37
|
+
"selectedColor": "#EA4C3B",
|
|
38
|
+
"borderStyle": "white",
|
|
39
|
+
"list": [
|
|
40
|
+
{
|
|
41
|
+
"pagePath": "pages/tabbar/home",
|
|
42
|
+
"text": "首页"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"pagePath": "pages/tabbar/my",
|
|
46
|
+
"text": "我的"
|
|
47
|
+
}
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
</script>
|
|
52
|
+
|
|
53
|
+
<!--也可以通过以下形式用js输出json,便于书写注释和使用条件编译-->
|
|
54
|
+
|
|
55
|
+
<!--<script name="json">-->
|
|
56
|
+
<!-- // 可以写注释,通过defs注入的常量做一些判断之类的操作-->
|
|
57
|
+
<!-- module.exports = {-->
|
|
58
|
+
<!-- pages: [-->
|
|
59
|
+
<!-- './pages/index'-->
|
|
60
|
+
<!-- ]-->
|
|
61
|
+
<!-- }-->
|
|
62
|
+
<!--</script>-->
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="update-user-component">
|
|
3
|
+
<text>用户信息更新组件</text>
|
|
4
|
+
</view>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
import { createComponent } from '@mpxjs/core'
|
|
9
|
+
|
|
10
|
+
createComponent({
|
|
11
|
+
data: {
|
|
12
|
+
title: '用户信息更新'
|
|
13
|
+
}
|
|
14
|
+
})
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<style lang="scss">
|
|
18
|
+
.update-user-component {
|
|
19
|
+
padding: 40rpx;
|
|
20
|
+
text-align: center;
|
|
21
|
+
font-size: 32rpx;
|
|
22
|
+
color: #333;
|
|
23
|
+
}
|
|
24
|
+
</style>
|
|
25
|
+
|
|
26
|
+
<script type="application/json">
|
|
27
|
+
{
|
|
28
|
+
"component": true,
|
|
29
|
+
"usingComponents": {}
|
|
30
|
+
}
|
|
31
|
+
</script>
|