From c52cb0db65c51e962faddee14c68973138141e5c Mon Sep 17 00:00:00 2001 From: maochaoying <925670706@qq.com> Date: Tue, 9 May 2023 17:45:14 +0800 Subject: [PATCH] local storage --- index.html | 308 +++++++++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 259 insertions(+), 49 deletions(-) diff --git a/index.html b/index.html index deb765e..2d9b4e1 100644 --- a/index.html +++ b/index.html @@ -38,6 +38,7 @@ height: 100vh; box-sizing: border-box; flex: 1; + max-width: calc(100vw - 500px); } .btn { padding: 36px; @@ -495,133 +496,300 @@ >

ID

- +

BASE

- +

OFFSET

- +

状态

设备状态

- - + +

异常状态

- - + +

当前转速

- - + +

当前位置

- - + +

配置

加速度

- - - + + +

减速度

- - - + + +

速度

- - - + + +

零点偏移

- - - + + +

归零速度

- - - + + +

归零减速度

- - - + + +

归零最大位移

- - - + + +

归零第一阶段移动距离

- - - + + +

动作

速度模式控制

- - + +

位置模式控制

- - + +

位置模式相对位置

- - + +

归零

- - + +

零位校准

- - + +

停止

- - + +

清空异常

- - + +
@@ -645,8 +813,16 @@ window.onload = () => { const commonI = document.querySelector("#common_id"); const commonB = document.querySelector("#common_base"); + const dianI = document.querySelector("#dianji_id"); + const dianB = document.querySelector("#dianji_base"); + const duoI = document.querySelector("#duoji_id"); + const duoB = document.querySelector("#duoji_base"); commonI.value = localStorage.getItem("id"); commonB.value = localStorage.getItem("base"); + dianI.value = localStorage.getItem("d_id"); + dianB.value = localStorage.getItem("d_base"); + duoI.value = localStorage.getItem("du_id"); + duoB.value = localStorage.getItem("du_base"); }; var ws = null; const websocketInput = document.querySelector("#ws_connnect_input"); @@ -672,12 +848,28 @@ const commonI = document.querySelector("#common_id"); const commonB = document.querySelector("#common_base"); + const dianI = document.querySelector("#dianji_id"); + const dianB = document.querySelector("#dianji_base"); + const duoI = document.querySelector("#duoji_id"); + const duoB = document.querySelector("#duoji_base"); commonI.addEventListener("input", (e) => { localStorage.setItem("id", e.target.value); }); commonB.addEventListener("input", (e) => { localStorage.setItem("base", e.target.value); }); + dianI.addEventListener("input", (e) => { + localStorage.setItem("d_id", e.target.value); + }); + dianB.addEventListener("input", (e) => { + localStorage.setItem("d_base", e.target.value); + }); + duoI.addEventListener("input", (e) => { + localStorage.setItem("du_id", e.target.value); + }); + duoB.addEventListener("input", (e) => { + localStorage.setItem("du_base", e.target.value); + }); const tabs = document.querySelector(".tabs"); const tabBars = document.querySelectorAll(".tab-bar .tab"); @@ -912,5 +1104,23 @@