feat(M03-D): 完成场景码NFC与受控WiFi
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
{
|
||||
"pages": [
|
||||
"pages/index/index",
|
||||
"pages/store/detail",
|
||||
"pages/room/detail",
|
||||
"pages/logs/logs"
|
||||
],
|
||||
"window": {
|
||||
|
||||
@@ -9,6 +9,12 @@ Page({
|
||||
stores: [],
|
||||
},
|
||||
|
||||
onLoad(options) {
|
||||
if (options.scene) {
|
||||
this.resolveScene(decodeURIComponent(options.scene), options.source === 'nfc' ? 'NFC' : 'QRCODE')
|
||||
}
|
||||
},
|
||||
|
||||
onCityInput(event) {
|
||||
this.setData({ city: event.detail.value })
|
||||
},
|
||||
@@ -52,4 +58,22 @@ Page({
|
||||
this.setData({ loading: false })
|
||||
}
|
||||
},
|
||||
|
||||
async resolveScene(code, sourceType) {
|
||||
this.setData({ loading: true, errorMessage: '' })
|
||||
try {
|
||||
const response = await request('/scenes/resolve', {
|
||||
method: 'POST',
|
||||
data: { code, sourceType },
|
||||
})
|
||||
const target = response.data
|
||||
const query = [`storeId=${encodeURIComponent(target.storeId)}`]
|
||||
if (target.roomId) query.push(`roomId=${encodeURIComponent(target.roomId)}`)
|
||||
wx.navigateTo({ url: `${target.page}?${query.join('&')}` })
|
||||
} catch (error) {
|
||||
this.setData({ errorMessage: error.message || '场景码已失效' })
|
||||
} finally {
|
||||
this.setData({ loading: false })
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
Page({
|
||||
data: {
|
||||
storeId: '',
|
||||
roomId: '',
|
||||
},
|
||||
onLoad(options) {
|
||||
this.setData({
|
||||
storeId: options.storeId || '',
|
||||
roomId: options.roomId || '',
|
||||
})
|
||||
},
|
||||
})
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"navigationBarTitleText": "房间详情"
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
<view class="page">
|
||||
<view class="title">房间详情</view>
|
||||
<view>门店编号:{{storeId}}</view>
|
||||
<view>房间编号:{{roomId}}</view>
|
||||
<view class="notice">扫码或 NFC 只打开此页面,开门权限仍由有效订单单独校验。</view>
|
||||
</view>
|
||||
@@ -0,0 +1,14 @@
|
||||
.page {
|
||||
padding: 32rpx;
|
||||
}
|
||||
|
||||
.title {
|
||||
margin-bottom: 24rpx;
|
||||
font-size: 40rpx;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.notice {
|
||||
margin-top: 32rpx;
|
||||
color: #777777;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
Page({
|
||||
data: {
|
||||
storeId: '',
|
||||
},
|
||||
onLoad(options) {
|
||||
this.setData({ storeId: options.storeId || '' })
|
||||
},
|
||||
})
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"navigationBarTitleText": "门店详情"
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<view class="page">
|
||||
<view class="title">门店详情</view>
|
||||
<view>门店编号:{{storeId}}</view>
|
||||
<view class="notice">场景码仅用于页面导航,不授予开门或设备控制权限。</view>
|
||||
</view>
|
||||
@@ -0,0 +1,14 @@
|
||||
.page {
|
||||
padding: 32rpx;
|
||||
}
|
||||
|
||||
.title {
|
||||
margin-bottom: 24rpx;
|
||||
font-size: 40rpx;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.notice {
|
||||
margin-top: 32rpx;
|
||||
color: #777777;
|
||||
}
|
||||
Reference in New Issue
Block a user