Commit bd08a3f9 by 李伟康

增加获取微信用户信息方法

1 parent 53dc6d7f
......@@ -138,6 +138,15 @@ class UsersApi {
* 只传loginToken就返回unionId和openid
* 传加密信息就解析手机号
*/
/**获取微信用户信息 */
async getWXUserInfo() {
let wx_user_info = wx.$storage.get('wx_user_info')
if (!wx_user_info) {
const data = await this.getUserProfile()
wx.$storage.set('wx_user_info', data)
return data
} else return wx_user_info
}
async getUserProfile(loginToken, detail = {}) {
if (detail.errMsg && detail.errMsg == 'getPhoneNumber:fail user deny') Promise.reject()
delete detail.errMsg
......@@ -150,8 +159,7 @@ class UsersApi {
method: 'scrm.api.sso.wechat.applets.phone.grant.analysis',
...detail,
platformEntrance: 'BUSINESS_ASSISTANT'
}
)
})
}
}
export default UsersApi
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!