kk.shi %!s(int64=3) %!d(string=hai) anos
pai
achega
905e8bc304
Modificáronse 2 ficheiros con 84 adicións e 47 borrados
  1. 78 44
      pages/integral/integral.js
  2. 6 3
      pages/integral/integral.wxml

+ 78 - 44
pages/integral/integral.js

@@ -111,6 +111,9 @@ Page({
             }
         }).catch(error=>{
             console.log(error);
+            if (error.data.code === '2000') {
+                this.scoreClick()
+            }
         })
     }
   },
@@ -420,51 +423,57 @@ getphoneClick() {
                         }
                     }
                 }
-            } else {
-                this.setData({
-                    loading: true,
-                    bgStatus: true
-                })
-                
-                setTimeout(() => {
-                    // #ifdef H5
-                    window.location.href = arr.message;
-                    // #endif
-
-                    // #ifdef MP-WEIXIN
-                    const version = wx.getSystemInfoSync().SDKVersion
-
-                    if (this.compareVersion(version, '2.20.1') >= 0) {
-                        wx.openEmbeddedMiniProgram({
-                            appId: arr.data.appId,
-                            path: arr.data.path,
-                            extraData: arr.data.extraData,
-                            success(res) {
-                                // 打开成功
-                            },
-                            fail() {}
-                        })
-                    } else {
-                        // 如果希望用户在最新版本的客户端上体验您的小程序,可以这样子提示
-                        wx.navigateToMiniProgram({
-                            appId: arr.data.appId,
-                            path: arr.data.path,
-                            extraData: arr.data.extraData,
-                            success(res) {
-                                // 打开成功
-                            },
-                            fail() {
-
-                            }
-                        })
-                    }
-                    // #endif
-                    this.hideModal()
-                    this.loading = false
-                }, 4000)
-            }
+            } 
         }).catch(error => {
            console.log(error)
+           let arr = error.data
+           console.log(arr)
+           if(arr.code ==='2000'){
+            this.setData({
+                scorePhone: false,
+                loading: true,
+                bgStatus: true
+            })
+            
+            setTimeout(() => {
+                // #ifdef H5
+                // window.location.href = arr.message;
+                // #endif
+
+                // #ifdef MP-WEIXIN
+                const version = wx.getSystemInfoSync().SDKVersion
+
+                if (this.compareVersion(version, '2.20.1') >= 0) {
+                    wx.openEmbeddedMiniProgram({
+                        appId: arr.data.appId,
+                        path: arr.data.path,
+                        extraData: arr.data.extraData,
+                        success(res) {
+                            // 打开成功
+                        },
+                        fail() {}
+                    })
+                } else {
+                    // 如果希望用户在最新版本的客户端上体验您的小程序,可以这样子提示
+                    wx.navigateToMiniProgram({
+                        appId: arr.data.appId,
+                        path: arr.data.path,
+                        extraData: arr.data.extraData,
+                        success(res) {
+                            // 打开成功
+                        },
+                        fail() {
+
+                        }
+                    })
+                }
+                // #endif
+                this.hideModal()
+                this.setData({
+                    loading: false
+                })
+            }, 4000)
+           }
         })
     }
 },
@@ -874,6 +883,31 @@ paymentClick() {
         wx.navigateTo({
             url: '../integral/exchange?obj=' + JSON.stringify(obj)
         })
-    }
+    },
+    compareVersion(v1, v2) {
+        v1 = v1.split('.')
+        v2 = v2.split('.')
+        const len = Math.max(v1.length, v2.length)
+
+        while (v1.length < len) {
+            v1.push('0')
+        }
+        while (v2.length < len) {
+            v2.push('0')
+        }
+
+        for (let i = 0; i < len; i++) {
+            const num1 = parseInt(v1[i])
+            const num2 = parseInt(v2[i])
+
+            if (num1 > num2) {
+                return 1
+            } else if (num1 < num2) {
+                return -1
+            }
+        }
+
+        return 0
+    },
        
 })

+ 6 - 3
pages/integral/integral.wxml

@@ -141,8 +141,11 @@
 
   <!-- 查询中等待效果框 -->
   <view class="score-integral" wx:if="{{loading}}">
-    <view class="loading-bg-img">
+    <!-- <view class="loading-bg-img">
       <image class="loading-bg-image" src="../../images/logo.png" mode=""></image>
+    </view> -->
+     <view class="loading-bg-img" style="text-align: center;margin-top: 10rpx;">
+      <view style="font-weight: bold">中国移动积分查询中...</view>
     </view>
     <view class="loading-title" style="margin: 30upx auto;">
       <text class="iconfont iconphone"></text>
@@ -151,9 +154,9 @@
     <view class="loading-title">
       <text style="display:inline-block;">中国移动官方授权积分查询</text>
     </view>
-    <view class="loading">
+    <!-- <view class="loading">
       <image class="loading-image" src="../../images/logo.png" mode=""></image>
-    </view>
+    </view> -->
   </view>
 
 <!-- 弹出框背景黑化 -->