@cloudbase/lowcode-builder 1.8.8 → 1.8.10
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/config/index.d.ts +2 -2
- package/lib/builder/config/index.js +2 -2
- package/lib/builder/core/index.d.ts +1 -1
- package/lib/builder/core/index.js +24 -20
- package/lib/builder/h5/generate.d.ts +7 -1
- package/lib/builder/h5/generate.js +16 -8
- package/lib/builder/h5/webpack.js +3 -1
- package/lib/builder/mp/BuildContext.d.ts +4 -0
- package/lib/builder/mp/index.js +1 -0
- package/lib/builder/mp/materials.js +1 -0
- package/lib/builder/mp/wxml.js +10 -0
- package/lib/builder/util/generateFiles.d.ts +1 -1
- package/lib/builder/util/generateFiles.js +13 -8
- package/package.json +3 -3
- package/template/html/index.html.ejs +5 -3
- package/template/mp/common/loading/index.js +30 -0
- package/template/mp/common/loading/index.json +4 -0
- package/template/mp/common/loading/index.wxml +8 -0
- package/template/mp/common/loading/index.wxss +44 -0
- package/template/mp/common/util.js +17 -8
- package/template/mp/common/weapp-page.js +20 -9
- package/template/mp/package.json +1 -1
- package/dist/builder.web.js +0 -71
- package/lib/.turbo/turbo-build.log +0 -0
- package/lib/.turbo/turbo-develop.log +0 -0
- package/lib/builder.web.js +0 -71
- package/lib/event-emitter.d.ts +0 -32
- package/lib/event-emitter.js +0 -88
- package/lib/flow.d.ts +0 -32
- package/lib/flow.js +0 -60
- package/lib/query.d.ts +0 -48
- package/lib/query.js +0 -171
- package/lib/test.d.ts +0 -11
- package/lib/test.js +0 -717
|
@@ -6,12 +6,12 @@ export declare const materialsDirName = "materials";
|
|
|
6
6
|
* src/template的代码,在IDE编辑器插件中构建builder
|
|
7
7
|
* 存放在大账号:100015939275。访问地址:https://console.cloud.tencent.com/cos/bucket?bucket=comp-public-1303824488®ion=ap-shanghai&path=%252Flcap-builder%252F
|
|
8
8
|
*/
|
|
9
|
-
export declare const builderTemplateURL = "https://comp-public-1303824488.cos.ap-shanghai.myqcloud.com/lcap-builder/
|
|
9
|
+
export declare const builderTemplateURL = "https://comp-public-1303824488.cos.ap-shanghai.myqcloud.com/lcap-builder/template_20230606.zip";
|
|
10
10
|
/**
|
|
11
11
|
* miniprogram的代码,IDE插件后续会提供端功能
|
|
12
12
|
* 存放在大账号:100015939275。访问地址:https://console.cloud.tencent.com/cos/bucket?bucket=comp-public-1303824488®ion=ap-shanghai&path=%252Flcap-builder%252F
|
|
13
13
|
*/
|
|
14
|
-
export declare const miniprogramURL = "https://comp-public-1303824488.cos.ap-shanghai.myqcloud.com/lcap-builder/
|
|
14
|
+
export declare const miniprogramURL = "https://comp-public-1303824488.cos.ap-shanghai.myqcloud.com/lcap-builder/miniprogram_npm_20230606.zip";
|
|
15
15
|
/**
|
|
16
16
|
* miniprogram_npm存放目录。IDE插件builder用到
|
|
17
17
|
*/
|
|
@@ -45,12 +45,12 @@ exports.materialsDirName = 'materials'; // materials diretory of current project
|
|
|
45
45
|
* src/template的代码,在IDE编辑器插件中构建builder
|
|
46
46
|
* 存放在大账号:100015939275。访问地址:https://console.cloud.tencent.com/cos/bucket?bucket=comp-public-1303824488®ion=ap-shanghai&path=%252Flcap-builder%252F
|
|
47
47
|
*/
|
|
48
|
-
exports.builderTemplateURL = 'https://comp-public-1303824488.cos.ap-shanghai.myqcloud.com/lcap-builder/
|
|
48
|
+
exports.builderTemplateURL = 'https://comp-public-1303824488.cos.ap-shanghai.myqcloud.com/lcap-builder/template_20230606.zip';
|
|
49
49
|
/**
|
|
50
50
|
* miniprogram的代码,IDE插件后续会提供端功能
|
|
51
51
|
* 存放在大账号:100015939275。访问地址:https://console.cloud.tencent.com/cos/bucket?bucket=comp-public-1303824488®ion=ap-shanghai&path=%252Flcap-builder%252F
|
|
52
52
|
*/
|
|
53
|
-
exports.miniprogramURL = 'https://comp-public-1303824488.cos.ap-shanghai.myqcloud.com/lcap-builder/
|
|
53
|
+
exports.miniprogramURL = 'https://comp-public-1303824488.cos.ap-shanghai.myqcloud.com/lcap-builder/miniprogram_npm_20230606.zip';
|
|
54
54
|
/**
|
|
55
55
|
* miniprogram_npm存放目录。IDE插件builder用到
|
|
56
56
|
*/
|
|
@@ -48,7 +48,7 @@ export declare function buildWedaConfig({ output, domain, isPrivateMode, endpoin
|
|
|
48
48
|
endpointType?: IBuildWedaApp['endpointType'];
|
|
49
49
|
buildTypeList?: IBuildWedaApp['buildTypeList'];
|
|
50
50
|
}): Promise<void>;
|
|
51
|
-
export declare function buildWedaApp({ cals, subAppCalsList, dependencies, appKey, runtime, ignoreInstall, buildTypeList, mode, devTool, deployOptions, generateMpType, plugins, extraData, resourceAppId, domain, output, isBrowserMpBuilder, cdnEndpoints, isPrivateMode, endpointType, }: IBuildWedaApp, cb?: WebpackBuildCallBack): Promise<
|
|
51
|
+
export declare function buildWedaApp({ cals, subAppCalsList, dependencies, appKey, runtime, ignoreInstall, buildTypeList, mode, devTool, deployOptions, generateMpType, plugins, extraData, resourceAppId, domain, output, isBrowserMpBuilder, cdnEndpoints, isPrivateMode, endpointType, }: IBuildWedaApp, cb?: WebpackBuildCallBack): Promise<any>;
|
|
52
52
|
export declare function cleanComponentDir(): Promise<void>;
|
|
53
53
|
export declare const version: any;
|
|
54
54
|
export { getFiles, fileToZip, strToBuf } from '../util/generateFiles';
|
|
@@ -12,7 +12,6 @@ const common_1 = require("../types/common");
|
|
|
12
12
|
const index_1 = require("../mp/index");
|
|
13
13
|
const types_1 = require("../../types");
|
|
14
14
|
const mixMode_1 = require("../mp/mixMode");
|
|
15
|
-
const index_2 = require("../h5/index");
|
|
16
15
|
const common_2 = require("../../utils/common");
|
|
17
16
|
const postProcess_1 = require("../../utils/postProcess");
|
|
18
17
|
const cals_1 = require("@cloudbase/cals");
|
|
@@ -62,7 +61,7 @@ async function buildWedaApp({ cals, subAppCalsList = [], dependencies = [], appK
|
|
|
62
61
|
isComposite: false,
|
|
63
62
|
compProps: {},
|
|
64
63
|
}, resourceAppId = undefined, domain = '', output, isBrowserMpBuilder = false, cdnEndpoints, isPrivateMode = false, endpointType = undefined, }, cb) {
|
|
65
|
-
var _a, _b;
|
|
64
|
+
var _a, _b, _c;
|
|
66
65
|
if (!cals) {
|
|
67
66
|
console.error('无效的应用配置');
|
|
68
67
|
return;
|
|
@@ -138,6 +137,7 @@ async function buildWedaApp({ cals, subAppCalsList = [], dependencies = [], appK
|
|
|
138
137
|
? 'px'
|
|
139
138
|
: 'rpx'),
|
|
140
139
|
enablePageRoot,
|
|
140
|
+
enableLoading: (_c = cals === null || cals === void 0 ? void 0 : cals.extra) === null || _c === void 0 ? void 0 : _c.enableLoading,
|
|
141
141
|
};
|
|
142
142
|
const result = await (0, index_1.generateWxMp)({
|
|
143
143
|
weapps: apps,
|
|
@@ -185,24 +185,28 @@ async function buildWedaApp({ cals, subAppCalsList = [], dependencies = [], appK
|
|
|
185
185
|
return outDir;
|
|
186
186
|
}
|
|
187
187
|
else {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
188
|
+
// web worker build 构建时注入, H5构建目前不支持web worker,web worker build时过滤掉
|
|
189
|
+
if (!process.env.IS_WEB_WORKER) {
|
|
190
|
+
const { buildH5App } = require('../h5/index');
|
|
191
|
+
const h5BuildDir = await buildH5App({
|
|
192
|
+
buildContext: { ...buildContext, isMixMode: false },
|
|
193
|
+
cals,
|
|
194
|
+
subAppCalsList,
|
|
195
|
+
extraData,
|
|
196
|
+
buildTypeList,
|
|
197
|
+
mode,
|
|
198
|
+
devTool,
|
|
199
|
+
runtime,
|
|
200
|
+
deployOptions,
|
|
201
|
+
ignoreInstall,
|
|
202
|
+
cdnEndpoints,
|
|
203
|
+
});
|
|
204
|
+
await (cb === null || cb === void 0 ? void 0 : cb(null, {
|
|
205
|
+
outDir: h5BuildDir,
|
|
206
|
+
timeElapsed: Date.now() - startTime,
|
|
207
|
+
}));
|
|
208
|
+
return h5BuildDir;
|
|
209
|
+
}
|
|
206
210
|
}
|
|
207
211
|
}
|
|
208
212
|
catch (err) {
|
|
@@ -6,7 +6,12 @@ import { BuildType } from '../types/common';
|
|
|
6
6
|
* 该函数从 @govcloud/generate 取到需要的模版文件
|
|
7
7
|
*/
|
|
8
8
|
export declare function generateProjectFiles(buildData: BuildAppProps): Promise<void>;
|
|
9
|
-
export declare function generateHTML({ appId, envId, description, appBuildDir, externalResources, mode, devTool, isBuildApp, buildTypeList, cdnEndpoints,
|
|
9
|
+
export declare function generateHTML({ appId, envId, description, appBuildDir, externalResources, mode, devTool, isBuildApp, buildTypeList, cdnEndpoints,
|
|
10
|
+
/**
|
|
11
|
+
* 由于存量兜底逻辑存在
|
|
12
|
+
* 默认值为 undefined 否则应为 false
|
|
13
|
+
*/
|
|
14
|
+
enableLoading, }: {
|
|
10
15
|
appId: string;
|
|
11
16
|
envId: string;
|
|
12
17
|
description?: string;
|
|
@@ -17,6 +22,7 @@ export declare function generateHTML({ appId, envId, description, appBuildDir, e
|
|
|
17
22
|
isBuildApp: boolean;
|
|
18
23
|
buildTypeList: BuildType[];
|
|
19
24
|
cdnEndpoints?: ICDN_ENDPOINTS_COFIG;
|
|
25
|
+
enableLoading?: boolean;
|
|
20
26
|
}): Promise<void>;
|
|
21
27
|
export declare function handleAssets({ appBuildDir, buildTypeList, assets, }: {
|
|
22
28
|
appBuildDir: string;
|
|
@@ -25,7 +25,12 @@ async function generateProjectFiles(buildData) {
|
|
|
25
25
|
}));
|
|
26
26
|
}
|
|
27
27
|
exports.generateProjectFiles = generateProjectFiles;
|
|
28
|
-
async function generateHTML({ appId, envId, description = '', appBuildDir, externalResources = [], mode, devTool, isBuildApp, buildTypeList, cdnEndpoints,
|
|
28
|
+
async function generateHTML({ appId, envId, description = '', appBuildDir, externalResources = [], mode, devTool, isBuildApp, buildTypeList, cdnEndpoints,
|
|
29
|
+
/**
|
|
30
|
+
* 由于存量兜底逻辑存在
|
|
31
|
+
* 默认值为 undefined 否则应为 false
|
|
32
|
+
*/
|
|
33
|
+
enableLoading = undefined, }) {
|
|
29
34
|
const templatePath = path_1.default.join(config_1.appTemplateDir, 'html', 'index.html.ejs');
|
|
30
35
|
const dstFilePath = path_1.default.join(appBuildDir, 'index.html');
|
|
31
36
|
const packageTpl = await fs_extra_1.default.readFile(templatePath, { encoding: 'utf8' });
|
|
@@ -56,14 +61,17 @@ async function generateHTML({ appId, envId, description = '', appBuildDir, exter
|
|
|
56
61
|
cdnEndpoints: (0, config_1.generateCdnEndpoints)(cdnEndpoints),
|
|
57
62
|
/**
|
|
58
63
|
* @deprecated
|
|
59
|
-
*
|
|
64
|
+
* 此次临时保留白名单兜底逻辑
|
|
65
|
+
* 当应用数据补充完成后可以祛除
|
|
60
66
|
*/
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
+
enableLoading: !(0, common_2.buildAsAdminPortalByBuildType)(buildTypeList) && enableLoading === undefined
|
|
68
|
+
? [
|
|
69
|
+
'lowcode-4gzdsu5k66946492',
|
|
70
|
+
'lowcode-2gay8jgh25c7b1cf',
|
|
71
|
+
'lowcode-4g9b78bx94404d85',
|
|
72
|
+
'lowcode-8gmx7bat3135e2de',
|
|
73
|
+
].includes(envId)
|
|
74
|
+
: enableLoading,
|
|
67
75
|
}));
|
|
68
76
|
}
|
|
69
77
|
exports.generateHTML = generateHTML;
|
|
@@ -6,6 +6,7 @@ const webpack_1 = require("../service/webpack");
|
|
|
6
6
|
const generate_1 = require("./generate");
|
|
7
7
|
const cals_1 = require("@cloudbase/cals");
|
|
8
8
|
async function runWebpackCore({ cals, mainAppData, subAppDataList, appBuildDir, publicPath, mode = common_1.WebpackModeType.NONE, appKey, buildTypeList = [common_1.BuildType.WEB], mpConfig, assets = [], devTool = 'vite', generateMpType = common_1.GenerateMpType.APP, cdnEndpoints, }) {
|
|
9
|
+
var _a;
|
|
9
10
|
console.time('runWebpackCore');
|
|
10
11
|
console.time('webpackGenerate');
|
|
11
12
|
const allAppDataList = subAppDataList.concat(mainAppData);
|
|
@@ -29,7 +30,8 @@ async function runWebpackCore({ cals, mainAppData, subAppDataList, appBuildDir,
|
|
|
29
30
|
await (0, generate_1.generateHTML)({
|
|
30
31
|
appId: mainAppData.id || appKey,
|
|
31
32
|
envId: mainAppData.envId || '',
|
|
32
|
-
description: cals.description || '',
|
|
33
|
+
description: cals.description /* || cals.label */ || '',
|
|
34
|
+
enableLoading: (_a = cals.extra) === null || _a === void 0 ? void 0 : _a.enableLoading,
|
|
33
35
|
appBuildDir,
|
|
34
36
|
externalResources: (cals.externalResources || []).concat(assets.map((url) => ({
|
|
35
37
|
type: cals_1.EExternalResourceType.CSSUrl,
|
package/lib/builder/mp/index.js
CHANGED
|
@@ -238,6 +238,7 @@ async function generateCompositeComponent(ctx, compositedComp, compLibCommonReso
|
|
|
238
238
|
const compositeCtx = {
|
|
239
239
|
...ctx,
|
|
240
240
|
isPage: false,
|
|
241
|
+
enableLoading: false,
|
|
241
242
|
};
|
|
242
243
|
const { materialName } = compositedComp;
|
|
243
244
|
const outDir = path.join(compositeCtx.projDir, compositeCtx.rootPath || '', // 混合模式下,可能会有 rootPath
|
package/lib/builder/mp/wxml.js
CHANGED
|
@@ -66,6 +66,16 @@ function generateWxml(ctx, widgets, docTag, wxmlDataPrefix, usingComponents, com
|
|
|
66
66
|
_parent: null,
|
|
67
67
|
},
|
|
68
68
|
];
|
|
69
|
+
if (ctx.enableLoading) {
|
|
70
|
+
usingComponents['wd-loading'] = '/common/loading/index';
|
|
71
|
+
xmlJson.elements.push({
|
|
72
|
+
type: 'element',
|
|
73
|
+
name: 'wd-loading',
|
|
74
|
+
attributes: {
|
|
75
|
+
['wx:if']: '{{_isCheckingAtuh}}',
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
}
|
|
69
79
|
}
|
|
70
80
|
function createXml(widgets, parent = null, parentForNodes = []) {
|
|
71
81
|
var _a, _b, _c, _d, _e, _f;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { OutputType } from 'jszip';
|
|
3
3
|
export declare const generatedFileContents: {};
|
|
4
|
-
export default function generateFiles(appFileData: any, srcDir: string, dstDir: string): Promise<
|
|
4
|
+
export default function generateFiles(appFileData: any, srcDir: string, dstDir: string): Promise<void>;
|
|
5
5
|
export declare function writeFile(outFile: string, content: string): Promise<boolean>;
|
|
6
6
|
export declare function removeFile(file: string): void;
|
|
7
7
|
/**
|
|
@@ -42,16 +42,21 @@ async function generateFiles(appFileData, srcDir, dstDir) {
|
|
|
42
42
|
const fileNameList = file.split('|');
|
|
43
43
|
const srcFileName = fileNameList[0];
|
|
44
44
|
const outFileName = fileNameList[1] || fileNameList[0];
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
45
|
+
const srcePath = path_1.default.join(srcDir, srcFileName);
|
|
46
|
+
if (fs_extra_1.default.lstatSync(srcePath).isDirectory()) {
|
|
47
|
+
(0, exports.copyRecursiveSync)(srcePath, path_1.default.join(dstDir, outFileName));
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
const tplStr = await fs_extra_1.default.readFile(path_1.default.join(srcDir, srcFileName), {
|
|
51
|
+
encoding: 'utf8',
|
|
52
|
+
});
|
|
53
|
+
let generatedCode = (0, lodash_1.template)(tplStr, { interpolate: /<%=([\s\S]+?)%>/ })(appFileData[file]);
|
|
54
|
+
const outFile = path_1.default.resolve(dstDir, outFileName.replace(/\.tpl$/, ''));
|
|
55
|
+
if (await writeFile(outFile, generatedCode)) {
|
|
56
|
+
filesGenerated.push(outFileName);
|
|
57
|
+
}
|
|
52
58
|
}
|
|
53
59
|
}
|
|
54
|
-
return filesGenerated;
|
|
55
60
|
}
|
|
56
61
|
exports.default = generateFiles;
|
|
57
62
|
async function writeFile(outFile, content) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/lowcode-builder",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.10",
|
|
4
4
|
"description": "云开发 Tencent CloudBase Framework Low Code Plugin,将低码配置生成完整项目并一键部署云开发资源。",
|
|
5
5
|
"author": "yhsunshining@gmail.com",
|
|
6
6
|
"homepage": "https://github.com/TencentCloudBase/cloudbase-framework#readme",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"url": "https://github.com/TencentCloudBase/cloudbase-framework/issues"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@cloudbase/cals": "^1.0.9
|
|
42
|
-
"@cloudbase/lowcode-generator": "^1.8.
|
|
41
|
+
"@cloudbase/cals": "^1.0.9",
|
|
42
|
+
"@cloudbase/lowcode-generator": "^1.8.1",
|
|
43
43
|
"axios": "^0.21.0",
|
|
44
44
|
"browserfs": "^1.4.3",
|
|
45
45
|
"browserify-zlib": "^0.2.0",
|
|
@@ -9,7 +9,9 @@
|
|
|
9
9
|
content="width=device-width,initial-scale=1.0,user-scalable=no<% if(!isBuildApp) {%>,viewport-fit=cover<%}%>"
|
|
10
10
|
/>
|
|
11
11
|
<meta name="format-detection" content="telephone=no" />
|
|
12
|
-
|
|
12
|
+
<% if(desc){ %>
|
|
13
|
+
<meta name="description" content="<%= desc %>" />
|
|
14
|
+
<% } %>
|
|
13
15
|
<link
|
|
14
16
|
rel="stylesheet"
|
|
15
17
|
href="<%=
|
|
@@ -389,7 +391,7 @@
|
|
|
389
391
|
|
|
390
392
|
<body data-weui-theme="light">
|
|
391
393
|
<div id="root" class="main-wrap">
|
|
392
|
-
<% if(
|
|
394
|
+
<% if(enableLoading){ %>
|
|
393
395
|
<style type="text/css">
|
|
394
396
|
.weda-loading-container {
|
|
395
397
|
position: fixed;
|
|
@@ -549,7 +551,7 @@
|
|
|
549
551
|
crossorigin
|
|
550
552
|
src="<%=
|
|
551
553
|
cdnEndpoints.cdngo
|
|
552
|
-
%>/lcap/lcap-resource-cdngo/-/0.1.4/_files/static/weda-render/main.
|
|
554
|
+
%>/lcap/lcap-resource-cdngo/-/0.1.4/_files/static/weda-render/main.3df3008899037155a92c.bundle.js"
|
|
553
555
|
></script>
|
|
554
556
|
</body>
|
|
555
557
|
</html>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
Component({
|
|
2
|
+
/**
|
|
3
|
+
* 组件的属性列表
|
|
4
|
+
*/
|
|
5
|
+
properties: {
|
|
6
|
+
message: String
|
|
7
|
+
},
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* 组件的初始数据
|
|
11
|
+
*/
|
|
12
|
+
data: {
|
|
13
|
+
message: '',
|
|
14
|
+
visible: false
|
|
15
|
+
},
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* 组件的方法列表
|
|
19
|
+
*/
|
|
20
|
+
methods: {
|
|
21
|
+
|
|
22
|
+
},
|
|
23
|
+
lifetimes: {
|
|
24
|
+
attached() {
|
|
25
|
+
setTimeout(() => {
|
|
26
|
+
this.setData({ visible: true, message: '登录鉴权中...' })
|
|
27
|
+
}, 100)
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
})
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
.weda-loading-container {
|
|
2
|
+
position: fixed;
|
|
3
|
+
left:0;
|
|
4
|
+
top:0;
|
|
5
|
+
width: 100%;
|
|
6
|
+
display: flex;
|
|
7
|
+
justify-content: center;
|
|
8
|
+
align-items: center;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
height:100%;
|
|
11
|
+
padding: 0 20px;
|
|
12
|
+
}
|
|
13
|
+
.weda-loading-container .logo {
|
|
14
|
+
width: 100%;
|
|
15
|
+
display: flex;
|
|
16
|
+
justify-content: center;
|
|
17
|
+
text-align: center;
|
|
18
|
+
margin-bottom: 50rpx;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.weda-loading-container .text {
|
|
22
|
+
font-size: 14px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.weda-loading-container .sp{
|
|
26
|
+
width: 48px;
|
|
27
|
+
height:48px;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.weda-loading-container .sp-circle {
|
|
31
|
+
border: 6px rgba(0,82,217,0.25) solid;
|
|
32
|
+
border-top: 6px rgba(0,82,217,1) solid;
|
|
33
|
+
border-radius: 50%;
|
|
34
|
+
-webkit-animation: spCircRot .6s infinite linear;
|
|
35
|
+
animation: spCircRot .6s infinite linear;
|
|
36
|
+
}
|
|
37
|
+
@-webkit-keyframes spCircRot {
|
|
38
|
+
from { -webkit-transform: rotate(0deg); }
|
|
39
|
+
to { -webkit-transform: rotate(359deg); }
|
|
40
|
+
}
|
|
41
|
+
@keyframes spCircRot {
|
|
42
|
+
from { transform: rotate(0deg); }
|
|
43
|
+
to { transform: rotate(359deg); }
|
|
44
|
+
}
|
|
@@ -157,6 +157,9 @@ export function createEventHandlers(
|
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
159
|
} catch (e) {
|
|
160
|
+
if (e.message) {
|
|
161
|
+
e.message = `${currentTarget?.id || ''}[${trigger}:${l.key}]: ${e.message}`;
|
|
162
|
+
}
|
|
160
163
|
nextEventHandles[0].handlerName = l.key ? `${prefix}$${l.key}_fail` : '';
|
|
161
164
|
nextEventHandles[0].event.detail = isIfAction ? event.detail : e;
|
|
162
165
|
error = e;
|
|
@@ -170,12 +173,20 @@ export function createEventHandlers(
|
|
|
170
173
|
const nextHandler = nextEventHandles[0];
|
|
171
174
|
|
|
172
175
|
if (!self[nextHandler.handlerName] && error) {
|
|
173
|
-
console.error(`Action error
|
|
176
|
+
console.error(`Action error:`, error);
|
|
174
177
|
if (!looseError) {
|
|
175
|
-
app.
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
178
|
+
if (app.__internal__?.env?.type !== 'production') {
|
|
179
|
+
app.showModal({
|
|
180
|
+
title: `事件响应失败`,
|
|
181
|
+
content: error.message || '',
|
|
182
|
+
showCancel: false,
|
|
183
|
+
});
|
|
184
|
+
} else {
|
|
185
|
+
app.showToast({
|
|
186
|
+
icon: 'error',
|
|
187
|
+
title: `事件响应失败`,
|
|
188
|
+
});
|
|
189
|
+
}
|
|
179
190
|
}
|
|
180
191
|
throw error;
|
|
181
192
|
} else {
|
|
@@ -213,7 +224,6 @@ export function createEventHandlers(
|
|
|
213
224
|
return res.length ? res[0] : event.detail;
|
|
214
225
|
});
|
|
215
226
|
}
|
|
216
|
-
|
|
217
227
|
};
|
|
218
228
|
}
|
|
219
229
|
|
|
@@ -456,7 +466,6 @@ export function formatErrorMsg(e) {
|
|
|
456
466
|
* 检查页面权限
|
|
457
467
|
**/
|
|
458
468
|
export async function checkAuth(app, appId, $page) {
|
|
459
|
-
return true;
|
|
460
469
|
const loginPage = findLoginPage(app);
|
|
461
470
|
if (loginPage?.id === $page.id) {
|
|
462
471
|
return true;
|
|
@@ -521,7 +530,7 @@ export function redirectToLogin(currentPage) {
|
|
|
521
530
|
pageId: loginPage.id,
|
|
522
531
|
params: {
|
|
523
532
|
sourcePageId: currentPage.id,
|
|
524
|
-
sourcePageParams: currentPage.params,
|
|
533
|
+
sourcePageParams: currentPage.params || currentPage.dataset?.params,
|
|
525
534
|
},
|
|
526
535
|
});
|
|
527
536
|
} else {
|
|
@@ -86,7 +86,11 @@ export function createPage({
|
|
|
86
86
|
|
|
87
87
|
return Component({
|
|
88
88
|
_componentType: 'page',
|
|
89
|
-
data:
|
|
89
|
+
data: {
|
|
90
|
+
...createInitData(widgetProps, dataBinds),
|
|
91
|
+
_isCheckingAtuh: false,
|
|
92
|
+
weDaHasLogin: false
|
|
93
|
+
},
|
|
90
94
|
lifetimes: {
|
|
91
95
|
attached() {
|
|
92
96
|
this._disposers = []
|
|
@@ -108,7 +112,7 @@ export function createPage({
|
|
|
108
112
|
const widget = getWidget($page.widgets, e.target.id);
|
|
109
113
|
widget._methods = {};
|
|
110
114
|
};
|
|
111
|
-
this._disposers.push(
|
|
115
|
+
this._disposers.push(...this.initMergeRenderer($page.widgets));
|
|
112
116
|
},
|
|
113
117
|
detached() {
|
|
114
118
|
const $page = this._getInstance();
|
|
@@ -142,18 +146,25 @@ export function createPage({
|
|
|
142
146
|
if (query) {
|
|
143
147
|
EXTRA_API.setParams($page.uuid, query);
|
|
144
148
|
}
|
|
145
|
-
|
|
146
|
-
this.setData({
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
149
|
+
try {
|
|
150
|
+
this.setData({ _isCheckingAtuh: true })
|
|
151
|
+
const auth = await checkAuth(app, app.id, $page);
|
|
152
|
+
if(auth) {
|
|
153
|
+
this.setData({
|
|
154
|
+
weDaHasLogin: true,
|
|
155
|
+
});
|
|
156
|
+
createStateDataSourceVar($page.uuid, generateParamsParser({ app, $page }));
|
|
157
|
+
}
|
|
158
|
+
} finally {
|
|
159
|
+
this.setData({ _isCheckingAtuh: false })
|
|
150
160
|
}
|
|
161
|
+
|
|
151
162
|
// eslint-disable-next-line no-restricted-syntax
|
|
152
|
-
for (const queryId in $page.dataset?.query||{}) {
|
|
163
|
+
for (const queryId in $page.dataset?.query || {}) {
|
|
153
164
|
if ($page.dataset.query[queryId]?._schema?.trigger === 'auto') {
|
|
154
165
|
try {
|
|
155
166
|
$page.dataset.query[queryId].trigger();
|
|
156
|
-
this._disposers.push(()=> $page.dataset.query[queryId].destroy())
|
|
167
|
+
this._disposers.push(() => $page.dataset.query[queryId].destroy())
|
|
157
168
|
} catch (e) {
|
|
158
169
|
console.error(`query ${queryId} 初始化失败:`, e);
|
|
159
170
|
}
|
package/template/mp/package.json
CHANGED