|
@@ -12,7 +12,7 @@ Page({
|
|
|
canGetPhoneNumber: false,
|
|
canGetPhoneNumber: false,
|
|
|
},
|
|
},
|
|
|
onSaveExitState: function () {
|
|
onSaveExitState: function () {
|
|
|
- wx.clearStorage();
|
|
|
|
|
|
|
+ // wx.clearStorage();
|
|
|
console.log("onSaveExitState=");
|
|
console.log("onSaveExitState=");
|
|
|
// 返回保存的数据和超时时间(可选)
|
|
// 返回保存的数据和超时时间(可选)
|
|
|
return {
|
|
return {
|
|
@@ -43,12 +43,26 @@ Page({
|
|
|
wx.scanCode({
|
|
wx.scanCode({
|
|
|
success: function (res) {
|
|
success: function (res) {
|
|
|
console.log('扫码获取的参数', res);
|
|
console.log('扫码获取的参数', res);
|
|
|
- wx.clearStorage();
|
|
|
|
|
- wx.setStorageSync('res', res);
|
|
|
|
|
- wx.setStorageSync('scanResultExpiresAt', Date.now() + 2 * 60 * 60 * 1000); // 超时时间戳,例如设置为2小时后过期
|
|
|
|
|
- wx.reLaunch({
|
|
|
|
|
- url: '/pages/index/index?res=' + res,//传res
|
|
|
|
|
- })
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if (res.result) {
|
|
|
|
|
+ hotelcodeTemp = res.result.split('|')[0];
|
|
|
|
|
+ roomcodeTemp = res.result.split('|')[1];
|
|
|
|
|
+ // wx.clearStorage();
|
|
|
|
|
+ var userInfo = wx.getStorageSync("userInfo") || {};
|
|
|
|
|
+ if (hotelcodeTemp == userInfo.hotel && roomcodeTemp == userInfo.room) {
|
|
|
|
|
+ wx.setStorageSync('res', res);
|
|
|
|
|
+ wx.setStorageSync('scanResultExpiresAt', Date.now() + 2 * 60 * 60 * 1000); // 超时时间戳,例如设置为2小时后过期
|
|
|
|
|
+ wx.reLaunch({
|
|
|
|
|
+ url: '/pages/index/index?res=' + res,//传res
|
|
|
|
|
+ })
|
|
|
|
|
+ } else {
|
|
|
|
|
+ wx.showToast({
|
|
|
|
|
+ title: '暂无权限,请先办理入住',
|
|
|
|
|
+ icon: 'none'
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|