柒零 há 1 ano atrás
pai
commit
3a6fae4b65
5 ficheiros alterados com 87 adições e 13 exclusões
  1. 1 1
      pages/index/index.js
  2. 0 3
      subpages/main/main.json
  3. 16 9
      subpages/scan/scan.js
  4. 13 0
      subpages/scan/scan.wxml
  5. 57 0
      subpages/scan/scan.wxss

+ 1 - 1
pages/index/index.js

@@ -151,7 +151,7 @@ Page({
       case 3:
         // need Login
         if (hasAuth) {
-          if (index == 0 || index == 1) {
+          if (index == 0) {
             var hasHotelAuth = wx.getStorageSync("hasHotelAuth");
             if (!hasHotelAuth) {
               this.setData({

+ 0 - 3
subpages/main/main.json

@@ -3,8 +3,5 @@
     "ec-canvas": "../../ec-canvas/ec-canvas",
     "authorized-login-dialog": "../../componets/authorized-login-dialog/authorizedLoginDialog"
   },
-  "navigationBarRightButton": {
-    "hide": true
-  },
   "navigationStyle": "custom"
 }

+ 16 - 9
subpages/scan/scan.js

@@ -5,6 +5,7 @@ Page({
   data: {
     showAuthorizedDialog: false,
     hasAuth: false,
+    showTipsA: false,
     activeIcon: "/subpages/icons/ic_selected_radio.svg",
     normalIcon: "/subpages/icons/ic_radio.svg",
     logs: [],
@@ -26,8 +27,14 @@ Page({
       checkedPrivacy: check
     });
   },
+  onCloseTipsDialog() { 
+    this.setData({
+      showTipsA: false,
+    })
+  },
   //扫码
   tapScan() {
+    const that = this;
     if (!this.data.hasAuth) {
       this.showDialog();
       return;
@@ -48,19 +55,19 @@ Page({
           let hotelcodeTemp = res.result.split('|')[0];
           let roomcodeTemp = res.result.split('|')[1];
           // wx.clearStorage();
-          var userInfo = wx.getStorageSync("userInfo") || {};
-          // if (hotelcodeTemp == userInfo.hotel && roomcodeTemp == userInfo.room) {
+          var hotelEmpower = wx.getStorageSync("hotelEmpower");
+          var roomEmpower = wx.getStorageSync("roomEmpower");
+          if (hotelcodeTemp == hotelEmpower && roomcodeTemp == roomEmpower) {
             wx.setStorageSync('res', res);
             wx.setStorageSync('scanResultExpiresAt', Date.now() + 2 * 60 * 60 * 1000); // 超时时间戳,例如设置为2小时后过期
             wx.reLaunch({
-              url: '/pages/index/index?res=' + res,//传res
+              url: '/subpages/main/main?res=' + res,//传res
+            })
+          } else {
+            that.setData({
+              showTipsA: true
             })
-          // } else {
-          //   wx.showToast({
-          //     title: '暂无权限,请先办理入住',
-          //     icon: 'none'
-          //   });
-          // }
+          }
         }
 
       }

+ 13 - 0
subpages/scan/scan.wxml

@@ -27,4 +27,17 @@
   </view>
   <authorized-login-dialog showDialog="{{showAuthorizedDialog}}"
     bind:authorizationSuccessful="authorizationSuccessful"></authorized-login-dialog>
+  <van-popup show="{{ showTipsA }}" bind:close="onCloseTipsDialog" custom-style="background-color: transparent;">
+    <view class="tips-box">
+      <view class="tips-content">
+        <image class="ic-tips" src="/static/index/icon/ic_zwqx1.png" mode="widthFix"></image>
+        <text class="tips-title">暂无权限</text>
+        <text
+          class="tips-desc">{{'暂无权限的原因如下:\n1、您不是酒店住客或者爱眠客床垫用户,没有权限查看睡眠报告。\n2、您是酒店住客,但是没有获取到您的信息,请联系前台。\n3、您是爱眠客床垫用户,请联系客服。'}}</text>
+      </view>
+      <view class="tips-close-btn" bindtap="onCloseTipsDialog">
+        <van-icon name="close" color="#FFFFFF" size="56rpx" />
+      </view>
+    </view>
+  </van-popup>
 </view>

+ 57 - 0
subpages/scan/scan.wxss

@@ -129,4 +129,61 @@
 .privacy-detail-btn_tk {
   font-size: 24rpx;
   color: #0BC3AA;
+}
+
+.tips-box {
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+}
+
+.tips-content {
+  width: 630rpx;
+  min-height: 566rpx;
+  background: linear-gradient(180deg, #C7DAFF 0%, #FFFFFF 37%, #FFFFFF 100%);
+  border-radius: 16rpx 16rpx 16rpx 16rpx;
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+}
+
+.tips-contentB {
+  width: 630rpx;
+  min-height: 566rpx;
+  background: linear-gradient(180deg, #CCFFF8 0%, #FFFFFF 37%, #FFFFFF 100%);
+  border-radius: 16rpx 16rpx 16rpx 16rpx;
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+}
+
+.tips-close-btn {
+  display: flex;
+  flex-direction: column;
+  justify-content: center;
+  align-items: center;
+  height: 116rpx;
+  width: 116rpx;
+}
+
+.ic-tips {
+  margin-top: 42rpx;
+  height: 200rpx;
+  width: 200rpx;
+}
+
+.tips-title {
+  margin-top: 40rpx;
+  color: #3E3D44;
+  font-size: 32rpx;
+}
+
+.tips-desc {
+  width: calc(100% - 72rpx);
+  margin-top: 30rpx;
+  margin-left: auto;
+  margin-right: auto;
+  margin-bottom: 40rpx;
+  color: #6C6970;
+  font-size: 24rpx;
 }