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,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 */
/* pages/scan/entrance.wxss */
.btnView {
margin-top: 40px;
}
.btn {
margin-top: 10px;
}