<button v-else class='bottom' type='primary' open-type="getPhoneNumber" lang="zh_CN" @getphonenumber="bindGetPhoneNumber" scope='phoneNumber'>
手机号授权
</button>
// methods
bindGetPhoneNumber(e) {
console.log(e.detail)
}
// 授权返回结果如下
{errMsg: "getPhoneNumber:fail Error: {"response":"9j0HH6Qeo5A+kixxLFLIBTn4/8IND8ZtwoZqI+mRJz70moFKt1KzzW+VMDDMkuanFxsOww0898rHZKy5bXjoIg==","sign":"XggAr8O9rSToCx6q7rwx04o52kAdt/UbuAc500DSyPR30lIK4hgfJBo9VNf+Ipq0tFHwDaU8f3XSu/8vb8v4TDKVLQ/4yWDtUIRpQx0MyEwkEAgrRrJ1Tkjg99E+osg4FAXEyfFmV0MePGB3bfNm23x3AfT9ppQ+kG943BnoRH6/zqqf/EtduiCBrXKeaxIbFWvLwCEcWekOmPOon/i9+8SoWS9XnhTIWQ+NAJQQTvvMnlDm+5Zz+xd2bbkrK7+dr2VoCIMuv/4LDXggxZWpAlvHYRKXL4SiipxX2g0BxUj7K53DY7gFVYVtcUld65trfnPoOlM5XL0MdDVy18qm4w=="}"}
- 发布:2020-07-30 17:33
- 更新:2022-09-27 09:56
- 阅读:1712
产品分类: uniapp/小程序/阿里
PC开发环境操作系统: Mac
PC开发环境操作系统版本号: MacOS 10.14.6
HBuilderX类型: 正式
HBuilderX版本号: 2.8.3
第三方开发者工具版本号: 2.8.3.20200728
基础库版本号: 2.8.3
项目创建方式: HBuilderX
示例代码:
操作步骤:
<button v-else class='bottom' type='primary' open-type="getPhoneNumber" lang="zh_CN" @getphonenumber="bindGetPhoneNumber" scope='phoneNumber'>
手机号授权
</button>
// methods
bindGetPhoneNumber(e) {
console.log(e.detail)
}
// 以上代码可复现
<button v-else class='bottom' type='primary' open-type="getPhoneNumber" lang="zh_CN" @getphonenumber="bindGetPhoneNumber" scope='phoneNumber'>
手机号授权
</button>
// methods
bindGetPhoneNumber(e) {
console.log(e.detail)
}
// 以上代码可复现
预期结果:
// 预期结果
{
"errMsg": "getPhoneNumber:ok",
"encryptedData": "9j0HH6Qeo5A+kixxLFLIBTn4/8IND8ZtwoZqI+mRJz70moFKt1KzzW+VMDDMkuanFxsOww0898rHZKy5bXjoIg==",
"sign": "XggAr8O9rSToCx6q7rwx04o52kAdt/UbuAc500DSyPR30lIK4hgfJBo9VNf+Ipq0tFHwDaU8f3XSu/8vb8v4TDKVLQ/4yWDtUIRpQx0MyEwkEAgrRrJ1Tkjg99E+osg4FAXEyfFmV0MePGB3bfNm23x3AfT9ppQ+kG943BnoRH6/zqqf/EtduiCBrXKeaxIbFWvLwCEcWekOmPOon/i9+8SoWS9XnhTIWQ+NAJQQTvvMnlDm+5Zz+xd2bbkrK7+dr2VoCIMuv/4LDXggxZWpAlvHYRKXL4SiipxX2g0BxUj7K53DY7gFVYVtcUld65trfnPoOlM5XL0MdDVy18qm4w=="
}
// 预期结果
{
"errMsg": "getPhoneNumber:ok",
"encryptedData": "9j0HH6Qeo5A+kixxLFLIBTn4/8IND8ZtwoZqI+mRJz70moFKt1KzzW+VMDDMkuanFxsOww0898rHZKy5bXjoIg==",
"sign": "XggAr8O9rSToCx6q7rwx04o52kAdt/UbuAc500DSyPR30lIK4hgfJBo9VNf+Ipq0tFHwDaU8f3XSu/8vb8v4TDKVLQ/4yWDtUIRpQx0MyEwkEAgrRrJ1Tkjg99E+osg4FAXEyfFmV0MePGB3bfNm23x3AfT9ppQ+kG943BnoRH6/zqqf/EtduiCBrXKeaxIbFWvLwCEcWekOmPOon/i9+8SoWS9XnhTIWQ+NAJQQTvvMnlDm+5Zz+xd2bbkrK7+dr2VoCIMuv/4LDXggxZWpAlvHYRKXL4SiipxX2g0BxUj7K53DY7gFVYVtcUld65trfnPoOlM5XL0MdDVy18qm4w=="
}
实际结果:
// 授权返回结果如下
{errMsg: "getPhoneNumber:fail Error: {"response":"9j0HH6Qeo5A+kixxLFLIBTn4/8IND8ZtwoZqI+mRJz70moFKt1KzzW+VMDDMkuanFxsOww0898rHZKy5bXjoIg==","sign":"XggAr8O9rSToCx6q7rwx04o52kAdt/UbuAc500DSyPR30lIK4hgfJBo9VNf+Ipq0tFHwDaU8f3XSu/8vb8v4TDKVLQ/4yWDtUIRpQx0MyEwkEAgrRrJ1Tkjg99E+osg4FAXEyfFmV0MePGB3bfNm23x3AfT9ppQ+kG943BnoRH6/zqqf/EtduiCBrXKeaxIbFWvLwCEcWekOmPOon/i9+8SoWS9XnhTIWQ+NAJQQTvvMnlDm+5Zz+xd2bbkrK7+dr2VoCIMuv/4LDXggxZWpAlvHYRKXL4SiipxX2g0BxUj7K53DY7gFVYVtcUld65trfnPoOlM5XL0MdDVy18qm4w=="}"}
// 授权返回结果如下
{errMsg: "getPhoneNumber:fail Error: {"response":"9j0HH6Qeo5A+kixxLFLIBTn4/8IND8ZtwoZqI+mRJz70moFKt1KzzW+VMDDMkuanFxsOww0898rHZKy5bXjoIg==","sign":"XggAr8O9rSToCx6q7rwx04o52kAdt/UbuAc500DSyPR30lIK4hgfJBo9VNf+Ipq0tFHwDaU8f3XSu/8vb8v4TDKVLQ/4yWDtUIRpQx0MyEwkEAgrRrJ1Tkjg99E+osg4FAXEyfFmV0MePGB3bfNm23x3AfT9ppQ+kG943BnoRH6/zqqf/EtduiCBrXKeaxIbFWvLwCEcWekOmPOon/i9+8SoWS9XnhTIWQ+NAJQQTvvMnlDm+5Zz+xd2bbkrK7+dr2VoCIMuv/4LDXggxZWpAlvHYRKXL4SiipxX2g0BxUj7K53DY7gFVYVtcUld65trfnPoOlM5XL0MdDVy18qm4w=="}"}
bug描述:
前提:支付宝小程序已经获得”获取会员基础信息“和”获取会员手机号“权限
在依次点击获取基础授权和手机号授权后,可以拿到返回的response加密数据,但是格式有误,期望获得和微信小程序一致的数据格式。
沐小馨
这个你解决了吗?是什么原因,我也遇到了
2020-11-30 13:55