@cloudbase/framework-plugin-low-code 0.7.10 → 0.7.11-beta.3

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.
@@ -1 +1 @@
1
- {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../src/builder/core/generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAe5C,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAgBnD,wBAAsB,eAAe,CACnC,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,kBAAkB,EAC3B,cAAc,kCAA2B,EACzC,YAAY,6BAAsB,EAClC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,SAAS,EAAE,EAC1B,UAAU,EAAE,WAAW,EACvB,OAAO,qBAAwB,EAC/B,aAAa,qBAAQ,EACrB,SAAS;iBACM,OAAO;eACT,GAAG;aAIf,EACD,MAAM,EAAE,MAAM,iBAsEf;AACD,wBAAsB,mBAAmB,CAAC,YAAY,oBAAa,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,KAAA,iBAM/F"}
1
+ {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../src/builder/core/generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAe5C,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAgBnD,wBAAsB,eAAe,CACnC,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,kBAAkB,EAC3B,cAAc,kCAA2B,EACzC,YAAY,6BAAsB,EAClC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,SAAS,EAAE,EAC1B,UAAU,EAAE,WAAW,EACvB,OAAO,qBAAwB,EAC/B,aAAa,qBAAQ,EACrB,SAAS;iBACM,OAAO;eACT,GAAG;aAIf,EACD,MAAM,EAAE,MAAM,iBAuEf;AACD,wBAAsB,mBAAmB,CAAC,YAAY,oBAAa,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,KAAA,iBAM/F"}
@@ -53,6 +53,7 @@ function runGenerateCore(appBuildDir, appData, subAppDataList = [], dependencies
53
53
  }
54
54
  });
55
55
  yield Promise.all(allAppDataList.map((data) => __awaiter(this, void 0, void 0, function* () {
56
+ var _a;
56
57
  const { pageInstanceList, rootPath = '' } = data;
57
58
  const appName = rootPath ? `Sub app ${rootPath}` : 'Main app';
58
59
  console.log(chalk_1.default.blue.bold(`Generating files for ${appName}`));
@@ -68,6 +69,7 @@ function runGenerateCore(appBuildDir, appData, subAppDataList = [], dependencies
68
69
  appConfig: (0, util_1.JsonToStringWithVariableName)({
69
70
  id: appKey,
70
71
  envId: appData.envId,
72
+ clientId: (_a = appData.extra) === null || _a === void 0 ? void 0 : _a.clientId,
71
73
  staticResourceDomain: domain || '',
72
74
  envVersion: deployMode === types_1.DEPLOY_MODE.UPLOAD ? 'production' : 'preview',
73
75
  pages: pageInstanceList
@@ -214,14 +214,7 @@ function translateStyleByHandler(style = {}, handler) {
214
214
  setStyleValue(result, key, value);
215
215
  }
216
216
  else if (value !== undefined && value !== null) {
217
- try {
218
-
219
217
  setStyleValue(result, key, handler(value));
220
- }catch(e){
221
- console.log(style,key,value)
222
- console.log(e)
223
- throw e
224
- }
225
218
  }
226
219
  return result;
227
220
  }, {});
@@ -264,7 +257,6 @@ function toREM(cssLen) {
264
257
  return calPxToREM(cssLen);
265
258
  }
266
259
  else {
267
- console.log(cssLen)
268
260
  throw new Error('cssLen type error');
269
261
  }
270
262
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudbase/framework-plugin-low-code",
3
- "version": "0.7.10",
3
+ "version": "0.7.11-beta.3",
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",
@@ -1,15 +1,16 @@
1
1
  <!DOCTYPE html>
2
2
  <html lang="zh-cn">
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta http-equiv="X-UA-Compatible" content="IE=9" />
6
- <meta name="renderer" content="webkit|ie-stand" />
7
- <meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no,viewport-fit=cover" />
8
- <meta name="format-detection" content="telephone=no" />
9
- <meta name="description" content="<%= meta.desc %>" />
10
- <script crossorigin="anonymous" src="https://cdn-go.cn/aegis/aegis-sdk/latest/aegis.min.js?v=1"></script>
11
- <script>
12
- <% if(!isAdminPortal){ %>
3
+
4
+ <head>
5
+ <meta charset="utf-8" />
6
+ <meta http-equiv="X-UA-Compatible" content="IE=9" />
7
+ <meta name="renderer" content="webkit|ie-stand" />
8
+ <meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no,viewport-fit=cover" />
9
+ <meta name="format-detection" content="telephone=no" />
10
+ <meta name="description" content="<%= meta.desc %>" />
11
+ <script crossorigin="anonymous" src="https://cdn-go.cn/aegis/aegis-sdk/latest/aegis.min.js?v=1"></script>
12
+ <script>
13
+ <% if (!isAdminPortal) { %>
13
14
  const _aegis = new Aegis({
14
15
  id: 'lXHFsBpTjIzNADiczY', // 项目ID,即上报key
15
16
  reportApiSpeed: true, // 接口测速
@@ -27,430 +28,441 @@
27
28
  });
28
29
  <% }%>
29
30
  window._aegis = _aegis;
30
- window._aegis_inited = Date.now()
31
- </script>
32
- <title><%= meta.title %></title>
33
- <% if(delevopment){ %>
31
+ window._aegis_inited = Date.now()
32
+ </script>
33
+ <title>
34
+ <%= meta.title %>
35
+ </title>
36
+ <% if(delevopment){ %>
34
37
  <!-- <script src="https://cdn.jsdelivr.net/npm/eruda"></script>
35
38
  <script>
36
39
  eruda.init();
37
40
  </script> -->
38
- <% }%> <% Array.isArray(meta.jsApis) && meta.jsApis.filter(function(item){return !!item}).forEach(function(jsApi){%>
39
- <script src="<%=jsApi %>"></script>
40
- <% })%>
41
-
42
- <!-- 重置浏览器样式 -->
43
- <style type="text/css">
44
- .clearfix::before,
45
- .clearfix::after {
46
- content: '';
47
- display: table;
48
- }
49
-
50
- .clearfix::after {
51
- clear: both;
52
- }
53
-
54
- html {
55
- -ms-text-size-adjust: 100%;
56
- -webkit-text-size-adjust: 100%;
57
- -webkit-tap-highlight-color: transparent;
58
- height: 100%;
59
- }
60
-
61
- body {
62
- margin: 0;
63
- font-size: 14px;
64
- font-family: 'Helvetica Neue', Helvetica, 'Microsoft Yahei', STHeiTi, Arial, sans-serif;
65
- line-height: 1.5;
66
- color: #333;
67
- background-color: #fff;
68
- min-height: 100%;
69
- }
70
-
71
- body > #react-body {
72
- height: 100%;
73
- }
74
-
75
- .weapps-page {
76
- min-height: 100%;
77
- }
78
-
79
- article,
80
- aside,
81
- details,
82
- figcaption,
83
- figure,
84
- footer,
85
- header,
86
- hgroup,
87
- main,
88
- menu,
89
- nav,
90
- section,
91
- summary {
92
- display: block;
93
- }
94
-
95
- audio,
96
- canvas,
97
- progress,
98
- video {
99
- display: inline-block;
100
- }
101
-
102
- audio:not([controls]) {
103
- display: none;
104
- height: 0;
105
- }
106
-
107
- progress {
108
- vertical-align: baseline;
109
- }
110
-
111
- [hidden],
112
- template {
113
- display: none;
114
- }
115
-
116
- a {
117
- background: transparent;
118
- text-decoration: none;
119
- color: #08c;
120
- }
121
-
122
- a:active {
123
- outline: 0;
124
- }
125
-
126
- abbr[title] {
127
- border-bottom: 1px dotted;
128
- }
129
-
130
- b,
131
- strong {
132
- font-weight: bold;
133
- }
134
-
135
- dfn {
136
- font-style: italic;
137
- }
138
-
139
- mark {
140
- background: #ff0;
141
- color: #000;
142
- }
143
-
144
- small {
145
- font-size: 80%;
146
- }
147
-
148
- sub,
149
- sup {
150
- font-size: 75%;
151
- line-height: 0;
152
- position: relative;
153
- vertical-align: baseline;
154
- }
155
-
156
- sup {
157
- top: -0.5em;
158
- }
159
-
160
- sub {
161
- bottom: -0.25em;
162
- }
163
-
164
- img {
165
- border: 0;
166
- vertical-align: middle;
167
- }
168
-
169
- svg:not(:root) {
170
- overflow: hidden;
171
- }
172
-
173
- pre {
174
- overflow: auto;
175
- white-space: pre;
176
- white-space: pre-wrap;
177
- word-wrap: break-word;
178
- }
179
-
180
- code,
181
- kbd,
182
- pre,
183
- samp {
184
- font-family: monospace, monospace;
185
- font-size: 1em;
186
- }
187
-
188
- button,
189
- input,
190
- optgroup,
191
- select,
192
- textarea {
193
- color: inherit;
194
- font: inherit;
195
- margin: 0;
196
- vertical-align: middle;
197
- }
198
-
199
- button,
200
- input,
201
- select {
202
- overflow: visible;
203
- }
204
-
205
- button,
206
- select {
207
- text-transform: none;
208
- }
209
-
210
- button,
211
- html input[type='button'],
212
- input[type='reset'],
213
- input[type='submit'] {
214
- -webkit-appearance: button;
215
- cursor: pointer;
216
- }
217
-
218
- [disabled] {
219
- cursor: default;
220
- }
221
-
222
- button::-moz-focus-inner,
223
- input::-moz-focus-inner {
224
- border: 0;
225
- padding: 0;
226
- }
227
-
228
- input {
229
- line-height: normal;
230
- }
231
-
232
- input[type='checkbox'],
233
- input[type='radio'] {
234
- box-sizing: border-box;
235
- padding: 0;
236
- }
237
-
238
- input[type='number']::-webkit-inner-spin-button,
239
- input[type='number']::-webkit-outer-spin-button {
240
- height: auto;
241
- }
242
-
243
- input[type='search'] {
244
- -webkit-appearance: textfield;
245
- box-sizing: border-box;
246
- }
247
-
248
- input[type='search']::-webkit-search-cancel-button,
249
- input[type='search']::-webkit-search-decoration {
250
- -webkit-appearance: none;
251
- }
252
-
253
- fieldset {
254
- border: 1px solid #c0c0c0;
255
- margin: 0 2px;
256
- padding: 0.35em 0.625em 0.75em;
257
- }
258
-
259
- legend {
260
- border: 0;
261
- padding: 0;
262
- }
263
-
264
- textarea {
265
- overflow: auto;
266
- resize: vertical;
267
- vertical-align: top;
268
- }
269
-
270
- optgroup {
271
- font-weight: bold;
272
- }
273
-
274
- input,
275
- select,
276
- textarea {
277
- outline: 0;
278
- }
279
-
280
- textarea,
281
- input {
282
- -webkit-user-modify: read-write-plaintext-only;
283
- }
284
-
285
- input::-ms-clear,
286
- input::-ms-reveal {
287
- display: none;
288
- }
289
-
290
- input::-moz-placeholder,
291
- textarea::-moz-placeholder {
292
- color: #999;
293
- }
294
-
295
- input:-ms-input-placeholder,
296
- textarea:-ms-input-placeholder {
297
- color: #999;
298
- }
299
-
300
- input::-webkit-input-placeholder,
301
- textarea::-webkit-input-placeholder {
302
- color: #999;
303
- }
304
-
305
- .placeholder {
306
- color: #999;
307
- }
308
-
309
- table {
310
- border-collapse: collapse;
311
- border-spacing: 0;
312
- }
313
-
314
- td,
315
- th {
316
- padding: 0;
317
- }
318
-
319
- h1,
320
- h2,
321
- h3,
322
- h4,
323
- h5,
324
- h6,
325
- p,
326
- figure,
327
- form,
328
- blockquote {
329
- margin: 0;
330
- }
331
-
332
- ul,
333
- ol,
334
- li,
335
- dl,
336
- dd {
337
- margin: 0;
338
- padding: 0;
339
- }
340
-
341
- ul,
342
- ol {
343
- list-style: none outside none;
344
- }
345
-
346
- h1,
347
- h2,
348
- h3 {
349
- line-height: 2;
350
- font-weight: normal;
351
- }
352
-
353
- h1 {
354
- font-size: 18px;
355
- }
356
-
357
- h2 {
358
- font-size: 16px;
359
- }
360
-
361
- h3 {
362
- font-size: 14px;
363
- }
364
-
365
- i {
366
- font-style: normal;
367
- }
368
-
369
- * {
370
- box-sizing: border-box;
371
- }
372
-
373
- .hide {
374
- display: none;
375
- }
376
- </style>
377
- </head>
378
-
379
- <body data-weui-theme="light">
380
- <div id="react-body" class="main-wrap"></div>
381
- <% if(!isAdminPortal){ %>
41
+ <% }%>
42
+ <% Array.isArray(meta.jsApis) && meta.jsApis.filter(function(item){return !!item}).forEach(function(jsApi){%>
43
+ <script src="<%=jsApi %>"></script>
44
+ <% })%>
45
+
46
+ <!-- 重置浏览器样式 -->
47
+ <style type="text/css">
48
+ .clearfix::before,
49
+ .clearfix::after {
50
+ content: '';
51
+ display: table;
52
+ }
53
+
54
+ .clearfix::after {
55
+ clear: both;
56
+ }
57
+
58
+ html {
59
+ -ms-text-size-adjust: 100%;
60
+ -webkit-text-size-adjust: 100%;
61
+ -webkit-tap-highlight-color: transparent;
62
+ height: 100%;
63
+ }
64
+
65
+ body {
66
+ margin: 0;
67
+ font-size: 14px;
68
+ font-family: 'Helvetica Neue', Helvetica, 'Microsoft Yahei', STHeiTi, Arial, sans-serif;
69
+ line-height: 1.5;
70
+ color: #333;
71
+ background-color: #fff;
72
+ min-height: 100%;
73
+ }
74
+
75
+ body>#react-body {
76
+ height: 100%;
77
+ }
78
+
79
+ .weapps-page {
80
+ min-height: 100%;
81
+ }
82
+
83
+ article,
84
+ aside,
85
+ details,
86
+ figcaption,
87
+ figure,
88
+ footer,
89
+ header,
90
+ hgroup,
91
+ main,
92
+ menu,
93
+ nav,
94
+ section,
95
+ summary {
96
+ display: block;
97
+ }
98
+
99
+ audio,
100
+ canvas,
101
+ progress,
102
+ video {
103
+ display: inline-block;
104
+ }
105
+
106
+ audio:not([controls]) {
107
+ display: none;
108
+ height: 0;
109
+ }
110
+
111
+ progress {
112
+ vertical-align: baseline;
113
+ }
114
+
115
+ [hidden],
116
+ template {
117
+ display: none;
118
+ }
119
+
120
+ a {
121
+ background: transparent;
122
+ text-decoration: none;
123
+ color: #08c;
124
+ }
125
+
126
+ a:active {
127
+ outline: 0;
128
+ }
129
+
130
+ abbr[title] {
131
+ border-bottom: 1px dotted;
132
+ }
133
+
134
+ b,
135
+ strong {
136
+ font-weight: bold;
137
+ }
138
+
139
+ dfn {
140
+ font-style: italic;
141
+ }
142
+
143
+ mark {
144
+ background: #ff0;
145
+ color: #000;
146
+ }
147
+
148
+ small {
149
+ font-size: 80%;
150
+ }
151
+
152
+ sub,
153
+ sup {
154
+ font-size: 75%;
155
+ line-height: 0;
156
+ position: relative;
157
+ vertical-align: baseline;
158
+ }
159
+
160
+ sup {
161
+ top: -0.5em;
162
+ }
163
+
164
+ sub {
165
+ bottom: -0.25em;
166
+ }
167
+
168
+ img {
169
+ border: 0;
170
+ vertical-align: middle;
171
+ }
172
+
173
+ svg:not(:root) {
174
+ overflow: hidden;
175
+ }
176
+
177
+ pre {
178
+ overflow: auto;
179
+ white-space: pre;
180
+ white-space: pre-wrap;
181
+ word-wrap: break-word;
182
+ }
183
+
184
+ code,
185
+ kbd,
186
+ pre,
187
+ samp {
188
+ font-family: monospace, monospace;
189
+ font-size: 1em;
190
+ }
191
+
192
+ button,
193
+ input,
194
+ optgroup,
195
+ select,
196
+ textarea {
197
+ color: inherit;
198
+ font: inherit;
199
+ margin: 0;
200
+ vertical-align: middle;
201
+ }
202
+
203
+ button,
204
+ input,
205
+ select {
206
+ overflow: visible;
207
+ }
208
+
209
+ button,
210
+ select {
211
+ text-transform: none;
212
+ }
213
+
214
+ button,
215
+ html input[type='button'],
216
+ input[type='reset'],
217
+ input[type='submit'] {
218
+ -webkit-appearance: button;
219
+ cursor: pointer;
220
+ }
221
+
222
+ [disabled] {
223
+ cursor: default;
224
+ }
225
+
226
+ button::-moz-focus-inner,
227
+ input::-moz-focus-inner {
228
+ border: 0;
229
+ padding: 0;
230
+ }
231
+
232
+ input {
233
+ line-height: normal;
234
+ }
235
+
236
+ input[type='checkbox'],
237
+ input[type='radio'] {
238
+ box-sizing: border-box;
239
+ padding: 0;
240
+ }
241
+
242
+ input[type='number']::-webkit-inner-spin-button,
243
+ input[type='number']::-webkit-outer-spin-button {
244
+ height: auto;
245
+ }
246
+
247
+ input[type='search'] {
248
+ -webkit-appearance: textfield;
249
+ box-sizing: border-box;
250
+ }
251
+
252
+ input[type='search']::-webkit-search-cancel-button,
253
+ input[type='search']::-webkit-search-decoration {
254
+ -webkit-appearance: none;
255
+ }
256
+
257
+ fieldset {
258
+ border: 1px solid #c0c0c0;
259
+ margin: 0 2px;
260
+ padding: 0.35em 0.625em 0.75em;
261
+ }
262
+
263
+ legend {
264
+ border: 0;
265
+ padding: 0;
266
+ }
267
+
268
+ textarea {
269
+ overflow: auto;
270
+ resize: vertical;
271
+ vertical-align: top;
272
+ }
273
+
274
+ optgroup {
275
+ font-weight: bold;
276
+ }
277
+
278
+ input,
279
+ select,
280
+ textarea {
281
+ outline: 0;
282
+ }
283
+
284
+ textarea,
285
+ input {
286
+ -webkit-user-modify: read-write-plaintext-only;
287
+ }
288
+
289
+ input::-ms-clear,
290
+ input::-ms-reveal {
291
+ display: none;
292
+ }
293
+
294
+ input::-moz-placeholder,
295
+ textarea::-moz-placeholder {
296
+ color: #999;
297
+ }
298
+
299
+ input:-ms-input-placeholder,
300
+ textarea:-ms-input-placeholder {
301
+ color: #999;
302
+ }
303
+
304
+ input::-webkit-input-placeholder,
305
+ textarea::-webkit-input-placeholder {
306
+ color: #999;
307
+ }
308
+
309
+ .placeholder {
310
+ color: #999;
311
+ }
312
+
313
+ table {
314
+ border-collapse: collapse;
315
+ border-spacing: 0;
316
+ }
317
+
318
+ td,
319
+ th {
320
+ padding: 0;
321
+ }
322
+
323
+ h1,
324
+ h2,
325
+ h3,
326
+ h4,
327
+ h5,
328
+ h6,
329
+ p,
330
+ figure,
331
+ form,
332
+ blockquote {
333
+ margin: 0;
334
+ }
335
+
336
+ ul,
337
+ ol,
338
+ li,
339
+ dl,
340
+ dd {
341
+ margin: 0;
342
+ padding: 0;
343
+ }
344
+
345
+ ul,
346
+ ol {
347
+ list-style: none outside none;
348
+ }
349
+
350
+ h1,
351
+ h2,
352
+ h3 {
353
+ line-height: 2;
354
+ font-weight: normal;
355
+ }
356
+
357
+ h1 {
358
+ font-size: 18px;
359
+ }
360
+
361
+ h2 {
362
+ font-size: 16px;
363
+ }
364
+
365
+ h3 {
366
+ font-size: 14px;
367
+ }
368
+
369
+ i {
370
+ font-style: normal;
371
+ }
372
+
373
+ * {
374
+ box-sizing: border-box;
375
+ }
376
+
377
+ .hide {
378
+ display: none;
379
+ }
380
+ </style>
381
+ </head>
382
+
383
+ <body data-weui-theme="light">
384
+ <div id="react-body" class="main-wrap"></div>
385
+ <% if(!isAdminPortal){ %>
382
386
  <script src="/weda-config/weda-private.js"></script>
383
387
  <script src="//static.cloudbase.net/cloudbase-js-sdk/2.4.0-alpha.0/cloudbase.full.js?v=1"></script>
384
388
  <% }%>
385
- <script>
386
- if (window.cloudbase) {
387
- const _callFunction = window.cloudbase.__proto__.callFunction;
388
- window.cloudbase.__proto__.callFunction = function (args) {
389
- let promise = _callFunction.call(window.cloudbase, ...arguments);
390
- if (promise instanceof Promise) {
391
- return promise
392
- .then(function (res) {
393
- const { name, data = {} } = args || {};
394
- try {
395
- if (res.result && res.result.code) {
389
+ <script>
390
+ if (window.cloudbase) {
391
+ const _callFunction = window.cloudbase.__proto__.callFunction;
392
+ window.cloudbase.__proto__.callFunction = function (args) {
393
+ let promise = _callFunction.call(window.cloudbase, ...arguments);
394
+ if (promise instanceof Promise) {
395
+ return promise
396
+ .then(function (res) {
397
+ const { name, data = {} } = args || {};
398
+ try {
399
+ if (res.result && res.result.code) {
400
+ _aegis.report({
401
+ msg:
402
+ '[' +
403
+ name +
404
+ ':' +
405
+ data.methodName +
406
+ ']: ' +
407
+ (res.result.message || '函数调用失败'),
408
+ level: '16',
409
+ ext2: res.result.code,
410
+ ext3: res.requestId,
411
+ trace: 'trace',
412
+ });
413
+ }
414
+ } catch (e) { }
415
+ return res;
416
+ })
417
+ .catch(function (e) {
418
+ try {
396
419
  _aegis.report({
397
420
  msg: '[' + name + ':' + data.methodName + ']: ' + (res.result.message || '函数调用失败'),
398
421
  level: '16',
399
- ext2: res.result.code,
400
- ext3: res.requestId,
422
+ ext2: e.code,
423
+ ext3: e.requestId,
401
424
  trace: 'trace',
402
425
  });
403
426
  }
404
- } catch (e) {}
405
- return res;
406
- })
407
- .catch(function (e) {
408
- try {
409
- _aegis.report({
410
- msg: '[' + name + ':' + data.methodName + ']: ' + (e.message || '函数调用失败'),
411
- level: '16',
412
- ext2: e.code,
413
- ext3: e.requestId,
414
- trace: 'trace',
415
- });
416
- } catch (e) {}
417
- throw e;
418
- });
427
+ } catch (e) { }
428
+ return res;
429
+ })
430
+ .catch (function (e) {
431
+ try {
432
+ _aegis.report({
433
+ msg: '[' + name + ':' + data.methodName + ']: ' + (e.message || '函数调用失败'),
434
+ level: '16',
435
+ ext2: e.code,
436
+ ext3: e.requestId,
437
+ trace: 'trace',
438
+ });
439
+ } catch (e) { }
440
+ throw e;
441
+ });
419
442
  } else {
420
443
  return promise;
421
444
  }
422
445
  };
423
446
  }
424
- </script>
425
- <script
426
- crossorigin
427
- src="https://qbase.cdn-go.cn/lcap/lcap-resource-cdngo/-/release/_npm/react@16.14.0/umd/react.production.min.js"
428
- ></script>
429
- <script
430
- crossorigin
431
- src="https://qbase.cdn-go.cn/lcap/lcap-resource-cdngo/-/release/_npm/react-dom@16.14.0/umd/react-dom.production.min.js"
432
- ></script>
433
- <script
434
- src="https://qbase.cdn-go.cn/lcap/lcap-resource-cdngo/-/0.1.2/_url/ajax/libs/mobx/5.15.7/mobx.umd.js"
435
- crossorigin="anonymous"
436
- ></script>
437
- <script
438
- crossorigin="anonymous"
439
- src="https://qbase.cdn-go.cn/lcap/lcap-resource-cdngo/-/release/_npm/@cloudbase/weda-cloud-sdk@1.0.10/dist/h5.browser.js"
440
- ></script>
441
- <script>
442
- // zxing polifill
443
- if (!this.globalThis) {
444
- this.globalThis = this;
445
- }
446
- </script>
447
- <script
448
- crossorigin="anonymous"
449
- src="https://qbase.cdn-go.cn/lcap/lcap-resource-cdngo/-/0.1.2/_url/npm/@zxing/library@0.18.6/umd/index.min.js"
450
- ></script>
451
- <script
452
- crossorigin="anonymous"
453
- src="https://qbase.cdn-go.cn//lcap/lcap-resource-cdngo/-/release/_npm/@cloudbase/weda-client@0.2.8/dist/web.browser.js"
454
- ></script>
455
- </body>
456
- </html>
447
+ </script>
448
+ <script crossorigin
449
+ src="https://qbase.cdn-go.cn/lcap/lcap-resource-cdngo/-/release/_npm/react@16.14.0/umd/react.production.min.js"></script>
450
+ <script crossorigin
451
+ src="https://qbase.cdn-go.cn/lcap/lcap-resource-cdngo/-/release/_npm/react-dom@16.14.0/umd/react-dom.production.min.js"></script>
452
+ <script src="https://qbase.cdn-go.cn/lcap/lcap-resource-cdngo/-/0.1.2/_url/ajax/libs/mobx/5.15.7/mobx.umd.js"
453
+ crossorigin="anonymous"></script>
454
+ <script crossorigin="anonymous"
455
+ src="https://qbase.cdn-go.cn/lcap/lcap-resource-cdngo/-/release/_npm/@cloudbase/weda-cloud-sdk@1.0.10/dist/h5.browser.js"></script>
456
+ <script>
457
+ // zxing polifill
458
+ if (!this.globalThis) {
459
+ this.globalThis = this;
460
+ }
461
+ </script>
462
+ <script crossorigin="anonymous"
463
+ src="https://qbase.cdn-go.cn/lcap/lcap-resource-cdngo/-/0.1.2/_url/npm/@zxing/library@0.18.6/umd/index.min.js"></script>
464
+ <script crossorigin="anonymous"
465
+ src="https://qbase.cdn-go.cn//lcap/lcap-resource-cdngo/-/release/_npm/@cloudbase/weda-client@0.2.8/dist/web.browser.js"></script>
466
+ </body>
467
+
468
+ </html>
@@ -10,7 +10,7 @@
10
10
  "@tcwd/weapps-core": "2.2.6",
11
11
  "@tcwd/weapps-sdk": "1.2.9",
12
12
  "@zxing/library": "^0.18.6",
13
- "lodash-es": "^4.17.19",
13
+ "lodash": "^4.17.19",
14
14
  "mobx": "^5.15.4",
15
15
  "mobx-react-lite": "^2.0.7",
16
16
  "path-to-regexp": "^1.7.0",
@@ -12,7 +12,7 @@ import common from './common';
12
12
  import { formatEnum, enumOptions } from '../utils/formatEnum';
13
13
  import { _isMobile } from '../utils';
14
14
  import actionMap from './material-actions';
15
- import { get as lodashGet } from 'lodash-es';
15
+ import { get as lodashGet } from 'lodash';
16
16
 
17
17
  const mainAppKey = '__weappsMainApp';
18
18
  const appGlobal = process.env.isMiniprogram ? getApp() : window;
@@ -3,7 +3,7 @@ import { useContext, useCallback, createContext, useRef } from 'react';
3
3
  import { observer } from 'mobx-react-lite';
4
4
  import { emitEvent } from '../actionHandler/utils';
5
5
  import { translateStyleToRem } from '@tcwd/weapps-core';
6
- import { get, set } from 'lodash-es';
6
+ import { get, set } from 'lodash';
7
7
  import { $page } from '../../app/global-api';
8
8
  import { getDom } from '../utils/widgets';
9
9
  import { checkVisible } from '../../utils/index';
@@ -1,5 +1,5 @@
1
1
  import { resolveDataBinds } from '../utils/common';
2
- import { set as lodashSet } from 'lodash-es';
2
+ import { set as lodashSet } from 'lodash';
3
3
 
4
4
  const DEFAULT_MAX_TIMEOUT = 10 * 1000;
5
5
 
@@ -2,7 +2,7 @@
2
2
  /**
3
3
  * 生命周期处理函数
4
4
  */
5
- import { throttle } from 'lodash-es';
5
+ import { throttle } from 'lodash';
6
6
  import { wx } from '@tcwd/weapps-sdk';
7
7
  import * as querystring from 'querystring';
8
8
  // 小程序 端使用lifeCycle
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { set, cloneDeep } from 'lodash-es';
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';
@@ -214,29 +214,44 @@ export async function checkAnonymous() {
214
214
  return isAnonymous;
215
215
  }
216
216
 
217
+ let loginConfig;
218
+ export async function getLoginConfig() {
219
+ if (loginConfig !== undefined) {
220
+ return loginConfig;
221
+ }
222
+ const { staticResourceDomain, id } = app.__internal__.getConfig();
223
+ const url = `https://${staticResourceDomain}/${id}/login.config.json?t=${Date.now()}`;
224
+ try {
225
+ let response = await fetch(url);
226
+ loginConfig = await response.json();
227
+ } catch (e) {
228
+ loginConfig = {};
229
+ console.error(`加载登录配置${url}失败`, e);
230
+ }
231
+ return loginConfig;
232
+ }
233
+
217
234
  /**
218
235
  * 检查页面权限
219
236
  **/
220
237
  export async function checkAuth(app, appId, $page) {
221
238
  <% if (isAdminPortal || isXPage) { %>return true;<% } %>
222
- const loginPage = findLoginPage(app);
223
- if (loginPage?.id === $page.id) {
224
- return true
225
- }
226
- app.showNavigationBarLoading();
239
+ app.showNavigationBarLoading();
240
+ const loginConfig = await getLoginConfig();
227
241
  const requestList = [getAccessPermission(app, appId, $page.id)];
228
- // 暂时先认为有登录页则自定义登录功能开启且生效
229
- if (loginPage) {
242
+ // 登录配置内有web登录项则认为开启web登录
243
+ if (loginConfig.web?.length > 0) {
230
244
  requestList.push(getAuthConfig(app));
231
245
  requestList.push(checkAnonymous());
246
+ requestList.push(getLoginConfig()); // 提前并行加载
232
247
  }
233
248
  const [isAccess, authConfig, isAnonymous] = await Promise.all(requestList);
234
249
  app.hideNavigationBarLoading();
235
250
 
236
- if (loginPage && isAnonymous) {
251
+ if (loginConfig.web?.length > 0 && isAnonymous) {
237
252
  if (authConfig.NeedLogin || (!isAccess && authConfig.RejectStrategy === 'to_login')) {
238
253
  redirectToLogin($page);
239
- return isAccess;
254
+ return false;
240
255
  }
241
256
  }
242
257
 
@@ -249,25 +264,22 @@ export async function checkAuth(app, appId, $page) {
249
264
  return isAccess;
250
265
  }
251
266
 
252
- export function redirectToLogin(currentPage) {
267
+ export async function redirectToLogin(currentPage) {
253
268
  // 去登录则清空权限缓存。
254
269
  _AUTH_CACHE_MAP = {};
255
270
  const app = window.app;
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) {
271
+
272
+ const loginConfig = await getLoginConfig();
273
+ if (loginConfig.web?.length > 0) {
274
+ const { staticResourceDomain, envId, id, clientId } = app.__internal__.getConfig();
275
+ const url = `${location.origin}/__auth/?redirect_uri=${encodeURIComponent(
276
+ location.href,
277
+ )}&app_id=${id}&env_id=${envId}&client_id=${clientId}`;
264
278
  app.redirectTo({
265
- pageId: loginPage.id,
266
- params: {
267
- sourcePageId: currentPage.id,
268
- sourcePageParams: currentPage.dataset.params
269
- }
270
- })
279
+ mode: 'web',
280
+ params: {},
281
+ url,
282
+ });
271
283
  } else {
272
284
  app.showToast({
273
285
  title: '用户未登录',
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { observable, autorun, untracked } from 'mobx';
3
- import { remove } from 'lodash-es';
3
+ import { remove } from 'lodash';
4
4
  import { checkVisible } from '../../utils/index';
5
5
 
6
6
  export const WidgetsContext = React.createContext({ parent: null });
@@ -11,7 +11,7 @@ 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, findLoginPage, getAuthConfig, checkAnonymous } from './handlers/utils'
14
+ import { redirectToLogin, getAuthConfig, checkAnonymous, getLoginConfig } 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);
@@ -25,8 +25,7 @@ WEDA_CLOUD_SDK.setConfig({
25
25
  },
26
26
  beforeCallFunction: async (params) => {
27
27
  try{
28
- const loginPage = findLoginPage();
29
-
28
+ const loginConfig = await getLoginConfig();
30
29
  let skip = false;
31
30
  switch (params?.data?.methodName) {
32
31
  case 'callWedaApi': {
@@ -38,7 +37,7 @@ WEDA_CLOUD_SDK.setConfig({
38
37
  }
39
38
 
40
39
  // 后续做过滤处理
41
- if (!loginPage || (params?.data?.mode === 'c' && skip)) {
40
+ if (!(loginConfig.web?.length > 0) || (params?.data?.mode === 'c' && skip)) {
42
41
  return params;
43
42
  }
44
43
  const { accessToken } = await auth.getAccessToken();
@@ -59,8 +58,8 @@ WEDA_CLOUD_SDK.setConfig({
59
58
  },
60
59
  async afterCallFunction(params, error, res) {
61
60
  if(params?.data?.params?.action != 'DescribeRuntimeResourceStrategy' && ['InnerError.AuthFailure','InvalidAccessToken'].includes(res?.result?.code)) {
62
- const loginPage = findLoginPage();
63
- if (loginPage) {
61
+ const loginConfig = await getLoginConfig();
62
+ if (loginConfig.web?.length > 0) {
64
63
  const authConfig = await getAuthConfig();
65
64
  const isAnonymous = await checkAnonymous();
66
65
  if (isAnonymous && authConfig.RejectStrategy == 'to_login') {
@@ -11,7 +11,7 @@ import { app as mainApp } from 'app/global-api' // 取主包app
11
11
  import { app, $page } from '../../app/global-api' // 取对应子包app
12
12
  import { createWidgets, retryDataBinds, resolveComponentProps, checkAuth, reportTime } from 'handlers/utils'
13
13
  import { useScrollTop } from 'handlers/hooks'
14
- import { get } from "lodash-es";
14
+ import { get } from "lodash";
15
15
  import './index.less'
16
16
  <% if(pageSource){ %>
17
17
  import { loadMicroApp } from 'qiankun';
@@ -1,7 +1,7 @@
1
1
  import * as React from "react";
2
2
  import { observer } from "mobx-react-lite";
3
3
  import { observable } from "mobx";
4
- import { get } from 'lodash-es'
4
+ import { get } from 'lodash'
5
5
 
6
6
  import { AppRender } from "handlers/render";
7
7
  import { createComputed } from "../../../../utils";
@@ -1,4 +1,4 @@
1
- import { get as lodashGet, set as lodashSet } from 'lodash-es';
1
+ import { get as lodashGet, set as lodashSet } from 'lodash';
2
2
 
3
3
  const componentsInfoMap = <%= componentsInfoMap %>;
4
4