fix: frontend

This commit is contained in:
Tony Yang 2023-01-09 21:06:29 +08:00
parent 458b8805ff
commit af597adb7e
Signed by: t510599
GPG Key ID: D88388851C28715D

View File

@ -8,23 +8,10 @@
<link rel="stylesheet" href="https://cdn.simplecss.org/simple.min.css"> <link rel="stylesheet" href="https://cdn.simplecss.org/simple.min.css">
<title>Automated Garbage Segregation</title> <title>Automated Garbage Segregation</title>
<style> <style>
/* strict dark theme from simple.css */ body {
/* :root { grid-template-columns: 1fr min(75rem, 90%) 1fr;
color-scheme:dark;
--bg: #212121;
--accent-bg: #2b2b2b;
--text: #dcdcdc;
--text-light: #ababab;
--accent: #ffb300;
--code: #f06292;
--preformatted: #ccc;
--disabled: #111
} }
img,video {
opacity: .8
} */
body, html { body, html {
padding: 0; padding: 0;
margin: 0; margin: 0;
@ -50,7 +37,9 @@
<body> <body>
<div id="main" v-scope @mounted="mounted()" @unmounted="unmounted()"> <div id="main" v-scope @mounted="mounted()" @unmounted="unmounted()">
<div id="image"> <div id="image">
<img :src="image" alt="item"> <img v-if="state =='put'" :src="placeholder" alt="placeholder">
<img v-else-if="state =='camera'" :src="loader" alt="loader">
<img v-else :src="imageUrl" alt="item">
</div> </div>
<div id="status"> <div id="status">
<h1>{{ status }}</h1> <h1>{{ status }}</h1>
@ -66,12 +55,6 @@
imageUrl: "/photo", imageUrl: "/photo",
type: "未知", type: "未知",
state: "put", state: "put",
get image() {
if (this.state == "put") return this.placeholder;
if (this.state == "camera") return this.loader;
return this.imageUrl;
},
get status() { get status() {
let data = { let data = {
"put": "請放置垃圾", "put": "請放置垃圾",
@ -94,7 +77,6 @@
update(data) { update(data) {
let state = data.state; let state = data.state;
if (state == "identified") this.type = data.type; if (state == "identified") this.type = data.type;
if (state == "identify") this.imageUrl = data.imageUrl;
this.state = state; this.state = state;
}, },