@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.
- package/lib/builder/core/generate.d.ts.map +1 -1
- package/lib/builder/core/generate.js +2 -0
- package/lib/weapps-core/utils/style.js +0 -8
- package/package.json +1 -1
- package/template/html/index.html.ejs +431 -419
- package/template/package.json +1 -1
- package/template/src/app/global-api.js +1 -1
- package/template/src/handlers/FieldMiddleware/renderer.jsx +1 -1
- package/template/src/handlers/actionHandler/utils.js +1 -1
- package/template/src/handlers/lifecycle.js +1 -1
- package/template/src/handlers/render.jsx +1 -1
- package/template/src/handlers/utils/common.js +36 -24
- package/template/src/handlers/utils/widgets.js +1 -1
- package/template/src/index.jsx +5 -6
- package/template/src/pages/app.tpl +1 -1
- package/template/src/pages/composite.tpl +1 -1
- package/template/src/utils/index.js +1 -1
|
@@ -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,
|
|
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.
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
-
<% }%>
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
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
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
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:
|
|
400
|
-
ext3:
|
|
422
|
+
ext2: e.code,
|
|
423
|
+
ext3: e.requestId,
|
|
401
424
|
trace: 'trace',
|
|
402
425
|
});
|
|
403
426
|
}
|
|
404
|
-
} catch (e) {}
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
.catch(function (e) {
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
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
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
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>
|
package/template/package.json
CHANGED
|
@@ -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
|
|
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
|
|
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 * as React from 'react';
|
|
2
|
-
import { set, cloneDeep } from 'lodash
|
|
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
|
-
|
|
223
|
-
|
|
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 (
|
|
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 (
|
|
251
|
+
if (loginConfig.web?.length > 0 && isAnonymous) {
|
|
237
252
|
if (authConfig.NeedLogin || (!isAccess && authConfig.RejectStrategy === 'to_login')) {
|
|
238
253
|
redirectToLogin($page);
|
|
239
|
-
return
|
|
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
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
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
|
-
|
|
266
|
-
params: {
|
|
267
|
-
|
|
268
|
-
|
|
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
|
|
3
|
+
import { remove } from 'lodash';
|
|
4
4
|
import { checkVisible } from '../../utils/index';
|
|
5
5
|
|
|
6
6
|
export const WidgetsContext = React.createContext({ parent: null });
|
package/template/src/index.jsx
CHANGED
|
@@ -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,
|
|
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
|
|
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 (!
|
|
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
|
|
63
|
-
if (
|
|
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
|
|
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
|
|
4
|
+
import { get } from 'lodash'
|
|
5
5
|
|
|
6
6
|
import { AppRender } from "handlers/render";
|
|
7
7
|
import { createComputed } from "../../../../utils";
|