From a766eb1951a956a8bc34bad7237529c1477e9ef9 Mon Sep 17 00:00:00 2001 From: Fam Zheng Date: Sat, 12 Apr 2025 23:47:19 +0800 Subject: [PATCH] scanner: Update frame page --- scanner/pages/frame/frame.js | 22 +++++++++++++++++++++- scanner/pages/frame/frame.wxml | 3 +++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/scanner/pages/frame/frame.js b/scanner/pages/frame/frame.js index df27d65..a3b9d6d 100644 --- a/scanner/pages/frame/frame.js +++ b/scanner/pages/frame/frame.js @@ -10,7 +10,7 @@ Page({ data: { uploaded: 0, failed: 0, - session_id: Date.now(), + session_id: null, frame_id: 0, next_upload_time: 0, uploading: false, @@ -73,20 +73,24 @@ Page({ }, set_pos() { + const session_id = new Date().toISOString() + "_pos"; this.setData({ label: "pos", pos_class: "active", neg_class: "", stop_class: "", + session_id, }) }, set_neg() { + const session_id = new Date().toISOString() + "_neg"; this.setData({ label: "neg", pos_class: "", neg_class: "active", stop_class: "", + session_id, }) }, stop() { @@ -105,6 +109,7 @@ Page({ }) const listener = ctx.onCameraFrame((res) => { this.handle_frame(res) }); listener.start(); + this.ctx = ctx; }, handle_frame(res) { if (!this.data.label || this.data.uploading) { @@ -150,4 +155,19 @@ Page({ }, }); }, + zoom_1x() { + this.ctx.setZoom({ + zoom: 1, + }); + }, + zoom_2x() { + this.ctx.setZoom({ + zoom: 2, + }); + }, + zoom_4x() { + this.ctx.setZoom({ + zoom: 4, + }); + }, }) \ No newline at end of file diff --git a/scanner/pages/frame/frame.wxml b/scanner/pages/frame/frame.wxml index 51d1423..edf66dd 100644 --- a/scanner/pages/frame/frame.wxml +++ b/scanner/pages/frame/frame.wxml @@ -3,6 +3,9 @@ + + + uploaded: {{ uploaded }} failed: {{ failed }}