1
0
Code Issues Pull Requests Packages Projects Releases Wiki Activity GitHub Gitee

小程序端扫门禁码跳转;门禁端调整;bugfix小程序端商品售价和划线价反了

This commit is contained in:
程序员小墨 2023-04-15 23:47:18 +08:00
parent 7f8a0f8d60
commit a6580355a2
20 changed files with 1315 additions and 665 deletions

View File

@ -1,7 +1,30 @@
还要做的部分
社区、系统管理员后台管理 frontend项目
小程序扫门禁码之后门禁开门
购物车隐藏
首页密码修改
大门人员进出后台管理
首页加一个扫门禁码
订单发货小程序端显示
小程序扫门禁码之后门禁开门(扫码 websocket 推到门禁端)
门禁段显示大门开放状态
后台管理两个端分开
小程序提审(项目部署到服务器,提审时隐藏小商店)
数据库填充测试数据(以及创建一些测试账号)并备份,线上演示数据修改删除避免真删
小程序修改密码
# IP 配置

View File

@ -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();
// 拼装返回结果

View File

@ -17,6 +17,9 @@ public class GateService {
public Gate getGateById(Long id) {
if (id == null) {
return null;
}
return gateDao.getGateById(id);
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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

View File

@ -8,49 +8,64 @@
<!-- Electron -->
<!-- <meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src *; img-src *; connect-src *;"> -->
<title>社区疫情防控系统 - 门禁端</title>
<link rel="stylesheet" href="./assets/css/index.css" />
<link rel="stylesheet" href="./assets/css/setting-panel.css" />
<link rel="stylesheet" href="./assets/css/index.css"/>
<link rel="stylesheet" href="./assets/css/setting-panel.css"/>
</head>
<body>
<div class="ctrl-btn">
<img class="btn btn-ctrl" id="setting-button" src="./assets/svg/setting.svg" alt="">
<img class="btn btn-ctrl" id="fullscreen-button" src="./assets/svg/fullscreen.svg" alt="">
<div class="ctrl-btn">
<img class="btn btn-ctrl" id="setting-button" src="./assets/svg/setting.svg" alt="">
<img class="btn btn-ctrl" id="fullscreen-button" src="./assets/svg/fullscreen.svg" alt="">
</div>
<div class="container">
<div class="top-container">
<p id="gate-name" style="font-size: 28px;">Loading...</p>
</div>
<div class="container">
<div class="left-container">
<h1>进出社区请扫码</h1>
<h3>社区居民</h3>
<p>1. 打开 微信 > 扫一扫,扫描右侧小程序码</p>
<p>2. 点击确认进入,门即开启</p>
<div class="left-container">
<h1>进出社区请扫码</h1>
<h3>社区居民</h3>
<p>1. 打开 微信 > 扫一扫,扫描右侧小程序码</p>
<p>2. 点击确认进入,门即开启</p>
<h3>外来访客</h3>
<p>1. 打开 微信 > 扫一扫,扫描右侧小程序码</p>
<p>2. 填写进入申请表</p>
<h3>外来访客</h3>
<p>1. 打开 微信 > 扫一扫,扫描右侧小程序码</p>
<p>2. 填写进入申请表</p>
<h3>长期租客</h3>
<p>1. 请联系管理员为你添加进出权限</p>
</div>
<div class="right-container">
<img id="qrcode" src="">
<p id="refreshTimeCountDown"></p>
</div>
<h3>长期租客</h3>
<p>1. 请联系管理员为你添加进出权限</p>
</div>
<div class="right-container">
<h1 id="no-qrcode">请选择大门</h1>
<img id="qrcode" src="" style="display: none">
<p id="refreshTimeCountDown"></p>
</div>
</div>
<div id="full-screen-mask" class="full-screen-mask"></div>
<div id="setting-container" class="setting-container">
<div class="setting-panel">
<!-- 关闭按钮 -->
<img id="close-setting-button" class="btn" src="./assets/svg/close.svg" alt="">
<div id="full-screen-mask" class="full-screen-mask hidden"></div>
<div id="setting-container" class="setting-container hidden">
<div class="setting-panel">
<!-- 关闭按钮 -->
<img id="close-setting-button" class="btn" src="./assets/svg/close.svg" alt="">
<div class="save-button-container" style="text-align: center;">
<button class="save-setting-button">保 存</button>
<h3 style="text-align: center;">请选择大门</h3>
<div id="gate-list">
<div class="gate-list-item">
<p>大门1</p>
<p class="status open closed">
开放 封闭
</p>
</div>
</div>
<div class="save-button-container" style="text-align: center;">
<button class="save-setting-button">保 存</button>
</div>
</div>
<script src="./renderer.js" type="module"></script>
<script src="./assets/js/setting-panel.js" type="module"></script>
<script src="./assets/js/websocket.js"></script>
</div>
<script src="./assets/js/setting-panel.js" type="module"></script>
<script src="./renderer.js" type="module"></script>
<script src="./assets/js/websocket.js"></script>
</body>
</html>

View File

@ -1,3 +1,4 @@
// 定义常量
const url = "https://epp.only4.work/access/wechat/getUnlimitedQRCode"
const page = "pages/index/index" // "pages/scan/entrance"
const envVersion = "develop" // 正式版为 "release",体验版为 "trial",开发版为 "develop"
@ -5,6 +6,36 @@ const autoColor = true
const isHyaline = false
const width = 500
// 页面上的元素
const image = document.getElementById('qrcode')
const noQrInfo = document.getElementById('no-qrcode')
const refreshTimeCountDown = document.getElementById('refreshTimeCountDown')
const DOMGateList = document.getElementById('gate-list')
// 大门列表
window.gateList = []
// 当前大门
window.currentGate = null
// 点击全屏
document.getElementById("fullscreen-button").addEventListener("click", function () {
if (document.fullscreenElement) {
document.exitFullscreen();
} else {
if (inElectron) {
// electron 中
const message = JSON.stringify({
action: 'fullscreen'
});
window.parent.postMessage(message, '*');
} else {
// 浏览器中
document.body.requestFullscreen()
}
}
})
// 获取 Url 参数
function getUrlParams() {
let params = {}
@ -18,46 +49,19 @@ function getUrlParams() {
// console.log(params)
return params
}
let urlParams = getUrlParams()
console.log("urlParams", urlParams)
// 是否在 electron 中
const inElectron = urlParams['inElectron']
// 当前的门禁端
let gateId = urlParams['gateId'] || ""
if (!gateId) {
// 弹出选择框
}
// 点击全屏
document.getElementById("fullscreen-button").addEventListener("click", function () {
if (document.fullscreenElement) {
document.exitFullscreen();
} else {
if(inElectron) {
// electron 中
const message = JSON.stringify({
action: 'fullscreen'
});
window.parent.postMessage(message, '*');
} else {
// 浏览器中
document.body.requestFullscreen()
}
}
})
// 页面上的元素
const image = document.getElementById('qrcode')
const refreshTimeCountDown = document.getElementById('refreshTimeCountDown')
// 定时更新页面上的小程序码
let i = 0, refreshTime = 10 + 1
function updateQRCode() {
// 取消图片隐藏
image.style.visibility = '';
image.style.display = '';
noQrInfo.style.display = 'none';
if (i % refreshTime == 0) {
let scene = encodeURIComponent(`guard&${Date.now()}`);
// scene 最长支支持 32 位,所以这里不传入时间戳
let scene = encodeURIComponent(`guard&${window.currentGate.id}`); // &${Date.now()}
image.src = `${url}?page=${page}&scene=${scene}&envVersion=${envVersion}&width=${width}&autoColor=${autoColor}&isHyaline=${isHyaline}`
console.log(image.src)
refreshTimeCountDown.innerHTML = `&nbsp;`
@ -67,5 +71,76 @@ function updateQRCode() {
i = i % refreshTime + 1
}
updateQRCode()
setInterval(updateQRCode, 1000)
// 挂载到 window 上
window.updateQRCode = updateQRCode
// 弹窗中修改 item
function changePanelSelectGate(gateId) {
// 删除旧的 active
let activeList = document.querySelectorAll('.gate-list-item.active')
for (let a of activeList) {
a.classList.remove('active')
}
// 添加新的 active
let newActiveItem = document.getElementById(`gate-list-${gateId}`)
if (newActiveItem) {
newActiveItem.classList.add('active')
window.selectGateId = gateId
}
}
// 挂载到 window 上
window.changePanelSelectGate = changePanelSelectGate
// 发送请求,获取大门列表
async function getGateList() {
const response = await fetch('https://epp.only4.work/access/gate/guard-client/getGateList');
const data = await response.json();
return data.data;
}
window.onload = async function () {
// 获取 url 参数
let urlParams = getUrlParams()
console.log("urlParams", urlParams)
// 是否在 electron 中
const inElectron = urlParams['inElectron']
// 当前的门禁端
let gateId = urlParams['gateId'] || ""
// 获取大门列表
window.gateList = await getGateList()
console.log("gateList", window.gateList)
let domList = []
for (let gate of window.gateList) {
domList.push(`
<div id="gate-list-${gate.id}" class="gate-list-item" onclick="window.changePanelSelectGate('${gate.id}')">
<p>${gate.name}</p>
<p class="status ${gate.open ? 'open' : 'closed'}">
${gate.open ? '开放' : '封闭'}
</p>
</div>
`)
}
DOMGateList.innerHTML = domList.join('')
// 通过id 找门禁
window.currentGate = gateList.find((gate) => gate.id === gateId)
if (!window.currentGate) {
// 弹出选择框
window.showSettingPanel && window.showSettingPanel()
} else {
document.querySelector('#gate-name').textContent = window.currentGate.name
// 开始更新图片
updateQRCode()
setInterval(updateQRCode, 1000)
}
}

View File

@ -11,7 +11,7 @@
Target Server Version : 80012
File Encoding : 65001
Date: 14/04/2023 00:51:48
Date: 15/04/2023 18:50:35
*/
SET NAMES utf8mb4;
@ -321,7 +321,7 @@ CREATE TABLE `order_detail` (
INDEX `good_id`(`good_id`) USING BTREE,
CONSTRAINT `order_detail_ibfk_1` FOREIGN KEY (`good_id`) REFERENCES `goods` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
CONSTRAINT `order_detail_ibfk_2` FOREIGN KEY (`order_id`) REFERENCES `order` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 46 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = DYNAMIC;
) ENGINE = InnoDB AUTO_INCREMENT = 49 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of order_detail
@ -352,7 +352,7 @@ CREATE TABLE `report` (
`temperature` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '体温是否正常',
`address` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '地址',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 71 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;
) ENGINE = InnoDB AUTO_INCREMENT = 72 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of report
@ -366,6 +366,7 @@ INSERT INTO `report` VALUES (60, 3, '用户 密码user', '2023-03-20 00:47:22',
INSERT INTO `report` VALUES (61, 3, '用户 密码user', '2023-03-23 22:24:14', '0', '湖北省武汉市武昌区修远路');
INSERT INTO `report` VALUES (62, 3, '用户 密码user', '2023-03-13 22:54:12', '0', '湖北省武汉市洪山区文治街102-4号');
INSERT INTO `report` VALUES (70, 3, '用户 密码user', '2023-04-14 00:36:55', '0', '湖北省武汉市洪山区文治街102-4号');
INSERT INTO `report` VALUES (71, 3, '用户 密码user', '2023-04-14 13:36:23', '0', '湖北省武汉市洪山区紫菘花园东路');
-- ----------------------------
-- Table structure for role

View File

@ -173,6 +173,114 @@
}
},
"response": []
},
{
"name": "http://localhost:8001/user/manage/getUserList?pageIndex=2&pageSize=2&username=&roleId=&realname=&phoneNumber=11&idNumber=&buildingId=&doorplate=",
"request": {
"method": "GET",
"header": [
{
"key": "authority",
"value": "epp.only4.work"
},
{
"key": "accept",
"value": "application/json, text/plain, */*"
},
{
"key": "accept-language",
"value": "zh-CN,zh;q=0.9,en;q=0.8"
},
{
"key": "origin",
"value": "http://localhost:5173"
},
{
"key": "referer",
"value": "http://localhost:5173/"
},
{
"key": "sec-ch-ua",
"value": "\"Google Chrome\";v=\"111\", \"Not(A:Brand\";v=\"8\", \"Chromium\";v=\"111\""
},
{
"key": "sec-ch-ua-mobile",
"value": "?0"
},
{
"key": "sec-ch-ua-platform",
"value": "\"Windows\""
},
{
"key": "sec-fetch-dest",
"value": "empty"
},
{
"key": "sec-fetch-mode",
"value": "cors"
},
{
"key": "sec-fetch-site",
"value": "cross-site"
},
{
"key": "user-agent",
"value": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36"
}
],
"url": {
"raw": "http://localhost:8001/user/manage/getUserList?pageIndex=2&pageSize=2&username=&roleId=&realname=&phoneNumber=11&idNumber=&buildingId=&doorplate=",
"protocol": "http",
"host": [
"localhost"
],
"port": "8001",
"path": [
"user",
"manage",
"getUserList"
],
"query": [
{
"key": "pageIndex",
"value": "2"
},
{
"key": "pageSize",
"value": "2"
},
{
"key": "username",
"value": ""
},
{
"key": "roleId",
"value": ""
},
{
"key": "realname",
"value": ""
},
{
"key": "phoneNumber",
"value": "11"
},
{
"key": "idNumber",
"value": ""
},
{
"key": "buildingId",
"value": ""
},
{
"key": "doorplate",
"value": ""
}
]
}
},
"response": []
}
]
},
@ -327,6 +435,50 @@
}
},
"response": []
},
{
"name": "[线上] 门禁端 获取大门列表",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "https://epp.only4.work/access/gate/guard-client/getGateList",
"protocol": "https",
"host": [
"epp",
"only4",
"work"
],
"path": [
"access",
"gate",
"guard-client",
"getGateList"
]
}
},
"response": []
},
{
"name": "[线上] 小程序端 获取大门详情",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "https://epp.only4.work/guard-client/getGateList",
"protocol": "https",
"host": [
"epp",
"only4",
"work"
],
"path": [
"guard-client",
"getGateList"
]
}
},
"response": []
}
]
},
@ -352,6 +504,45 @@
}
},
"response": []
},
{
"name": "http://localhost:80/test",
"request": {
"method": "POST",
"header": [],
"url": {
"raw": "http://localhost:80/test/test",
"protocol": "http",
"host": [
"localhost"
],
"port": "80",
"path": [
"test",
"test"
]
}
},
"response": []
},
{
"name": "http://localhost:8011/test",
"request": {
"method": "POST",
"header": [],
"url": {
"raw": "http://localhost:8011/test",
"protocol": "http",
"host": [
"localhost"
],
"port": "8011",
"path": [
"test"
]
}
},
"response": []
}
]
},
@ -667,6 +858,176 @@
}
},
"response": []
},
{
"name": "https://epp.only4.work/shop/good/manage/editGood",
"request": {
"method": "POST",
"header": [
{
"key": "authority",
"value": "epp.only4.work"
},
{
"key": "accept",
"value": "application/json, text/plain, */*"
},
{
"key": "accept-language",
"value": "zh-CN,zh;q=0.9,en;q=0.8"
},
{
"key": "content-type",
"value": "application/x-www-form-urlencoded"
},
{
"key": "origin",
"value": "http://localhost:5174"
},
{
"key": "referer",
"value": "http://localhost:5174/"
},
{
"key": "sec-ch-ua",
"value": "\"Google Chrome\";v=\"111\", \"Not(A:Brand\";v=\"8\", \"Chromium\";v=\"111\""
},
{
"key": "sec-ch-ua-mobile",
"value": "?0"
},
{
"key": "sec-ch-ua-platform",
"value": "\"Windows\""
},
{
"key": "sec-fetch-dest",
"value": "empty"
},
{
"key": "sec-fetch-mode",
"value": "cors"
},
{
"key": "sec-fetch-site",
"value": "cross-site"
},
{
"key": "user-agent",
"value": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36"
}
],
"body": {
"mode": "urlencoded",
"urlencoded": [
{
"key": "id",
"value": "-1",
"type": "text"
},
{
"key": "picUrl",
"value": "qfbcdboiwxn",
"type": "text"
},
{
"key": "goodsName",
"value": "syihtraudeuueqrmqe",
"type": "text"
},
{
"key": "categoryId",
"value": "2",
"type": "text"
},
{
"key": "brand",
"value": "vfadnwkwvxnp",
"type": "text"
},
{
"key": "brief",
"value": "swxypuwotn",
"type": "text"
},
{
"key": "isOnSale",
"value": "1",
"type": "text"
},
{
"key": "sortOrder",
"value": "797",
"type": "text"
},
{
"key": "unit",
"value": "oyu",
"type": "text"
},
{
"key": "counterPrice",
"value": "133.5214",
"type": "text"
},
{
"key": "retailPrice",
"value": "2701338743",
"type": "text"
},
{
"key": "detail",
"value": "hpfowwfaewhclntoyddefpyroqmwkkqgsyuvmktwwkwbrqtocrygeusevgvwbplvnectvdrkwfybilhspgqpzmgmhsiadkdsvwj",
"type": "text"
}
]
},
"url": {
"raw": "https://epp.only4.work/shop/good/manage/editGood",
"protocol": "https",
"host": [
"epp",
"only4",
"work"
],
"path": [
"shop",
"good",
"manage",
"editGood"
]
}
},
"response": []
},
{
"name": "[微服务] getTmpCosCredential",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "http://localhost:8003/shop/good/manage/imageUpload/getTmpCosCredential?ext=1",
"protocol": "http",
"host": [
"localhost"
],
"port": "8003",
"path": [
"shop",
"good",
"manage",
"imageUpload",
"getTmpCosCredential"
],
"query": [
{
"key": "ext",
"value": "1"
}
]
}
},
"response": []
}
]
}

