xyvcard-wechat-auth 0.0.17 → 0.0.19
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/dist/api/auth/index.js +1 -159
- package/dist/api/auth/types.js +1 -1
- package/dist/api/dict/index.js +1 -36
- package/dist/api/dict/types.js +1 -1
- package/dist/api/dicts.js +1 -53
- package/dist/api/files/index.js +1 -135
- package/dist/api/files/types.js +1 -1
- package/dist/api/index.js +1 -12
- package/dist/api/myorgan/index.js +1 -1
- package/dist/api/myorgan/types.js +1 -1
- package/dist/api/types.js +1 -9
- package/dist/app.d.ts +0 -0
- package/dist/app.js +1 -0
- package/dist/app.json +27 -0
- package/dist/app.wxss +0 -0
- package/dist/components/auth-user/jmash-update-user/index.js +1 -133
- package/dist/components/auth-user/jmash-user/index.js +1 -34
- package/dist/components/common/auth-avatar/avatar-edit/index.js +1 -82
- package/dist/components/common/auth-btn/double-btn/index.js +1 -67
- package/dist/components/common/auth-btn/single-btn/index.js +1 -34
- package/dist/components/common/auth-none-data/none-data-image/index.js +1 -53
- package/dist/components/common/auth-popup/index.js +1 -50
- package/dist/components/common/auth-search/index.js +1 -60
- package/dist/components/common/auth-top-navigation/index.js +1 -49
- package/dist/components/jmash-half-login/index.js +1 -105
- package/dist/components/jmash-login/index.js +1 -113
- package/dist/constant.js +1 -15
- package/dist/index.js +1 -35
- package/dist/pages/auth/login/index.d.ts +1 -0
- package/dist/pages/auth/login/index.js +1 -0
- package/dist/pages/auth/login/index.json +5 -0
- package/dist/pages/auth/login/index.wxml +6 -0
- package/dist/pages/auth/login/index.wxss +1 -0
- package/dist/pages/demo/index.d.ts +0 -0
- package/dist/pages/demo/index.js +1 -0
- package/dist/pages/demo/index.json +14 -0
- package/dist/pages/demo/index.wxml +11 -0
- package/dist/pages/demo/index.wxss +0 -0
- package/dist/pages/half-home/index.d.ts +1 -0
- package/dist/pages/half-home/index.js +1 -0
- package/dist/pages/half-home/index.json +5 -0
- package/dist/pages/half-home/index.wxml +5 -0
- package/dist/pages/half-home/index.wxss +0 -0
- package/dist/pages/home/index.d.ts +1 -0
- package/dist/pages/home/index.js +1 -0
- package/dist/pages/home/index.json +3 -0
- package/dist/pages/home/index.wxml +2 -0
- package/dist/pages/home/index.wxss +0 -0
- package/dist/pages/index/index.d.ts +1 -0
- package/dist/pages/index/index.js +1 -0
- package/dist/pages/index/index.json +4 -0
- package/dist/pages/index/index.wxml +8 -0
- package/dist/pages/index/index.wxss +0 -0
- package/dist/sitemap.json +7 -0
- package/dist/utils/auth.js +1 -212
- package/dist/utils/common.d.ts +1 -1
- package/dist/utils/common.js +1 -112
- package/dist/utils/config.js +1 -29
- package/dist/utils/db.js +1 -188
- package/dist/utils/request.js +1 -86
- package/dist/utils/util.js +1 -88
- package/package.json +1 -1
package/dist/api/auth/index.js
CHANGED
|
@@ -1,159 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { config } from "../../utils/config.js";
|
|
3
|
-
import { sendRequest, request, clearEmpty } from "../../utils/request.js";
|
|
4
|
-
class AuthApiImpl {
|
|
5
|
-
// code 登录
|
|
6
|
-
miniappLogin(data) {
|
|
7
|
-
const header = {
|
|
8
|
-
"content-type": "application/json"
|
|
9
|
-
};
|
|
10
|
-
return sendRequest({
|
|
11
|
-
url: "/v1/front/rbac/miniapp_login/" + config.tenant,
|
|
12
|
-
method: "POST",
|
|
13
|
-
data
|
|
14
|
-
}, header);
|
|
15
|
-
}
|
|
16
|
-
// 手机号注册登录
|
|
17
|
-
miniappPhoneNumber(data) {
|
|
18
|
-
const header = {
|
|
19
|
-
"content-type": "application/json"
|
|
20
|
-
};
|
|
21
|
-
return sendRequest({
|
|
22
|
-
url: "/v1/front/rbac/miniapp_phonenumber/" + config.tenant,
|
|
23
|
-
method: "POST",
|
|
24
|
-
data
|
|
25
|
-
}, header);
|
|
26
|
-
}
|
|
27
|
-
// 刷新token
|
|
28
|
-
refreshToken(data) {
|
|
29
|
-
data.tenant = config.tenant;
|
|
30
|
-
data.clientId = config.appId;
|
|
31
|
-
const header = {
|
|
32
|
-
"content-type": "application/json"
|
|
33
|
-
};
|
|
34
|
-
return sendRequest({
|
|
35
|
-
url: "/v1/front/rbac/auth/refresh_token",
|
|
36
|
-
method: "POST",
|
|
37
|
-
data
|
|
38
|
-
}, header);
|
|
39
|
-
}
|
|
40
|
-
// 登出
|
|
41
|
-
logout(accessToken) {
|
|
42
|
-
return request({
|
|
43
|
-
url: "/v1/rbac/auth/logout?tenant=" + config.tenant + "&client_id=" + config.appId + "&accessToken=" + accessToken,
|
|
44
|
-
method: "DELETE"
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
// 获取当前会话用户
|
|
48
|
-
userInfo() {
|
|
49
|
-
return request({
|
|
50
|
-
url: "/v1/rbac/auth/user?tenant=" + config.tenant,
|
|
51
|
-
method: "GET"
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
// 当前用户角色权限
|
|
55
|
-
userRolesPerms() {
|
|
56
|
-
return request({
|
|
57
|
-
url: "/v1/rbac/auth/roles_perms?tenant=" + config.tenant,
|
|
58
|
-
method: "GET"
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
// 允许切换身份的用户列表
|
|
62
|
-
allowRunAsUser() {
|
|
63
|
-
return request({
|
|
64
|
-
url: "/v1/rbac/auth/allow_run_as_user?tenant=" + config.tenant,
|
|
65
|
-
method: "GET"
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
// 运行某种身份
|
|
69
|
-
runAsUser(userId) {
|
|
70
|
-
const data = {
|
|
71
|
-
tenant: config.tenant,
|
|
72
|
-
userId
|
|
73
|
-
};
|
|
74
|
-
return request({
|
|
75
|
-
url: "/v1/rbac/auth/run_as",
|
|
76
|
-
method: "POST",
|
|
77
|
-
data
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
// 更新用户
|
|
81
|
-
updateUser(data) {
|
|
82
|
-
return request({
|
|
83
|
-
url: "/v1/rbac/auth/user",
|
|
84
|
-
method: "PATCH",
|
|
85
|
-
data
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
// 修改密码
|
|
89
|
-
updatePwd(encodeOldPwd, encodeNewPwd) {
|
|
90
|
-
const data = {
|
|
91
|
-
tenant: db.getUserTenant(),
|
|
92
|
-
encodeOldPwd,
|
|
93
|
-
encodeNewPwd
|
|
94
|
-
};
|
|
95
|
-
return request({
|
|
96
|
-
url: "/v1/rbac/auth/change_pwd",
|
|
97
|
-
method: "PATCH",
|
|
98
|
-
data
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
// 部门Tree
|
|
102
|
-
deptTree(deptId) {
|
|
103
|
-
const query = {
|
|
104
|
-
tenant: db.getUserTenant(),
|
|
105
|
-
excludeId: deptId
|
|
106
|
-
};
|
|
107
|
-
return request({
|
|
108
|
-
url: "/v1/rbac/dept/treelist",
|
|
109
|
-
method: "GET",
|
|
110
|
-
data: query
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
// 职务Tree
|
|
114
|
-
jobTree() {
|
|
115
|
-
const query = {
|
|
116
|
-
tenant: db.getUserTenant(),
|
|
117
|
-
roleType: "job",
|
|
118
|
-
hasRoleType: true
|
|
119
|
-
};
|
|
120
|
-
return request({
|
|
121
|
-
url: "/v1/rbac/role/treelist",
|
|
122
|
-
method: "GET",
|
|
123
|
-
data: query
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
// 修改个人信息
|
|
127
|
-
updateUserInfo(data) {
|
|
128
|
-
data.tenant = config.tenant;
|
|
129
|
-
clearEmpty(data);
|
|
130
|
-
return request({
|
|
131
|
-
url: "/v1/rbac/auth/user",
|
|
132
|
-
method: "PATCH",
|
|
133
|
-
data
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
// 已登陆状态小程序更换绑定手机号
|
|
137
|
-
replaceBindphone(data) {
|
|
138
|
-
data.tenant = config.tenant;
|
|
139
|
-
clearEmpty(data);
|
|
140
|
-
return request({
|
|
141
|
-
url: "/v1/front/rbac/miniapp_bindphone",
|
|
142
|
-
method: "POST",
|
|
143
|
-
data
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
// 获取当前会话用户的信息
|
|
147
|
-
findUserInfo(data) {
|
|
148
|
-
data.tenant = config.tenant;
|
|
149
|
-
return request({
|
|
150
|
-
url: "/v1/front/rbac/auth/user",
|
|
151
|
-
method: "GET",
|
|
152
|
-
data
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
const authApi = new AuthApiImpl();
|
|
157
|
-
export {
|
|
158
|
-
authApi
|
|
159
|
-
};
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../utils/db.js"),t=require("../../utils/config.js"),n=require("../../utils/request.js");const r=new class a{miniappLogin(e){return n.sendRequest({url:"/v1/front/rbac/miniapp_login/"+t.config.tenant,method:"POST",data:e},{"content-type":"application/json"})}miniappPhoneNumber(e){return n.sendRequest({url:"/v1/front/rbac/miniapp_phonenumber/"+t.config.tenant,method:"POST",data:e},{"content-type":"application/json"})}refreshToken(e){e.tenant=t.config.tenant,e.clientId=t.config.appId;return n.sendRequest({url:"/v1/front/rbac/auth/refresh_token",method:"POST",data:e},{"content-type":"application/json"})}logout(e){return n.request({url:"/v1/rbac/auth/logout?tenant="+t.config.tenant+"&client_id="+t.config.appId+"&accessToken="+e,method:"DELETE"})}userInfo(){return n.request({url:"/v1/rbac/auth/user?tenant="+t.config.tenant,method:"GET"})}userRolesPerms(){return n.request({url:"/v1/rbac/auth/roles_perms?tenant="+t.config.tenant,method:"GET"})}allowRunAsUser(){return n.request({url:"/v1/rbac/auth/allow_run_as_user?tenant="+t.config.tenant,method:"GET"})}runAsUser(e){const r={tenant:t.config.tenant,userId:e};return n.request({url:"/v1/rbac/auth/run_as",method:"POST",data:r})}updateUser(e){return n.request({url:"/v1/rbac/auth/user",method:"PATCH",data:e})}updatePwd(t,r){const a={tenant:e.db.getUserTenant(),encodeOldPwd:t,encodeNewPwd:r};return n.request({url:"/v1/rbac/auth/change_pwd",method:"PATCH",data:a})}deptTree(t){const r={tenant:e.db.getUserTenant(),excludeId:t};return n.request({url:"/v1/rbac/dept/treelist",method:"GET",data:r})}jobTree(){const t={tenant:e.db.getUserTenant(),roleType:"job",hasRoleType:!0};return n.request({url:"/v1/rbac/role/treelist",method:"GET",data:t})}updateUserInfo(e){return e.tenant=t.config.tenant,n.clearEmpty(e),n.request({url:"/v1/rbac/auth/user",method:"PATCH",data:e})}replaceBindphone(e){return e.tenant=t.config.tenant,n.clearEmpty(e),n.request({url:"/v1/front/rbac/miniapp_bindphone",method:"POST",data:e})}findUserInfo(e){return e.tenant=t.config.tenant,n.request({url:"/v1/front/rbac/auth/user",method:"GET",data:e})}};exports.authApi=r,"object"==typeof exports&&"undefined"!=typeof module&&Object.keys(module.exports).forEach(function(e){exports[e]=module.exports[e]});
|
package/dist/api/auth/types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";"object"==typeof exports&&"undefined"!=typeof module&&Object.keys(module.exports).forEach(function(e){exports[e]=module.exports[e]});
|
package/dist/api/dict/index.js
CHANGED
|
@@ -1,36 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { request } from "../../utils/request.js";
|
|
3
|
-
class DictApiImpl {
|
|
4
|
-
/**
|
|
5
|
-
* 枚举
|
|
6
|
-
* @param data 查询条件
|
|
7
|
-
* @returns 返回Promise<Entry[]>的对象
|
|
8
|
-
*/
|
|
9
|
-
enumApi(module, className, type) {
|
|
10
|
-
const data = { className, type };
|
|
11
|
-
return request({
|
|
12
|
-
url: "/v1/" + module + "/enum/entry",
|
|
13
|
-
method: "GET",
|
|
14
|
-
data
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* 普通字典
|
|
19
|
-
* @param data 查询条件
|
|
20
|
-
* @returns 返回Promise<Entry[]>的对象
|
|
21
|
-
*/
|
|
22
|
-
dictEntryApi(data) {
|
|
23
|
-
if (data) {
|
|
24
|
-
data.hasEnable = data.enable != void 0;
|
|
25
|
-
}
|
|
26
|
-
return request({
|
|
27
|
-
url: "/v1/dict/dict_entry/list/" + config.tenant,
|
|
28
|
-
method: "GET",
|
|
29
|
-
data
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
const dictApi = new DictApiImpl();
|
|
34
|
-
export {
|
|
35
|
-
dictApi
|
|
36
|
-
};
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../utils/config.js"),t=require("../../utils/request.js");const r=new class o{enumApi(e,r,o){const s={className:r,type:o};return t.request({url:"/v1/"+e+"/enum/entry",method:"GET",data:s})}dictEntryApi(r){return r&&(r.hasEnable=null!=r.enable),t.request({url:"/v1/dict/dict_entry/list/"+e.config.tenant,method:"GET",data:r})}};exports.dictApi=r,"object"==typeof exports&&"undefined"!=typeof module&&Object.keys(module.exports).forEach(function(e){exports[e]=module.exports[e]});
|
package/dist/api/dict/types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";"object"==typeof exports&&"undefined"!=typeof module&&Object.keys(module.exports).forEach(function(e){exports[e]=module.exports[e]});
|
package/dist/api/dicts.js
CHANGED
|
@@ -1,53 +1 @@
|
|
|
1
|
-
|
|
2
|
-
class EnumDict {
|
|
3
|
-
constructor(module, enumClass, type = 0) {
|
|
4
|
-
this.values = [];
|
|
5
|
-
this.module = module;
|
|
6
|
-
this.enumClass = enumClass;
|
|
7
|
-
this.type = type;
|
|
8
|
-
}
|
|
9
|
-
useEnumValues() {
|
|
10
|
-
return new Promise((resolve) => {
|
|
11
|
-
dictApi.enumApi(this.module, this.enumClass, this.type).then(({ data }) => {
|
|
12
|
-
this.values.length = 0;
|
|
13
|
-
this.values.push(...data.values);
|
|
14
|
-
resolve(this.values);
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
getEnumValue(key) {
|
|
19
|
-
for (const obj of this.values) {
|
|
20
|
-
if (obj.key == key) {
|
|
21
|
-
return obj.value;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
return "";
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
class EntryDict {
|
|
28
|
-
constructor(typeCode, enable = true) {
|
|
29
|
-
this.values = [];
|
|
30
|
-
this.typeCode = typeCode;
|
|
31
|
-
this.enable = enable;
|
|
32
|
-
}
|
|
33
|
-
// 加载数据字典
|
|
34
|
-
useDictValues() {
|
|
35
|
-
return new Promise((resolve) => {
|
|
36
|
-
const req = { typeCode: this.typeCode, enable: this.enable };
|
|
37
|
-
dictApi.dictEntryApi(req).then(({ data }) => {
|
|
38
|
-
this.values.length = 0;
|
|
39
|
-
this.values.push(...data.results);
|
|
40
|
-
resolve(this.values);
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
//获取字典值
|
|
45
|
-
getDictValue(key) {
|
|
46
|
-
const entry = this.values.find((entrys) => entrys.dictCode === key);
|
|
47
|
-
return (entry == null ? void 0 : entry.dictName) ? entry.dictName : "";
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
export {
|
|
51
|
-
EntryDict,
|
|
52
|
-
EnumDict
|
|
53
|
-
};
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./dict/index.js");exports.EntryDict=class t{constructor(e,t=!0){this.values=[],this.typeCode=e,this.enable=t}useDictValues(){return new Promise(t=>{const s={typeCode:this.typeCode,enable:this.enable};e.dictApi.dictEntryApi(s).then(({data:e})=>{this.values.length=0,this.values.push(...e.results),t(this.values)})})}getDictValue(e){const t=this.values.find(t=>t.dictCode===e);return(null==t?void 0:t.dictName)?t.dictName:""}},exports.EnumDict=class s{constructor(e,t,s=0){this.values=[],this.module=e,this.enumClass=t,this.type=s}useEnumValues(){return new Promise(t=>{e.dictApi.enumApi(this.module,this.enumClass,this.type).then(({data:e})=>{this.values.length=0,this.values.push(...e.values),t(this.values)})})}getEnumValue(e){for(const t of this.values)if(t.key==e)return t.value;return""}},"object"==typeof exports&&"undefined"!=typeof module&&Object.keys(module.exports).forEach(function(e){exports[e]=module.exports[e]});
|
package/dist/api/files/index.js
CHANGED
|
@@ -1,135 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { clearEmpty, request } from "../../utils/request.js";
|
|
3
|
-
import { db } from "../../utils/db.js";
|
|
4
|
-
class FileApi {
|
|
5
|
-
baseApiUrl() {
|
|
6
|
-
let currentBaseURL = config.baseUrl;
|
|
7
|
-
if (currentBaseURL.slice(-1) === "/") {
|
|
8
|
-
currentBaseURL = currentBaseURL.slice(0, -1);
|
|
9
|
-
}
|
|
10
|
-
return currentBaseURL;
|
|
11
|
-
}
|
|
12
|
-
// 上传Url
|
|
13
|
-
uploadUrl() {
|
|
14
|
-
return this.baseApiUrl() + "/v1/file/upload?tenant=" + config.tenant;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* url 获取图片Full路径
|
|
18
|
-
* @param type resize 等比例缩放,white 补白,trans 补透明,clip 裁剪
|
|
19
|
-
*/
|
|
20
|
-
imageUrl(imageUrl, width = 0, height = 0, type = "clip") {
|
|
21
|
-
const regular = /^\//;
|
|
22
|
-
if (regular.test(imageUrl)) {
|
|
23
|
-
return this.baseApiUrl() + `/v1/file/image/${type}/${width}/${height}` + imageUrl;
|
|
24
|
-
} else {
|
|
25
|
-
return this.baseApiUrl() + `/v1/file/image/${type}/${width}/${height}/` + imageUrl;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Id 获取图片Full路径
|
|
30
|
-
* @param type resize 等比例缩放,white 补白,trans 补透明,clip 裁剪
|
|
31
|
-
*/
|
|
32
|
-
imageIdUrl(imageId, width = 0, height = 0, type = "clip") {
|
|
33
|
-
return this.baseApiUrl() + "/v1/file/image_id/" + config.tenant + `/${type}/${width}/${height}/` + imageId;
|
|
34
|
-
}
|
|
35
|
-
// url 获取文件Full路径
|
|
36
|
-
fileUrl(fileUrl) {
|
|
37
|
-
return this.baseApiUrl() + "/v1/file/path/" + fileUrl;
|
|
38
|
-
}
|
|
39
|
-
// Id 获取文件Full路径
|
|
40
|
-
fileIdUrl(fileId) {
|
|
41
|
-
return this.baseApiUrl() + "/v1/file/id/" + config.tenant + fileId;
|
|
42
|
-
}
|
|
43
|
-
// 上传文件
|
|
44
|
-
uploadBase64File(base64) {
|
|
45
|
-
base64.tenant = config.tenant;
|
|
46
|
-
clearEmpty(base64);
|
|
47
|
-
return request({
|
|
48
|
-
url: "/v1/file/base64upload",
|
|
49
|
-
method: "POST",
|
|
50
|
-
data: base64
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
// 上传文件
|
|
54
|
-
uploadFile(file) {
|
|
55
|
-
let that = this;
|
|
56
|
-
return new Promise((resolve, reject) => {
|
|
57
|
-
wx.uploadFile({
|
|
58
|
-
url: that.uploadUrl(),
|
|
59
|
-
filePath: file,
|
|
60
|
-
name: "file",
|
|
61
|
-
header: {
|
|
62
|
-
"Content-Type": "multipart/form-data",
|
|
63
|
-
"Authorization": db.getBearerToken()
|
|
64
|
-
},
|
|
65
|
-
success(response) {
|
|
66
|
-
if (response.statusCode === 200) {
|
|
67
|
-
resolve({
|
|
68
|
-
code: response.statusCode,
|
|
69
|
-
message: response.errMsg,
|
|
70
|
-
data: JSON.parse(response.data)
|
|
71
|
-
});
|
|
72
|
-
} else if (response.statusCode === 401) {
|
|
73
|
-
wx.clearStorage();
|
|
74
|
-
} else {
|
|
75
|
-
wx.showToast({
|
|
76
|
-
title: response.errMsg,
|
|
77
|
-
icon: "none",
|
|
78
|
-
duration: 2e3
|
|
79
|
-
});
|
|
80
|
-
resolve({
|
|
81
|
-
code: response.statusCode,
|
|
82
|
-
message: response.errMsg,
|
|
83
|
-
data: JSON.parse(response.data)
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
fail(error) {
|
|
88
|
-
reject(error);
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
// 上传文件
|
|
94
|
-
downloadFile(url) {
|
|
95
|
-
return new Promise((resolve, reject) => {
|
|
96
|
-
wx.downloadFile({
|
|
97
|
-
url,
|
|
98
|
-
header: {
|
|
99
|
-
"Authorization": db.getBearerToken()
|
|
100
|
-
},
|
|
101
|
-
success(response) {
|
|
102
|
-
resolve({
|
|
103
|
-
statusCode: response.statusCode,
|
|
104
|
-
tempFilePath: response.tempFilePath,
|
|
105
|
-
filePath: response.tempFilePath
|
|
106
|
-
});
|
|
107
|
-
},
|
|
108
|
-
fail(error) {
|
|
109
|
-
reject(error);
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
// 上传文件
|
|
115
|
-
uploadWebFile(data) {
|
|
116
|
-
clearEmpty(data);
|
|
117
|
-
return request({
|
|
118
|
-
url: "/v1/file/webupload",
|
|
119
|
-
method: "POST",
|
|
120
|
-
data
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
// 删除文件
|
|
124
|
-
deleteFile(filePath) {
|
|
125
|
-
return request({
|
|
126
|
-
url: "/api/v1/files",
|
|
127
|
-
method: "DELETE",
|
|
128
|
-
data: { filePath }
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
const fileApi = new FileApi();
|
|
133
|
-
export {
|
|
134
|
-
fileApi
|
|
135
|
-
};
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../utils/config.js"),t=require("../../utils/request.js"),r=require("../../utils/db.js");const a=new class i{baseApiUrl(){let t=e.config.baseUrl;return"/"===t.slice(-1)&&(t=t.slice(0,-1)),t}uploadUrl(){return this.baseApiUrl()+"/v1/file/upload?tenant="+e.config.tenant}imageUrl(e,t=0,r=0,a="clip"){return/^\//.test(e)?this.baseApiUrl()+`/v1/file/image/${a}/${t}/${r}`+e:this.baseApiUrl()+`/v1/file/image/${a}/${t}/${r}/`+e}imageIdUrl(t,r=0,a=0,i="clip"){return this.baseApiUrl()+"/v1/file/image_id/"+e.config.tenant+`/${i}/${r}/${a}/`+t}fileUrl(e){return this.baseApiUrl()+"/v1/file/path/"+e}fileIdUrl(t){return this.baseApiUrl()+"/v1/file/id/"+e.config.tenant+t}uploadBase64File(r){return r.tenant=e.config.tenant,t.clearEmpty(r),t.request({url:"/v1/file/base64upload",method:"POST",data:r})}uploadFile(e){let t=this;return new Promise((a,i)=>{wx.uploadFile({url:t.uploadUrl(),filePath:e,name:"file",header:{"Content-Type":"multipart/form-data",Authorization:r.db.getBearerToken()},success(e){200===e.statusCode?a({code:e.statusCode,message:e.errMsg,data:JSON.parse(e.data)}):401===e.statusCode?wx.clearStorage():(wx.showToast({title:e.errMsg,icon:"none",duration:2e3}),a({code:e.statusCode,message:e.errMsg,data:JSON.parse(e.data)}))},fail(e){i(e)}})})}downloadFile(e){return new Promise((t,a)=>{wx.downloadFile({url:e,header:{Authorization:r.db.getBearerToken()},success(e){t({statusCode:e.statusCode,tempFilePath:e.tempFilePath,filePath:e.tempFilePath})},fail(e){a(e)}})})}uploadWebFile(e){return t.clearEmpty(e),t.request({url:"/v1/file/webupload",method:"POST",data:e})}deleteFile(e){return t.request({url:"/api/v1/files",method:"DELETE",data:{filePath:e}})}};exports.fileApi=a,"object"==typeof exports&&"undefined"!=typeof module&&Object.keys(module.exports).forEach(function(e){exports[e]=module.exports[e]});
|
package/dist/api/files/types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";"object"==typeof exports&&"undefined"!=typeof module&&Object.keys(module.exports).forEach(function(e){exports[e]=module.exports[e]});
|
package/dist/api/index.js
CHANGED
|
@@ -1,12 +1 @@
|
|
|
1
|
-
|
|
2
|
-
const Constant = require("../constant");
|
|
3
|
-
const _Dict = class _Dict2 {
|
|
4
|
-
};
|
|
5
|
-
_Dict.genderDict = new EnumDict(
|
|
6
|
-
Constant.MODULE_RBAC,
|
|
7
|
-
Constant.ENUM_GENDER
|
|
8
|
-
);
|
|
9
|
-
let Dict = _Dict;
|
|
10
|
-
export {
|
|
11
|
-
Dict
|
|
12
|
-
};
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./dicts.js"),t=require("../constant"),o=class e{};o.genderDict=new e.EnumDict(t.MODULE_RBAC,t.ENUM_GENDER);let r=o;exports.Dict=r,"object"==typeof exports&&"undefined"!=typeof module&&Object.keys(module.exports).forEach(function(e){exports[e]=module.exports[e]});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";"object"==typeof exports&&"undefined"!=typeof module&&Object.keys(module.exports).forEach(function(e){exports[e]=module.exports[e]});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";"object"==typeof exports&&"undefined"!=typeof module&&Object.keys(module.exports).forEach(function(e){exports[e]=module.exports[e]});
|
package/dist/api/types.js
CHANGED
|
@@ -1,9 +1 @@
|
|
|
1
|
-
var TenantType
|
|
2
|
-
TenantType2[TenantType2["System"] = 0] = "System";
|
|
3
|
-
TenantType2[TenantType2["User"] = 1] = "User";
|
|
4
|
-
TenantType2[TenantType2["Organ"] = 2] = "Organ";
|
|
5
|
-
return TenantType2;
|
|
6
|
-
})(TenantType || {});
|
|
7
|
-
export {
|
|
8
|
-
TenantType
|
|
9
|
-
};
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var e=(e=>(e[e.System=0]="System",e[e.User=1]="User",e[e.Organ=2]="Organ",e))(e||{});exports.TenantType=e,"object"==typeof exports&&"undefined"!=typeof module&&Object.keys(module.exports).forEach(function(e){exports[e]=module.exports[e]});
|
package/dist/app.d.ts
ADDED
|
File without changes
|
package/dist/app.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";App({globalData:{},onLaunch(){(wx.getStorageSync("logs")||[]).unshift(Date.now()),wx.login({success:e=>{}})}}),"object"==typeof exports&&"undefined"!=typeof module&&Object.keys(module.exports).forEach(function(e){exports[e]=module.exports[e]});
|
package/dist/app.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"pages": [
|
|
3
|
+
"pages/index/index",
|
|
4
|
+
"pages/demo/index",
|
|
5
|
+
"pages/home/index",
|
|
6
|
+
"pages/half-home/index",
|
|
7
|
+
"pages/auth/login/index"
|
|
8
|
+
],
|
|
9
|
+
"window": {
|
|
10
|
+
"navigationBarTextStyle": "black",
|
|
11
|
+
"navigationBarTitleText": "",
|
|
12
|
+
"navigationBarBackgroundColor": "#fff"
|
|
13
|
+
},
|
|
14
|
+
"rendererOptions": {
|
|
15
|
+
"skyline": {
|
|
16
|
+
"defaultDisplayBlock": true,
|
|
17
|
+
"defaultContentBox": true,
|
|
18
|
+
"tagNameStyleIsolation": "legacy",
|
|
19
|
+
"disableABTest": true,
|
|
20
|
+
"sdkVersionBegin": "3.0.0",
|
|
21
|
+
"sdkVersionEnd": "15.255.255"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"componentFramework": "glass-easel",
|
|
25
|
+
"sitemapLocation": "sitemap.json",
|
|
26
|
+
"lazyCodeLoading": "requiredComponents"
|
|
27
|
+
}
|
package/dist/app.wxss
ADDED
|
File without changes
|
|
@@ -1,133 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { fileApi } from "../../../api/files/index.js";
|
|
3
|
-
import { config } from "../../../utils/config.js";
|
|
4
|
-
import { db } from "../../../utils/db.js";
|
|
5
|
-
Component({
|
|
6
|
-
/**
|
|
7
|
-
* 组件的属性列表
|
|
8
|
-
*/
|
|
9
|
-
properties: {
|
|
10
|
-
// 是否显示用户头像
|
|
11
|
-
isUserAvatar: {
|
|
12
|
-
type: Boolean,
|
|
13
|
-
value: true
|
|
14
|
-
},
|
|
15
|
-
// 是否显示昵称
|
|
16
|
-
isUserNickName: {
|
|
17
|
-
type: Boolean,
|
|
18
|
-
value: true
|
|
19
|
-
},
|
|
20
|
-
// 是否显示姓名
|
|
21
|
-
isUserRealName: {
|
|
22
|
-
type: Boolean,
|
|
23
|
-
value: true
|
|
24
|
-
},
|
|
25
|
-
// 是否显示手机号
|
|
26
|
-
isUserMobilePhone: {
|
|
27
|
-
type: Boolean,
|
|
28
|
-
value: true
|
|
29
|
-
},
|
|
30
|
-
// 用户数据
|
|
31
|
-
form: {
|
|
32
|
-
type: Object,
|
|
33
|
-
value: {}
|
|
34
|
-
},
|
|
35
|
-
// 是否显示更换手机号
|
|
36
|
-
isChangePhone: {
|
|
37
|
-
type: Boolean,
|
|
38
|
-
value: true
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
/**
|
|
42
|
-
* 组件的初始数据
|
|
43
|
-
*/
|
|
44
|
-
data: {
|
|
45
|
-
resourceUrl: config.resourceUrl + "/images",
|
|
46
|
-
imageUrl: config.baseUrl + "/v1/file/path/",
|
|
47
|
-
userInfo: {}
|
|
48
|
-
},
|
|
49
|
-
lifetimes: {
|
|
50
|
-
ready() {
|
|
51
|
-
if (Object.keys(this.data.form).length > 0) {
|
|
52
|
-
this.setData({
|
|
53
|
-
userInfo: {
|
|
54
|
-
...this.properties.form
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
} else {
|
|
58
|
-
this.getUserInfo();
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
/**
|
|
63
|
-
* 组件的方法列表
|
|
64
|
-
*/
|
|
65
|
-
methods: {
|
|
66
|
-
// 获取用户信息
|
|
67
|
-
getUserInfo() {
|
|
68
|
-
authApi.userInfo().then((resp) => {
|
|
69
|
-
this.setData({
|
|
70
|
-
userInfo: resp.data
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
},
|
|
74
|
-
// 获取微信昵称
|
|
75
|
-
getNicknameValue(e) {
|
|
76
|
-
this.setData({
|
|
77
|
-
"userInfo.nickName": e.detail.value
|
|
78
|
-
});
|
|
79
|
-
},
|
|
80
|
-
// 设置姓名
|
|
81
|
-
setrealNameValue(e) {
|
|
82
|
-
this.setData({
|
|
83
|
-
"userInfo.realName": e.detail.value
|
|
84
|
-
});
|
|
85
|
-
},
|
|
86
|
-
// 获取微信头像
|
|
87
|
-
onChooseAvatar(e) {
|
|
88
|
-
const { avatarUrl } = e.detail;
|
|
89
|
-
fileApi.uploadFile(avatarUrl).then((res) => {
|
|
90
|
-
this.setData({
|
|
91
|
-
"userInfo.avatar": res.data.fileSrc
|
|
92
|
-
});
|
|
93
|
-
});
|
|
94
|
-
},
|
|
95
|
-
// 更换手机号
|
|
96
|
-
getPhoneNumber(e) {
|
|
97
|
-
if (e.detail.errMsg === "getPhoneNumber:ok") {
|
|
98
|
-
authApi.replaceBindphone({
|
|
99
|
-
appId: config.appId,
|
|
100
|
-
phoneCode: e.detail.code,
|
|
101
|
-
componentAppid: config.componentAppid
|
|
102
|
-
}).then((res) => {
|
|
103
|
-
if (res.data) {
|
|
104
|
-
authApi.findUserInfo({}).then((res2) => {
|
|
105
|
-
if (res2.code == 200) {
|
|
106
|
-
db.userInfoStorage(res2.data);
|
|
107
|
-
this.setData({
|
|
108
|
-
userInfo: {
|
|
109
|
-
...this.data.userInfo,
|
|
110
|
-
...wx.getStorageSync("userInfo")
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
},
|
|
119
|
-
// 更新用户信息
|
|
120
|
-
updateUserInfo() {
|
|
121
|
-
this.data.userInfo.requestId = Math.random() * 10 + "";
|
|
122
|
-
this.data.userInfo.updateMask = "nickName,avatar,realName";
|
|
123
|
-
authApi.updateUserInfo(this.data.userInfo).then((res) => {
|
|
124
|
-
if (res.code == 200) {
|
|
125
|
-
db.userInfoStorage(res.data);
|
|
126
|
-
wx.navigateBack({
|
|
127
|
-
delta: 1
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
});
|
|
1
|
+
"use strict";const e=require("../../../api/auth/index.js"),a=require("../../../api/files/index.js"),t=require("../../../utils/config.js"),o=require("../../../utils/db.js");var r=Object.defineProperty,s=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable,u=(e,a,t)=>a in e?r(e,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[a]=t,l=(e,a)=>{for(var t in a||(a={}))n.call(a,t)&&u(e,t,a[t]);if(s)for(var t of s(a))i.call(a,t)&&u(e,t,a[t]);return e};Component({properties:{isUserAvatar:{type:Boolean,value:!0},isUserNickName:{type:Boolean,value:!0},isUserRealName:{type:Boolean,value:!0},isUserMobilePhone:{type:Boolean,value:!0},form:{type:Object,value:{}},isChangePhone:{type:Boolean,value:!0}},data:{resourceUrl:t.config.resourceUrl+"/images",imageUrl:t.config.baseUrl+"/v1/file/path/",userInfo:{}},lifetimes:{ready(){Object.keys(this.data.form).length>0?this.setData({userInfo:l({},this.properties.form)}):this.getUserInfo()}},methods:{getUserInfo(){e.authApi.userInfo().then(e=>{this.setData({userInfo:e.data})})},getNicknameValue(e){this.setData({"userInfo.nickName":e.detail.value})},setrealNameValue(e){this.setData({"userInfo.realName":e.detail.value})},onChooseAvatar(e){const{avatarUrl:t}=e.detail;a.fileApi.uploadFile(t).then(e=>{this.setData({"userInfo.avatar":e.data.fileSrc})})},getPhoneNumber(a){"getPhoneNumber:ok"===a.detail.errMsg&&e.authApi.replaceBindphone({appId:t.config.appId,phoneCode:a.detail.code,componentAppid:t.config.componentAppid}).then(a=>{a.data&&e.authApi.findUserInfo({}).then(e=>{200==e.code&&(o.db.userInfoStorage(e.data),this.setData({userInfo:l(l({},this.data.userInfo),wx.getStorageSync("userInfo"))}))})})},updateUserInfo(){this.data.userInfo.requestId=10*Math.random()+"",this.data.userInfo.updateMask="nickName,avatar,realName",e.authApi.updateUserInfo(this.data.userInfo).then(e=>{200==e.code&&(o.db.userInfoStorage(e.data),wx.navigateBack({delta:1}))})}}}),"object"==typeof exports&&"undefined"!=typeof module&&Object.keys(module.exports).forEach(function(e){exports[e]=module.exports[e]});
|
|
@@ -1,34 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Component({
|
|
3
|
-
/**
|
|
4
|
-
* 组件的属性列表
|
|
5
|
-
*/
|
|
6
|
-
properties: {
|
|
7
|
-
userInfo: {
|
|
8
|
-
type: Object,
|
|
9
|
-
value: {}
|
|
10
|
-
},
|
|
11
|
-
token: {
|
|
12
|
-
type: String,
|
|
13
|
-
value: ""
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
/**
|
|
17
|
-
* 组件的初始数据
|
|
18
|
-
*/
|
|
19
|
-
data: {
|
|
20
|
-
BASE_URL: config.baseUrl + "/v1/file/image/clip/200/200/",
|
|
21
|
-
resourceUrl: config.resourceUrl + "/images/mall"
|
|
22
|
-
},
|
|
23
|
-
/**
|
|
24
|
-
* 组件的方法列表
|
|
25
|
-
*/
|
|
26
|
-
methods: {
|
|
27
|
-
handleLogin() {
|
|
28
|
-
this.triggerEvent("login");
|
|
29
|
-
},
|
|
30
|
-
handleUpdateUser() {
|
|
31
|
-
this.triggerEvent("updateUser");
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
});
|
|
1
|
+
"use strict";const e=require("../../../utils/config.js");Component({properties:{userInfo:{type:Object,value:{}},token:{type:String,value:""}},data:{BASE_URL:e.config.baseUrl+"/v1/file/image/clip/200/200/",resourceUrl:e.config.resourceUrl+"/images/mall"},methods:{handleLogin(){this.triggerEvent("login")},handleUpdateUser(){this.triggerEvent("updateUser")}}}),"object"==typeof exports&&"undefined"!=typeof module&&Object.keys(module.exports).forEach(function(e){exports[e]=module.exports[e]});
|