@ibiz-template/vue3-util 0.7.38-alpha.23 → 0.7.38-alpha.45
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/index.min.css +1 -1
- package/dist/index.system.min.js +1 -1
- package/es/common/code-list/code-list.mjs +1 -1
- package/es/common/control-base/control-base.css +1 -1
- package/es/common/control-base/control-base.d.ts.map +1 -1
- package/es/common/control-base/control-base.mjs +67 -2
- package/es/common/icon/icon.d.ts.map +1 -1
- package/es/common/icon/icon.mjs +5 -0
- package/es/common/view-shell/view-shell.d.ts.map +1 -1
- package/es/common/view-shell/view-shell.mjs +79 -56
- package/es/index.mjs +1 -0
- package/es/locale/en/index.d.ts +2 -0
- package/es/locale/en/index.d.ts.map +1 -1
- package/es/locale/en/index.mjs +3 -1
- package/es/locale/zh-CN/index.d.ts +2 -0
- package/es/locale/zh-CN/index.d.ts.map +1 -1
- package/es/locale/zh-CN/index.mjs +3 -1
- package/es/panel-component/auth-wxmp-qrcode/auth-wxmp-qrcode.controller.d.ts +111 -0
- package/es/panel-component/auth-wxmp-qrcode/auth-wxmp-qrcode.controller.d.ts.map +1 -0
- package/es/panel-component/auth-wxmp-qrcode/auth-wxmp-qrcode.controller.mjs +176 -0
- package/es/panel-component/auth-wxmp-qrcode/auth-wxmp-qrcode.css +1 -0
- package/es/panel-component/auth-wxmp-qrcode/auth-wxmp-qrcode.d.ts +27 -0
- package/es/panel-component/auth-wxmp-qrcode/auth-wxmp-qrcode.d.ts.map +1 -0
- package/es/panel-component/auth-wxmp-qrcode/auth-wxmp-qrcode.mjs +54 -0
- package/es/panel-component/auth-wxmp-qrcode/auth-wxmp-qrcode.provider.d.ts +15 -0
- package/es/panel-component/auth-wxmp-qrcode/auth-wxmp-qrcode.provider.d.ts.map +1 -0
- package/es/panel-component/auth-wxmp-qrcode/auth-wxmp-qrcode.provider.mjs +15 -0
- package/es/panel-component/auth-wxmp-qrcode/auth-wxmp-qrcode.state.d.ts +54 -0
- package/es/panel-component/auth-wxmp-qrcode/auth-wxmp-qrcode.state.d.ts.map +1 -0
- package/es/panel-component/auth-wxmp-qrcode/auth-wxmp-qrcode.state.mjs +7 -0
- package/es/panel-component/auth-wxmp-qrcode/index.d.ts +24 -0
- package/es/panel-component/auth-wxmp-qrcode/index.d.ts.map +1 -0
- package/es/panel-component/auth-wxmp-qrcode/index.mjs +19 -0
- package/es/panel-component/index.d.ts +1 -0
- package/es/panel-component/index.d.ts.map +1 -1
- package/es/panel-component/index.mjs +1 -0
- package/es/panel-component/multi-data-container/multi-data-container.controller.d.ts +9 -0
- package/es/panel-component/multi-data-container/multi-data-container.controller.d.ts.map +1 -1
- package/es/panel-component/multi-data-container/multi-data-container.controller.mjs +15 -2
- package/es/panel-component/multi-data-container-raw/multi-data-container-raw.controller.d.ts +8 -0
- package/es/panel-component/multi-data-container-raw/multi-data-container-raw.controller.d.ts.map +1 -1
- package/es/panel-component/multi-data-container-raw/multi-data-container-raw.controller.mjs +14 -2
- package/es/panel-component/panel-container/panel-container.css +1 -1
- package/es/panel-component/single-data-container/single-data-container.controller.d.ts +8 -0
- package/es/panel-component/single-data-container/single-data-container.controller.d.ts.map +1 -1
- package/es/panel-component/single-data-container/single-data-container.controller.mjs +14 -2
- package/es/view/common/index.d.ts +1 -1
- package/es/view/common/view.d.ts +1 -1
- package/es/view/common/view.d.ts.map +1 -1
- package/es/view/common/view.mjs +1 -1
- package/lib/common/code-list/code-list.cjs +1 -1
- package/lib/common/control-base/control-base.cjs +66 -1
- package/lib/common/control-base/control-base.css +1 -1
- package/lib/common/icon/icon.cjs +5 -0
- package/lib/common/view-shell/view-shell.cjs +78 -55
- package/lib/index.cjs +25 -23
- package/lib/locale/en/index.cjs +3 -1
- package/lib/locale/zh-CN/index.cjs +3 -1
- package/lib/panel-component/auth-wxmp-qrcode/auth-wxmp-qrcode.cjs +56 -0
- package/lib/panel-component/auth-wxmp-qrcode/auth-wxmp-qrcode.controller.cjs +178 -0
- package/lib/panel-component/auth-wxmp-qrcode/auth-wxmp-qrcode.css +1 -0
- package/lib/panel-component/auth-wxmp-qrcode/auth-wxmp-qrcode.provider.cjs +17 -0
- package/lib/panel-component/auth-wxmp-qrcode/auth-wxmp-qrcode.state.cjs +9 -0
- package/lib/panel-component/auth-wxmp-qrcode/index.cjs +24 -0
- package/lib/panel-component/index.cjs +2 -0
- package/lib/panel-component/multi-data-container/multi-data-container.controller.cjs +14 -1
- package/lib/panel-component/multi-data-container-raw/multi-data-container-raw.controller.cjs +13 -1
- package/lib/panel-component/panel-container/panel-container.css +1 -1
- package/lib/panel-component/single-data-container/single-data-container.controller.cjs +13 -1
- package/lib/view/common/view.cjs +1 -1
- package/package.json +5 -5
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { defineComponent, reactive, resolveComponent,
|
|
1
|
+
import { defineComponent, reactive, createVNode, resolveComponent, computed, h } from 'vue';
|
|
2
|
+
import { ScriptFactory } from '@ibiz-template/runtime';
|
|
3
|
+
import { fixJsonString } from '@ibiz-template/core';
|
|
2
4
|
import { isNil } from 'ramda';
|
|
3
5
|
import '../../use/index.mjs';
|
|
4
6
|
import { useNamespace } from '../../use/namespace/namespace.mjs';
|
|
@@ -43,6 +45,68 @@ const IBizControlBase = /* @__PURE__ */ defineComponent({
|
|
|
43
45
|
}
|
|
44
46
|
}
|
|
45
47
|
}
|
|
48
|
+
const handleHtmlEvent = async (e, eventName) => {
|
|
49
|
+
e.stopPropagation();
|
|
50
|
+
const scriptCode = e.target.getAttribute(eventName);
|
|
51
|
+
const data = e.target.getAttribute("data");
|
|
52
|
+
const context = props.controller.context.clone();
|
|
53
|
+
const _context = e.target.getAttribute("context");
|
|
54
|
+
if (_context) {
|
|
55
|
+
Object.assign(context, fixJsonString(_context));
|
|
56
|
+
}
|
|
57
|
+
const params = {
|
|
58
|
+
...props.controller.params
|
|
59
|
+
};
|
|
60
|
+
const _params = e.target.getAttribute("params");
|
|
61
|
+
if (_params) {
|
|
62
|
+
Object.assign(params, fixJsonString(_params));
|
|
63
|
+
}
|
|
64
|
+
if (scriptCode) {
|
|
65
|
+
await ScriptFactory.asyncExecScriptFn({
|
|
66
|
+
...props.controller.getEventArgs(),
|
|
67
|
+
context,
|
|
68
|
+
params,
|
|
69
|
+
data: data ? fixJsonString(data) : null
|
|
70
|
+
}, scriptCode);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
const getControlRender = (data) => {
|
|
74
|
+
var _a, _b;
|
|
75
|
+
const {
|
|
76
|
+
controlRenders
|
|
77
|
+
} = model;
|
|
78
|
+
if (!controlRenders || controlRenders.length === 0) {
|
|
79
|
+
return void 0;
|
|
80
|
+
}
|
|
81
|
+
const controlRender = controlRenders[0];
|
|
82
|
+
if (controlRender.renderType === "LAYOUTPANEL_MODEL" && controlRender.layoutPanelModel) {
|
|
83
|
+
const htmlCode = ScriptFactory.execScriptFn({
|
|
84
|
+
...props.controller.getEventArgs(),
|
|
85
|
+
data
|
|
86
|
+
}, controlRender.layoutPanelModel, {
|
|
87
|
+
isAsync: false
|
|
88
|
+
});
|
|
89
|
+
return createVNode("div", {
|
|
90
|
+
"innerHTML": htmlCode,
|
|
91
|
+
"onClick": (e) => handleHtmlEvent(e, "click"),
|
|
92
|
+
"onDblclick": (e) => handleHtmlEvent(e, "dbclick"),
|
|
93
|
+
"class": [ns.e("control-render"), ns.e((_a = controlRender.renderName) == null ? void 0 : _a.toLowerCase())]
|
|
94
|
+
}, null);
|
|
95
|
+
}
|
|
96
|
+
if (controlRender.renderType === "LAYOUTPANEL" && controlRender.layoutPanel) {
|
|
97
|
+
return createVNode(resolveComponent("iBizControlShell"), {
|
|
98
|
+
"class": [ns.e("control-render"), ns.e((_b = controlRender.renderName) == null ? void 0 : _b.toLowerCase())],
|
|
99
|
+
"data": data,
|
|
100
|
+
"params": props.controller.params,
|
|
101
|
+
"context": props.controller.context,
|
|
102
|
+
"modelData": controlRender.layoutPanel
|
|
103
|
+
}, null);
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
const customRender = computed(() => {
|
|
107
|
+
const data = props.controller.data || props.controller.items;
|
|
108
|
+
return getControlRender(data);
|
|
109
|
+
});
|
|
46
110
|
return {
|
|
47
111
|
ns,
|
|
48
112
|
typeClass,
|
|
@@ -50,6 +114,7 @@ const IBizControlBase = /* @__PURE__ */ defineComponent({
|
|
|
50
114
|
inlineStyle,
|
|
51
115
|
codeName,
|
|
52
116
|
controls,
|
|
117
|
+
customRender,
|
|
53
118
|
onLayoutPanelCreated
|
|
54
119
|
};
|
|
55
120
|
},
|
|
@@ -101,7 +166,7 @@ const IBizControlBase = /* @__PURE__ */ defineComponent({
|
|
|
101
166
|
return createVNode("div", {
|
|
102
167
|
"class": [this.ns.b(), this.ns.b(this.typeClass), this.ns.m(this.codeName), this.sysCssName],
|
|
103
168
|
"style": this.inlineStyle
|
|
104
|
-
}, [layoutPanel || ((_c = (_b = this.$slots).default) == null ? void 0 : _c.call(_b))]);
|
|
169
|
+
}, [layoutPanel || this.customRender || ((_c = (_b = this.$slots).default) == null ? void 0 : _c.call(_b))]);
|
|
105
170
|
}
|
|
106
171
|
});
|
|
107
172
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icon.d.ts","sourceRoot":"","sources":["../../../src/common/icon/icon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAmB,QAAQ,EAAE,KAAK,EAAY,MAAM,KAAK,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAQ/C,OAAO,aAAa,CAAC;AAErB,eAAO,MAAM,QAAQ;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"icon.d.ts","sourceRoot":"","sources":["../../../src/common/icon/icon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAmB,QAAQ,EAAE,KAAK,EAAY,MAAM,KAAK,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAQ/C,OAAO,aAAa,CAAC;AAErB,eAAO,MAAM,QAAQ;;;;;;;;;;;SAoFN,KAAK,GAAG,IAAI;;;;;;;;;;;;;MAEzB,CAAC"}
|
package/es/common/icon/icon.mjs
CHANGED
|
@@ -36,6 +36,11 @@ const IBizIcon = /* @__PURE__ */ defineComponent({
|
|
|
36
36
|
"class": [ns.b(), icon.cssClass]
|
|
37
37
|
}, null);
|
|
38
38
|
}
|
|
39
|
+
if (icon.cssClass.indexOf("theme-icon") !== -1) {
|
|
40
|
+
return createVNode("i", {
|
|
41
|
+
"class": [ns.b(), icon.cssClass]
|
|
42
|
+
}, null);
|
|
43
|
+
}
|
|
39
44
|
return createVNode("ion-icon", {
|
|
40
45
|
"class": ns.b(),
|
|
41
46
|
"name": icon.cssClass
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"view-shell.d.ts","sourceRoot":"","sources":["../../../src/common/view-shell/view-shell.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"view-shell.d.ts","sourceRoot":"","sources":["../../../src/common/view-shell/view-shell.tsx"],"names":[],"mappings":"AAKA,OAAO,EAEL,aAAa,EAGb,eAAe,EAEhB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAGL,QAAQ,EACR,GAAG,EAIJ,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAK5C,OAAO,mBAAmB,CAAC;AAE3B,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;wBA6MW,eAAe,KAAG,QAAQ,IAAI,CAAC;;;;;;;;;;;;;;;;;YAiElE,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { defineComponent, ref, watch, h, resolveComponent, withDirectives, creat
|
|
|
2
2
|
import { calcDynaSysParams, getViewProvider, getErrorViewProvider } from '@ibiz-template/runtime';
|
|
3
3
|
import { RuntimeError } from '@ibiz-template/core';
|
|
4
4
|
import { createUUID } from 'qx-util';
|
|
5
|
-
import { isNil, isEmpty
|
|
5
|
+
import { clone, isNil, isEmpty } from 'ramda';
|
|
6
6
|
import '../../use/index.mjs';
|
|
7
7
|
import './view-shell.css';
|
|
8
8
|
import { useNamespace } from '../../use/namespace/namespace.mjs';
|
|
@@ -25,7 +25,9 @@ const IBizViewShell = /* @__PURE__ */ defineComponent({
|
|
|
25
25
|
type: String
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
|
-
setup(props
|
|
28
|
+
setup(props, {
|
|
29
|
+
attrs
|
|
30
|
+
}) {
|
|
29
31
|
const ns = useNamespace("view-shell");
|
|
30
32
|
const isComplete = ref(false);
|
|
31
33
|
const errMsg = ref("");
|
|
@@ -34,6 +36,7 @@ const IBizViewShell = /* @__PURE__ */ defineComponent({
|
|
|
34
36
|
const hasAuthority = ref(true);
|
|
35
37
|
const context = ref(props.context);
|
|
36
38
|
const params = ref(props.params || {});
|
|
39
|
+
let dynaViewCacheKey = "";
|
|
37
40
|
watch(() => ({
|
|
38
41
|
context: props.context,
|
|
39
42
|
params: props.params
|
|
@@ -76,6 +79,13 @@ const IBizViewShell = /* @__PURE__ */ defineComponent({
|
|
|
76
79
|
return checkResult;
|
|
77
80
|
};
|
|
78
81
|
let viewModel;
|
|
82
|
+
const getDynaViewCacheKey = (args) => {
|
|
83
|
+
const copyArgs = clone(args);
|
|
84
|
+
if (copyArgs.srfdatatype) {
|
|
85
|
+
delete copyArgs.srfdatatype;
|
|
86
|
+
}
|
|
87
|
+
return JSON.stringify(copyArgs);
|
|
88
|
+
};
|
|
79
89
|
const initViewModel = async () => {
|
|
80
90
|
if (props.modelData) {
|
|
81
91
|
viewModel = props.modelData;
|
|
@@ -84,69 +94,77 @@ const IBizViewShell = /* @__PURE__ */ defineComponent({
|
|
|
84
94
|
}
|
|
85
95
|
};
|
|
86
96
|
const init = async () => {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
hasAuthority.value = await checkViewAuthority(viewModel);
|
|
92
|
-
if (!hasAuthority.value) {
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
if (viewModel.dynaSysMode === 1) {
|
|
96
|
-
const appDataEntityId = viewModel.appDataEntityId;
|
|
97
|
-
if (!appDataEntityId) {
|
|
98
|
-
throw new RuntimeError(ibiz.i18n.t("vue3Util.common.noSupportLoadingDynamic", {
|
|
99
|
-
codeName: viewModel.codeName
|
|
100
|
-
}));
|
|
97
|
+
try {
|
|
98
|
+
await initViewModel();
|
|
99
|
+
if (!viewModel) {
|
|
100
|
+
throw new RuntimeError(ibiz.i18n.t("vue3Util.common.noFoundViewModel"));
|
|
101
101
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
});
|
|
106
|
-
if (params.value.srfdatatype) {
|
|
107
|
-
loadModelParams.srfdatatype = params.value.srfdatatype;
|
|
102
|
+
hasAuthority.value = await checkViewAuthority(viewModel);
|
|
103
|
+
if (!hasAuthority.value) {
|
|
104
|
+
return;
|
|
108
105
|
}
|
|
109
|
-
if (
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
106
|
+
if (viewModel.dynaSysMode === 1) {
|
|
107
|
+
const appDataEntityId = viewModel.appDataEntityId;
|
|
108
|
+
if (!appDataEntityId) {
|
|
109
|
+
throw new RuntimeError(ibiz.i18n.t("vue3Util.common.noSupportLoadingDynamic", {
|
|
110
|
+
codeName: viewModel.codeName
|
|
111
|
+
}));
|
|
112
|
+
}
|
|
113
|
+
const loadModelParams = await calcDynaSysParams(appDataEntityId, context.value, {
|
|
114
|
+
viewParams: params.value,
|
|
115
|
+
appId: viewModel.appId
|
|
116
|
+
});
|
|
117
|
+
if (params.value.srfdatatype) {
|
|
118
|
+
loadModelParams.srfdatatype = params.value.srfdatatype;
|
|
119
|
+
}
|
|
120
|
+
if (params.value.srfwftag) {
|
|
121
|
+
loadModelParams.srfwftag = params.value.srfwftag;
|
|
122
|
+
} else if (appDataEntityId && viewModel.enableWF) {
|
|
123
|
+
if (loadModelParams.srfkey) {
|
|
124
|
+
const noSrfSessionId = isNil(context.value.srfsessionid) || isEmpty(context.value.srfsessionid);
|
|
125
|
+
const id = createUUID();
|
|
126
|
+
if (noSrfSessionId) {
|
|
127
|
+
const domain = ibiz.uiDomainManager.create(id);
|
|
128
|
+
context.value.srfsessionid = domain.id;
|
|
130
129
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
130
|
+
const app = ibiz.hub.getApp(viewModel.appId);
|
|
131
|
+
const service = await app.deService.getService(context.value, appDataEntityId);
|
|
132
|
+
const res = await service.get(context.value, params.value || {});
|
|
133
|
+
if (res.ok && res.data) {
|
|
134
|
+
const {
|
|
135
|
+
srfwftag,
|
|
136
|
+
processdefinitionkey,
|
|
137
|
+
taskdefinitionkey
|
|
138
|
+
} = res.data;
|
|
139
|
+
if (srfwftag) {
|
|
140
|
+
loadModelParams.srfwftag = srfwftag;
|
|
134
141
|
}
|
|
135
|
-
if (
|
|
136
|
-
params.value.
|
|
142
|
+
if (["DEWFDYNAEDITVIEW3", "DEWFDYNAEDITVIEW"].includes(viewModel.viewType)) {
|
|
143
|
+
if (isNil(params.value.processDefinitionKey)) {
|
|
144
|
+
params.value.processDefinitionKey = processdefinitionkey;
|
|
145
|
+
}
|
|
146
|
+
if (isNil(params.value.taskDefinitionKey)) {
|
|
147
|
+
params.value.taskDefinitionKey = taskdefinitionkey;
|
|
148
|
+
}
|
|
137
149
|
}
|
|
138
150
|
}
|
|
151
|
+
if (noSrfSessionId) {
|
|
152
|
+
ibiz.uiDomainManager.destroy(id);
|
|
153
|
+
}
|
|
139
154
|
}
|
|
140
|
-
if (noSrfSessionId) {
|
|
141
|
-
ibiz.uiDomainManager.destroy(id);
|
|
142
|
-
}
|
|
143
155
|
}
|
|
156
|
+
const curDynaViewCacheKey = getDynaViewCacheKey(loadModelParams);
|
|
157
|
+
if (curDynaViewCacheKey === dynaViewCacheKey) {
|
|
158
|
+
setTimeout(() => {
|
|
159
|
+
isComplete.value = true;
|
|
160
|
+
});
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
viewModelData.value = await ibiz.hub.loadAppView(viewModel.appId, viewModel.id, loadModelParams);
|
|
164
|
+
dynaViewCacheKey = getDynaViewCacheKey(loadModelParams);
|
|
165
|
+
} else {
|
|
166
|
+
viewModelData.value = viewModel;
|
|
144
167
|
}
|
|
145
|
-
viewModelData.value = await ibiz.hub.loadAppView(viewModel.appId, viewModel.id, loadModelParams);
|
|
146
|
-
} else {
|
|
147
|
-
viewModelData.value = viewModel;
|
|
148
|
-
}
|
|
149
|
-
try {
|
|
150
168
|
provider.value = await getViewProvider(viewModel);
|
|
151
169
|
} catch (error) {
|
|
152
170
|
ibiz.log.error(error);
|
|
@@ -166,6 +184,11 @@ const IBizViewShell = /* @__PURE__ */ defineComponent({
|
|
|
166
184
|
} = redrawData;
|
|
167
185
|
Object.assign(context.value, redrawData.context);
|
|
168
186
|
Object.assign(params.value, redrawData.params);
|
|
187
|
+
const modal = attrs.modal;
|
|
188
|
+
if (modal) {
|
|
189
|
+
modal.hooks.shouldDismiss.clear();
|
|
190
|
+
modal.hooks.beforeDismiss.clear();
|
|
191
|
+
}
|
|
169
192
|
if (isReloadModel) {
|
|
170
193
|
await init();
|
|
171
194
|
} else {
|
package/es/index.mjs
CHANGED
|
@@ -59,6 +59,7 @@ export { TeleportPlaceholderProvider } from './panel-component/teleport-placehol
|
|
|
59
59
|
export { IBizTeleportPlaceholder } from './panel-component/teleport-placeholder/index.mjs';
|
|
60
60
|
export { IBizPanelContainerTabs } from './panel-component/panel-container-tabs/index.mjs';
|
|
61
61
|
export { IBizPanelCtrlViewPageCaption } from './panel-component/panel-ctrl-view-page-caption/index.mjs';
|
|
62
|
+
export { IBizAuthWxmpQrcode } from './panel-component/auth-wxmp-qrcode/index.mjs';
|
|
62
63
|
export { AppRedirectView } from './view/app-redirect-view/app-redirect-view.mjs';
|
|
63
64
|
export { IBizView } from './view/common/index.mjs';
|
|
64
65
|
export { TodoRedirect } from './view/todo-redirect/todo-redirect.mjs';
|
package/es/locale/en/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/locale/en/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,EAAE
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/locale/en/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwEd,CAAC"}
|
package/es/locale/en/index.mjs
CHANGED
|
@@ -25,7 +25,9 @@ const en = {
|
|
|
25
25
|
noProvidedSlot: "No {id} slot provided",
|
|
26
26
|
cannotEmpty: "{caption} cannot be empty",
|
|
27
27
|
unadaptedLayout: "Unadapted layout placeholder {layoutPos}",
|
|
28
|
-
placeholderIdentifier: "The placeholder identifier for panel member {id} of view {viewCodeName} is:"
|
|
28
|
+
placeholderIdentifier: "The placeholder identifier for panel member {id} of view {viewCodeName} is:",
|
|
29
|
+
refresh: "Refresh",
|
|
30
|
+
wxQrcodeCaption: "Please use wechat to scan the QR code to log in"
|
|
29
31
|
},
|
|
30
32
|
plugin: {
|
|
31
33
|
failureConfigurationLoad: "Configuration load failure",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/locale/zh-CN/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/locale/zh-CN/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgEhB,CAAC"}
|
|
@@ -25,7 +25,9 @@ const zhCn = {
|
|
|
25
25
|
noProvidedSlot: "\u672A\u63D0\u4F9B{id}\u63D2\u69FD",
|
|
26
26
|
cannotEmpty: "{caption} \u4E0D\u80FD\u4E3A\u7A7A",
|
|
27
27
|
unadaptedLayout: "\u672A\u9002\u914D\u7684\u5E03\u5C40\u5360\u4F4D{layoutPos}",
|
|
28
|
-
placeholderIdentifier: "\u89C6\u56FE{viewCodeName}\u7684\u9762\u677F\u6210\u5458{id}\u7684\u5360\u4F4D\u6807\u8BC6\u662F\uFF1A"
|
|
28
|
+
placeholderIdentifier: "\u89C6\u56FE{viewCodeName}\u7684\u9762\u677F\u6210\u5458{id}\u7684\u5360\u4F4D\u6807\u8BC6\u662F\uFF1A",
|
|
29
|
+
refresh: "\u5237\u65B0",
|
|
30
|
+
wxQrcodeCaption: "\u8BF7\u4F7F\u7528\u5FAE\u4FE1\u626B\u63CF\u4E8C\u7EF4\u7801\u767B\u5F55"
|
|
29
31
|
},
|
|
30
32
|
plugin: {
|
|
31
33
|
failureConfigurationLoad: "\u914D\u7F6E\u52A0\u8F7D\u5931\u8D25",
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { IPanelRawItem } from '@ibiz/model-core';
|
|
2
|
+
import { PanelItemController } from '@ibiz-template/runtime';
|
|
3
|
+
import { AuthWxmpQrcodeState } from './auth-wxmp-qrcode.state';
|
|
4
|
+
/**
|
|
5
|
+
* 微信公众号扫码登录控制器
|
|
6
|
+
*
|
|
7
|
+
* @export
|
|
8
|
+
* @class AuthWxmpQrcodeController
|
|
9
|
+
* @extends {PanelItemController<IPanelRawItem>}
|
|
10
|
+
*/
|
|
11
|
+
export declare class AuthWxmpQrcodeController extends PanelItemController<IPanelRawItem> {
|
|
12
|
+
/**
|
|
13
|
+
* 微信公众号扫码登录UI状态对象
|
|
14
|
+
*
|
|
15
|
+
* @type {AuthWxmpQrcodeState}
|
|
16
|
+
* @memberof AuthWxmpQrcodeController
|
|
17
|
+
*/
|
|
18
|
+
state: AuthWxmpQrcodeState;
|
|
19
|
+
/**
|
|
20
|
+
* 过期定时器
|
|
21
|
+
*
|
|
22
|
+
* @private
|
|
23
|
+
* @type {(NodeJS.Timeout | undefined)}
|
|
24
|
+
* @memberof AuthWxmpQrcodeController
|
|
25
|
+
*/
|
|
26
|
+
private expirationTimer;
|
|
27
|
+
/**
|
|
28
|
+
* 轮询定时器
|
|
29
|
+
*
|
|
30
|
+
* @private
|
|
31
|
+
* @type {(NodeJS.Timeout | undefined)}
|
|
32
|
+
* @memberof AuthWxmpQrcodeController
|
|
33
|
+
*/
|
|
34
|
+
private pollingTimer;
|
|
35
|
+
/**
|
|
36
|
+
* 轮询时间(秒)
|
|
37
|
+
* - 默认2秒
|
|
38
|
+
* @private
|
|
39
|
+
* @type {number}
|
|
40
|
+
* @memberof AuthWxmpQrcodeController
|
|
41
|
+
*/
|
|
42
|
+
private pollingTime;
|
|
43
|
+
/**
|
|
44
|
+
* 自定义补充参数
|
|
45
|
+
*
|
|
46
|
+
* @type {IData}
|
|
47
|
+
* @memberof AuthWxmpQrcodeController
|
|
48
|
+
*/
|
|
49
|
+
rawItemParams: IData;
|
|
50
|
+
/**
|
|
51
|
+
* 创建状态对象
|
|
52
|
+
*
|
|
53
|
+
* @protected
|
|
54
|
+
* @return {*} {AuthWxmpQrcodeState}
|
|
55
|
+
* @memberof AuthWxmpQrcodeController
|
|
56
|
+
*/
|
|
57
|
+
protected createState(): AuthWxmpQrcodeState;
|
|
58
|
+
/**
|
|
59
|
+
* 初始化
|
|
60
|
+
*
|
|
61
|
+
* @protected
|
|
62
|
+
* @return {*} {Promise<void>}
|
|
63
|
+
* @memberof AuthWxmpQrcodeController
|
|
64
|
+
*/
|
|
65
|
+
protected onInit(): Promise<void>;
|
|
66
|
+
/**
|
|
67
|
+
* 处理自定义补充参数
|
|
68
|
+
*
|
|
69
|
+
* @protected
|
|
70
|
+
* @memberof AuthWxmpQrcodeController
|
|
71
|
+
*/
|
|
72
|
+
protected handleRawItemParams(): void;
|
|
73
|
+
/**
|
|
74
|
+
* 初始化参数
|
|
75
|
+
*
|
|
76
|
+
* @protected
|
|
77
|
+
* @memberof AuthWxmpQrcodeController
|
|
78
|
+
*/
|
|
79
|
+
protected initParams(): void;
|
|
80
|
+
/**
|
|
81
|
+
* 加载二维码
|
|
82
|
+
*
|
|
83
|
+
* @protected
|
|
84
|
+
* @return {*} {Promise<void>}
|
|
85
|
+
* @memberof AuthWxmpQrcodeController
|
|
86
|
+
*/
|
|
87
|
+
loadQrcode(): Promise<void>;
|
|
88
|
+
/**
|
|
89
|
+
* 设置定时器
|
|
90
|
+
*
|
|
91
|
+
* @protected
|
|
92
|
+
* @memberof AuthWxmpQrcodeController
|
|
93
|
+
*/
|
|
94
|
+
protected setTimer(): void;
|
|
95
|
+
/**
|
|
96
|
+
* 轮询登录
|
|
97
|
+
*
|
|
98
|
+
* @protected
|
|
99
|
+
* @return {*} {Promise<void>}
|
|
100
|
+
* @memberof AuthWxmpQrcodeController
|
|
101
|
+
*/
|
|
102
|
+
protected pollingLogin(): Promise<void>;
|
|
103
|
+
/**
|
|
104
|
+
* 销毁方法
|
|
105
|
+
*
|
|
106
|
+
* @return {*} {Promise<void>}
|
|
107
|
+
* @memberof AuthWxmpQrcodeController
|
|
108
|
+
*/
|
|
109
|
+
destroy(): Promise<void>;
|
|
110
|
+
}
|
|
111
|
+
//# sourceMappingURL=auth-wxmp-qrcode.controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-wxmp-qrcode.controller.d.ts","sourceRoot":"","sources":["../../../src/panel-component/auth-wxmp-qrcode/auth-wxmp-qrcode.controller.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAW,MAAM,0BAA0B,CAAC;AAExE;;;;;;GAMG;AACH,qBAAa,wBAAyB,SAAQ,mBAAmB,CAAC,aAAa,CAAC;IAC9E;;;;;OAKG;IACK,KAAK,EAAE,mBAAmB,CAAC;IAEnC;;;;;;OAMG;IACH,OAAO,CAAC,eAAe,CAA6B;IAEpD;;;;;;OAMG;IACH,OAAO,CAAC,YAAY,CAA6B;IAEjD;;;;;;OAMG;IACH,OAAO,CAAC,WAAW,CAAa;IAEhC;;;;;OAKG;IACH,aAAa,EAAE,KAAK,CAAM;IAE1B;;;;;;OAMG;IACH,SAAS,CAAC,WAAW,IAAI,mBAAmB;IAI5C;;;;;;OAMG;cACa,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAOvC;;;;;OAKG;IACH,SAAS,CAAC,mBAAmB,IAAI,IAAI;IAYrC;;;;;OAKG;IACH,SAAS,CAAC,UAAU,IAAI,IAAI;IAY5B;;;;;;OAMG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAgBjC;;;;;OAKG;IACH,SAAS,CAAC,QAAQ,IAAI,IAAI;IAe1B;;;;;;OAMG;cACa,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAgC7C;;;;;OAKG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAW/B"}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { CoreConst } from '@ibiz-template/core';
|
|
2
|
+
import { notNilEmpty, setCookie, clearCookie } from 'qx-util';
|
|
3
|
+
import { PanelItemController } from '@ibiz-template/runtime';
|
|
4
|
+
import { AuthWxmpQrcodeState } from './auth-wxmp-qrcode.state.mjs';
|
|
5
|
+
|
|
6
|
+
"use strict";
|
|
7
|
+
class AuthWxmpQrcodeController extends PanelItemController {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
/**
|
|
11
|
+
* 轮询时间(秒)
|
|
12
|
+
* - 默认2秒
|
|
13
|
+
* @private
|
|
14
|
+
* @type {number}
|
|
15
|
+
* @memberof AuthWxmpQrcodeController
|
|
16
|
+
*/
|
|
17
|
+
this.pollingTime = 2;
|
|
18
|
+
/**
|
|
19
|
+
* 自定义补充参数
|
|
20
|
+
*
|
|
21
|
+
* @type {IData}
|
|
22
|
+
* @memberof AuthWxmpQrcodeController
|
|
23
|
+
*/
|
|
24
|
+
this.rawItemParams = {};
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* 创建状态对象
|
|
28
|
+
*
|
|
29
|
+
* @protected
|
|
30
|
+
* @return {*} {AuthWxmpQrcodeState}
|
|
31
|
+
* @memberof AuthWxmpQrcodeController
|
|
32
|
+
*/
|
|
33
|
+
createState() {
|
|
34
|
+
var _a;
|
|
35
|
+
return new AuthWxmpQrcodeState((_a = this.parent) == null ? void 0 : _a.state);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* 初始化
|
|
39
|
+
*
|
|
40
|
+
* @protected
|
|
41
|
+
* @return {*} {Promise<void>}
|
|
42
|
+
* @memberof AuthWxmpQrcodeController
|
|
43
|
+
*/
|
|
44
|
+
async onInit() {
|
|
45
|
+
await super.onInit();
|
|
46
|
+
this.handleRawItemParams();
|
|
47
|
+
this.initParams();
|
|
48
|
+
await this.loadQrcode();
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* 处理自定义补充参数
|
|
52
|
+
*
|
|
53
|
+
* @protected
|
|
54
|
+
* @memberof AuthWxmpQrcodeController
|
|
55
|
+
*/
|
|
56
|
+
handleRawItemParams() {
|
|
57
|
+
var _a;
|
|
58
|
+
let params = {};
|
|
59
|
+
const rawItemParams = (_a = this.model.rawItem) == null ? void 0 : _a.rawItemParams;
|
|
60
|
+
if (notNilEmpty(rawItemParams)) {
|
|
61
|
+
params = rawItemParams.reduce((param, item) => {
|
|
62
|
+
param[item.key.toLowerCase()] = item.value;
|
|
63
|
+
return param;
|
|
64
|
+
}, {});
|
|
65
|
+
}
|
|
66
|
+
Object.assign(this.rawItemParams, params);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* 初始化参数
|
|
70
|
+
*
|
|
71
|
+
* @protected
|
|
72
|
+
* @memberof AuthWxmpQrcodeController
|
|
73
|
+
*/
|
|
74
|
+
initParams() {
|
|
75
|
+
const isNumeric = (str) => {
|
|
76
|
+
return !!str && isFinite(Number(str));
|
|
77
|
+
};
|
|
78
|
+
this.pollingTime = isNumeric(this.rawItemParams.pollingtime) ? Number(this.rawItemParams.pollingtime) : 2;
|
|
79
|
+
this.state.tips = this.model.caption || ibiz.i18n.t("vue3Util.panelComponent.wxQrcodeCaption");
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* 加载二维码
|
|
83
|
+
*
|
|
84
|
+
* @protected
|
|
85
|
+
* @return {*} {Promise<void>}
|
|
86
|
+
* @memberof AuthWxmpQrcodeController
|
|
87
|
+
*/
|
|
88
|
+
async loadQrcode() {
|
|
89
|
+
try {
|
|
90
|
+
const res = await ibiz.net.get(
|
|
91
|
+
"/uaa/open/wxmp/createqrcode",
|
|
92
|
+
{},
|
|
93
|
+
{ srfdcsystem: ibiz.env.dcSystem }
|
|
94
|
+
);
|
|
95
|
+
if (res.ok && res.data) {
|
|
96
|
+
this.state.qrcode = res.data;
|
|
97
|
+
this.setTimer();
|
|
98
|
+
}
|
|
99
|
+
} catch (error) {
|
|
100
|
+
ibiz.log.error(error.message);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* 设置定时器
|
|
105
|
+
*
|
|
106
|
+
* @protected
|
|
107
|
+
* @memberof AuthWxmpQrcodeController
|
|
108
|
+
*/
|
|
109
|
+
setTimer() {
|
|
110
|
+
this.expirationTimer = setInterval(() => {
|
|
111
|
+
if (this.state.qrcode && this.state.qrcode.expirein > 0) {
|
|
112
|
+
this.state.qrcode.expirein -= 1;
|
|
113
|
+
} else {
|
|
114
|
+
clearInterval(this.expirationTimer);
|
|
115
|
+
}
|
|
116
|
+
}, 1e3);
|
|
117
|
+
this.pollingTimer = setInterval(async () => {
|
|
118
|
+
await this.pollingLogin();
|
|
119
|
+
}, this.pollingTime * 1e3);
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* 轮询登录
|
|
123
|
+
*
|
|
124
|
+
* @protected
|
|
125
|
+
* @return {*} {Promise<void>}
|
|
126
|
+
* @memberof AuthWxmpQrcodeController
|
|
127
|
+
*/
|
|
128
|
+
async pollingLogin() {
|
|
129
|
+
try {
|
|
130
|
+
if (this.state.qrcode && this.state.qrcode.expirein > 0) {
|
|
131
|
+
const res = await ibiz.net.get(
|
|
132
|
+
"/uaa/open/wxmp/qrcode/".concat(this.state.qrcode.ticket),
|
|
133
|
+
{},
|
|
134
|
+
{ srfdcsystem: ibiz.env.dcSystem }
|
|
135
|
+
);
|
|
136
|
+
const { data, ok } = res;
|
|
137
|
+
if (ok && (data == null ? void 0 : data.token)) {
|
|
138
|
+
clearInterval(this.pollingTimer);
|
|
139
|
+
setCookie(CoreConst.TOKEN, data.token, 0, true);
|
|
140
|
+
const expiredDate = (/* @__PURE__ */ new Date()).getTime() + (data.expirein || 7199) * 1e3;
|
|
141
|
+
setCookie(CoreConst.TOKEN_EXPIRES, "".concat(expiredDate), 0, true);
|
|
142
|
+
if (data.refresh_token) {
|
|
143
|
+
setCookie(CoreConst.REFRESH_TOKEN, data.refresh_token, 0, true);
|
|
144
|
+
}
|
|
145
|
+
clearCookie(CoreConst.IS_ANONYMOUS, true);
|
|
146
|
+
window.location.hash = "/";
|
|
147
|
+
window.history.pushState({}, "");
|
|
148
|
+
window.location.reload();
|
|
149
|
+
}
|
|
150
|
+
} else {
|
|
151
|
+
clearInterval(this.pollingTimer);
|
|
152
|
+
}
|
|
153
|
+
} catch (error) {
|
|
154
|
+
ibiz.log.error(error.message);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* 销毁方法
|
|
159
|
+
*
|
|
160
|
+
* @return {*} {Promise<void>}
|
|
161
|
+
* @memberof AuthWxmpQrcodeController
|
|
162
|
+
*/
|
|
163
|
+
async destroy() {
|
|
164
|
+
await super.destroy();
|
|
165
|
+
if (this.pollingTimer) {
|
|
166
|
+
clearInterval(this.pollingTimer);
|
|
167
|
+
this.pollingTimer = void 0;
|
|
168
|
+
}
|
|
169
|
+
if (this.expirationTimer) {
|
|
170
|
+
clearInterval(this.expirationTimer);
|
|
171
|
+
this.expirationTimer = void 0;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export { AuthWxmpQrcodeController };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.ibiz-auth-wxmp-qrcode{width:100%;height:100%}.ibiz-auth-wxmp-qrcode__content{position:relative;width:100%;height:100%}.ibiz-auth-wxmp-qrcode__qrcode{width:100%;height:100%;-o-object-fit:contain;object-fit:contain}.ibiz-auth-wxmp-qrcode__caption{font-size:var(--ibiz-font-size-small);text-align:center}.ibiz-auth-wxmp-qrcode__mask{position:absolute;top:0;left:0;display:flex;align-items:center;justify-content:center;width:100%;height:100%;color:var(--ibiz-color-primary);background-color:rgba(255,255,255,.9)}.ibiz-auth-wxmp-qrcode__mask--icon{font-size:var(--ibiz-font-size-header-1);cursor:pointer}.ibiz-auth-wxmp-qrcode__mask--icon:hover{color:var(--ibiz-color-primary-hover)}
|