View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M768 149.333333a21.333333 21.333333 0 0 1 21.333333-21.333333h64v-21.333333a21.333333 21.333333 0 0 1 42.666667 0v21.333333h64a21.333333 21.333333 0 0 1 0 42.666667h-170.666667a21.333333 21.333333 0 0 1-21.333333-21.333334zM64 170.666667h170.666667a21.333333 21.333333 0 0 0 0-42.666667h-64v-21.333333a21.333333 21.333333 0 0 0-42.666667 0v21.333333H64a21.333333 21.333333 0 0 0 0 42.666667z m917.333333 64v640a21.333333 21.333333 0 0 1-21.333333 21.333333h-170.666667a21.333333 21.333333 0 0 1-21.333333-21.333333v-21.333334H256v21.333334a21.333333 21.333333 0 0 1-21.333333 21.333333H64a21.333333 21.333333 0 0 1-21.333333-21.333333V234.666667a21.333333 21.333333 0 0 1 21.333333-21.333334h170.666667a21.333333 21.333333 0 0 1 21.333333 21.333334v106.666666h42.666667v-64a21.333333 21.333333 0 0 1 42.666666 0v490.666667h85.333334V597.333333h-21.333334a21.333333 21.333333 0 0 1-21.333333-21.333333V490.666667a21.333333 21.333333 0 0 1 21.333333-21.333334h21.333334V384h-21.333334a21.333333 21.333333 0 0 1 0-42.666667h21.333334V192a21.333333 21.333333 0 0 1 42.666666 0v149.333333h85.333334V192a21.333333 21.333333 0 0 1 42.666666 0v149.333333h85.333334v-64a21.333333 21.333333 0 0 1 42.666666 0v64h42.666667V234.666667a21.333333 21.333333 0 0 1 21.333333-21.333334h170.666667a21.333333 21.333333 0 0 1 21.333333 21.333334zM298.666667 384h-42.666667v384h42.666667z m256 213.333333H469.333333v170.666667h85.333334z m0-213.333333H469.333333v85.333333h85.333334z m128 0H597.333333v85.333333h21.333334a21.333333 21.333333 0 0 1 21.333333 21.333334v85.333333a21.333333 21.333333 0 0 1-21.333333 21.333333h-21.333334v170.666667h42.666667v42.666667h42.666667z m85.333333 0h-42.666667v384h42.666667z" fill="#5C5C66"></path></svg>

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -46,10 +46,11 @@ Page({
//判断用户是否是通过扫小程序码进来的
if (options && options.scene) {
// 扫门禁的小程序码
if (options.scene.split('%')[0] == "guard") {
options.scene = null
let scene = options.scene
if (scene.startsWith("guard%")) { // scene.split('%')[0] == "guard"
options.scene = null // 清掉参数 避免重复触发
wx.navigateTo({
url: "/pages/scan/entrance"
url: "/pages/scan/entrance?scene=" + scene
})
return
}

View File

@ -1,11 +1,24 @@
// pages/scan/entrance.js
const gateService = require("../../services/gate")
Page({
/**
* 页面的初始数据
*/
data: {
options: {},
// 传入参数
gateId: "",
// 接口返回数据
gateDetail: "",
// UI显示用
gateName: "未知",
open: false,
currentTime: "",
},
/**
@ -13,9 +26,23 @@ Page({
*/
onLoad(options) {
console.log(options)
let scene = options.scene
if (!scene) {
wx.navigateBack()
return
}
scene = decodeURIComponent(scene) // %26 == &
if (scene.indexOf('&') == -1) {
wx.navigateBack()
return
}
let gateId = scene.split('&')[1]
this.setData({
options: JSON.stringify(options),
})
gateId: gateId,
});
this.loadPageData()
},
/**
@ -50,7 +77,7 @@ Page({
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
this.loadPageData()
},
/**
@ -65,5 +92,24 @@ Page({
*/
onShareAppMessage() {
},
loadPageData() {
let gateId = this.data.gateId;
(async () => {
let gateDetail = await gateService.getGateDetail(gateId)
console.log("gateDetail", gateDetail)
this.setData({
gateDetail: JSON.stringify(gateDetail),
gateName: gateDetail.name,
open: gateDetail.open,
currentTime: new Date(Date.now() + 8 * 3600 * 1000).toISOString().replace('T', ' ').substring(0, 19)
});
})();
},
navigateBack: function () {
wx.navigateBack()
}
})

View File

@ -1,4 +1,5 @@
{
"usingComponents": {},
"navigationBarTitleText": "进入社区"
"navigationBarTitleText": "进入社区",
"enablePullDownRefresh": true
}

View File

@ -1,5 +1,30 @@
<!--pages/scan/entrance.wxml-->
<view>
您将要进入社区:未知
{{ options }}
<view style="text-align: center;">
<view style="margin-top: 10vh;">
<image src="../../image/icon/gate-background.svg" style="height: 40vh;"></image>
</view>
<view style="margin-top: 2vh;">
<text>您将要进入社区</text>
</view>
<view style="margin-top: 10px;">
<text style="font-size: 1.5em; font-weight: bold; color: {{ open ? '#0ee919' : 'red' }};">{{ gateName }}</text>
</view>
<view style="margin-top: 2vh;">
<view wx:if="{{ !open }}">当前大门暂不允许通行</view>
<view>当前时间:{{ currentTime }}</view>
</view>
<view class="btnView">
<!--按钮-->
<button disabled="{{ !open }}" class="btn" type="primary" bindtap="enterGate">确认进入</button>
<button class="btn" type="warn" bindtap="navigateBack">不进入</button>
</view>
</view>
<view style="font-size: 0.6em; color: #c5c5c5; position: absolute; bottom: 16px; width: 100%; text-align: center;">
大门id: {{ gateId }}
</view>

View File

@ -1 +1,8 @@
/* pages/scan/entrance.wxss */
.btnView {
margin-top: 40px;
}
.btn {
margin-top: 10px;
}

View File

@ -2,17 +2,17 @@
<view class="good-wapper">
<image class="good-image" src="{{goodinfo.picUrl}}" />
<view class="good-detail">
<view class="good-price good-price-counter">
<!-- 原价 -->
<view class="good-price-symbol">¥</view>
<view class="good-price-number">{{ goodinfo.counterPrice }}</view>
</view>
<view class="good-price good-price-retail">
<!-- 售价 -->
<view style="height:0.12em;" class="good-price-line"></view>
<view class="good-price-symbol">¥</view>
<view class="good-price-number">{{ goodinfo.retailPrice }}</view>
</view>
<view class="good-price good-price-counter">
<!-- 原价 -->
<view style="height:0.12em;" class="good-price-line"></view>
<view class="good-price-symbol">¥</view>
<view class="good-price-number">{{ goodinfo.counterPrice }}</view>
</view>
<!-- 商品标题 -->
<view class="good-title line-wrap">

View File

@ -24,12 +24,12 @@
position: relative;
}
.good-price-counter {
.good-price-retail {
color: #fa4126;
font-size: 72rpx;
}
.good-price-retail {
.good-price-counter {
color: #bbbbbb;
font-size: 32rpx;
margin: 0 0 0 18rpx;

View File

@ -0,0 +1,15 @@
/* eslint-disable no-param-reassign */
const send_request = require('../utils/sendRequest')
/** 获取门禁详情 */
export function getGateDetail(id) {
console.log("gateId", id)
return send_request({
url: '/access/gate/miniprogram/detail',
method: "GET",
data: {
id: id,
}
})
}

View File

@ -1,19 +1,21 @@
function scanQRCode(Taro) {
function scanQRCode(wx) {
// 只允许从相机扫码
Taro.scanCode({
wx.scanCode({
onlyFromCamera: true,
success(res) {
console.log(res)
if (res.scanType == "WX_CODE" && res.path) {
let searchParams = res.path.split('?');
if (searchParams.length > 1 && searchParams[1].startsWith('scene=guard')) {
Taro.navigateTo({
url: "/pages/scan/entrance"
// let scene = searchParams[1].substring(searchParams[1].indexOf('='))
console.log("searchParams", searchParams)
wx.navigateTo({
url: "/pages/scan/entrance?" + searchParams[1]
})
return
}
}
Taro.showToast({
wx.showToast({
title: "您扫描的不是门禁码",
icon: 'error',
duration: 2000