Parcourir la source

腾讯验证码

wangxin il y a 5 ans
Parent
commit
60e5348f5b
1 fichiers modifiés avec 14 ajouts et 16 suppressions
  1. 14 16
      src/view/captcha/captcha.vue

+ 14 - 16
src/view/captcha/captcha.vue

@@ -53,7 +53,8 @@
             }
             }
         },
         },
         mounted() {
         mounted() {
-            var container = document.querySelector("body")
+            const container = document.querySelector("body")
+            container.style.background = 'red'
             container.addEventListener('DOMSubtreeModified', function () {
             container.addEventListener('DOMSubtreeModified', function () {
                 const element = document.querySelector('#tcaptcha_transform')
                 const element = document.querySelector('#tcaptcha_transform')
                 const t_verify = document.querySelector('#t_verify')
                 const t_verify = document.querySelector('#t_verify')
@@ -62,17 +63,16 @@
                     mask.style.display = 'none'
                     mask.style.display = 'none'
                 }
                 }
                 if (t_verify) {
                 if (t_verify) {
+                    // console.log(t_verify);
+                    // document.querySelector('.t-verify').style.background = 'transparent'
                     t_verify.style.border = 'none'
                     t_verify.style.border = 'none'
+                    t_verify.style.background = 'transparent'
                 }
                 }
                 if (element) {
                 if (element) {
                     element.style.border = 'none'
                     element.style.border = 'none'
                 }
                 }
 
 
             }, false);
             }, false);
-            document.querySelector('iframe').onload = function () {
-
-            }
-
             this.isAndroid = /(Android)/i.test(navigator.userAgent)
             this.isAndroid = /(Android)/i.test(navigator.userAgent)
             this.isiOS = /(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)
             this.isiOS = /(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)
             const that = this;
             const that = this;
@@ -87,21 +87,23 @@
                             randstr: res.randstr,
                             randstr: res.randstr,
                             phone: that.phone
                             phone: that.phone
                         }).then(() => {
                         }).then(() => {
-                            that.$toast.fail({message: '验证码获取成功'})
                             if (that.isiOS) {
                             if (that.isiOS) {
                                 window.webkit.messageHandlers.returnVerificationCode.postMessage(res.ret.toString());
                                 window.webkit.messageHandlers.returnVerificationCode.postMessage(res.ret.toString());
                             }
                             }
                             if (that.isAndroid) {
                             if (that.isAndroid) {
                                 window.hap.verificationCode(res.ret.toString());
                                 window.hap.verificationCode(res.ret.toString());
                             }
                             }
+
                         }).catch(data => {
                         }).catch(data => {
                             that.$toast.fail({icon: 'close', message: data.errmsg})
                             that.$toast.fail({icon: 'close', message: data.errmsg})
-                            if (that.isiOS) {
-                                window.webkit.messageHandlers.returnVerificationCode.postMessage(res.ret.toString());
-                            }
-                            if (that.isAndroid) {
-                                window.hap.verificationCode(res.ret.toString());
-                            }
+                            setTimeout(function () {
+                                if (that.isiOS) {
+                                    window.webkit.messageHandlers.returnVerificationCode.postMessage(res.ret.toString());
+                                }
+                                if (that.isAndroid) {
+                                    window.hap.verificationCode(res.ret.toString());
+                                }
+                            }, 1200)
                         })
                         })
                     } else {
                     } else {
                         if (that.isiOS) {
                         if (that.isiOS) {
@@ -171,10 +173,6 @@
 </script>
 </script>
 
 
 <style lang="less" scoped>
 <style lang="less" scoped>
-    body {
-        background: transparent;
-    }
-
     .image {
     .image {
         height: 180px;
         height: 180px;
         position: fixed;
         position: fixed;