2017-04-05 51 views

回答

1
getSMS(sms) 
    { 

    if(window.SMS)window.SMS.listSMS({},data=> 
    { 
     setTimeout(()=>{console.log(data); 
     this.otp =data; 
     if(Array.isArray(this.otp)) { 

       for(let i in this.otp) 
       { 
        var msg = this.otp[i]; 
         let msgaddress = msg.address; 
        let msgbody = msg.body; 
        var newValue = msgbody.slice(0,34); 

        if(msgaddress == "VK-POCKET" || msgaddress == "VM-POCKET" && newValue == "your pepocket registration otp is:") 
        { 

          var newVal = msgbody.substring(34,msgbody.length); 

          this.otpname=newVal; 
         } 
        } 


       } 

     },0) 
    },error=> 
    { 
     console.log(error); 
    }); 


    } 
相關問題