fix
This commit is contained in:
@ -22,6 +22,7 @@
|
||||
<link rel="stylesheet" href="<?= $resources ?>/css/style.css">
|
||||
<link rel="stylesheet" href="<?= $resources ?>/css/tgApp.css">
|
||||
<script src="https://telegram.org/js/telegram-web-app.js"></script>
|
||||
<script src="https://unpkg.com/html5-qrcode" type="text/javascript"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
23
app/modules/tgbot/views/tgbot/main/card_action.php
Normal file
23
app/modules/tgbot/views/tgbot/main/card_action.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/**
|
||||
* @var \kernel\app_modules\card\models\Card $card
|
||||
*/
|
||||
|
||||
|
||||
use kernel\helpers\Html;
|
||||
|
||||
?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12 m-1">
|
||||
<?php
|
||||
echo Html::img(src: "data:image/png;base64, " . \kernel\app_modules\card\services\CardFileService::createCardPNG($card, true));
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12 m-1">
|
||||
<a class="btn btn-primary" href="/miniapp/add_purchase">Добавить покупку</a>
|
||||
</div>
|
||||
</div>
|
30
app/modules/tgbot/views/tgbot/main/scanner.php
Normal file
30
app/modules/tgbot/views/tgbot/main/scanner.php
Normal file
@ -0,0 +1,30 @@
|
||||
<div id="tg_app">
|
||||
|
||||
</div>
|
||||
<div id="scanner_box"></div>
|
||||
<script>
|
||||
function domReady(fn) {
|
||||
if (
|
||||
document.readyState === "complete" ||
|
||||
document.readyState === "interactive"
|
||||
) {
|
||||
setTimeout(fn, 1000);
|
||||
} else {
|
||||
document.addEventListener("DOMContentLoaded", fn);
|
||||
}
|
||||
}
|
||||
|
||||
domReady(function () {
|
||||
|
||||
// If found you qr code
|
||||
function onScanSuccess(decodeText, decodeResult) {
|
||||
window.location.href = "/miniapp/card_action/" + decodeText;
|
||||
}
|
||||
|
||||
let htmlscanner = new Html5QrcodeScanner(
|
||||
"scanner_box",
|
||||
{fps: 10, qrbox: {width: 250, height: 250}},
|
||||
);
|
||||
htmlscanner.render(onScanSuccess);
|
||||
});
|
||||
</script>
|
Reference in New Issue
Block a user