From a6580355a286c8f62961426d302d15ba3760ef2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E5=91=98=E5=B0=8F=E5=A2=A8?= <2291200076@qq.com> Date: Sat, 15 Apr 2023 23:47:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E7=AB=AF=E6=89=AB?= =?UTF-8?q?=E9=97=A8=E7=A6=81=E7=A0=81=E8=B7=B3=E8=BD=AC=EF=BC=9B=E9=97=A8?= =?UTF-8?q?=E7=A6=81=E7=AB=AF=E8=B0=83=E6=95=B4=EF=BC=9Bbugfix=E5=B0=8F?= =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E7=AB=AF=E5=95=86=E5=93=81=E5=94=AE=E4=BB=B7?= =?UTF-8?q?=E5=92=8C=E5=88=92=E7=BA=BF=E4=BB=B7=E5=8F=8D=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TODOs.md | 27 +- .../epp/access/controller/GateController.java | 22 +- .../epp/access/service/GateService.java | 3 + .../static/access/assets/css/index.css | 86 +- .../access/assets/css/setting-panel.css | 129 ++- .../static/access/assets/js/setting-panel.js | 11 +- .../main/resources/static/access/index.html | 77 +- .../main/resources/static/access/renderer.js | 149 ++- database/epp.sql | 967 +++++++++--------- .../epp.postman_collection.json | 361 +++++++ .../image/icon/gate-background.svg | 1 + weixin-miniprogram/pages/index/index.js | 7 +- weixin-miniprogram/pages/scan/entrance.js | 54 +- weixin-miniprogram/pages/scan/entrance.json | 3 +- weixin-miniprogram/pages/scan/entrance.wxml | 31 +- weixin-miniprogram/pages/scan/entrance.wxss | 9 +- weixin-miniprogram/pages/shop/goodDetail.wxml | 12 +- weixin-miniprogram/pages/shop/goodDetail.wxss | 4 +- weixin-miniprogram/services/gate.js | 15 + weixin-miniprogram/utils/scanQRCode.js | 12 +- 20 files changed, 1315 insertions(+), 665 deletions(-) create mode 100644 weixin-miniprogram/image/icon/gate-background.svg create mode 100644 weixin-miniprogram/services/gate.js diff --git a/TODOs.md b/TODOs.md index 7ff7c40..5413d18 100644 --- a/TODOs.md +++ b/TODOs.md @@ -1,7 +1,30 @@ 还要做的部分 -社区、系统管理员后台管理 frontend项目 -小程序扫门禁码之后门禁开门 + + +购物车隐藏 + +首页密码修改 + +大门人员进出后台管理 + +首页加一个扫门禁码 + +订单发货小程序端显示 + +小程序扫门禁码之后门禁开门(扫码 websocket 推到门禁端) + +门禁段显示大门开放状态 + +后台管理两个端分开 + +小程序提审(项目部署到服务器,提审时隐藏小商店) + + +数据库填充测试数据(以及创建一些测试账号)并备份,线上演示数据修改删除避免真删 + + + 小程序修改密码 # IP 配置 diff --git a/backend/microservice-provider-access-8002/src/main/java/com/cxyxiaomo/epp/access/controller/GateController.java b/backend/microservice-provider-access-8002/src/main/java/com/cxyxiaomo/epp/access/controller/GateController.java index cdc7e46..2c1fa88 100644 --- a/backend/microservice-provider-access-8002/src/main/java/com/cxyxiaomo/epp/access/controller/GateController.java +++ b/backend/microservice-provider-access-8002/src/main/java/com/cxyxiaomo/epp/access/controller/GateController.java @@ -47,6 +47,20 @@ public class GateController { return Res.success(gateVOList); } + /** + * 获取大门详情(小程序端) + * + * @return + */ + @GetMapping("/miniprogram/detail") + @ResponseBody + public Res getGateDetail(String id) { + Long gateId = Long.valueOf(id); + Gate gate = gateService.getGateById(gateId); + GateVO gateVO = GateVO.convertFrom(gate); + return Res.success(gateVO); + } + /** * 获取大门列表 * @@ -77,10 +91,10 @@ public class GateController { "大门名称", FieldBuilder.EDIT_PLACEHOLDER_SAME_AS_ADD_PLACEHOLDER, FieldRuleListBuilder.create() .add(FieldRuleBuilder.create("大门名称").required()) - .add(FieldRuleBuilder.create("大门名称").minMax(2, 15)), - "DPD @cword(2, 15)" + .add(FieldRuleBuilder.create("大门名称").minMax(2, 12)), + "DPD @cword(2, 12)" ) - .add("open", "open", "状态", true, + .add("open", "openStatus", "状态", true, FieldType.TEXT, SearchType.SELECT, AddType.SELECT, EditType.SELECT, FieldBuilder.SEARCH_PLACEHOLDER_SAME_AS_FIELDNAME, "状态", FieldBuilder.EDIT_PLACEHOLDER_SAME_AS_ADD_PLACEHOLDER, @@ -96,7 +110,7 @@ public class GateController { stateMap.put(false, "禁止通行"); // build JSONArray fieldMapper = FieldMapperBuilder.create() - .add("open", "open", stateMap) + .add("open", "openStatus", stateMap) .build(); // 拼装返回结果 diff --git a/backend/microservice-provider-access-8002/src/main/java/com/cxyxiaomo/epp/access/service/GateService.java b/backend/microservice-provider-access-8002/src/main/java/com/cxyxiaomo/epp/access/service/GateService.java index fbfed93..0fdd73f 100644 --- a/backend/microservice-provider-access-8002/src/main/java/com/cxyxiaomo/epp/access/service/GateService.java +++ b/backend/microservice-provider-access-8002/src/main/java/com/cxyxiaomo/epp/access/service/GateService.java @@ -17,6 +17,9 @@ public class GateService { public Gate getGateById(Long id) { + if (id == null) { + return null; + } return gateDao.getGateById(id); } diff --git a/backend/microservice-provider-access-8002/src/main/resources/static/access/assets/css/index.css b/backend/microservice-provider-access-8002/src/main/resources/static/access/assets/css/index.css index 3454ab6..648ddef 100644 --- a/backend/microservice-provider-access-8002/src/main/resources/static/access/assets/css/index.css +++ b/backend/microservice-provider-access-8002/src/main/resources/static/access/assets/css/index.css @@ -1,81 +1,89 @@ * { - margin: 0; - padding: 0; + margin: 0; + padding: 0; } + html, body { - height: 100%; + height: 100%; } .container { - width: 100%; - height: 100%; - background-color: #0556c6; - display: grid; - grid-template-columns: 3fr 4fr; - place-items: center; - color: white; + width: 100%; + height: 100%; + background-color: #0556c6; + display: grid; + grid-template-columns: 3fr 4fr; + grid-template-rows: 60px 1fr; + place-items: center; + color: white; } +.top-container { + grid-column-start: 1; + grid-column-end: 3; +} + +.top-container, .left-container { - text-shadow: 2px 2px 2px #00000066; + text-shadow: 2px 2px 2px #00000066; } h1 { - margin-bottom: 30px; - font-size: 4vw; + margin-bottom: 30px; + font-size: 4vw; } h3 { - margin-bottom: 10px; - margin-top: 22px; - font-size: 2vw; + margin-bottom: 10px; + margin-top: 22px; + font-size: 2vw; } p { - font-size: 1.4vw; - line-height: 1.5em; + font-size: 1.4vw; + line-height: 1.5em; } .right-container { } #qrcode { - box-shadow: 0px 0px 17px 12px rgb(0 0 0 / 50%); - border-radius: 50%; - display: block; - width: min(40vw, 68vh); - height: min(40vw, 68vh); + box-shadow: 0px 0px 17px 12px rgb(0 0 0 / 50%); + border-radius: 50%; + display: block; + width: min(40vw, 68vh); + height: min(40vw, 68vh); } #refreshTimeCountDown { - text-align: center; - margin-top: 30px; - font-size: 2em; - color: #ffffff9c; + text-align: center; + margin-top: 30px; + font-size: 2em; + color: #ffffff9c; } /* 右上角按钮 */ .ctrl-btn { - position: absolute; - right: 0; - top: 0; - padding: 10px; + position: absolute; + right: 0; + top: 0; + padding: 10px; } .btn { - width: 32px; - height: 32px; - cursor: pointer; - filter: invert(1) opacity(0.8); + width: 32px; + height: 32px; + cursor: pointer; + filter: invert(1) opacity(0.8); } .btn-ctrl { - margin-left: 2px; - vertical-align: middle; + margin-left: 2px; + vertical-align: middle; } #fullscreen-button { - width: 28px; - height: 28px; + width: 28px; + height: 28px; } diff --git a/backend/microservice-provider-access-8002/src/main/resources/static/access/assets/css/setting-panel.css b/backend/microservice-provider-access-8002/src/main/resources/static/access/assets/css/setting-panel.css index 3d6a88e..1ef16c7 100644 --- a/backend/microservice-provider-access-8002/src/main/resources/static/access/assets/css/setting-panel.css +++ b/backend/microservice-provider-access-8002/src/main/resources/static/access/assets/css/setting-panel.css @@ -1,66 +1,109 @@ .full-screen-mask { - position: fixed; - width: 100%; - height: 100%; - top: 0; - left: 0; - z-index: 10; - background-color: black; - opacity: 0.35; + position: fixed; + width: 100%; + height: 100%; + top: 0; + left: 0; + z-index: 10; + background-color: black; + opacity: 0.35; } .setting-container { - position: fixed; - width: 100%; - height: 100%; - top: 0; - left: 0; - z-index: 20; - display: grid; - place-items: center; + position: fixed; + width: 100%; + height: 100%; + top: 0; + left: 0; + z-index: 20; + display: grid; + place-items: center; } .setting-panel { - width: 320px; - height: 450px; - background-color: white; - border-radius: 40px; - position: relative; - padding: 14px; - box-sizing: border-box; + width: 320px; + height: 450px; + background-color: white; + border-radius: 40px; + position: relative; + padding: 14px; + box-sizing: border-box; } #close-setting-button { - position: absolute; - right: -17px; - top: -21px; - transform: rotate(12deg) scale(0.9); - transition: 0.3s; + position: absolute; + right: -17px; + top: -21px; + transform: rotate(12deg) scale(0.9); + transition: 0.3s; } #close-setting-button:hover { - transform: rotate(102deg) scale(1.1); + transform: rotate(102deg) scale(1.1); } .save-button-container { - position: absolute; - bottom: 20px; - left: 0; - right: 0; + position: absolute; + bottom: 20px; + left: 0; + right: 0; } .save-setting-button { - width: 120px; - font-weight: 200; - font-size: 1.1em; - color: white; - background-color: #0556C6; - border: none; - border-radius: 5px; - height: 32px; - cursor: pointer; + width: 120px; + font-weight: 200; + font-size: 1.1em; + color: white; + background-color: #0556C6; + border: none; + border-radius: 5px; + height: 32px; + cursor: pointer; } .hidden { - display: none; + display: none; +} + +/* 弹窗列表样式 */ +#gate-list { + width: 100%; + height: 70%; + /*box-shadow: 0 2px 10px 0 rgb(0 0 0 / 19%);*/ + overflow-x: hidden; + overflow-y: scroll; +} + +.gate-list-item { + display: grid; + grid-template-columns: 1fr 70px; + height: 50px; + margin: 8px 10px; + box-sizing: border-box; + place-items: center; + background-color: #f6f6f6; +} + +.gate-list-item > p { + font-size: 14px; +} + +.gate-list-item:hover { + background-color: #dcdcdc; +} + +.gate-list-item.active { + background-color: #b7b7b7; +} + +.status { + font-weight: bold; +} + +.open { + color: green; +} + +.closed { + color: red; } diff --git a/backend/microservice-provider-access-8002/src/main/resources/static/access/assets/js/setting-panel.js b/backend/microservice-provider-access-8002/src/main/resources/static/access/assets/js/setting-panel.js index 0a9180b..6bd180d 100644 --- a/backend/microservice-provider-access-8002/src/main/resources/static/access/assets/js/setting-panel.js +++ b/backend/microservice-provider-access-8002/src/main/resources/static/access/assets/js/setting-panel.js @@ -25,6 +25,15 @@ DOMSettingPanel.addEventListener('click', function (e) { e.stopPropagation() }) DOMSaveSettingButton.addEventListener('click', function (e) { - closeSettingPanel() e.stopPropagation() + if (window.selectGateId) { + closeSettingPanel() + location.href = "./index.html?gateId=" + window.selectGateId + } else { + alert("请选择大门") + } }) + +// 绑定到全局 +window.showSettingPanel = showSettingPanel +window.closeSettingPanel = closeSettingPanel diff --git a/backend/microservice-provider-access-8002/src/main/resources/static/access/index.html b/backend/microservice-provider-access-8002/src/main/resources/static/access/index.html index 555025c..79aedfa 100644 --- a/backend/microservice-provider-access-8002/src/main/resources/static/access/index.html +++ b/backend/microservice-provider-access-8002/src/main/resources/static/access/index.html @@ -8,49 +8,64 @@ 社区疫情防控系统 - 门禁端 - - + + -
- - +
+ + +
+
+
+

Loading...

-
-
-

进出社区请扫码

-

社区居民

-

1. 打开 微信 > 扫一扫,扫描右侧小程序码

-

2. 点击确认进入,门即开启

+
+

进出社区请扫码

+

社区居民

+

1. 打开 微信 > 扫一扫,扫描右侧小程序码

+

2. 点击确认进入,门即开启

-

外来访客

-

1. 打开 微信 > 扫一扫,扫描右侧小程序码

-

2. 填写进入申请表

+

外来访客

+

1. 打开 微信 > 扫一扫,扫描右侧小程序码

+

2. 填写进入申请表

-

长期租客

-

1. 请联系管理员为你添加进出权限

-
-
- -

-
+

长期租客

+

1. 请联系管理员为你添加进出权限

+
+

请选择大门

+ +

+
+
-
-
-
- - + +