Commit 1fb6838a by 姜雷

注册添加用户code

parent dc648dca
...@@ -35,7 +35,16 @@ export const changePwdByCellphone = (data: PwdParams) => ...@@ -35,7 +35,16 @@ export const changePwdByCellphone = (data: PwdParams) =>
data: data, data: data,
}); });
type RegisiterPramas = {}; type RegisiterPramas = {
code: string;
areaId: number;
areaName: string;
customerName: string;
customerPhone: string;
customerSex: string;
password: string;
verificationCode: string;
};
// type RegisiterReponseData = {}; // type RegisiterReponseData = {};
export const wxUserRegister = (entity: RegisiterPramas) => export const wxUserRegister = (entity: RegisiterPramas) =>
......
...@@ -160,37 +160,43 @@ class Register extends Component { ...@@ -160,37 +160,43 @@ class Register extends Component {
userinfo: { areaId, areaName }, userinfo: { areaId, areaName },
updateUserInfo, updateUserInfo,
} = this.props; } = this.props;
wxUserRegister({ Taro.login()
areaId: areaId, .then(res => res.code)
areaName: areaName, .then(code => {
customerName: name, wxUserRegister({
customerPhone: cellphone, code: code,
customerSex: sex, areaId: areaId,
password: pwd, areaName: areaName,
verificationCode: vcode, customerName: name,
}) customerPhone: cellphone,
.then(res => { customerSex: sex,
const { register, wxToken, ...userInfo } = res.data; password: pwd,
console.log(userInfo); verificationCode: vcode,
updateUserInfo({ })
...userInfo, .then(res => {
token: wxToken, const { register, wxToken, ...userInfo } = res.data;
}); console.log(userInfo);
Taro.showToast({ updateUserInfo({
title: '注册成功', ...userInfo,
}); token: wxToken,
setTimeout(() => { });
Taro.reLaunch({ Taro.showToast({
url: '/pages/Home/Home', title: '注册成功',
});
setTimeout(() => {
Taro.reLaunch({
url: '/pages/Home/Home',
});
}, 2000);
})
.catch(err => {
console.log(err);
this.setState({
fetching: false,
});
}); });
}, 2000);
}) })
.catch(err => { .catch(console.log);
console.log(err);
this.setState({
fetching: false,
});
});
} }
} }
......
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