@cloudbase/framework-plugin-low-code 0.7.9 → 0.7.10-beta.2

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;AAkBnD,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,qBAAiB,EAC9B,SAAS;iBACM,OAAO;eACT,GAAG;aAIf,EACD,MAAM,EAAE,MAAM,iBA6Gf;AACD,wBAAsB,mBAAmB,CACvC,YAAY,oBAAa,EACzB,WAAW,EAAE,MAAM,EACnB,MAAM,KAAA,iBASP"}
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;AAkBnD,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,qBAAiB,EAC9B,SAAS;iBACM,OAAO;eACT,GAAG;aAIf,EACD,MAAM,EAAE,MAAM,iBA8Gf;AACD,wBAAsB,mBAAmB,CACvC,YAAY,oBAAa,EACzB,WAAW,EAAE,MAAM,EACnB,MAAM,KAAA,iBASP"}
@@ -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.9",
3
+ "version": "0.7.10-beta.2",
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,21 +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
8
- name="viewport"
9
- content="width=device-width,initial-scale=1.0,user-scalable=no,viewport-fit=cover"
10
- />
11
- <meta name="format-detection" content="telephone=no" />
12
- <meta name="description" content="<%= meta.desc %>" />
13
- <script
14
- crossorigin="anonymous"
15
- src="https://cdn-go.cn/aegis/aegis-sdk/latest/aegis.min.js?v=1"
16
- ></script>
17
- <script>
18
- <% 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) { %>
19
14
  const _aegis = new Aegis({
20
15
  id: 'lXHFsBpTjIzNADiczY', // 项目ID,即上报key
21
16
  reportApiSpeed: true, // 接口测速
@@ -33,374 +28,395 @@
33
28
  });
34
29
  <% }%>
35
30
  window._aegis = _aegis;
36
- window._aegis_inited = Date.now()
37
- </script>
38
- <title><%= meta.title %></title>
39
- <% if(delevopment){ %>
31
+ window._aegis_inited = Date.now()
32
+ </script>
33
+ <title>
34
+ <%= meta.title %>
35
+ </title>
36
+ <% if(delevopment){ %>
40
37
  <!-- <script src="https://cdn.jsdelivr.net/npm/eruda"></script>
41
38
  <script>
42
39
  eruda.init();
43
40
  </script> -->
44
- <% }%> <% Array.isArray(meta.jsApis) &&
45
- meta.jsApis.filter(function(item){return !!item}).forEach(function(jsApi){%>
46
- <script src="<%=jsApi %>"></script>
47
- <% })%>
48
-
49
- <!-- 重置浏览器样式 -->
50
- <style type="text/css">
51
- .clearfix::before,
52
- .clearfix::after {
53
- content: '';
54
- display: table;
55
- }
56
-
57
- .clearfix::after {
58
- clear: both;
59
- }
60
-
61
- html {
62
- -ms-text-size-adjust: 100%;
63
- -webkit-text-size-adjust: 100%;
64
- -webkit-tap-highlight-color: transparent;
65
- height: 100%;
66
- }
67
-
68
- body {
69
- margin: 0;
70
- font-size: 14px;
71
- font-family: 'Helvetica Neue', Helvetica, 'Microsoft Yahei', STHeiTi,
72
- Arial, sans-serif;
73
- line-height: 1.5;
74
- color: #333;
75
- background-color: #fff;
76
- min-height: 100%;
77
- }
78
-
79
- body > #react-body {
80
- height: 100%;
81
- }
82
-
83
- .weapps-page {
84
- min-height: 100%;
85
- }
86
-
87
- article,
88
- aside,
89
- details,
90
- figcaption,
91
- figure,
92
- footer,
93
- header,
94
- hgroup,
95
- main,
96
- menu,
97
- nav,
98
- section,
99
- summary {
100
- display: block;
101
- }
102
-
103
- audio,
104
- canvas,
105
- progress,
106
- video {
107
- display: inline-block;
108
- }
109
-
110
- audio:not([controls]) {
111
- display: none;
112
- height: 0;
113
- }
114
-
115
- progress {
116
- vertical-align: baseline;
117
- }
118
-
119
- [hidden],
120
- template {
121
- display: none;
122
- }
123
-
124
- a {
125
- background: transparent;
126
- text-decoration: none;
127
- color: #08c;
128
- }
129
-
130
- a:active {
131
- outline: 0;
132
- }
133
-
134
- abbr[title] {
135
- border-bottom: 1px dotted;
136
- }
137
-
138
- b,
139
- strong {
140
- font-weight: bold;
141
- }
142
-
143
- dfn {
144
- font-style: italic;
145
- }
146
-
147
- mark {
148
- background: #ff0;
149
- color: #000;
150
- }
151
-
152
- small {
153
- font-size: 80%;
154
- }
155
-
156
- sub,
157
- sup {
158
- font-size: 75%;
159
- line-height: 0;
160
- position: relative;
161
- vertical-align: baseline;
162
- }
163
-
164
- sup {
165
- top: -0.5em;
166
- }
167
-
168
- sub {
169
- bottom: -0.25em;
170
- }
171
-
172
- img {
173
- border: 0;
174
- vertical-align: middle;
175
- }
176
-
177
- svg:not(:root) {
178
- overflow: hidden;
179
- }
180
-
181
- pre {
182
- overflow: auto;
183
- white-space: pre;
184
- white-space: pre-wrap;
185
- word-wrap: break-word;
186
- }
187
-
188
- code,
189
- kbd,
190
- pre,
191
- samp {
192
- font-family: monospace, monospace;
193
- font-size: 1em;
194
- }
195
-
196
- button,
197
- input,
198
- optgroup,
199
- select,
200
- textarea {
201
- color: inherit;
202
- font: inherit;
203
- margin: 0;
204
- vertical-align: middle;
205
- }
206
-
207
- button,
208
- input,
209
- select {
210
- overflow: visible;
211
- }
212
-
213
- button,
214
- select {
215
- text-transform: none;
216
- }
217
-
218
- button,
219
- html input[type='button'],
220
- input[type='reset'],
221
- input[type='submit'] {
222
- -webkit-appearance: button;
223
- cursor: pointer;
224
- }
225
-
226
- [disabled] {
227
- cursor: default;
228
- }
229
-
230
- button::-moz-focus-inner,
231
- input::-moz-focus-inner {
232
- border: 0;
233
- padding: 0;
234
- }
235
-
236
- input {
237
- line-height: normal;
238
- }
239
-
240
- input[type='checkbox'],
241
- input[type='radio'] {
242
- box-sizing: border-box;
243
- padding: 0;
244
- }
245
-
246
- input[type='number']::-webkit-inner-spin-button,
247
- input[type='number']::-webkit-outer-spin-button {
248
- height: auto;
249
- }
250
-
251
- input[type='search'] {
252
- -webkit-appearance: textfield;
253
- box-sizing: border-box;
254
- }
255
-
256
- input[type='search']::-webkit-search-cancel-button,
257
- input[type='search']::-webkit-search-decoration {
258
- -webkit-appearance: none;
259
- }
260
-
261
- fieldset {
262
- border: 1px solid #c0c0c0;
263
- margin: 0 2px;
264
- padding: 0.35em 0.625em 0.75em;
265
- }
266
-
267
- legend {
268
- border: 0;
269
- padding: 0;
270
- }
271
-
272
- textarea {
273
- overflow: auto;
274
- resize: vertical;
275
- vertical-align: top;
276
- }
277
-
278
- optgroup {
279
- font-weight: bold;
280
- }
281
-
282
- input,
283
- select,
284
- textarea {
285
- outline: 0;
286
- }
287
-
288
- textarea,
289
- input {
290
- -webkit-user-modify: read-write-plaintext-only;
291
- }
292
-
293
- input::-ms-clear,
294
- input::-ms-reveal {
295
- display: none;
296
- }
297
-
298
- input::-moz-placeholder,
299
- textarea::-moz-placeholder {
300
- color: #999;
301
- }
302
-
303
- input:-ms-input-placeholder,
304
- textarea:-ms-input-placeholder {
305
- color: #999;
306
- }
307
-
308
- input::-webkit-input-placeholder,
309
- textarea::-webkit-input-placeholder {
310
- color: #999;
311
- }
312
-
313
- .placeholder {
314
- color: #999;
315
- }
316
-
317
- table {
318
- border-collapse: collapse;
319
- border-spacing: 0;
320
- }
321
-
322
- td,
323
- th {
324
- padding: 0;
325
- }
326
-
327
- h1,
328
- h2,
329
- h3,
330
- h4,
331
- h5,
332
- h6,
333
- p,
334
- figure,
335
- form,
336
- blockquote {
337
- margin: 0;
338
- }
339
-
340
- ul,
341
- ol,
342
- li,
343
- dl,
344
- dd {
345
- margin: 0;
346
- padding: 0;
347
- }
348
-
349
- ul,
350
- ol {
351
- list-style: none outside none;
352
- }
353
-
354
- h1,
355
- h2,
356
- h3 {
357
- line-height: 2;
358
- font-weight: normal;
359
- }
360
-
361
- h1 {
362
- font-size: 18px;
363
- }
364
-
365
- h2 {
366
- font-size: 16px;
367
- }
368
-
369
- h3 {
370
- font-size: 14px;
371
- }
372
-
373
- i {
374
- font-style: normal;
375
- }
376
-
377
- * {
378
- box-sizing: border-box;
379
- }
380
-
381
- .hide {
382
- display: none;
383
- }
384
- </style>
385
- </head>
386
-
387
- <body data-weui-theme="light">
388
- <div id="react-body" class="main-wrap"></div>
389
- <% 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,
69
+ Arial, sans-serif;
70
+ line-height: 1.5;
71
+ color: #333;
72
+ background-color: #fff;
73
+ min-height: 100%;
74
+ }
75
+
76
+ body>#react-body {
77
+ height: 100%;
78
+ }
79
+
80
+ .weapps-page {
81
+ min-height: 100%;
82
+ }
83
+
84
+ article,
85
+ aside,
86
+ details,
87
+ figcaption,
88
+ figure,
89
+ footer,
90
+ header,
91
+ hgroup,
92
+ main,
93
+ menu,
94
+ nav,
95
+ section,
96
+ summary {
97
+ display: block;
98
+ }
99
+
100
+ audio,
101
+ canvas,
102
+ progress,
103
+ video {
104
+ display: inline-block;
105
+ }
106
+
107
+ audio:not([controls]) {
108
+ display: none;
109
+ height: 0;
110
+ }
111
+
112
+ progress {
113
+ vertical-align: baseline;
114
+ }
115
+
116
+ [hidden],
117
+ template {
118
+ display: none;
119
+ }
120
+
121
+ a {
122
+ background: transparent;
123
+ text-decoration: none;
124
+ color: #08c;
125
+ }
126
+
127
+ a:active {
128
+ outline: 0;
129
+ }
130
+
131
+ abbr[title] {
132
+ border-bottom: 1px dotted;
133
+ }
134
+
135
+ b,
136
+ strong {
137
+ font-weight: bold;
138
+ }
139
+
140
+ dfn {
141
+ font-style: italic;
142
+ }
143
+
144
+ mark {
145
+ background: #ff0;
146
+ color: #000;
147
+ }
148
+
149
+ small {
150
+ font-size: 80%;
151
+ }
152
+
153
+ sub,
154
+ sup {
155
+ font-size: 75%;
156
+ line-height: 0;
157
+ position: relative;
158
+ vertical-align: baseline;
159
+ }
160
+
161
+ sup {
162
+ top: -0.5em;
163
+ }
164
+
165
+ sub {
166
+ bottom: -0.25em;
167
+ }
168
+
169
+ img {
170
+ border: 0;
171
+ vertical-align: middle;
172
+ }
173
+
174
+ svg:not(:root) {
175
+ overflow: hidden;
176
+ }
177
+
178
+ pre {
179
+ overflow: auto;
180
+ white-space: pre;
181
+ white-space: pre-wrap;
182
+ word-wrap: break-word;
183
+ }
184
+
185
+ code,
186
+ kbd,
187
+ pre,
188
+ samp {
189
+ font-family: monospace, monospace;
190
+ font-size: 1em;
191
+ }
192
+
193
+ button,
194
+ input,
195
+ optgroup,
196
+ select,
197
+ textarea {
198
+ color: inherit;
199
+ font: inherit;
200
+ margin: 0;
201
+ vertical-align: middle;
202
+ }
203
+
204
+ button,
205
+ input,
206
+ select {
207
+ overflow: visible;
208
+ }
209
+
210
+ button,
211
+ select {
212
+ text-transform: none;
213
+ }
214
+
215
+ button,
216
+ html input[type='button'],
217
+ input[type='reset'],
218
+ input[type='submit'] {
219
+ -webkit-appearance: button;
220
+ cursor: pointer;
221
+ }
222
+
223
+ [disabled] {
224
+ cursor: default;
225
+ }
226
+
227
+ button::-moz-focus-inner,
228
+ input::-moz-focus-inner {
229
+ border: 0;
230
+ padding: 0;
231
+ }
232
+
233
+ input {
234
+ line-height: normal;
235
+ }
236
+
237
+ input[type='checkbox'],
238
+ input[type='radio'] {
239
+ box-sizing: border-box;
240
+ padding: 0;
241
+ }
242
+
243
+ input[type='number']::-webkit-inner-spin-button,
244
+ input[type='number']::-webkit-outer-spin-button {
245
+ height: auto;
246
+ }
247
+
248
+ input[type='search'] {
249
+ -webkit-appearance: textfield;
250
+ box-sizing: border-box;
251
+ }
252
+
253
+ input[type='search']::-webkit-search-cancel-button,
254
+ input[type='search']::-webkit-search-decoration {
255
+ -webkit-appearance: none;
256
+ }
257
+
258
+ fieldset {
259
+ border: 1px solid #c0c0c0;
260
+ margin: 0 2px;
261
+ padding: 0.35em 0.625em 0.75em;
262
+ }
263
+
264
+ legend {
265
+ border: 0;
266
+ padding: 0;
267
+ }
268
+
269
+ textarea {
270
+ overflow: auto;
271
+ resize: vertical;
272
+ vertical-align: top;
273
+ }
274
+
275
+ optgroup {
276
+ font-weight: bold;
277
+ }
278
+
279
+ input,
280
+ select,
281
+ textarea {
282
+ outline: 0;
283
+ }
284
+
285
+ textarea,
286
+ input {
287
+ -webkit-user-modify: read-write-plaintext-only;
288
+ }
289
+
290
+ input::-ms-clear,
291
+ input::-ms-reveal {
292
+ display: none;
293
+ }
294
+
295
+ input::-moz-placeholder,
296
+ textarea::-moz-placeholder {
297
+ color: #999;
298
+ }
299
+
300
+ input:-ms-input-placeholder,
301
+ textarea:-ms-input-placeholder {
302
+ color: #999;
303
+ }
304
+
305
+ input::-webkit-input-placeholder,
306
+ textarea::-webkit-input-placeholder {
307
+ color: #999;
308
+ }
309
+
310
+ .placeholder {
311
+ color: #999;
312
+ }
313
+
314
+ table {
315
+ border-collapse: collapse;
316
+ border-spacing: 0;
317
+ }
318
+
319
+ td,
320
+ th {
321
+ padding: 0;
322
+ }
323
+
324
+ h1,
325
+ h2,
326
+ h3,
327
+ h4,
328
+ h5,
329
+ h6,
330
+ p,
331
+ figure,
332
+ form,
333
+ blockquote {
334
+ margin: 0;
335
+ }
336
+
337
+ ul,
338
+ ol,
339
+ li,
340
+ dl,
341
+ dd {
342
+ margin: 0;
343
+ padding: 0;
344
+ }
345
+
346
+ ul,
347
+ ol {
348
+ list-style: none outside none;
349
+ }
350
+
351
+ h1,
352
+ h2,
353
+ h3 {
354
+ line-height: 2;
355
+ font-weight: normal;
356
+ }
357
+
358
+ h1 {
359
+ font-size: 18px;
360
+ }
361
+
362
+ h2 {
363
+ font-size: 16px;
364
+ }
365
+
366
+ h3 {
367
+ font-size: 14px;
368
+ }
369
+
370
+ i {
371
+ font-style: normal;
372
+ }
373
+
374
+ * {
375
+ box-sizing: border-box;
376
+ }
377
+
378
+ .hide {
379
+ display: none;
380
+ }
381
+ </style>
382
+ </head>
383
+
384
+ <body data-weui-theme="light">
385
+ <div id="react-body" class="main-wrap"></div>
386
+ <% if(!isAdminPortal){ %>
390
387
  <script src="/weda-config/weda-private.js"></script>
391
388
  <script src="//static.cloudbase.net/cloudbase-js-sdk/2.4.0-alpha.0/cloudbase.full.js?v=1"></script>
392
389
  <% }%>
