@hyext/builder-revues 0.0.1-beta.16 → 0.0.1-beta.19
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/dist/index.js +160 -43
- package/package.json +8 -7
- package/static/template/remote-debugger.hbs +61 -0
package/dist/index.js
CHANGED
@@ -15,6 +15,7 @@ var chalk = require('chalk');
|
|
15
15
|
var util = require('util');
|
16
16
|
var glob = require('glob');
|
17
17
|
var handlebars = require('handlebars');
|
18
|
+
var tapable = require('tapable');
|
18
19
|
var liveServer = require('live-server');
|
19
20
|
var archiver = require('archiver');
|
20
21
|
var R = require('ramda');
|
@@ -36,10 +37,18 @@ var EDeployMode;
|
|
36
37
|
EDeployMode[EDeployMode["Separate"] = 1] = "Separate";
|
37
38
|
})(EDeployMode || (EDeployMode = {}));
|
38
39
|
|
39
|
-
const
|
40
|
+
const tempDir = os__default["default"].tmpdir();
|
41
|
+
const cacheDir = path__default["default"].join(tempDir, '.revue_cache');
|
40
42
|
// 根据环境变量判断 要不要把运行框架代码留在项目内 还是 CDN
|
41
43
|
const deployMode = EDeployMode.Integration;
|
42
|
-
const staticPath = path__default["default"].resolve(__dirname, '../static' );
|
44
|
+
const staticPath = path__default["default"].resolve(__dirname, '../static' );
|
45
|
+
var COMPILE_TYPE;
|
46
|
+
(function (COMPILE_TYPE) {
|
47
|
+
COMPILE_TYPE["miniProgram"] = "miniProgram";
|
48
|
+
COMPILE_TYPE["miniProgramPlugin"] = "miniProgramPlugin";
|
49
|
+
COMPILE_TYPE["miniGame"] = "miniGame";
|
50
|
+
COMPILE_TYPE["miniGamePlugin"] = "miniGamePlugin";
|
51
|
+
})(COMPILE_TYPE || (COMPILE_TYPE = {}));
|
43
52
|
|
44
53
|
const filename = 'project.config.json';
|
45
54
|
function copyProjectConfigJSON(srcDir, destDir) {
|
@@ -144,6 +153,45 @@ function renderTemplate(input, output, data) {
|
|
144
153
|
fs__default["default"].outputFileSync(output, render(content, data));
|
145
154
|
}
|
146
155
|
|
156
|
+
const PluginDriver = {
|
157
|
+
context: { deviceOrientation: 'portrait', },
|
158
|
+
hooks: {
|
159
|
+
onMergedMainPackge: new tapable.SyncHook(['IOnMergedMainPackge'])
|
160
|
+
}
|
161
|
+
};
|
162
|
+
|
163
|
+
class InjectWebviewUrlParamsPlugin {
|
164
|
+
apply(pluginDriver) {
|
165
|
+
pluginDriver.hooks.onMergedMainPackge.tap('InjectWebviewUrlParamsPlugin', opts => {
|
166
|
+
const { compileType, mainPath } = opts;
|
167
|
+
let isLandscape = 0;
|
168
|
+
const isGame = compileType === COMPILE_TYPE.miniGame;
|
169
|
+
if (isGame) {
|
170
|
+
const gameJson = fs__default["default"].readJsonSync(path__default["default"].join(mainPath, 'game.json'));
|
171
|
+
if (typeof gameJson.deviceOrientation === 'string' &&
|
172
|
+
gameJson.deviceOrientation.includes('landscape')) {
|
173
|
+
isLandscape = 1;
|
174
|
+
}
|
175
|
+
}
|
176
|
+
pluginDriver.context.webviewUrlParams = {
|
177
|
+
isLandscape,
|
178
|
+
disablePopGesture: 1,
|
179
|
+
hideStatusBar: isGame ? 1 : 0,
|
180
|
+
hideBar: 1,
|
181
|
+
bounces: 0
|
182
|
+
};
|
183
|
+
});
|
184
|
+
}
|
185
|
+
}
|
186
|
+
function makeWebviewUrlParamsStr() {
|
187
|
+
const params = PluginDriver.context.webviewUrlParams;
|
188
|
+
return params ? Object.keys(params).reduce((str, key) => {
|
189
|
+
// @ts-ignore
|
190
|
+
str += `&${key}=${encodeURIComponent(params[key])}`;
|
191
|
+
return str;
|
192
|
+
}, '') : '';
|
193
|
+
}
|
194
|
+
|
147
195
|
function isMainPackage(config) {
|
148
196
|
return config.name === codeCompiler.pkgFileType.MainPkg && config.root === '.';
|
149
197
|
}
|
@@ -234,7 +282,7 @@ function mergeGamePackage(releasePath, opts) {
|
|
234
282
|
const { mainPakConf, packagePath } = mergeMainPackage(watch, releasePath);
|
235
283
|
const templatePath = path__default["default"].join(staticPath, 'template');
|
236
284
|
const mainPath = path__default["default"].join(packagePath, mainPakConf.name);
|
237
|
-
const entrys = builderConfig.supportExtTypes.map(
|
285
|
+
const entrys = builderConfig.supportExtTypes.map(extType => {
|
238
286
|
const entryFilename = `index_${extType}.html`;
|
239
287
|
return {
|
240
288
|
extType,
|
@@ -247,6 +295,11 @@ function mergeGamePackage(releasePath, opts) {
|
|
247
295
|
entryFilename
|
248
296
|
};
|
249
297
|
});
|
298
|
+
PluginDriver.hooks.onMergedMainPackge.call({
|
299
|
+
mainConf: mainPakConf,
|
300
|
+
mainPath,
|
301
|
+
compileType: COMPILE_TYPE.miniGame
|
302
|
+
});
|
250
303
|
if (!watch) {
|
251
304
|
// 渲染模版
|
252
305
|
renderGameTemplate({
|
@@ -256,23 +309,40 @@ function mergeGamePackage(releasePath, opts) {
|
|
256
309
|
: publicPath,
|
257
310
|
templatePath,
|
258
311
|
mainPath,
|
312
|
+
extUuid,
|
259
313
|
...opts.template
|
260
314
|
});
|
261
315
|
// wasn文件 会被 cocos 同步请求,由于二进制文件同步请求失败 所以改为 base64 文本
|
262
316
|
transformWasnFileToBase64File(mainPath);
|
263
317
|
}
|
264
|
-
return
|
318
|
+
return {
|
319
|
+
entrys,
|
320
|
+
mainPublicPath: 'package/' + mainPakConf.name
|
321
|
+
};
|
265
322
|
}
|
323
|
+
// mark 热更新 整个函数不会重渲染。
|
266
324
|
function renderGameTemplate(opts) {
|
267
|
-
const { mainPath, sourcePathPrefix, templatePath, entrys, debug } = opts;
|
268
|
-
const
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
325
|
+
const { mainPath, sourcePathPrefix, templatePath, entrys, debug, dev, extUuid } = opts;
|
326
|
+
const renderConfigList = [
|
327
|
+
{
|
328
|
+
input: path__default["default"].join(templatePath, 'game-frame.hbs'),
|
329
|
+
output: path__default["default"].join(mainPath, 'game-frame.html'),
|
330
|
+
data: {
|
331
|
+
sourcePathPrefix
|
332
|
+
}
|
273
333
|
}
|
274
|
-
|
275
|
-
|
334
|
+
];
|
335
|
+
if (dev) {
|
336
|
+
renderConfigList.push({
|
337
|
+
input: path__default["default"].join(templatePath, 'remote-debugger.hbs'),
|
338
|
+
output: path__default["default"].join(mainPath, 'remote-debugger.html'),
|
339
|
+
data: {
|
340
|
+
extUuid,
|
341
|
+
paramsStr: makeWebviewUrlParamsStr()
|
342
|
+
}
|
343
|
+
});
|
344
|
+
}
|
345
|
+
const entryRenderConfList = entrys.map(info => {
|
276
346
|
return {
|
277
347
|
input: path__default["default"].join(templatePath, 'minigame-page-manager.hbs'),
|
278
348
|
output: path__default["default"].join(mainPath, info.entryFilename),
|
@@ -283,8 +353,7 @@ function renderGameTemplate(opts) {
|
|
283
353
|
}
|
284
354
|
};
|
285
355
|
});
|
286
|
-
|
287
|
-
entryRenderConfList.concat(gameFrameRenderItem).forEach(config => {
|
356
|
+
entryRenderConfList.concat(renderConfigList).forEach(config => {
|
288
357
|
renderTemplate(config.input, config.output, config.data);
|
289
358
|
});
|
290
359
|
}
|
@@ -305,7 +374,7 @@ function transformWasnFileToBase64File(mainPath) {
|
|
305
374
|
nodir: true,
|
306
375
|
absolute: false
|
307
376
|
});
|
308
|
-
console.log('transform wasm to base64 files: \n', files);
|
377
|
+
files.length && console.log('transform wasm to base64 files: \n', files);
|
309
378
|
files.forEach(file => {
|
310
379
|
const abs = path__default["default"].join(mainPath, file);
|
311
380
|
const text = fs__default["default"].readFileSync(abs).toString('base64');
|
@@ -334,7 +403,7 @@ function mergeMiniprogramPackage(releasePath, opts) {
|
|
334
403
|
const extConfig = getPackageExtConfig(packagePath);
|
335
404
|
const templatePath = path__default["default"].join(staticPath, 'template');
|
336
405
|
const mainPath = path__default["default"].join(packagePath, mainPakConf.name);
|
337
|
-
const entrys = builderConfig.supportExtTypes.map(
|
406
|
+
const entrys = builderConfig.supportExtTypes.map(extType => {
|
338
407
|
const entryFilename = `index_${extType}.html`;
|
339
408
|
return {
|
340
409
|
extType,
|
@@ -347,6 +416,11 @@ function mergeMiniprogramPackage(releasePath, opts) {
|
|
347
416
|
entryFilename
|
348
417
|
};
|
349
418
|
});
|
419
|
+
PluginDriver.hooks.onMergedMainPackge.call({
|
420
|
+
mainConf: mainPakConf,
|
421
|
+
mainPath,
|
422
|
+
compileType: COMPILE_TYPE.miniProgram
|
423
|
+
});
|
350
424
|
if (!watch) {
|
351
425
|
// 渲染模版
|
352
426
|
renderMiniprogramTemplate({
|
@@ -357,22 +431,35 @@ function mergeMiniprogramPackage(releasePath, opts) {
|
|
357
431
|
packageExtConfig: extConfig,
|
358
432
|
templatePath,
|
359
433
|
mainPath,
|
434
|
+
extUuid,
|
360
435
|
...opts.template
|
361
436
|
});
|
362
437
|
}
|
363
|
-
return entrys;
|
438
|
+
return { entrys, mainPublicPath: 'package/' + mainPakConf.name };
|
364
439
|
}
|
365
440
|
function renderMiniprogramTemplate(opts) {
|
366
|
-
const { mainPath, sourcePathPrefix, templatePath, entrys, packageExtConfig, debug } = opts;
|
441
|
+
const { mainPath, sourcePathPrefix, templatePath, entrys, packageExtConfig, debug, dev, extUuid } = opts;
|
367
442
|
const packageExtConfigStr = JSON.stringify(packageExtConfig);
|
368
|
-
const
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
443
|
+
const renderConfigList = [
|
444
|
+
{
|
445
|
+
input: path__default["default"].join(templatePath, 'service.hbs'),
|
446
|
+
output: path__default["default"].join(mainPath, 'service.html'),
|
447
|
+
data: {
|
448
|
+
sourcePathPrefix
|
449
|
+
}
|
373
450
|
}
|
374
|
-
|
375
|
-
|
451
|
+
];
|
452
|
+
if (dev) {
|
453
|
+
renderConfigList.push({
|
454
|
+
input: path__default["default"].join(templatePath, 'remote-debugger.hbs'),
|
455
|
+
output: path__default["default"].join(mainPath, 'remote-debugger.html'),
|
456
|
+
data: {
|
457
|
+
extUuid,
|
458
|
+
paramsStr: makeWebviewUrlParamsStr()
|
459
|
+
}
|
460
|
+
});
|
461
|
+
}
|
462
|
+
const entryRenderConfList = entrys.map(info => {
|
376
463
|
return {
|
377
464
|
input: path__default["default"].join(templatePath, 'miniapp-page-manager.hbs'),
|
378
465
|
output: path__default["default"].join(mainPath, info.entryFilename),
|
@@ -384,12 +471,15 @@ function renderMiniprogramTemplate(opts) {
|
|
384
471
|
}
|
385
472
|
};
|
386
473
|
});
|
387
|
-
|
388
|
-
entryRenderConfList.concat(serviceRenderItem).forEach(config => {
|
474
|
+
entryRenderConfList.concat(renderConfigList).forEach(config => {
|
389
475
|
renderTemplate(config.input, config.output, config.data);
|
390
476
|
});
|
391
477
|
}
|
392
478
|
|
479
|
+
function initPlugins(pluginDriver) {
|
480
|
+
new InjectWebviewUrlParamsPlugin().apply(pluginDriver);
|
481
|
+
}
|
482
|
+
|
393
483
|
var httpsConf = {
|
394
484
|
cert: fs__default["default"].readFileSync(path__default["default"].join(staticPath, "./certs/cert.pem")),
|
395
485
|
key: fs__default["default"].readFileSync(path__default["default"].join(staticPath, "./certs/key.pem")),
|
@@ -434,17 +524,19 @@ function compress(output) {
|
|
434
524
|
});
|
435
525
|
}
|
436
526
|
|
527
|
+
// 36PX
|
437
528
|
async function makeBuildResults(mode, opts) {
|
438
529
|
const { baseURI, entrys, outputPath } = opts;
|
439
530
|
const releasePath = path__default["default"].join(outputPath, 'build-result');
|
440
531
|
const buildResultMap = {};
|
532
|
+
const paramsStr = makeWebviewUrlParamsStr();
|
441
533
|
const buildResultList = entrys.map(info => {
|
442
534
|
const result = {
|
443
535
|
type: 'HTML',
|
444
536
|
content: {
|
445
537
|
pages: [
|
446
538
|
{
|
447
|
-
path: getPagePath(info)
|
539
|
+
path: getPagePath(info, paramsStr)
|
448
540
|
}
|
449
541
|
],
|
450
542
|
baseURI
|
@@ -466,12 +558,12 @@ async function makeBuildResults(mode, opts) {
|
|
466
558
|
}
|
467
559
|
return buildResultMap;
|
468
560
|
}
|
469
|
-
function getPagePath(entryInfo) {
|
561
|
+
function getPagePath(entryInfo, extraParams) {
|
470
562
|
const extType = entryInfo.extType;
|
471
563
|
let entry = entryInfo.entryPath;
|
472
564
|
// 移动端需要补 __module_busi__
|
473
565
|
if (extType.endsWith('_h5')) {
|
474
|
-
entry += '?__module_busi__=kiwi-ExtSDK';
|
566
|
+
entry += '?__module_busi__=kiwi-ExtSDK' + extraParams;
|
475
567
|
}
|
476
568
|
return entry;
|
477
569
|
}
|
@@ -502,6 +594,7 @@ const getPublicIP = (config) => {
|
|
502
594
|
};
|
503
595
|
|
504
596
|
const supportedExtTypeSet = new Set([
|
597
|
+
"app_inner_h5",
|
505
598
|
'web_video_com',
|
506
599
|
'app_panel_h5',
|
507
600
|
'zs_anchor_panel_h5',
|
@@ -553,6 +646,17 @@ function getDevBaseURI(config) {
|
|
553
646
|
return `${protocol}://${config.host}:${config.port}/`;
|
554
647
|
}
|
555
648
|
|
649
|
+
function checkAppId(project) {
|
650
|
+
const appId = project.appId || project.appid;
|
651
|
+
if (appId == null || appId === '') {
|
652
|
+
logger.fatal('请填写正确的appid');
|
653
|
+
}
|
654
|
+
else if (appId.length > 10) {
|
655
|
+
logger.fatal('appid错误,请登录 https://ext.huya.com/ 在您的小程序概要中查看小程序ID');
|
656
|
+
}
|
657
|
+
return appId;
|
658
|
+
}
|
659
|
+
|
556
660
|
function mergePackage(projectConfig, outputPath, opts) {
|
557
661
|
logger.log('正在合并分包...');
|
558
662
|
const mergeMethod = projectConfig.compileType == 'game'
|
@@ -562,7 +666,14 @@ function mergePackage(projectConfig, outputPath, opts) {
|
|
562
666
|
logger.success('合并分包完成');
|
563
667
|
return entryInfo;
|
564
668
|
}
|
669
|
+
function getTempProjectDir(projectDir) {
|
670
|
+
return path__default["default"].join(tempDir, '.revues-projects', path__default["default"].basename(projectDir));
|
671
|
+
}
|
565
672
|
class RevueBuilder {
|
673
|
+
constructor() {
|
674
|
+
// 单例 PluginDriver 更加灵活
|
675
|
+
initPlugins(PluginDriver);
|
676
|
+
}
|
566
677
|
// 这里拿到打包好的代码 原样输出 + build result
|
567
678
|
async build(opts) {
|
568
679
|
const { inputPath, outputPath, publicPath, projectConfig, config, extUuid } = opts;
|
@@ -570,8 +681,9 @@ class RevueBuilder {
|
|
570
681
|
fs__default["default"].existsSync(outputPath) && fs__default["default"].removeSync(outputPath);
|
571
682
|
// 把 inputPath 的文件 迁移到 outputPath
|
572
683
|
await fs__default["default"].copy(inputPath, outputPath, { overwrite: true });
|
573
|
-
const entrys = mergePackage(projectConfig, outputPath, {
|
574
|
-
builderConfig: processedConfig
|
684
|
+
const { entrys } = mergePackage(projectConfig, outputPath, {
|
685
|
+
builderConfig: processedConfig,
|
686
|
+
extUuid
|
575
687
|
});
|
576
688
|
return await makeBuildResults('production', {
|
577
689
|
entrys: entrys,
|
@@ -581,41 +693,46 @@ class RevueBuilder {
|
|
581
693
|
}
|
582
694
|
async start(opts) {
|
583
695
|
const { debug, inputPath, projectConfig, outputPath: outputPath$1, config } = opts;
|
584
|
-
const outputPath =
|
696
|
+
const outputPath = getTempProjectDir(path__default["default"].dirname(inputPath))
|
697
|
+
;
|
698
|
+
const appId = checkAppId(projectConfig);
|
585
699
|
const processedConfig = processBuilderConfigJSON('development', config);
|
586
700
|
if (projectConfig.compileType == 'game') {
|
587
701
|
await watchGame(inputPath, outputPath, () => {
|
588
702
|
mergePackage(projectConfig, outputPath, {
|
589
|
-
|
590
|
-
|
703
|
+
builderConfig: processedConfig,
|
704
|
+
watch: true
|
591
705
|
});
|
592
706
|
});
|
593
707
|
}
|
594
708
|
else {
|
595
709
|
await watch(inputPath, outputPath, () => {
|
596
710
|
mergePackage(projectConfig, outputPath, {
|
597
|
-
|
598
|
-
|
711
|
+
builderConfig: processedConfig,
|
712
|
+
watch: true
|
599
713
|
});
|
600
714
|
});
|
601
715
|
}
|
602
|
-
const entrys = mergePackage(projectConfig, outputPath, {
|
716
|
+
const { entrys, mainPublicPath } = mergePackage(projectConfig, outputPath, {
|
603
717
|
builderConfig: processedConfig,
|
718
|
+
extUuid: appId,
|
604
719
|
template: {
|
605
|
-
debug
|
720
|
+
debug,
|
721
|
+
dev: true
|
606
722
|
}
|
607
723
|
});
|
608
724
|
logger.log('启动 live server 服务...');
|
609
|
-
logger.success('本地访问地址:', getDevBaseURI(processedConfig) +
|
610
|
-
|
725
|
+
logger.success('本地访问地址:', getDevBaseURI(processedConfig) + entrys[0]?.entryPath);
|
726
|
+
logger.success('扫码预览地址:', getDevBaseURI(processedConfig) + mainPublicPath + '/remote-debugger.html');
|
611
727
|
startLiveServer({
|
612
728
|
...processedConfig,
|
613
|
-
root: outputPath
|
729
|
+
root: outputPath,
|
730
|
+
ignore: 'node_modules'
|
614
731
|
});
|
615
732
|
return await makeBuildResults('development', {
|
616
733
|
entrys,
|
617
734
|
baseURI: getDevBaseURI(processedConfig),
|
618
|
-
outputPath
|
735
|
+
outputPath: outputPath$1
|
619
736
|
});
|
620
737
|
}
|
621
738
|
// 这里仅仅在 client 打包 小程序/小游戏
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@hyext/builder-revues",
|
3
|
-
"version": "0.0.1-beta.
|
3
|
+
"version": "0.0.1-beta.19",
|
4
4
|
"description": "> TODO: description",
|
5
5
|
"author": "diamondloler <857276958@qq.com>",
|
6
6
|
"homepage": "",
|
@@ -22,11 +22,11 @@
|
|
22
22
|
},
|
23
23
|
"scripts": {},
|
24
24
|
"dependencies": {
|
25
|
-
"@revues/cocos-web-adapter": "0.0.1-beta.
|
26
|
-
"@revues/code-compiler": "0.0.1-beta.
|
27
|
-
"@revues/hyext-adapter": "0.0.1-beta.
|
28
|
-
"@revues/web-frame": "0.0.1-beta.
|
29
|
-
"@revues/web-sdk-core": "0.0.1-beta.
|
25
|
+
"@revues/cocos-web-adapter": "0.0.1-beta.19",
|
26
|
+
"@revues/code-compiler": "0.0.1-beta.19",
|
27
|
+
"@revues/hyext-adapter": "0.0.1-beta.19",
|
28
|
+
"@revues/web-frame": "0.0.1-beta.19",
|
29
|
+
"@revues/web-sdk-core": "0.0.1-beta.19",
|
30
30
|
"archiver": "^7.0.1",
|
31
31
|
"chalk": "^2.4.2",
|
32
32
|
"fs-extra": "8.1.0",
|
@@ -34,6 +34,7 @@
|
|
34
34
|
"handlebars": "^4.7.8",
|
35
35
|
"live-server": "^1.2.2",
|
36
36
|
"ramda": "^0.29.1",
|
37
|
+
"tapable": "^2.2.1",
|
37
38
|
"util": "^0.12.5"
|
38
39
|
},
|
39
40
|
"devDependencies": {
|
@@ -41,5 +42,5 @@
|
|
41
42
|
"@types/live-server": "^1.2.3",
|
42
43
|
"@types/ramda": "^0.29.11"
|
43
44
|
},
|
44
|
-
"gitHead": "
|
45
|
+
"gitHead": "467b64993d87fa2aa48440c32a3760a1617a8952"
|
45
46
|
}
|
@@ -0,0 +1,61 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en"><head>
|
3
|
+
<meta charset="UTF-8">
|
4
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
5
|
+
<title>扫码预览</title>
|
6
|
+
<script charset="UTF-8" src="https://cdnjs.cloudflare.com/ajax/libs/qrcode/1.5.1/qrcode.min.js"></script>
|
7
|
+
<style>
|
8
|
+
* {
|
9
|
+
box-sizing: border-box;
|
10
|
+
}
|
11
|
+
a {
|
12
|
+
color: blue;
|
13
|
+
}
|
14
|
+
body,html {
|
15
|
+
height: 100%;
|
16
|
+
width: 100%;
|
17
|
+
|
18
|
+
font-size: 16px;
|
19
|
+
color: #333;
|
20
|
+
}
|
21
|
+
body {
|
22
|
+
display: flex;
|
23
|
+
flex-direction: column;
|
24
|
+
flex: 1;
|
25
|
+
margin: 0;
|
26
|
+
position: relative;
|
27
|
+
}
|
28
|
+
.container {
|
29
|
+
display: flex;
|
30
|
+
flex-direction: column;
|
31
|
+
flex: 1;
|
32
|
+
justify-content: center;
|
33
|
+
align-items: center;
|
34
|
+
}
|
35
|
+
.title {
|
36
|
+
font-weight: bold;
|
37
|
+
}
|
38
|
+
.tip {
|
39
|
+
font-size: 14px;
|
40
|
+
line-height: 26px;
|
41
|
+
}
|
42
|
+
</style>
|
43
|
+
</head>
|
44
|
+
|
45
|
+
<body>
|
46
|
+
<div class="container">
|
47
|
+
<canvas id="canvas"></canvas>
|
48
|
+
<span class="title">扫码调试</span>
|
49
|
+
<span class="tip">如未绑定全局小程序下发,请先<a href="">绑定</a></span>
|
50
|
+
<span class="tip">如需查看 vconsole, 可在 project.config.json 把 debug 字段设置为 true 或在 cocos ide 打包时勾上调试选项</a></span>
|
51
|
+
</div>
|
52
|
+
<script>
|
53
|
+
var url = 'https://m.huya.com?hyaction=hyminiprogram&extuuid={{ extUuid }}{{paramsStr}}'
|
54
|
+
var canvas = document.getElementById('canvas')
|
55
|
+
QRCode.toCanvas(canvas, url, {width: 200}, function (error) {
|
56
|
+
if (error) console.error(error)
|
57
|
+
console.log('success!');
|
58
|
+
})
|
59
|
+
</script>
|
60
|
+
</body>
|
61
|
+
</html>
|