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

小程序扫门禁码开门流程完成

This commit is contained in:
程序员小墨 2023-04-18 01:17:27 +08:00
parent 873b66deec
commit c77a4c98fc
5 changed files with 37 additions and 5 deletions

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 t="1681750942531" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5423" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M512 1024C229.248 1024 0 794.752 0 512S229.248 0 512 0s512 229.248 512 512-229.248 512-512 512z m-114.176-310.954667a53.333333 53.333333 0 0 0 75.434667 0l323.328-323.328a53.333333 53.333333 0 1 0-75.434667-75.434666l-287.914667 283.306666-128.853333-128.853333a53.333333 53.333333 0 1 0-75.434667 75.434667l168.874667 168.874666z" fill="#6fcb19" p-id="5424"></path></svg>

After

Width:  |  Height:  |  Size: 705 B

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 t="1681751438767" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6662" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M827.392 195.584q65.536 65.536 97.792 147.456t32.256 167.936-32.256 167.936-97.792 147.456-147.456 98.304-167.936 32.768-168.448-32.768-147.968-98.304-98.304-147.456-32.768-167.936 32.768-167.936 98.304-147.456 147.968-97.792 168.448-32.256 167.936 32.256 147.456 97.792zM720.896 715.776q21.504-21.504 18.944-49.152t-24.064-49.152l-107.52-107.52 107.52-107.52q21.504-21.504 24.064-49.152t-18.944-49.152-51.712-21.504-51.712 21.504l-107.52 106.496-104.448-104.448q-21.504-20.48-49.152-23.04t-49.152 17.92q-21.504 21.504-21.504 52.224t21.504 52.224l104.448 104.448-104.448 104.448q-21.504 21.504-21.504 51.712t21.504 51.712 49.152 18.944 49.152-24.064l104.448-104.448 107.52 107.52q21.504 21.504 51.712 21.504t51.712-21.504z" p-id="6663" fill="#e5250c"></path></svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -150,6 +150,7 @@ Page({
url: '/pages/person/updpwd'
})
break
// 退出登录
case "logout":
wx.clearStorageSync()

View File

@ -16,9 +16,15 @@ Page({
// UI显示用
gateName: "未知",
open: false,
open: false, // 大门是否开始
currentTime: "",
// 是否已经完成开门
finishOpen: false,
// 用户是否有权限进入
isForbidden: false,
forbiddenMsg: "",
},
/**
@ -116,6 +122,20 @@ Page({
(async () => {
let enterGate = await gateService.enterGate(this.data.gateId, "IN")
console.log("enterGate", enterGate)
if (enterGate === true) {
// 开门成功
this.setData({
finishOpen: true,
isForbidden: false,
})
} else {
// 无权进入大门
this.setData({
finishOpen: true,
isForbidden: true,
forbiddenMsg: "开门失败",
})
}
})();
},

View File

@ -1,11 +1,12 @@
<!--pages/scan/entrance.wxml-->
<view style="text-align: center;">
<view style="margin-top: 10vh;">
<image src="../../image/icon/gate-background.svg" style="height: 40vh;"></image>
<image wx:if="{{ !finishOpen }}" src="../../image/icon/gate-background.svg" style="height: 40vh;"></image>
<image wx:else src="../../image/icon/{{isForbidden?'error':'done'}}.svg" style="height: 32vh; margin: 20px;"></image>
</view>
<view style="margin-top: 2vh;">
<text>您将要进入社区</text>
<text wx:if="{{ !finishOpen }}">您将要进入社区</text>
</view>
<view style="margin-top: 10px;">
@ -15,13 +16,21 @@
<view style="margin-top: 2vh;">
<view wx:if="{{ !open }}">当前大门暂不允许通行</view>
<view>当前时间:{{ currentTime }}</view>
<text wx:if="{{ finishOpen && !isForbidden }}">大门已为您开启,欢迎回家!</text>
<text wx:if="{{ finishOpen && isForbidden }}" style="font-weight: bold;color: red;">
{{ forbiddenMsg }}
您无权进入该大门,请联系管理员
</text>
</view>
<view class="btnView">
<!--按钮-->
<view class="btnView" wx:if="{{ !finishOpen }}">
<button disabled="{{ !open }}" class="btn" type="primary" bindtap="enterGate">确认进入</button>
<button class="btn" type="warn" bindtap="navigateBack">不进入</button>
</view>
<view class="btnView" wx:else>
<button class="btn" type="primary" bindtap="navigateBack">完成</button>
</view>
</view>