393
- <script>
394
- if (window.cloudbase) {
395
- const _callFunction = window.cloudbase.__proto__.callFunction;
396
- window.cloudbase.__proto__.callFunction = function (args) {
397
- let promise = _callFunction.call(window.cloudbase, ...arguments);
398
- if (promise instanceof Promise) {
399
- return promise
400
- .then(function (res) {
401
- const { name, data = {} } = args || {};
402
- try {
403
- if (res.result && res.result.code) {
390
+ <script>
391
+ if (window.cloudbase) {
392
+ const _callFunction = window.cloudbase.__proto__.callFunction;
393
+ window.cloudbase.__proto__.callFunction = function (args) {
394
+ let promise = _callFunction.call(window.cloudbase, ...arguments);
395
+ if (promise instanceof Promise) {
396
+ return promise
397
+ .then(function (res) {
398
+ const { name, data = {} } = args || {};
399
+ try {
400
+ if (res.result && res.result.code) {
401
+ _aegis.report({
402
+ msg:
403
+ '[' +
404
+ name +
405
+ ':' +
406
+ data.methodName +
407
+ ']: ' +
408
+ (res.result.message || '函数调用失败'),
409
+ level: '16',
410
+ ext2: res.result.code,
411
+ ext3: res.requestId,
412
+ trace: 'trace',
413
+ });
414
+ }
415
+ } catch (e) { }
416
+ return res;
417
+ })
418
+ .catch(function (e) {
419
+ try {
404
420
  _aegis.report({
405
421
  msg:
406
422
  '[' +
@@ -408,57 +424,33 @@
408
424
  ':' +
409
425
  data.methodName +
410
426
  ']: ' +
411
- (res.result.message || '函数调用失败'),
427
+ (e.message || '函数调用失败'),
412
428
  level: '16',
413
- ext2: res.result.code,
414
- ext3: res.requestId,
429
+ ext2: e.code,
430
+ ext3: e.requestId,
415
431
  trace: 'trace',
416
432
  });
417
- }
418
- } catch (e) {}
419
- return res;
420
- })
421
- .catch(function (e) {
422
- try {
423
- _aegis.report({
424
- msg:
425
- '[' +
426
- name +
427
- ':' +
428
- data.methodName +
429
- ']: ' +
430
- (e.message || '函数调用失败'),
431
- level: '16',
432
- ext2: e.code,
433
- ext3: e.requestId,
434
- trace: 'trace',
435
- });
436
- } catch (e) {}
437
- throw e;
438
- });
439
- } else {
440
- return promise;
441
- }
442
- };
443
- }
444
- </script>
445
- <script
446
- src="https://qbase.cdn-go.cn/lcap/lcap-resource-cdngo/-/0.1.2/_url/ajax/libs/mobx/5.15.7/mobx.umd.js?v=1"
447
- crossorigin="anonymous"
448
- ></script>
449
- <script
450
- crossorigin="anonymous"
451
- src="https://qbase.cdn-go.cn/lcap/lcap-resource-cdngo/-/release/_npm/@cloudbase/weda-cloud-sdk@1.0.8-alpha.12/dist/h5.browser.js?v=1"
452
- ></script>
453
- <script>
454
- // zxing polifill
455
- if (!this.globalThis) {
456
- this.globalThis = this;
457
- }
458
- </script>
459
- <script
460
- crossorigin="anonymous"
461
- src="https://qbase.cdn-go.cn/lcap/lcap-resource-cdngo/-/0.1.2/_url/npm/@zxing/library@0.18.6/umd/index.min.js?v=1"
462
- ></script>
463
- </body>
464
- </html>
433
+ } catch (e) { }
434
+ throw e;
435
+ });
436
+ } else {
437
+ return promise;
438
+ }
439
+ };
440
+ }
441
+ </script>
442
+ <script src="https://qbase.cdn-go.cn/lcap/lcap-resource-cdngo/-/0.1.2/_url/ajax/libs/mobx/5.15.7/mobx.umd.js?v=1"
443
+ crossorigin="anonymous"></script>
444
+ <script crossorigin="anonymous"
445
+ src="https://qbase.cdn-go.cn/lcap/lcap-resource-cdngo/-/release/_npm/@cloudbase/weda-cloud-sdk@1.0.10/dist/h5.browser.js?v=1"></script>
446
+ <script>
447
+ // zxing polifill
448
+ if (!this.globalThis) {
449
+ this.globalThis = this;
450
+ }
451
+ </script>
452
+ <script crossorigin="anonymous"
453
+ src="https://qbase.cdn-go.cn/lcap/lcap-resource-cdngo/-/0.1.2/_url/npm/@zxing/library@0.18.6/umd/index.min.js?v=1"></script>
454
+ </body>
455
+
456
+ </html>
@@ -6,11 +6,10 @@
6
6
  },
