|
|
@@ -28,7 +28,7 @@ Page({
|
|
|
checkedPrivacy: check
|
|
|
});
|
|
|
},
|
|
|
- onCloseTipsDialog() {
|
|
|
+ onCloseTipsDialog() {
|
|
|
this.setData({
|
|
|
showTipsA: false,
|
|
|
})
|
|
|
@@ -65,9 +65,7 @@ Page({
|
|
|
url: '/subpages/main/main?res=' + res,//传res
|
|
|
})
|
|
|
} else {
|
|
|
- that.setData({
|
|
|
- showTipsA: true
|
|
|
- })
|
|
|
+ that.checkwxstatus(res, hotelcodeTemp, roomcodeTemp);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -100,13 +98,13 @@ Page({
|
|
|
hasAuth: hasAuth
|
|
|
})
|
|
|
if (hasAuth) {
|
|
|
- // var userInfo = wx.getStorageSync("userInfo");
|
|
|
- // this.setData({
|
|
|
- // userName: userInfo.userName || "用户登录",
|
|
|
- // avatarUrl: userInfo.avatarUrl || defaultAvatarUrl,
|
|
|
- // phoneNumber: userInfo.phoneNumber || ""
|
|
|
+ // var userInfo = wx.getStorageSync("userInfo");
|
|
|
+ // this.setData({
|
|
|
+ // userName: userInfo.userName || "用户登录",
|
|
|
+ // avatarUrl: userInfo.avatarUrl || defaultAvatarUrl,
|
|
|
+ // phoneNumber: userInfo.phoneNumber || ""
|
|
|
// })
|
|
|
-
|
|
|
+
|
|
|
// 判断扫码控制权限
|
|
|
wx.request({
|
|
|
url: `${homeApi_empower}/wxstatus`,
|
|
|
@@ -126,6 +124,7 @@ Page({
|
|
|
wx.setStorageSync('roomEmpower', intervalRes.data.room);
|
|
|
wx.setStorageSync('hname', intervalRes.data.hname);
|
|
|
wx.setStorageSync('rname', intervalRes.data.rname);
|
|
|
+
|
|
|
} else {
|
|
|
wx.setStorageSync('hasHotelAuth', false);
|
|
|
}
|
|
|
@@ -137,6 +136,49 @@ Page({
|
|
|
}
|
|
|
return hasAuth;
|
|
|
},
|
|
|
+ // 扫码后判断是否有权限 针对特权用户
|
|
|
+ checkwxstatus(res, hotelcodeTem, roomcodeTemp) {
|
|
|
+ const that = this;
|
|
|
+ wx.request({
|
|
|
+ url: `${homeApi_empower}/wxstatus`,
|
|
|
+ data: {
|
|
|
+ unionid: wx.getStorageSync('unionid'),
|
|
|
+ openid: wx.getStorageSync('openid'),
|
|
|
+ token: wx.getStorageSync('token'),
|
|
|
+ "hotel": hotelcodeTem,
|
|
|
+ "room": roomcodeTemp
|
|
|
+ },
|
|
|
+ method: 'POST',
|
|
|
+ success: function (intervalRes) {
|
|
|
+ console.log('intervalRes=' + JSON.stringify(intervalRes));
|
|
|
+ console.log('intervalRes.data=' + JSON.stringify(intervalRes.data));
|
|
|
+ //empower.js? [sm]:152 intervalRes.data={"st":"success","status":"0"}
|
|
|
+ if (intervalRes.data && intervalRes.data.st && intervalRes.data.status && intervalRes.data.st == 'success' && intervalRes.data.status == '1') {
|
|
|
+ wx.setStorageSync('hasHotelAuth', true);
|
|
|
+ wx.setStorageSync('hotelEmpower', intervalRes.data.hotel);
|
|
|
+ wx.setStorageSync('roomEmpower', intervalRes.data.room);
|
|
|
+ wx.setStorageSync('hname', intervalRes.data.hname);
|
|
|
+ wx.setStorageSync('rname', intervalRes.data.rname);
|
|
|
+
|
|
|
+ wx.setStorageSync('res', res);
|
|
|
+ wx.setStorageSync('scanResultExpiresAt', Date.now() + 2 * 60 * 60 * 1000); // 超时时间戳,例如设置为2小时后过期
|
|
|
+ wx.reLaunch({
|
|
|
+ url: '/subpages/main/main?res=' + res,//传res
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ wx.setStorageSync('hasHotelAuth', false);
|
|
|
+ that.setData({
|
|
|
+ showTipsA: true
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ fail: function (error) {
|
|
|
+ that.setData({
|
|
|
+ showTipsA: true
|
|
|
+ })
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
authorizationSuccessful() {
|
|
|
console.log("授权成功");
|
|
|
this.setData({ showAuthorizedDialog: false })
|