@cloudbase/framework-plugin-low-code 0.7.10-beta.2 → 0.7.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/builder/core/generate.d.ts.map +1 -1
- package/lib/builder/core/generate.js +6 -8
- package/lib/builder/core/index.d.ts.map +1 -1
- package/lib/builder/service/builder/webpack.d.ts +1 -1
- package/lib/builder/service/builder/webpack.d.ts.map +1 -1
- package/lib/builder/service/builder/webpack.js +17 -28
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +25 -73
- package/lib/weapps-core/utils/style.js +8 -0
- package/package.json +1 -1
- package/template/html/index.html.ejs +426 -426
- package/template/mp/app/weapps-api.js +27 -95
- package/template/mp/app.js +60 -76
- package/template/mp/common/util.js +3 -312
- package/template/mp/datasources/index.js +16 -5
- package/template/mp/package.json +2 -2
- package/template/package.json +1 -1
- package/template/src/app/global-api.js +41 -154
- package/template/src/datasources/index.js.tpl +14 -2
- package/template/src/handlers/FieldMiddleware/renderer.jsx +25 -85
- package/template/src/handlers/actionHandler/utils.js +10 -31
- package/template/src/handlers/lifecycle.js +10 -21
- package/template/src/handlers/render.jsx +6 -17
- package/template/src/handlers/utils/common.js +26 -42
- package/template/src/handlers/utils/widgets.js +8 -37
- package/template/src/index.jsx +9 -8
- package/template/src/pages/app.tpl +2 -0
- package/template/src/utils/formatEnum.js +1 -1
- package/template/src/utils/index.js +0 -14
- package/template/src/utils/ScanCodeComponent.js +0 -345
- package/template/src/utils/date.js +0 -324
- package/template/src/utils/scan-code-action.js +0 -27
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* 生命周期处理函数
|
|
4
4
|
*/
|
|
5
|
-
import
|
|
5
|
+
import { throttle } from 'lodash';
|
|
6
6
|
import { wx } from '@tcwd/weapps-sdk';
|
|
7
7
|
import * as querystring from 'querystring';
|
|
8
8
|
// 小程序 端使用lifeCycle
|
|
@@ -33,7 +33,7 @@ export function initLifeCycle(
|
|
|
33
33
|
onTabItemTap,
|
|
34
34
|
},
|
|
35
35
|
app,
|
|
36
|
-
mainApp
|
|
36
|
+
mainApp,
|
|
37
37
|
) {
|
|
38
38
|
if (!process.env.isMiniprogram) {
|
|
39
39
|
window.$$global = window.$$global || {};
|
|
@@ -61,17 +61,14 @@ export function initLifeCycle(
|
|
|
61
61
|
mainApp.onAppHide && mainApp.onAppHide(onAppHide);
|
|
62
62
|
mainApp.onError && mainApp.onError(onAppError);
|
|
63
63
|
mainApp.onPageNotFound && mainApp.onPageNotFound(onAppPageNotFound);
|
|
64
|
-
mainApp.onUnhandledRejection &&
|
|
65
|
-
mainApp.onUnhandledRejection(onAppUnhandledRejection);
|
|
64
|
+
mainApp.onUnhandledRejection && mainApp.onUnhandledRejection(onAppUnhandledRejection);
|
|
66
65
|
|
|
67
66
|
// 预留等客户端来触发
|
|
68
67
|
window.addEventListener('appLaunch', (...args) => onAppLaunchCb(...args));
|
|
69
68
|
window.addEventListener('appShow', (...args) => onAppShow(...args));
|
|
70
69
|
window.addEventListener('appHide', (...args) => onAppHide(...args));
|
|
71
70
|
window.addEventListener('error', (...args) => onAppError(...args));
|
|
72
|
-
window.addEventListener('unhandledRejection', (...args) =>
|
|
73
|
-
onAppUnhandledRejection(...args)
|
|
74
|
-
);
|
|
71
|
+
window.addEventListener('unhandledRejection', (...args) => onAppUnhandledRejection(...args));
|
|
75
72
|
window.$$global.alreadyInitAppLifeCycle = true;
|
|
76
73
|
}
|
|
77
74
|
|
|
@@ -84,9 +81,7 @@ export function initLifeCycle(
|
|
|
84
81
|
window.addEventListener('wxunload', (...args) => onPageUnload(...args));
|
|
85
82
|
// 页面级别特殊事件
|
|
86
83
|
if (typeof onPullDownRefresh === 'function') {
|
|
87
|
-
window.addEventListener('pulldownrefresh', (...args) =>
|
|
88
|
-
onPullDownRefresh(...args)
|
|
89
|
-
);
|
|
84
|
+
window.addEventListener('pulldownrefresh', (...args) => onPullDownRefresh(...args));
|
|
90
85
|
}
|
|
91
86
|
|
|
92
87
|
if (typeof onPageScroll === 'function') {
|
|
@@ -143,7 +138,7 @@ export function pageLifeCycleMount(
|
|
|
143
138
|
onShareTimeline,
|
|
144
139
|
onTabItemTap,
|
|
145
140
|
},
|
|
146
|
-
app = {}
|
|
141
|
+
app = {},
|
|
147
142
|
) {
|
|
148
143
|
let queryText = location.href.split('?')[1];
|
|
149
144
|
let query = querystring.parse(queryText);
|
|
@@ -162,22 +157,16 @@ export function pageLifeCycleMount(
|
|
|
162
157
|
if (typeof onPullDownRefresh === 'function') {
|
|
163
158
|
app.onPullDownRefresh(onPullDownRefresh);
|
|
164
159
|
}
|
|
165
|
-
if (
|
|
166
|
-
typeof onPageScroll === 'function' ||
|
|
167
|
-
typeof onReachBottom === 'function'
|
|
168
|
-
) {
|
|
160
|
+
if (typeof onPageScroll === 'function' || typeof onReachBottom === 'function') {
|
|
169
161
|
window.onscroll = throttle(() => {
|
|
170
162
|
//变量scrollTop是滚动条滚动时,滚动条上端距离顶部的距离
|
|
171
|
-
let scrollTop =
|
|
172
|
-
document.documentElement.scrollTop || document.body.scrollTop;
|
|
163
|
+
let scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
|
|
173
164
|
|
|
174
165
|
//变量windowHeight是可视区的高度
|
|
175
|
-
let windowHeight =
|
|
176
|
-
document.documentElement.clientHeight || document.body.clientHeight;
|
|
166
|
+
let windowHeight = document.documentElement.clientHeight || document.body.clientHeight;
|
|
177
167
|
|
|
178
168
|
//变量scrollHeight是滚动条的总高度(当前可滚动的页面的总高度)
|
|
179
|
-
let scrollHeight =
|
|
180
|
-
document.documentElement.scrollHeight || document.body.scrollHeight;
|
|
169
|
+
let scrollHeight = document.documentElement.scrollHeight || document.body.scrollHeight;
|
|
181
170
|
if (typeof onPageScroll === 'function') {
|
|
182
171
|
onPageScroll({
|
|
183
172
|
scrollTop: window.pageYOffset,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { set, cloneDeep } from 'lodash';
|
|
3
3
|
import { ForContext, getComponentRenderList } from './FieldMiddleware/renderer';
|
|
4
4
|
import { isScopeSlot } from '../utils/index';
|
|
5
5
|
import { observer } from 'mobx-react-lite';
|
|
@@ -9,9 +9,7 @@ export function getComponentChildren(component, context = {}) {
|
|
|
9
9
|
if (!properties) {
|
|
10
10
|
return [];
|
|
11
11
|
}
|
|
12
|
-
const list = Object.values(properties).sort(
|
|
13
|
-
(a, b) => (a['x-index'] || 0) - (b['x-index'] || 0)
|
|
14
|
-
);
|
|
12
|
+
const list = Object.values(properties).sort((a, b) => (a['x-index'] || 0) - (b['x-index'] || 0));
|
|
15
13
|
const {
|
|
16
14
|
virtualFields,
|
|
17
15
|
codeContext,
|
|
@@ -81,9 +79,7 @@ function getRenderList(props) {
|
|
|
81
79
|
// preClassName.current = className;
|
|
82
80
|
// }
|
|
83
81
|
|
|
84
|
-
containerEl['x-props'].classNameList = Array.from(
|
|
85
|
-
new Set([className, ...classNameList])
|
|
86
|
-
);
|
|
82
|
+
containerEl['x-props'].classNameList = Array.from(new Set([className, ...classNameList]));
|
|
87
83
|
}
|
|
88
84
|
|
|
89
85
|
if (xProps && xProps.sourceKey) {
|
|
@@ -117,14 +113,7 @@ function getRenderList(props) {
|
|
|
117
113
|
export function generateSlotMetaMap(componentSchema, context, options = {}) {
|
|
118
114
|
const slots = {};
|
|
119
115
|
const { properties = {} } = componentSchema;
|
|
120
|
-
const {
|
|
121
|
-
scopeContext,
|
|
122
|
-
codeContext,
|
|
123
|
-
virtualFields,
|
|
124
|
-
dataContext,
|
|
125
|
-
updateContext,
|
|
126
|
-
forContext,
|
|
127
|
-
} = context;
|
|
116
|
+
const { scopeContext, codeContext, virtualFields, dataContext, updateContext, forContext } = context;
|
|
128
117
|
// eslint-disable-next-line guard-for-in
|
|
129
118
|
for (const key in properties) {
|
|
130
119
|
const child = properties[key];
|
|
@@ -135,8 +124,8 @@ export function generateSlotMetaMap(componentSchema, context, options = {}) {
|
|
|
135
124
|
type: isHOC ? 'HOC' : 'ELEMENT',
|
|
136
125
|
node: isHOC
|
|
137
126
|
? (props) => {
|
|
138
|
-
let clonedScopeContext =
|
|
139
|
-
|
|
127
|
+
let clonedScopeContext = cloneDeep(scopeContext);
|
|
128
|
+
set(clonedScopeContext, `${componentSchema.key}.${key}`, props);
|
|
140
129
|
return (
|
|
141
130
|
<AppRender
|
|
142
131
|
key={key}
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import config from '../../datasources/config'
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
async function loginScope() {
|
|
5
|
-
const { auth } = await getTcbInstance();
|
|
6
|
-
return auth.loginScope();
|
|
7
|
-
}
|
|
2
|
+
import { auth } from '@cloudbase/weda-client';
|
|
3
|
+
const { loginScope, getAccessToken } = auth;
|
|
8
4
|
|
|
9
5
|
export function getComponentId(key) {
|
|
10
6
|
return `__weapps-component-wrapper-${key}`;
|
|
@@ -218,44 +214,29 @@ export async function checkAnonymous() {
|
|
|
218
214
|
return isAnonymous;
|
|
219
215
|
}
|
|
220
216
|
|
|
221
|
-
let loginConfig;
|
|
222
|
-
export async function getLoginConfig() {
|
|
223
|
-
if (loginConfig !== undefined) {
|
|
224
|
-
return loginConfig;
|
|
225
|
-
}
|
|
226
|
-
const { staticResourceDomain, id } = app.__internal__.getConfig();
|
|
227
|
-
const url = `https://${staticResourceDomain}/${id}/login.config.json?t=${Date.now()}`;
|
|
228
|
-
try {
|
|
229
|
-
let response = await fetch(url);
|
|
230
|
-
loginConfig = await response.json();
|
|
231
|
-
} catch (e) {
|
|
232
|
-
loginConfig = {};
|
|
233
|
-
console.error(`加载登录配置${url}失败`, e);
|
|
234
|
-
}
|
|
235
|
-
return loginConfig;
|
|
236
|
-
}
|
|
237
|
-
|
|
238
217
|
/**
|
|
239
218
|
* 检查页面权限
|
|
240
219
|
**/
|
|
241
220
|
export async function checkAuth(app, appId, $page) {
|
|
242
221
|
<% if (isAdminPortal || isXPage) { %>return true;<% } %>
|
|
243
|
-
|
|
244
|
-
|
|
222
|
+
const loginPage = findLoginPage(app);
|
|
223
|
+
if (loginPage?.id === $page.id) {
|
|
224
|
+
return true
|
|
225
|
+
}
|
|
226
|
+
app.showNavigationBarLoading();
|
|
245
227
|
const requestList = [getAccessPermission(app, appId, $page.id)];
|
|
246
|
-
//
|
|
247
|
-
if (
|
|
228
|
+
// 暂时先认为有登录页则自定义登录功能开启且生效
|
|
229
|
+
if (loginPage) {
|
|
248
230
|
requestList.push(getAuthConfig(app));
|
|
249
231
|
requestList.push(checkAnonymous());
|
|
250
|
-
requestList.push(getLoginConfig()); // 提前并行加载
|
|
251
232
|
}
|
|
252
233
|
const [isAccess, authConfig, isAnonymous] = await Promise.all(requestList);
|
|
253
234
|
app.hideNavigationBarLoading();
|
|
254
235
|
|
|
255
|
-
if (
|
|
236
|
+
if (loginPage && isAnonymous) {
|
|
256
237
|
if (authConfig.NeedLogin || (!isAccess && authConfig.RejectStrategy === 'to_login')) {
|
|
257
238
|
redirectToLogin($page);
|
|
258
|
-
return
|
|
239
|
+
return isAccess;
|
|
259
240
|
}
|
|
260
241
|
}
|
|
261
242
|
|
|
@@ -268,22 +249,25 @@ export async function checkAuth(app, appId, $page) {
|
|
|
268
249
|
return isAccess;
|
|
269
250
|
}
|
|
270
251
|
|
|
271
|
-
export
|
|
252
|
+
export function redirectToLogin(currentPage) {
|
|
272
253
|
// 去登录则清空权限缓存。
|
|
273
254
|
_AUTH_CACHE_MAP = {};
|
|
274
255
|
const app = window.app;
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
256
|
+
const loginPage = findLoginPage(app);
|
|
257
|
+
if (!currentPage) {
|
|
258
|
+
currentPage = app.utils.getCurrentPage() || {};
|
|
259
|
+
}
|
|
260
|
+
if (loginPage?.id === currentPage.id) {
|
|
261
|
+
return true
|
|
262
|
+
}
|
|
263
|
+
if (loginPage) {
|
|
282
264
|
app.redirectTo({
|
|
283
|
-
|
|
284
|
-
params: {
|
|
285
|
-
|
|
286
|
-
|
|
265
|
+
pageId: loginPage.id,
|
|
266
|
+
params: {
|
|
267
|
+
sourcePageId: currentPage.id,
|
|
268
|
+
sourcePageParams: currentPage.dataset.params
|
|
269
|
+
}
|
|
270
|
+
})
|
|
287
271
|
} else {
|
|
288
272
|
app.showToast({
|
|
289
273
|
title: '用户未登录',
|
|
@@ -58,12 +58,7 @@ export function getDom(element, options) {
|
|
|
58
58
|
return Promise.resolve(result);
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
export function findWidgets(
|
|
62
|
-
widget,
|
|
63
|
-
parentType,
|
|
64
|
-
filterFn,
|
|
65
|
-
includeInvisibleDescendants
|
|
66
|
-
) {
|
|
61
|
+
export function findWidgets(widget, parentType, filterFn, includeInvisibleDescendants) {
|
|
67
62
|
if (!widget) return [];
|
|
68
63
|
|
|
69
64
|
let { children = [] } = widget;
|
|
@@ -94,12 +89,7 @@ export function retryDataBinds(tryTime = 10) {
|
|
|
94
89
|
retryDataBinds(tryTime - 1);
|
|
95
90
|
}, 0);
|
|
96
91
|
}
|
|
97
|
-
export function createWidgets(
|
|
98
|
-
widgetProps,
|
|
99
|
-
dataBinds,
|
|
100
|
-
scopeContext = {},
|
|
101
|
-
context = {}
|
|
102
|
-
) {
|
|
92
|
+
export function createWidgets(widgetProps, dataBinds, scopeContext = {}, context = {}) {
|
|
103
93
|
const nodeTree = createWidgetTree(widgetProps, dataBinds);
|
|
104
94
|
const widgets = runFor(nodeTree, {}, null, null, scopeContext, context);
|
|
105
95
|
return widgets;
|
|
@@ -114,14 +104,7 @@ export function createWidgets(
|
|
|
114
104
|
* @param {*} context
|
|
115
105
|
* @returns top level widgets or for dispose
|
|
116
106
|
*/
|
|
117
|
-
function runFor(
|
|
118
|
-
curForNode,
|
|
119
|
-
forItems,
|
|
120
|
-
parentLevelWidgets,
|
|
121
|
-
parentWidget,
|
|
122
|
-
scopeContext,
|
|
123
|
-
context
|
|
124
|
-
) {
|
|
107
|
+
function runFor(curForNode, forItems, parentLevelWidgets, parentWidget, scopeContext, context) {
|
|
125
108
|
const nodeId = curForNode.id;
|
|
126
109
|
if (!curForNode.value) {
|
|
127
110
|
return createSubTree(curForNode, {}, scopeContext, context);
|
|
@@ -148,8 +131,7 @@ export function createWidgets(
|
|
|
148
131
|
dfsTree(curForNode, (node) => {
|
|
149
132
|
const arr = parentLevelWidgets[node.id];
|
|
150
133
|
arr.splice(0, arr.length);
|
|
151
|
-
parentWidget &&
|
|
152
|
-
remove(parentWidget.children, ({ id }) => id === node.id);
|
|
134
|
+
parentWidget && remove(parentWidget.children, ({ id }) => id === node.id);
|
|
153
135
|
});
|
|
154
136
|
|
|
155
137
|
forList.forEach((item, index) => {
|
|
@@ -180,10 +162,7 @@ export function createWidgets(
|
|
|
180
162
|
w.findWidgets = (type, includeInvisibleDescendants) =>
|
|
181
163
|
findWidgets(w, w.widgetType, type, includeInvisibleDescendants);
|
|
182
164
|
w.getWidgetsByType = (type, includeInvisibleDescendants) =>
|
|
183
|
-
w.findWidgets(
|
|
184
|
-
(currentWidget) => currentWidget.widgetType === type,
|
|
185
|
-
includeInvisibleDescendants
|
|
186
|
-
);
|
|
165
|
+
w.findWidgets((currentWidget) => currentWidget.widgetType === type, includeInvisibleDescendants);
|
|
187
166
|
w.getOwnerWidget = () => null; // 寻找父widget,默认返回null, 后续会覆写
|
|
188
167
|
w._getInstanceRef = () => null; // 默认初始值
|
|
189
168
|
Object.defineProperty(w, '_methods', {
|
|
@@ -221,12 +200,7 @@ export function createWidgets(
|
|
|
221
200
|
const dispose = autorun(() => {
|
|
222
201
|
try {
|
|
223
202
|
// Computed data bind in the next tick since data bind may read widgets data
|
|
224
|
-
w[prop] = dataBinds[node.id][prop](
|
|
225
|
-
subForItems,
|
|
226
|
-
undefined,
|
|
227
|
-
context,
|
|
228
|
-
scopeContext
|
|
229
|
-
);
|
|
203
|
+
w[prop] = dataBinds[node.id][prop](subForItems, undefined, context, scopeContext);
|
|
230
204
|
disposeError = false;
|
|
231
205
|
} catch (e) {
|
|
232
206
|
options.showLog && console.error(e);
|
|
@@ -252,10 +226,7 @@ export function createWidgets(
|
|
|
252
226
|
|
|
253
227
|
// run for of next level
|
|
254
228
|
dfsTree(curForNode, (node, parentNode) => {
|
|
255
|
-
if (
|
|
256
|
-
node.forCount === curForNode.forCount + 1 &&
|
|
257
|
-
dataBinds[node.id]?._waFor
|
|
258
|
-
) {
|
|
229
|
+
if (node.forCount === curForNode.forCount + 1 && dataBinds[node.id]?._waFor) {
|
|
259
230
|
widgets[node.id]._disposers = { dataBinds: [] };
|
|
260
231
|
const dispose = runFor(
|
|
261
232
|
node,
|
|
@@ -263,7 +234,7 @@ export function createWidgets(
|
|
|
263
234
|
widgets,
|
|
264
235
|
node.parent && widgets[node.parent.id],
|
|
265
236
|
scopeContext,
|
|
266
|
-
context
|
|
237
|
+
context,
|
|
267
238
|
);
|
|
268
239
|
curForNode.id && widgets[curForNode.id]._disposers.push(dispose);
|
|
269
240
|
}
|
package/template/src/index.jsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react'
|
|
2
2
|
import * as ReactDOM from 'react-dom'
|
|
3
|
-
import {
|
|
3
|
+
import { _WEDA_CLOUD_SDK as WEDA_CLOUD_SDK, auth } from '@cloudbase/weda-client'
|
|
4
4
|
import App from './router'
|
|
5
5
|
import './utils/monitor-jssdk.min'
|
|
6
6
|
import './index.less'
|
|
@@ -11,21 +11,22 @@ import '@babel/polyfill/noConflict'
|
|
|
11
11
|
import { initWebConfig } from 'handlers/lifecycle'
|
|
12
12
|
const AppConfig = require('../webpack/miniprogram.config')
|
|
13
13
|
import { app } from './app/global-api'
|
|
14
|
-
import { redirectToLogin, getAuthConfig, checkAnonymous
|
|
14
|
+
import { redirectToLogin, findLoginPage, getAuthConfig, checkAnonymous } from './handlers/utils'
|
|
15
15
|
// app 中注册配置页面以及app的全局配置miniprogram.config,h5里分app以及web页分别处理,使用process.env.isApp 区分判断
|
|
16
16
|
if (process.env.isApp) {
|
|
17
17
|
initWebConfig(app, AppConfig);
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
// 设置数据源请求的 loading 及 toast 处理
|
|
21
|
-
setConfig({
|
|
21
|
+
WEDA_CLOUD_SDK.setConfig({
|
|
22
22
|
beforeDSRequest: (cfg) => {
|
|
23
23
|
if (!cfg.options || !cfg.options.showLoading) return
|
|
24
24
|
app.showLoading()
|
|
25
25
|
},
|
|
26
26
|
beforeCallFunction: async (params) => {
|
|
27
27
|
try{
|
|
28
|
-
const
|
|
28
|
+
const loginPage = findLoginPage();
|
|
29
|
+
|
|
29
30
|
let skip = false;
|
|
30
31
|
switch (params?.data?.methodName) {
|
|
31
32
|
case 'callWedaApi': {
|
|
@@ -37,10 +38,10 @@ setConfig({
|
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
// 后续做过滤处理
|
|
40
|
-
if (!
|
|
41
|
+
if (!loginPage || (params?.data?.mode === 'c' && skip)) {
|
|
41
42
|
return params;
|
|
42
43
|
}
|
|
43
|
-
const { accessToken } = await getAccessToken();
|
|
44
|
+
const { accessToken } = await auth.getAccessToken();
|
|
44
45
|
if (accessToken) {
|
|
45
46
|
params.data.accessToken = accessToken;
|
|
46
47
|
}
|
|
@@ -58,8 +59,8 @@ setConfig({
|
|
|
58
59
|
},
|
|
59
60
|
async afterCallFunction(params, error, res) {
|
|
60
61
|
if(params?.data?.params?.action != 'DescribeRuntimeResourceStrategy' && ['InnerError.AuthFailure','InvalidAccessToken'].includes(res?.result?.code)) {
|
|
61
|
-
const
|
|
62
|
-
if (
|
|
62
|
+
const loginPage = findLoginPage();
|
|
63
|
+
if (loginPage) {
|
|
63
64
|
const authConfig = await getAuthConfig();
|
|
64
65
|
const isAnonymous = await checkAnonymous();
|
|
65
66
|
if (isAnonymous && authConfig.RejectStrategy == 'to_login') {
|
|
@@ -86,6 +86,7 @@ export default function App() {
|
|
|
86
86
|
const isPure = !!pureSrc;
|
|
87
87
|
|
|
88
88
|
React.useEffect(() => {
|
|
89
|
+
|
|
89
90
|
Object.assign($page, {
|
|
90
91
|
id: '<%= pageName %>',
|
|
91
92
|
state: observable(initPageState),
|
|
@@ -102,6 +103,7 @@ export default function App() {
|
|
|
102
103
|
app.utils.set($page.dataset.state, keyPath, userSetState[keyPath]);
|
|
103
104
|
});
|
|
104
105
|
};
|
|
106
|
+
app.__internal__.activePage = $page
|
|
105
107
|
|
|
106
108
|
checkAuth(app, app.id, $page).then((checkAuthResult) => {
|
|
107
109
|
setWeDaHasLogin(checkAuthResult)
|
|
@@ -30,7 +30,7 @@ function getEnumOptions(optionName) {
|
|
|
30
30
|
}
|
|
31
31
|
return '';
|
|
32
32
|
}
|
|
33
|
-
|
|
33
|
+
async function getGeneralOptions(optionName) {
|
|
34
34
|
return app.cloud.callWedaApi({
|
|
35
35
|
action: 'DescribeGeneralOptionsDetailList',
|
|
36
36
|
data: {
|
|
@@ -12,20 +12,6 @@ export function createComputed(funcs, bindContext = null) {
|
|
|
12
12
|
return obj;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
/*
|
|
16
|
-
根据 object对象的path路径获取值。 如果解析 value 是 undefined 会以 defaultValue 取代。
|
|
17
|
-
*/
|
|
18
|
-
export function getter(context, path, defaultValue = undefined) {
|
|
19
|
-
return lodashGet(context, path, defaultValue);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/*
|
|
23
|
-
设置 object对象中对应 path 属性路径上的值,如果path不存在,则创建。 缺少的索引属性会创建为数组,而缺少的属性会创建为对象。 使用_.setWith 定制path创建
|
|
24
|
-
*/
|
|
25
|
-
export function setter(context, path, value = undefined) {
|
|
26
|
-
return lodashSet(context, path, value);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
15
|
export function checkVisible({ _visible }) {
|
|
30
16
|
return _visible !== false && _visible !== '';
|
|
31
17
|
}
|