Explorar o código

贷款-注册会员代码优化

panyong %!s(int64=4) %!d(string=hai) anos
pai
achega
f528276a45
Modificáronse 1 ficheiros con 24 adicións e 14 borrados
  1. 24 14
      htmldev/loan/src/views/loan/register/index.vue

+ 24 - 14
htmldev/loan/src/views/loan/register/index.vue

@@ -181,7 +181,8 @@
         ],
         numCount: 60,
         strCapture: STRCAPTURE,
-        timer: null
+        timer: null,
+        numPositionY: 0
       }
     },
     async mounted () {
@@ -233,22 +234,30 @@
           }
         ]
         this.strCapture = STRCAPTURE
+        this.numPositionY = 0
+        this.$nextTick(() => {
+          if (!this.scroll) {
+            this.scroll = new BScroll(this.$refs.wrapper, {
+              click: true,
+              pullUpLoad: {
+                threshold: -20
+              },
+              scrollbar: true
+            })
+          }
+        })
+        this.funInit()
         this.funGetChinaArea()
+      } else {
+        this.$nextTick(() => {
+          if (this.scroll) {
+            this.scroll.refresh()
+            this.scroll.scrollTo(0, this.numPositionY)
+          }
+        })
       }
       this.numCount = 60
       clearInterval(this.timer)
-      if (!this.scroll) {
-        this.scroll = new BScroll(this.$refs.wrapper, {
-          click: true,
-          pullUpLoad: {
-            threshold: -20
-          },
-          scrollbar: true
-        })
-      } else {
-        this.scroll.refresh()
-      }
-      this.funInit()
       this.$route.meta.isUseCache = false
     },
     methods: {
@@ -358,7 +367,7 @@
         getUserInfo().then(res => {
           const { status } = res
           if (status) {
-            this.$router.replace({ path: '/loan/mine' })
+            // this.$router.replace({ path: '/loan/mine' })
           }
         }).catch((err) => {
           Toast(err)
@@ -402,6 +411,7 @@
       if (['loanPrivacy', 'loanVipAgreement'].includes(to.name)) {
         from.meta.isUseCache = true
       }
+      this.numPositionY = this.scroll ? this.scroll.y : 0
       next()
     }
   }