xyvcard-wechat-auth 0.0.19 → 0.0.21

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.
Files changed (67) hide show
  1. package/dist/api/auth/index.js +159 -1
  2. package/dist/api/auth/types.js +1 -1
  3. package/dist/api/dict/index.js +36 -1
  4. package/dist/api/dict/types.js +1 -1
  5. package/dist/api/dicts.js +53 -1
  6. package/dist/api/files/index.js +135 -1
  7. package/dist/api/files/types.js +1 -1
  8. package/dist/api/index.js +12 -1
  9. package/dist/api/myorgan/index.js +1 -1
  10. package/dist/api/myorgan/types.js +1 -1
  11. package/dist/api/types.js +9 -1
  12. package/dist/components/auth-user/jmash-update-user/index.js +133 -1
  13. package/dist/components/auth-user/jmash-user/index.js +56 -1
  14. package/dist/components/common/auth-avatar/avatar-edit/index.js +82 -1
  15. package/dist/components/common/auth-basic-title/basic-title-view/index.js +39 -0
  16. package/dist/{pages/home → components/common/auth-basic-title/basic-title-view}/index.json +1 -0
  17. package/dist/components/common/auth-basic-title/basic-title-view/index.wxml +5 -0
  18. package/dist/components/common/auth-basic-title/basic-title-view/index.wxss +1 -0
  19. package/dist/components/common/auth-btn/double-btn/index.js +67 -1
  20. package/dist/components/common/auth-btn/single-btn/index.js +34 -1
  21. package/dist/components/common/auth-none-data/none-data-image/index.js +53 -1
  22. package/dist/components/common/auth-popup/index.js +53 -1
  23. package/dist/components/common/auth-popup/index.wxml +3 -3
  24. package/dist/components/common/auth-popup/index.wxss +1 -1
  25. package/dist/components/common/auth-search/index.js +60 -1
  26. package/dist/components/common/auth-top-navigation/index.js +49 -1
  27. package/dist/components/jmash-half-login/index.js +105 -1
  28. package/dist/components/jmash-login/index.js +121 -1
  29. package/dist/constant.js +15 -1
  30. package/dist/index.js +35 -1
  31. package/dist/utils/auth.js +212 -1
  32. package/dist/utils/common.js +113 -1
  33. package/dist/utils/config.js +29 -1
  34. package/dist/utils/db.js +188 -1
  35. package/dist/utils/request.js +86 -1
  36. package/dist/utils/util.js +88 -1
  37. package/package.json +1 -1
  38. package/dist/app.d.ts +0 -0
  39. package/dist/app.js +0 -1
  40. package/dist/app.json +0 -27
  41. package/dist/app.wxss +0 -0
  42. package/dist/pages/auth/login/index.js +0 -1
  43. package/dist/pages/auth/login/index.json +0 -5
  44. package/dist/pages/auth/login/index.wxml +0 -6
  45. package/dist/pages/auth/login/index.wxss +0 -1
  46. package/dist/pages/demo/index.d.ts +0 -0
  47. package/dist/pages/demo/index.js +0 -1
  48. package/dist/pages/demo/index.json +0 -14
  49. package/dist/pages/demo/index.wxml +0 -11
  50. package/dist/pages/demo/index.wxss +0 -0
  51. package/dist/pages/half-home/index.d.ts +0 -1
  52. package/dist/pages/half-home/index.js +0 -1
  53. package/dist/pages/half-home/index.json +0 -5
  54. package/dist/pages/half-home/index.wxml +0 -5
  55. package/dist/pages/half-home/index.wxss +0 -0
  56. package/dist/pages/home/index.d.ts +0 -1
  57. package/dist/pages/home/index.js +0 -1
  58. package/dist/pages/home/index.wxml +0 -2
  59. package/dist/pages/home/index.wxss +0 -0
  60. package/dist/pages/index/index.d.ts +0 -1
  61. package/dist/pages/index/index.js +0 -1
  62. package/dist/pages/index/index.json +0 -4
  63. package/dist/pages/index/index.wxml +0 -8
  64. package/dist/pages/index/index.wxss +0 -0
  65. package/dist/sitemap.json +0 -7
  66. package/xyvcard-wechat-auth-0.0.1.tgz +0 -0
  67. /package/dist/{pages/auth/login → components/common/auth-basic-title/basic-title-view}/index.d.ts +0 -0
