本文主要是介绍uniapp/微信小程序 获取手机号码,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
<button
type="primary"
open-type="getPhoneNumber"
@getphonenumber="getPhoneNumber"
>获取本机号码</button>
getPhoneNumber(e) {
this.$request({
url: 'user/get_phonenumber'
, method: 'POST'
, data: {
encrypteddata: e.detail.encryptedData
, iv: e.detail.iv
, sessionkey: gracejs.getStorage('user_sessionkey')
}
}).then(res => {
if (res) {
this.run_mobile = res.phoneNumber
}
})
}
function get_phonenumber(){
$encrypteddata=I('encrypteddata');
$aes_encrypteddata=base64_decode($encrypteddata);
$iv=I('iv');
$aes_iv=base64_decode($iv);
$sessionkey=I('sessionkey');
$aes_sessionkey=base64_decode($sessionkey);
$result=openssl_decrypt($aes_encrypteddata,"AES-128-CBC",$aes_sessionkey,1,$aes_iv);
\ajax_success(\jsondecode($result));
}
这篇关于uniapp/微信小程序 获取手机号码的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!