Authored by 王水玲

ufo

... ... @@ -62,7 +62,6 @@ export default class UserCenter extends Component {
});
this.showUserInfo();
this.getInfoNum();
}
//测试接口,将获取到的unionID等参数,上报给服务端以便于调试
... ...
No preview for this file type
import {login as loginModel} from '../models';
export default {
/**
* button触发getUserInfo之后立即解析获取unionid
*/
decodeUnionId(srd_session, result, callbackFunc) {
let res = result.detail;
let userInfo = res.userInfo;
let nickName = userInfo.nickName;
//保存用户信息
// app.setUserInfo(res.userInfo)
let param = {
method: 'wechat.smallProgram.decodeUserInfo',
}
loginModel.getDecodeUserInfo({
srdSession: srd_session,
encryptedData: res.encryptedData,
iv: res.iv
}).then(data => {
let responseData = data.data
checkUnionIDExist(responseData.openid + '', responseData.union_id + '', responseData.srd_session + '', param.method)
if (!isStringEmpty(responseData.union_id)) {
//保存并查询该unionID是否有uid
app.setWXUnionID(responseData.union_id);
callbackFunc({
isHaveUnionID: true,
});
sendWeChatUserDataWithUnionId(responseData.union_id, userInfo.nickName, userInfo.avatarUrl)
wechatUserIsBind(responseData.union_id, nickName, userInfo.avatarUrl, callbackFunc);
}
})
.catch(error => {
callbackFunc({
succeed: false,
message: error.message
});
});
}
};
\ No newline at end of file