package/dist/utils/db.js CHANGED
@@ -1 +1,188 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./config.js");const t=new class r{getTenant(){return e.config.tenant}getUserTenant(){return this.getUserInfo().storage}getOrganTenant(){return this.getDefaultOrgan().tenant}getToken(){return wx.getStorageSync("token")}getRefreshToken(){return wx.getStorageSync("refreshToken")}getRoleCodes(){return wx.getStorageSync("roleCodes")}getPermCodes(){return wx.getStorageSync("permCodes")}getUserInfo(){return wx.getStorageSync("userInfo")}getBearerToken(){return wx.getStorageSync("token")?"Bearer "+wx.getStorageSync("token"):""}isTokenExpire(){if(wx.getStorageSync("token")){const e=wx.getStorageSync("expireTime");return e&&(new Date).getTime()>e}return!1}loginStorage(e){e.token&&this.tokenStorage(e.token),wx.setStorageSync("mobilePhone",e.message)}tokenStorage(e){if(wx.setStorageSync("token",e.accessToken),wx.setStorageSync("expiresIn",e.expiresIn),wx.setStorageSync("refreshToken",e.refreshToken),e.expiresIn){const t=(new Date).getTime()+1e3*e.expiresIn-6e4;wx.setStorageSync("expireTime",t)}}rolesPermsStorage(e){wx.setStorageSync("roleCodes",e.roleCodes),wx.setStorageSync("permCodes",e.permCodes)}userInfoStorage(e){wx.setStorageSync("userInfo",e)}clearStorage(){wx.clearStorage()}setSearchStorage(e){const t=wx.getStorageSync("historical")?wx.getStorageSync("historical"):JSON.stringify([]);let r=JSON.parse(t);r.push(e),wx.setStorageSync("historical",JSON.stringify(r))}setSearchStorageAll(e){wx.setStorageSync("historical",JSON.stringify(e))}getSearchStorage(){return wx.getStorageSync("historical")?JSON.parse(wx.getStorageSync("historical")):[]}clearSearchStorage(){wx.setStorageSync("historical",JSON.stringify([]))}setDefaultOrgan(e){wx.setStorageSync("defaultOrgan",e)}getDefaultOrgan(){return wx.getStorageSync("defaultOrgan")||{}}clearDefaultOrgan(){wx.setStorageSync("defaultOrgan",{})}clearDefaultCmsinfo(){wx.setStorageSync("defaultCms",{})}getNetworkStatus(){return!!wx.getStorageSync("netWork")&&wx.getStorageSync("netWork")}setNetWorkStatus(e){wx.setStorageSync("netWork",e)}clearNetWorkStatus(){wx.setStorageSync("netWork","")}getDespTopStatus(){return!!wx.getStorageSync("desktop")&&wx.getStorageSync("desktop")}setDespTopStatus(e){wx.setStorageSync("desktop",e)}getBeforeExchangeStatus(){return wx.getStorageSync("exchange")}setBeforeExchangeStatus(e){wx.setStorageSync("exchange",e)}clearBeforeExchangeStatus(){wx.setStorageSync("exchange",!1)}getAddrNotesStorage(){return wx.getStorageSync("notes")}setAddrNotesStorage(e){wx.setStorageSync("notes",e)}clearAddrNotesStorage(){wx.setStorageSync("notes","")}};exports.db=t,"object"==typeof exports&&"undefined"!=typeof module&&Object.keys(module.exports).forEach(function(e){exports[e]=module.exports[e]});
1
+ import { config } from "./config.js";
2
+ class LocalStorage {
3
+ getTenant() {
4
+ return config.tenant;
5
+ }
6
+ // 用户租户
7
+ getUserTenant() {
8
+ return this.getUserInfo().storage;
9
+ }
10
+ // 组织租户
11
+ getOrganTenant() {
12
+ return this.getDefaultOrgan().tenant;
13
+ }
14
+ getToken() {
15
+ return wx.getStorageSync("token");
16
+ }
17
+ getRefreshToken() {
18
+ return wx.getStorageSync("refreshToken");
19
+ }
20
+ getRoleCodes() {
21
+ return wx.getStorageSync("roleCodes");
22
+ }
23
+ getPermCodes() {
24
+ return wx.getStorageSync("permCodes");
25
+ }
26
+ getUserInfo() {
27
+ return wx.getStorageSync("userInfo");
28
+ }
29
+ // 获取Bearer 格式请求Token
30
+ getBearerToken() {
31
+ return wx.getStorageSync("token") ? "Bearer " + wx.getStorageSync("token") : "";
32
+ }
33
+ // Token 是否过期
34
+ isTokenExpire() {
35
+ if (wx.getStorageSync("token")) {
36
+ const expireTime = wx.getStorageSync("expireTime");
37
+ return expireTime && (/* @__PURE__ */ new Date()).getTime() > expireTime;
38
+ }
39
+ return false;
40
+ }
41
+ // 登录存储Token等信息
42
+ loginStorage(loginResp) {
43
+ if (loginResp.token) {
44
+ this.tokenStorage(loginResp.token);
45
+ }
46
+ wx.setStorageSync("mobilePhone", loginResp.message);
47
+ }
48
+ // Token存储
49
+ tokenStorage(tokenRes) {
50
+ wx.setStorageSync("token", tokenRes.accessToken);
51
+ wx.setStorageSync("expiresIn", tokenRes.expiresIn);
52
+ wx.setStorageSync("refreshToken", tokenRes.refreshToken);
53
+ if (tokenRes.expiresIn) {
54
+ const expireTime = (/* @__PURE__ */ new Date()).getTime() + tokenRes.expiresIn * 1e3 - 60 * 1e3;
55
+ wx.setStorageSync("expireTime", expireTime);
56
+ }
57
+ }
58
+ // 角色权限存储
59
+ rolesPermsStorage(rolesPerms) {
60
+ wx.setStorageSync("roleCodes", rolesPerms.roleCodes);
61
+ wx.setStorageSync("permCodes", rolesPerms.permCodes);
62
+ }
63
+ // 用户存储
64
+ userInfoStorage(userInfo) {
65
+ wx.setStorageSync("userInfo", userInfo);
66
+ }
67
+ // 清理本地缓存
68
+ clearStorage() {
69
+ wx.clearStorage();
70
+ }
71
+ // 单个存储搜索页面历史记录
72
+ setSearchStorage(info) {
73
+ const data = wx.getStorageSync("historical") ? wx.getStorageSync("historical") : JSON.stringify([]);
74
+ let beforeArr = JSON.parse(data);
75
+ beforeArr.push(info);
76
+ wx.setStorageSync("historical", JSON.stringify(beforeArr));
77
+ }
78
+ // 整体替换本地搜索历史记录缓存
79
+ setSearchStorageAll(infoArr) {
80
+ wx.setStorageSync("historical", JSON.stringify(infoArr));
81
+ }
82
+ // 获取搜索页面历史记录
83
+ getSearchStorage() {
84
+ if (!wx.getStorageSync("historical")) return [];
85
+ return JSON.parse(wx.getStorageSync("historical"));
86
+ }
87
+ // 清除搜索的历史记录
88
+ clearSearchStorage() {
89
+ wx.setStorageSync("historical", JSON.stringify([]));
90
+ }
91
+ // 默认组织信息存储
92
+ setDefaultOrgan(organ) {
93
+ wx.setStorageSync("defaultOrgan", organ);
94
+ }
95
+ // 获取默认组织信息
96
+ getDefaultOrgan() {
97
+ return wx.getStorageSync("defaultOrgan") || {};
98
+ }
99
+ // 清除默认组织信息
100
+ clearDefaultOrgan() {
101
+ wx.setStorageSync("defaultOrgan", {});
102
+ }
103
+ // 设置企业 微网站 默认信息
104
+ // setDefaultCmsinfo(cmsInfo: CmsSiteOrganModel) {
105
+ // wx.setStorageSync("defaultCms", cmsInfo)
106
+ // }
107
+ // 获取企业/微网站/站点默认信息
108
+ // getDefaultCmsinfo(): CmsSiteStorageModel {
109
+ // // TODO// 微网站默认id
110
+ // // const siteId = wx.getStorageSync("defaultCms")?.minisiteList[0]?.siteId ? wx.getStorageSync("defaultCms")?.minisiteList[0]?.siteId : "";
111
+ // // // 微网站默认网站
112
+ // // const domainCode = wx.getStorageSync("defaultCms")?.minisiteList[0]?.domainCode ? wx.getStorageSync("defaultCms")?.minisiteList[0]?.domainCode : "";
113
+ // // // 企业官网、微网站信息
114
+ // // const defaultCms = wx.getStorageSync("defaultCms") || {};
115
+ // // return {
116
+ // // siteId,
117
+ // // domainCode,
118
+ // // defaultCms
119
+ // // }
120
+ // const storageData = wx.getStorageSync("defaultCms") || {};
121
+ // // 安全解构 minisiteList(设置默认空数组防止报错)
122
+ // const { minisiteList = [] } = storageData;
123
+ // const { siteId = "", domainCode = "" } = minisiteList[0] || {};
124
+ // return {
125
+ // // 微网站默认id
126
+ // siteId,
127
+ // // 微网站默认网站
128
+ // domainCode,
129
+ // defaultCms: storageData
130
+ // };
131
+ // }
132
+ // 清空企业/微网站/站点默认信息
133
+ clearDefaultCmsinfo() {
134
+ wx.setStorageSync("defaultCms", {});
135
+ }
136
+ // 切换组织的时候清空当前组织下保存的所有信息
137
+ // clearOrganAllStorage() {
138
+ // // 清空默认组织信息
139
+ // this.clearDefaultOrgan()
140
+ // // 清空企业/微网站/站点默认信息
141
+ // this.clearDefaultCmsinfo()
142
+ // // 清空组织管理员权限信息
143
+ // organdb.clearOrganRolesPerms()
144
+ // }
145
+ // 获取当前的网络状态
146
+ getNetworkStatus() {
147
+ return wx.getStorageSync("netWork") ? wx.getStorageSync("netWork") : false;
148
+ }
149
+ // 设置网路状态
150
+ setNetWorkStatus(status) {
151
+ wx.setStorageSync("netWork", status);
152
+ }
153
+ // 清除网路状态
154
+ clearNetWorkStatus() {
155
+ wx.setStorageSync("netWork", "");
156
+ }
157
+ // 悬浮层提示状态
158
+ getDespTopStatus() {
159
+ return wx.getStorageSync("desktop") ? wx.getStorageSync("desktop") : false;
160
+ }
161
+ setDespTopStatus(status) {
162
+ wx.setStorageSync("desktop", status);
163
+ }
164
+ // 预览页交换名片悬浮层未操作前的状态
165
+ getBeforeExchangeStatus() {
166
+ return wx.getStorageSync("exchange");
167
+ }
168
+ setBeforeExchangeStatus(status) {
169
+ wx.setStorageSync("exchange", status);
170
+ }
171
+ clearBeforeExchangeStatus() {
172
+ wx.setStorageSync("exchange", false);
173
+ }
174
+ // 分享地址备注本地缓存
175
+ getAddrNotesStorage() {
176
+ return wx.getStorageSync("notes");
177
+ }
178
+ setAddrNotesStorage(notes) {
179
+ wx.setStorageSync("notes", notes);
180
+ }
181
+ clearAddrNotesStorage() {
182
+ wx.setStorageSync("notes", "");
183
+ }
184
+ }
185
+ const db = new LocalStorage();
186
+ export {
187
+ db
188
+ };
@@ -1 +1,86 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./config.js"),t=require("./db.js"),r=require("./auth.js");let o=!1,s=null;const a=(t,r)=>new Promise((o,s)=>{wx.request({url:e.config.baseUrl+t.url,method:t.method,data:t.data,header:r,responseType:t.responseType?"text":t.responseType,success(e){200===e.statusCode?o({code:e.statusCode,message:e.errMsg,data:e.data}):401===e.statusCode?wx.clearStorage():o({code:e.statusCode,message:e.errMsg,data:e.data})},fail(e){s(e)}})});exports.clearEmpty=function e(t){for(const r in t)"object"==typeof t[r]&&e(t[r]),"object"==typeof t[r]&&0===Object.keys(t[r]).length&&delete t[r],""===t[r]&&delete t[r];return t},exports.request=(...e)=>{return n=null,c=[...e],u=function*(e={},n=""){t.db.isTokenExpire()&&(o?yield s:(o=!0,s||(s=new Promise((e,t)=>{r.auth.refreshToken().then(()=>e(!0)).catch(e=>{wx.clearStorage(),t(e)})})),yield s,o=!1));try{let r={"content-type":"application/json",Authorization:t.db.getBearerToken(),"Grpc-Metadata-Tenant":n};return yield a(e,r)}catch(c){return Promise.reject(c)}},new Promise((e,t)=>{var r=e=>{try{s(u.next(e))}catch(r){t(r)}},o=e=>{try{s(u.throw(e))}catch(r){t(r)}},s=t=>t.done?e(t.value):Promise.resolve(t.value).then(r,o);s((u=u.apply(n,c)).next())});var n,c,u},exports.sendRequest=a,"object"==typeof exports&&"undefined"!=typeof module&&Object.keys(module.exports).forEach(function(e){exports[e]=module.exports[e]});
1
+ import { config } from "./config.js";
2
+ import { db } from "./db.js";
3
+ import { auth } from "./auth.js";
4
+ let isRefreshing = false;
5
+ let refreshPromise = null;
6
+ const request = async (options = {}, tenant = "") => {
7
+ if (db.isTokenExpire()) {
8
+ if (!isRefreshing) {
9
+ isRefreshing = true;
10
+ if (!refreshPromise) {
11
+ refreshPromise = new Promise((resolve, reject) => {
12
+ auth.refreshToken().then(() => resolve(true)).catch((err) => {
13
+ wx.clearStorage();
14
+ reject(err);
15
+ });
16
+ });
17
+ }
18
+ await refreshPromise;
19
+ isRefreshing = false;
20
+ } else {
21
+ await refreshPromise;
22
+ }
23
+ }
24
+ try {
25
+ let header = {
26
+ "content-type": "application/json",
27
+ "Authorization": db.getBearerToken(),
28
+ "Grpc-Metadata-Tenant": tenant
29
+ };
30
+ const response = await sendRequest(options, header);
31
+ return response;
32
+ } catch (error) {
33
+ return Promise.reject(error);
34
+ }
35
+ };
36
+ const sendRequest = (options, header) => {
37
+ return new Promise((resolve, reject) => {
38
+ wx.request({
39
+ url: config.baseUrl + options.url,
40
+ method: options.method,
41
+ data: options.data,
42
+ header,
43
+ responseType: options.responseType ? "text" : options.responseType,
44
+ success(response) {
45
+ if (response.statusCode === 200) {
46
+ resolve({
47
+ code: response.statusCode,
48
+ message: response.errMsg,
49
+ data: response.data
50
+ });
51
+ } else if (response.statusCode === 401) {
52
+ console.log("token过期....");
53
+ wx.clearStorage();
54
+ } else {
55
+ resolve({
56
+ code: response.statusCode,
57
+ message: response.errMsg,
58
+ data: response.data
59
+ });
60
+ }
61
+ },
62
+ fail(error) {
63
+ reject(error);
64
+ }
65
+ });
66
+ });
67
+ };
68
+ function clearEmpty(params) {
69
+ for (const key in params) {
70
+ if (typeof params[key] === "object") {
71
+ clearEmpty(params[key]);
72
+ }
73
+ if (typeof params[key] === "object" && Object.keys(params[key]).length === 0) {
74
+ delete params[key];
75
+ }
76
+ if (params[key] === "") {
77
+ delete params[key];
78
+ }
79
+ }
80
+ return params;
81
+ }
82
+ export {
83
+ clearEmpty,
84
+ request,
85
+ sendRequest
86
+ };
@@ -1 +1,88 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=e=>{const t=e.toString();return t[1]?t:"0"+t};exports.formatDateTime=(e,t)=>{var n=new Date(e),o=n.getFullYear(),r=("0"+(n.getMonth()+1)).slice(-2),s=("0"+n.getDate()).slice(-2),Y=("0"+n.getHours()).slice(-2),i=("0"+n.getMinutes()).slice(-2),M=("0"+n.getSeconds()).slice(-2);return"YYYY-MM-DD HH:mm:ss"===t?o+"-"+r+"-"+s+" "+Y+":"+i+":"+M:"YYYY-MM-DD HH:mm"===t?o+"-"+r+"-"+s+" "+Y+":"+i:"YYYY-MM-DD"===t?o+"-"+r+"-"+s:"YYYY-MM"===t?o+"-"+r:"YYYY年MM月DD日"===t?o+"年"+r+"月"+s+"日":"YYYY年MM月DD日 HH:mm"===t?o+"年"+r+"月"+s+"日 "+Y+":"+i:"YYYY年MM月DD日 HH:mm:ss"===t?o+"年"+r+"月"+s+"日 "+Y+":"+i+":"+M:"YYYY年MM月DD日 HH时mm分"===t?o+"年"+r+"月"+s+"日 "+Y+"时"+i+"分":"MM.DD"===t?r+"."+s:"MM/DD"===t?r+"/"+s:"MM月DD日"===t?r+"月"+s+"日":"MM月DD日 HH:mm"===t?r+"月"+s+"日 "+Y+":"+i:""},exports.formatTime=t=>{const n=t.getFullYear(),o=t.getMonth()+1,r=t.getDate(),s=t.getHours(),Y=t.getMinutes(),i=t.getSeconds();return[n,o,r].map(e).join("/")+" "+[s,Y,i].map(e).join(":")},exports.splitOrganTenant=function(e){let t=e.organTenant;return e.orgId&&(t=e.organTenant.split("@")[1]),t},exports.splitVcardTenant=function(e){let t=e.organTenant;return e.orgId&&(t=e.organTenant.split("@")[1]),t},exports.splitVcardTenantReturn=function(e,t){return(null==t?void 0:t.indexOf("@e"))>-1&&(t=e.split("@")[1]?e.split("@")[1]:t),t},"object"==typeof exports&&"undefined"!=typeof module&&Object.keys(module.exports).forEach(function(e){exports[e]=module.exports[e]});
1
+ const formatDateTime = (dateTimeString, format) => {
2
+ var date = new Date(dateTimeString);
3
+ var year = date.getFullYear();
4
+ var month = ("0" + (date.getMonth() + 1)).slice(-2);
5
+ var day = ("0" + date.getDate()).slice(-2);
6
+ var hours = ("0" + date.getHours()).slice(-2);
7
+ var minutes = ("0" + date.getMinutes()).slice(-2);
8
+ var seconds = ("0" + date.getSeconds()).slice(-2);
9
+ if (format === "YYYY-MM-DD HH:mm:ss") {
10
+ return year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
11
+ }
12
+ if (format === "YYYY-MM-DD HH:mm") {
13
+ return year + "-" + month + "-" + day + " " + hours + ":" + minutes;
14
+ }
15
+ if (format === "YYYY-MM-DD") {
16
+ return year + "-" + month + "-" + day;
17
+ }
18
+ if (format === "YYYY-MM") {
19
+ return year + "-" + month;
20
+ }
21
+ if (format === "YYYY年MM月DD日") {
22
+ return year + "年" + month + "月" + day + "日";
23
+ }
24
+ if (format === "YYYY年MM月DD日 HH:mm") {
25
+ return year + "年" + month + "月" + day + "日 " + hours + ":" + minutes;
26
+ }
27
+ if (format === "YYYY年MM月DD日 HH:mm:ss") {
28
+ return year + "年" + month + "月" + day + "日 " + hours + ":" + minutes + ":" + seconds;
29
+ }
30
+ if (format === "YYYY年MM月DD日 HH时mm分") {
31
+ return year + "年" + month + "月" + day + "日 " + hours + "时" + minutes + "分";
32
+ }
33
+ if (format === "MM.DD") {
34
+ return month + "." + day;
35
+ }
36
+ if (format === "MM/DD") {
37
+ return month + "/" + day;
38
+ }
39
+ if (format === "MM月DD日") {
40
+ return month + "月" + day + "日";
41
+ }
42
+ if (format === "MM月DD日 HH:mm") {
43
+ return month + "月" + day + "日 " + hours + ":" + minutes;
44
+ }
45
+ return "";
46
+ };
47
+ const formatTime = (date) => {
48
+ const year = date.getFullYear();
49
+ const month = date.getMonth() + 1;
50
+ const day = date.getDate();
51
+ const hour = date.getHours();
52
+ const minute = date.getMinutes();
53
+ const second = date.getSeconds();
54
+ return [year, month, day].map(formatNumber).join("/") + " " + [hour, minute, second].map(formatNumber).join(":");
55
+ };
56
+ const formatNumber = (n) => {
57
+ const s = n.toString();
58
+ return s[1] ? s : "0" + s;
59
+ };
60
+ function splitOrganTenant(organ) {
61
+ let tenant = organ.organTenant;
62
+ if (organ.orgId) {
63
+ tenant = organ.organTenant.split("@")[1];
64
+ }
65
+ return tenant;
66
+ }
67
+ function splitVcardTenant(vcard) {
68
+ let tenant = vcard.organTenant;
69
+ if (vcard.orgId) {
70
+ tenant = vcard.organTenant.split("@")[1];
71
+ }
72
+ return tenant;
73
+ }
74
+ function splitVcardTenantReturn(vcardId, vcardTenant) {
75
+ const isOrganVcard = (vcardTenant == null ? void 0 : vcardTenant.indexOf("@e")) > -1 ? true : false;
76
+ console.log("是否是组织名片", isOrganVcard);
77
+ if (isOrganVcard) {
78
+ vcardTenant = vcardId.split("@")[1] ? vcardId.split("@")[1] : vcardTenant;
79
+ }
80
+ return vcardTenant;
81
+ }
82
+ export {
83
+ formatDateTime,
84
+ formatTime,
85
+ splitOrganTenant,
86
+ splitVcardTenant,
87
+ splitVcardTenantReturn
88
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xyvcard-wechat-auth",
3
- "version": "0.0.19",
3
+ "version": "0.0.21",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/dist/app.d.ts DELETED
File without changes
package/dist/app.js DELETED
@@ -1 +0,0 @@
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 DELETED
@@ -1,27 +0,0 @@
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 DELETED
File without changes
@@ -1 +0,0 @@
1
- "use strict";const e=require("../../../utils/config.js");Page({data:{resourceUrl:e.config.resourceUrl,backurl:"/pages/home/index",tabbar:!1},onLoad(e){this.data.tabbar="true"===e.tabbar,this.data.backurl=e.backurl},onReady(){},onShow(){},onHide(){},onUnload(){},onPullDownRefresh(){},onReachBottom(){},onShareAppMessage(){}}),"object"==typeof exports&&"undefined"!=typeof module&&Object.keys(module.exports).forEach(function(e){exports[e]=module.exports[e]});
@@ -1,5 +0,0 @@
1
- {
2
- "usingComponents": {
3
- "jmash-login": "/components/jmash-login/index"
4
- }
5
- }
@@ -1,6 +0,0 @@
1
- <jmash-login tabbar="{{ tabbar }}" backurl="{{ backurl }}">
2
- <image mode="widthFix" src="{{ resourceUrl }}/images/login_bg.png" class="index_bj" slot="before">
3
- <image mode="widthFix" src="{{ resourceUrl }}/images/logo.png" class="login_logo"></image>
4
- </image>
5
- <view class="tips_box" slot="after">温馨提示:{{config.name}}手机号授权登录。</view>
6
- </jmash-login>
@@ -1 +0,0 @@
1
- .login_logo{width:250px;margin-top:-500px}.index_bj{width:100%;text-align:center}.tips_box{color:#2563eb;font-size:12px;margin-top:40%}
File without changes
@@ -1 +0,0 @@
1
- "use strict";Page({data:{},onLoad(){},onReady(){},onShow(){},onHide(){},onUnload(){},onPullDownRefresh(){},onReachBottom(){},onShareAppMessage(){},toBack(){wx.navigateBack()}}),"object"==typeof exports&&"undefined"!=typeof module&&Object.keys(module.exports).forEach(function(o){exports[o]=module.exports[o]});
@@ -1,14 +0,0 @@
1
- {
2
- "usingComponents": {
3
- "auth-single-btn": "/components/common/auth-btn/single-btn/index",
4
- "auth-double-btn": "/components/common/auth-btn/double-btn/index",
5
- "auth-avatar-edit": "/components/common/auth-avatar/avatar-edit/index",
6
- "auth-search": "/components/common/auth-search/index",
7
- "auth-top-navigation": "/components/common/auth-top-navigation/index",
8
- "auth-popup": "/components/common/auth-popup/index",
9
- "auth-none-data-image": "/components/common/auth-none-data/none-data-image/index",
10
- "jmash-update-user": "/components/auth-user/jmash-update-user/index",
11
- "jmash-user": "/components/auth-user/jmash-user/index"
12
- },
13
- "navigationStyle": "custom"
14
- }
@@ -1,11 +0,0 @@
1
- <!--pages/test/index.wxml-->
2
-
3
- <auth-top-navigation title="首页" bind:eventBackTo="toBack"></auth-top-navigation>
4
- <view style="width: 100%;">
5
- <text>自定义顶部导航</text>
6
- <auth-search placeholder="" disabled="{{ true }}" bind:handleSearch="" bind:click=""></auth-search>
7
- <text>查询</text>
8
- <text>底部按钮</text>
9
- <auth-double-btn leftText="取消" rightText="保存" leftBgColor="#2563EB" leftColor="#fff" btnRadius="15px"></auth-double-btn>
10
- </view>
11
- <jmash-user />
File without changes
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- "use strict";const o=require("../../utils/auth.js");Page({data:{isLoginPopup:!1},onLoad(){o.auth.loginOnlyAC().then(()=>{}).catch(()=>{this.setData({isLoginPopup:!0})})},onReady(){},onShow(){},onHide(){},onUnload(){},onPullDownRefresh(){},onReachBottom(){},onShareAppMessage(){},onLoginClose(o){this.setData({isLoginPopup:o.detail})},loginSuccess(){}}),"object"==typeof exports&&"undefined"!=typeof module&&Object.keys(module.exports).forEach(function(o){exports[o]=module.exports[o]});
@@ -1,5 +0,0 @@
1
- {
2
- "usingComponents": {
3
- "jmash-half-login":"/components/jmash-half-login/index"
4
- }
5
- }
@@ -1,5 +0,0 @@
1
- <!--pages/hsp-home/index.wxml-->
2
- <text>主页(半屏登录)</text>
3
-
4
- <!-- 授权登录弹出层 -->
5
- <jmash-half-login show="{{ isLoginPopup }}" bind:close="onLoginClose" bind:status="loginSuccess"></jmash-half-login>
File without changes
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- "use strict";const e=require("../../utils/auth.js");Page({data:{},onLoad(){e.auth.loginAC("/page/home/index",!1).then(()=>{})},onReady(){},onShow(){},onHide(){},onUnload(){},onPullDownRefresh(){},onReachBottom(){},onShareAppMessage(){}}),"object"==typeof exports&&"undefined"!=typeof module&&Object.keys(module.exports).forEach(function(e){exports[e]=module.exports[e]});
@@ -1,2 +0,0 @@
1
- <!--pages/home/index.wxml-->
2
- <text>主页(全屏登录)</text>
File without changes
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- "use strict";const e=require("../../utils/auth.js");Page({data:{},onLoad(){},onReady(){},onShow(){},onHide(){},onUnload(){},onPullDownRefresh(){},onReachBottom(){},onShareAppMessage(){},toHomePage(){wx.navigateTo({url:"/pages/home/index"})},toHalfHomePage(){wx.navigateTo({url:"/pages/half-home/index"})},toCompTestPage(){wx.navigateTo({url:"/pages/demo/index"})},loginOut(){e.auth.loginOut()}}),"object"==typeof exports&&"undefined"!=typeof module&&Object.keys(module.exports).forEach(function(e){exports[e]=module.exports[e]});
@@ -1,4 +0,0 @@
1
- {
2
- "usingComponents": {
3
- }
4
- }
@@ -1,8 +0,0 @@
1
-
2
- <view class="page-body">
3
- <button type="default" bind:tap="toHomePage">主页(全屏登录)</button>
4
- <button type="default" bind:tap="toHalfHomePage">主页(半屏登录)</button>
5
- <button type="default" bind:tap="toCompTestPage">组件演示</button>
6
- <button type="default" bind:tap="loginOut">退出</button>
7
- </view>
8
-
File without changes
package/dist/sitemap.json DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
3
- "rules": [{
4
- "action": "allow",
5
- "page": "*"
6
- }]
7
- }
Binary file