7
7
  "dependencies": {
8
8
  "@cloudbase/js-sdk": "2.4.0-alpha.0",
9
- "@cloudbase/weda-cloud-sdk": "1.0.8",
9
+ "@cloudbase/weda-cloud-sdk": "1.0.10",
10
10
  "@tcwd/weapps-core": "2.2.6",
11
11
  "@tcwd/weapps-sdk": "1.2.9",
12
12
  "@zxing/library": "^0.18.6",
13
- "fastclick": "^1.0.6",
14
13
  "lodash": "^4.17.19",
15
14
  "mobx": "^5.15.4",
16
15
  "mobx-react-lite": "^2.0.7",
@@ -218,29 +218,44 @@ export async function checkAnonymous() {
218
218
  return isAnonymous;
219
219
  }
220
220
 
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
+
221
238
  /**
222
239
  * 检查页面权限
223
240
  **/
224
241
  export async function checkAuth(app, appId, $page) {
225
242
  <% if (isAdminPortal || isXPage) { %>return true;<% } %>
226
- const loginPage = findLoginPage(app);
227
- if (loginPage?.id === $page.id) {
228
- return true
229
- }
230
- app.showNavigationBarLoading();
243
+ app.showNavigationBarLoading();
244
+ const loginConfig = await getLoginConfig();
231
245
  const requestList = [getAccessPermission(app, appId, $page.id)];
232
- // 暂时先认为有登录页则自定义登录功能开启且生效
233
- if (loginPage) {
246
+ // 登录配置内有web登录项则认为开启web登录
247
+ if (loginConfig.web?.length > 0) {
234
248
  requestList.push(getAuthConfig(app));
235
249
  requestList.push(checkAnonymous());
250
+ requestList.push(getLoginConfig()); // 提前并行加载
236
251
  }
237
252
  const [isAccess, authConfig, isAnonymous] = await Promise.all(requestList);
238
253
  app.hideNavigationBarLoading();
239
254
 
240
- if (loginPage && isAnonymous) {
255
+ if (loginConfig.web?.length > 0 && isAnonymous) {
241
256
  if (authConfig.NeedLogin || (!isAccess && authConfig.RejectStrategy === 'to_login')) {
242
257
  redirectToLogin($page);
243
- return isAccess;
258
+ return false;
244
259
  }
245
260
  }
246
261
 
@@ -253,25 +268,22 @@ export async function checkAuth(app, appId, $page) {
253
268
  return isAccess;
254
269
  }
255
270
 
256
- export function redirectToLogin(currentPage) {
271
+ export async function redirectToLogin(currentPage) {
257
272
  // 去登录则清空权限缓存。
258
273
  _AUTH_CACHE_MAP = {};
259
274
  const app = window.app;
260
- const loginPage = findLoginPage(app);
261
- if (!currentPage) {
262
- currentPage = app.utils.getCurrentPage() || {};
263
- }
264
- if (loginPage?.id === currentPage.id) {
265
- return true
266
- }
267
- if (loginPage) {
275
+
276
+ const loginConfig = await getLoginConfig();
277
+ if (loginConfig.web?.length > 0) {
278
+ const { staticResourceDomain, envId, id, clientId } = app.__internal__.getConfig();
279
+ const url = `${location.origin}/__auth/?redirect_uri=${encodeURIComponent(
280
+ location.href,
281
+ )}&app_id=${id}&env_id=${envId}&client_id=${clientId}`;
268
282
  app.redirectTo({
269
- pageId: loginPage.id,
270
- params: {
271
- sourcePageId: currentPage.id,
272
- sourcePageParams: currentPage.dataset.params
273
- }
274
- })
283
+ mode: 'web',
284
+ params: {},
285
+ url,
286
+ });
275
287
  } else {
276
288
  app.showToast({
277
289
  title: '用户未登录',
@@ -8,11 +8,10 @@ import './index.less'
8
8
  import './datasources'
9
9
  import { initGlobalVar } from './handlers/initWebEnv'
10
10
  import '@babel/polyfill/noConflict'
11
- import attachFastClick from 'fastclick'
12
11
  import { initWebConfig } from 'handlers/lifecycle'
13
12
  const AppConfig = require('../webpack/miniprogram.config')
14
13
  import { app } from './app/global-api'
15
- import { redirectToLogin, findLoginPage, getAuthConfig, checkAnonymous } from './handlers/utils'
14
+ import { redirectToLogin, getAuthConfig, checkAnonymous, getLoginConfig } from './handlers/utils'
16
15
  // app 中注册配置页面以及app的全局配置miniprogram.config,h5里分app以及web页分别处理,使用process.env.isApp 区分判断
17
16
  if (process.env.isApp) {
18
17
  initWebConfig(app, AppConfig);
@@ -26,8 +25,7 @@ setConfig({
26
25
  },
27
26
  beforeCallFunction: async (params) => {
28
27
  try{
29
- const loginPage = findLoginPage();
30
-
28
+ const loginConfig = await getLoginConfig();
31
29
  let skip = false;
32
30
  switch (params?.data?.methodName) {
33
31
  case 'callWedaApi': {
@@ -39,7 +37,7 @@ setConfig({
39
37
  }
40
38
 
41
39
  // 后续做过滤处理
42
- if (!loginPage || (params?.data?.mode === 'c' && skip)) {
40
+ if (!(loginConfig.web?.length > 0) || (params?.data?.mode === 'c' && skip)) {
43
41
  return params;
44
42
  }
45
43
  const { accessToken } = await getAccessToken();
@@ -60,8 +58,8 @@ setConfig({
60
58
  },
61
59
  async afterCallFunction(params, error, res) {
62
60
  if(params?.data?.params?.action != 'DescribeRuntimeResourceStrategy' && ['InnerError.AuthFailure','InvalidAccessToken'].includes(res?.result?.code)) {
63
- const loginPage = findLoginPage();
64
- if (loginPage) {
61
+ const loginConfig = await getLoginConfig();
62
+ if (loginConfig.web?.length > 0) {
65
63
  const authConfig = await getAuthConfig();
66
64
  const isAnonymous = await checkAnonymous();
67
65
  if (isAnonymous && authConfig.RejectStrategy == 'to_login') {
@@ -140,7 +138,6 @@ function render(props){
140
138
 
141
139
  // if (!process.env.isAdminPortal) {
142
140
  if (!window.__POWERED_BY_QIANKUN__) {
143
- attachFastClick && attachFastClick.attach && attachFastClick.attach(document.body)
144
141
  render()
145
142
  }
146
143
 
@@ -270,7 +270,7 @@ module.exports = function (options) {
270
270
  priority: 100, // 优先级
271
271
  },
272
272
  utils: {
273
- test: /(lodash|dayjs|axios|kbone-api|fastclick)/,
273
+ test: /(lodash|dayjs|axios|kbone-api)/,
274
274
  chunks: 'all',
275
275
  priority: 100, // 优先级
276
276
  },