feat(M03-D): 完成场景码NFC与受控WiFi

This commit is contained in:
Codex
2026-06-18 15:56:36 +08:00
parent 88fa22ee92
commit d563078a9f
28 changed files with 859 additions and 14 deletions
+24
View File
@@ -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 })
}
},
})
+12
View File
@@ -0,0 +1,12 @@
Page({
data: {
storeId: '',
roomId: '',
},
onLoad(options) {
this.setData({
storeId: options.storeId || '',
roomId: options.roomId || '',
})
},
})
+3
View File
@@ -0,0 +1,3 @@
{
"navigationBarTitleText": "房间详情"
}
+6
View File
@@ -0,0 +1,6 @@
<view class="page">
<view class="title">房间详情</view>
<view>门店编号:{{storeId}}</view>
<view>房间编号:{{roomId}}</view>
<view class="notice">扫码或 NFC 只打开此页面,开门权限仍由有效订单单独校验。</view>
</view>
+14
View File
@@ -0,0 +1,14 @@
.page {
padding: 32rpx;
}
.title {
margin-bottom: 24rpx;
font-size: 40rpx;
font-weight: 600;
}
.notice {
margin-top: 32rpx;
color: #777777;
}
+8
View File
@@ -0,0 +1,8 @@
Page({
data: {
storeId: '',
},
onLoad(options) {
this.setData({ storeId: options.storeId || '' })
},
})
+3
View File
@@ -0,0 +1,3 @@
{
"navigationBarTitleText": "门店详情"
}
+5
View File
@@ -0,0 +1,5 @@
<view class="page">
<view class="title">门店详情</view>
<view>门店编号:{{storeId}}</view>
<view class="notice">场景码仅用于页面导航,不授予开门或设备控制权限。</view>
</view>
+14
View File
@@ -0,0 +1,14 @@
.page {
padding: 32rpx;
}
.title {
margin-bottom: 24rpx;
font-size: 40rpx;
font-weight: 600;
}
.notice {
margin-top: 32rpx;
color: #777777;
}