Browse Source

首页加loading

wangtao 3 years ago
parent
commit
f133b439dd

+ 2 - 0
src/views/balance/index.vue

@@ -108,6 +108,8 @@ export default {
                   if(typeof(_this.balanceHC) == "number"){
                     if(time1 <= _this.timeStamp(res.data.data.records[0].createTime)){
                       _this.balance = res.data.data.records[0].balance
+                      localStorage.setItem("getBalanceTime",getNowTime())
+                      _this.createdTime = "更新时间:" + localStorage.getItem("getBalanceTime")
                     }else{
                       _this.balance = _this.balanceHC
                       localStorage.setItem("getBalanceTime",getNowTime())

+ 59 - 31
src/views/home/index.vue

@@ -27,6 +27,16 @@
         <van-col :span="24">查看消费记录和充值记录</van-col>
       </van-row>
     </van-row>
+
+    <van-loading
+      size="24px"
+      v-if="loading"
+      color="#fff"
+      vertical
+      style="z-index: 999999; position: fixed; top: 40%; left: 0; right: 0"
+      >加载中...</van-loading
+    >
+    <van-overlay :show="loading" style="z-index: 100; position: fixed" />
   </div>
 </template>
 
@@ -38,22 +48,46 @@ export default {
   data() {
     return {
       user:undefined,
-      type:undefined
+      type:undefined,
+      loading: false,
     };
   },
   created(){
-    localStorage.removeItem('type');
-    localStorage.removeItem('user');
     var url = window.location.href;
     if(url.indexOf("token") > 1){
       //("app进入")
       if(this.getQueryVariable("token")){
-        axios({//查询信息
+        if(localStorage.getItem("user")){
+
+        }else{
+          this.loading = true
+        }
+        this.userQuery()
+      }else{
+        //console.log("app进入")
+        Toast(this.getQueryVariable("无token传入!"))
+      }
+    }else if(this.getQueryVariable("type")){
+      //console.log("扫码游客进入")
+      localStorage.removeItem('type');
+      localStorage.removeItem('user');
+      localStorage.setItem("type",this.type)
+    }else{
+      localStorage.removeItem('user');
+      localStorage.removeItem('type');
+      //console.log("无user、type进入")
+    }
+  },
+  mounted() {
+  },
+  methods: {
+    //用户查询
+    userQuery(){
+      axios({//查询信息
           method: 'get',
           url: 'https://smartpark.caih.com/zkxt/api/thirdparty/v1/user/getZkUserByCipher?cipher=' + this.getQueryVariable("token"),
           timeout: 10000,
         }).then(res =>{
-
           if(res.data?.data?.id){
             axios.get(`/dxtop/staff/one?id=${res.data.data.id}`).then(res2 => { //验证充值信息是否同步
               if(res2.data.data){
@@ -62,33 +96,20 @@ export default {
               }else{
                 this.userNoAlert()
               }
+              this.loading = false
             })
           }else if(res.data?.data?.cardId){
+            this.loading = false
             Toast("用户卡号未绑定")
           }else{
+            this.loading = false
             this.userNoAlert()
           }
         }).catch(err =>{
+          this.loading = false
           this.userNoAlert()
         });
-      }else{
-        //console.log("app进入")
-        Toast(this.getQueryVariable("无token传入!"))
-      }
-    }else if(this.getQueryVariable("type")){
-      //console.log("扫码游客进入")
-      localStorage.removeItem('type');
-      localStorage.removeItem('user');
-      localStorage.setItem("type",this.type)
-    }else{
-      localStorage.removeItem('user');
-      localStorage.removeItem('type');
-      //console.log("无user、type进入")
-    }
-  },
-  mounted() {
-  },
-  methods: {
+    },
     userNoAlert(){
       Toast("当前账户初始流程中,请耐心等待或联系管理人员查询")
     },
@@ -122,18 +143,25 @@ export default {
       }
     },
     balance(){
-      if(localStorage.getItem("user")){
-        this.$router.push({ path: "/balance"})
-      }else{
-        this.userNoAlert()
+      var url = window.location.href;
+      if(url.indexOf("token") >1){
+        if(localStorage.getItem("user")){
+          this.$router.push({ path: "/balance"})
+        }else{
+          this.userNoAlert()
+        }
       }
     },
     record(){
-      if(localStorage.getItem("user")){
-        this.$router.push({ path: "/record"})
-      }else{
-        this.userNoAlert()
+      var url = window.location.href;
+      if(url.indexOf("token") >1){
+        if(localStorage.getItem("user")){
+          this.$router.push({ path: "/record"})
+        }else{
+          this.userNoAlert()
+        }
       }
+      
     }
   },
 };

+ 1 - 1
vuepay/index.html

@@ -1 +1 @@
-<!DOCTYPE html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"><meta name="format-detection" content="telephone=yes"><link rel="icon" href="/vuepay/favicon.ico"><script src="https://res2.wx.qq.com/open/js/jweixin-1.6.0.js"></script><title></title><script></script><link href="/vuepay/static/css/about.f3f8a25c.css" rel="prefetch"><link href="/vuepay/static/js/about.5997d690.js" rel="prefetch"><link href="/vuepay/static/css/app.c691c8f1.css" rel="preload" as="style"><link href="/vuepay/static/css/chunk-vendors.9e9d9b26.css" rel="preload" as="style"><link href="/vuepay/static/js/app.423afce6.js" rel="preload" as="script"><link href="/vuepay/static/js/chunk-vendors.635a522f.js" rel="preload" as="script"><link href="/vuepay/static/css/chunk-vendors.9e9d9b26.css" rel="stylesheet"><link href="/vuepay/static/css/app.c691c8f1.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="/vuepay/static/js/chunk-vendors.635a522f.js"></script><script src="/vuepay/static/js/app.423afce6.js"></script></body></html>
+<!DOCTYPE html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"><meta name="format-detection" content="telephone=yes"><link rel="icon" href="/vuepay/favicon.ico"><script src="https://res2.wx.qq.com/open/js/jweixin-1.6.0.js"></script><title></title><script></script><link href="/vuepay/static/css/about.e0e5630e.css" rel="prefetch"><link href="/vuepay/static/js/about.21fe78f9.js" rel="prefetch"><link href="/vuepay/static/css/app.c691c8f1.css" rel="preload" as="style"><link href="/vuepay/static/css/chunk-vendors.9e9d9b26.css" rel="preload" as="style"><link href="/vuepay/static/js/app.ce725d7f.js" rel="preload" as="script"><link href="/vuepay/static/js/chunk-vendors.635a522f.js" rel="preload" as="script"><link href="/vuepay/static/css/chunk-vendors.9e9d9b26.css" rel="stylesheet"><link href="/vuepay/static/css/app.c691c8f1.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="/vuepay/static/js/chunk-vendors.635a522f.js"></script><script src="/vuepay/static/js/app.ce725d7f.js"></script></body></html>

File diff suppressed because it is too large
+ 0 - 0
vuepay/static/css/about.e0e5630e.css


File diff suppressed because it is too large
+ 0 - 0
vuepay/static/js/about.21fe78f9.js


File diff suppressed because it is too large
+ 0 - 0
vuepay/static/js/about.5997d690.js


File diff suppressed because it is too large
+ 0 - 0
vuepay/static/js/app.ce725d7f.js


Some files were not shown because too many files changed in this diff