fix: some fixes
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<!--
|
||||
<head>
|
||||
<!--
|
||||
If you are serving your web app in a path other than the root, change the
|
||||
href value below to reflect the base path you are serving from.
|
||||
|
||||
@@ -14,54 +14,55 @@
|
||||
This is a placeholder for base href that will be replaced by the value of
|
||||
the `--base-href` argument provided to `flutter build`.
|
||||
-->
|
||||
<base href="$FLUTTER_BASE_HREF">
|
||||
<base href="$FLUTTER_BASE_HREF" />
|
||||
|
||||
<meta charset="UTF-8">
|
||||
<meta content="IE=Edge" http-equiv="X-UA-Compatible">
|
||||
<meta name="description" content="A new Flutter project.">
|
||||
<meta charset="UTF-8" />
|
||||
<meta content="IE=Edge" http-equiv="X-UA-Compatible" />
|
||||
<meta name="description" content="A new Flutter project." />
|
||||
|
||||
<!-- iOS meta tags & icons -->
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<meta name="apple-mobile-web-app-title" content="flutter_application_1">
|
||||
<link rel="apple-touch-icon" href="icons/Icon-192.png">
|
||||
<!-- iOS meta tags & icons -->
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
|
||||
<meta name="apple-mobile-web-app-title" content="flutter_application_1" />
|
||||
<link rel="apple-touch-icon" href="icons/Icon-192.png" />
|
||||
|
||||
<!-- Favicon -->
|
||||
<link rel="icon" type="image/png" href="favicon.png"/>
|
||||
<!-- Favicon -->
|
||||
<link rel="icon" type="image/png" href="favicon.png" />
|
||||
|
||||
<title>flutter_application_1</title>
|
||||
<link rel='stylesheet' href='css/styles.css'>
|
||||
<link rel="manifest" href="manifest.json">
|
||||
<title>flutter_application_1</title>
|
||||
<link rel="stylesheet" href="css/styles.css" />
|
||||
<link rel="manifest" href="manifest.json" />
|
||||
|
||||
<!-- <script>
|
||||
<!-- <script>
|
||||
// The value below is injected by flutter build, do not touch.
|
||||
const serviceWorkerVersion = null;
|
||||
</script> -->
|
||||
<!-- This script adds the flutter initialization JS code -->
|
||||
<script src="flutter.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
<button id='token'>Token btn</button>
|
||||
<button id='colorChangeBtnRed'>Color btn Red</button>
|
||||
<button id='colorChangeBtnBlue'>Color btn Blue</button>
|
||||
<section class='contents'>
|
||||
<article>
|
||||
<div id="flutter_target"></div>
|
||||
</article>
|
||||
</section>
|
||||
<script>
|
||||
window.addEventListener('load', function(ev) {
|
||||
let target = document.querySelector('#flutter_target');
|
||||
_flutter.loader.loadEntrypoint({
|
||||
onEntrypointLoaded: async function (engineInitializer) {
|
||||
let appRunner = await engineInitializer.initializeEngine({
|
||||
hostElement: target,
|
||||
});
|
||||
await appRunner.runApp();
|
||||
}
|
||||
})
|
||||
});
|
||||
</script>
|
||||
<script src='js/demo-js-interop.js' defer></script>
|
||||
</body>
|
||||
<!-- This script adds the flutter initialization JS code -->
|
||||
<script src="flutter.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
<button id="token">Token btn</button>
|
||||
<button id="token2">Token btn 2</button>
|
||||
<button id="colorChangeBtnRed">Color btn Red</button>
|
||||
<button id="colorChangeBtnBlue">Color btn Blue</button>
|
||||
<section class="contents">
|
||||
<article>
|
||||
<div id="flutter_target"></div>
|
||||
</article>
|
||||
</section>
|
||||
<script>
|
||||
window.addEventListener('load', function (ev) {
|
||||
let target = document.querySelector('#flutter_target');
|
||||
_flutter.loader.loadEntrypoint({
|
||||
onEntrypointLoaded: async function (engineInitializer) {
|
||||
let appRunner = await engineInitializer.initializeEngine({
|
||||
hostElement: target,
|
||||
});
|
||||
await appRunner.runApp();
|
||||
},
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script src="js/demo-js-interop.js" defer></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -7,26 +7,22 @@
|
||||
};
|
||||
let appState = window._appState;
|
||||
|
||||
function getToken() {
|
||||
fetch(
|
||||
'http://gymlink.freemyip.com:8080/api/auth/authorize_client',
|
||||
{
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
GymKey: 'eeb42dcb-8e5b-4f21-825a-3fc7ada43445', // Just testing token
|
||||
id: '123',
|
||||
}),
|
||||
}
|
||||
)
|
||||
function getToken(token) {
|
||||
fetch('http://gymlink.freemyip.com:8080/api/auth/authorize_client', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
GymKey: token, // Just testing token
|
||||
id: '123',
|
||||
}),
|
||||
})
|
||||
.then(res => res.json())
|
||||
.catch(e => {
|
||||
console.log(e);
|
||||
setTimeout(getToken, 1000);
|
||||
})
|
||||
.then(data => {
|
||||
if (data.payload)
|
||||
appState.onTokenReceived(data.payload.token);
|
||||
if (data.payload) appState.checkToken(data.payload.token);
|
||||
else {
|
||||
console.log(data);
|
||||
setTimeout(getToken, 1000);
|
||||
@@ -34,31 +30,28 @@
|
||||
});
|
||||
}
|
||||
|
||||
let btn = document.getElementById('token');
|
||||
btn.addEventListener('click', getToken);
|
||||
const btn = document.getElementById('token');
|
||||
btn.addEventListener('click', () => getToken('eeb42dcb-8e5b-4f21-825a-3fc7ada43445'));
|
||||
|
||||
const btn2 = document.getElementById('token2');
|
||||
btn2.addEventListener('click', () => getToken('a8622a61-3142-487e-8db8-b6aebd4f04aa'));
|
||||
|
||||
let colorChangeBtnRed = document.getElementById('colorChangeBtnRed');
|
||||
colorChangeBtnRed.addEventListener('click', function () {
|
||||
var hexColor = '#FF0000'
|
||||
.replace(
|
||||
/^#?([a-f\d])([a-f\d])([a-f\d])$/i,
|
||||
(m, r, g, b) => '#ff' + r + r + g + g + b + b
|
||||
)
|
||||
.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i, (m, r, g, b) => '#ff' + r + r + g + g + b + b)
|
||||
.substring(1);
|
||||
var numColor = parseInt(hexColor, 16);
|
||||
appState.changeColor(numColor);
|
||||
appState.changeColor(numColor, true);
|
||||
});
|
||||
|
||||
let colorChangeBtnBlue = document.getElementById('colorChangeBtnBlue');
|
||||
colorChangeBtnBlue.addEventListener('click', function () {
|
||||
var hexColor = '#0000FF'
|
||||
.replace(
|
||||
/^#?([a-f\d])([a-f\d])([a-f\d])$/i,
|
||||
(m, r, g, b) => '#ff' + r + r + g + g + b + b
|
||||
)
|
||||
.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i, (m, r, g, b) => '#ff' + r + r + g + g + b + b)
|
||||
.substring(1);
|
||||
var numColor = parseInt(hexColor, 16);
|
||||
appState.changeColor(numColor);
|
||||
appState.changeColor(numColor, false);
|
||||
});
|
||||
|
||||
function onError() {
|
||||
|
||||
Reference in New Issue
Block a user