Commit 1fb6838a by 姜雷

注册添加用户code

parent dc648dca
......@@ -35,7 +35,16 @@ export const changePwdByCellphone = (data: PwdParams) =>
data: data,
});
type RegisiterPramas = {};
type RegisiterPramas = {
code: string;
areaId: number;
areaName: string;
customerName: string;
customerPhone: string;
customerSex: string;
password: string;
verificationCode: string;
};
// type RegisiterReponseData = {};
export const wxUserRegister = (entity: RegisiterPramas) =>
......
......@@ -160,37 +160,43 @@ class Register extends Component {
userinfo: { areaId, areaName },
updateUserInfo,
} = this.props;
wxUserRegister({
areaId: areaId,
areaName: areaName,
customerName: name,
customerPhone: cellphone,
customerSex: sex,
password: pwd,
verificationCode: vcode,
})
.then(res => {
const { register, wxToken, ...userInfo } = res.data;
console.log(userInfo);
updateUserInfo({
...userInfo,
token: wxToken,
});
Taro.showToast({
title: '注册成功',
});
setTimeout(() => {
Taro.reLaunch({
url: '/pages/Home/Home',
Taro.login()
.then(res => res.code)
.then(code => {
wxUserRegister({
code: code,
areaId: areaId,
areaName: areaName,
customerName: name,
customerPhone: cellphone,
customerSex: sex,
password: pwd,
verificationCode: vcode,
})
.then(res => {
const { register, wxToken, ...userInfo } = res.data;
console.log(userInfo);
updateUserInfo({
...userInfo,
token: wxToken,
});
Taro.showToast({
title: '注册成功',
});
setTimeout(() => {
Taro.reLaunch({
url: '/pages/Home/Home',
});
}, 2000);
})
.catch(err => {
console.log(err);
this.setState({
fetching: false,
});
});
}, 2000);
})
.catch(err => {
console.log(err);
this.setState({
fetching: false,
});
});
.catch(console.log);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment