Commit f7b12965 by zeven

刷脸设备兼容即拿迷你店

parent 019a08ca
{
"name": "zm-face-counter",
"version": "1.1.8",
"version": "1.2.0",
"private": true,
"scripts": {
"android": "react-native run-android",
......
......@@ -80,6 +80,10 @@ class FacePage extends Component {
this.phone = this.phone.substr(0, this.phone.length - 1);
else if (/^\d$/.test(text)) this.phone += text;
if (this.phone.length > 11) this.phone = this.phone.substr(-11);
clearTimeout(this.clearPhoneTimeout); // 输入号码超过1分钟,自动清除号码,防止绑定错误号码
this.clearPhoneTimeout = setTimeout(() => {
this.phone = '';
}, 60000);
});
}
......@@ -174,12 +178,14 @@ class FacePage extends Component {
}
};
doorOpen = ({action}) => {
doorOpen = ({action, sense}) => {
this.action = action;
this.sense = sense;
if (action === '进店') this.action = 'leave';
else if (action === '出店') this.action = 'enter';
this.loading(false);
this.wakeUp();
if (this.sense && this.action === 'enter') this.face();
};
handleTalkCall = async () => {
......@@ -264,6 +270,10 @@ class FacePage extends Component {
});
return;
}
if (ret.code === -10) {
this.setQrcode({action: ret.action, tip: tipText, qrcode: true}); // 开通免密支付
return;
}
// else if (ret.orders && ret.orders.length > 0) {
// // 有购物订单
// let goodsArr = [];
......@@ -304,7 +314,9 @@ class FacePage extends Component {
setQrcode = ({action, tip, qrcode}) => {
const state = {
qrCode: `${qrHost}/#/store-${action || 'leave'}-j${this.storeKey}`,
qrCode: `${qrHost}/#/store-${action || 'leave'}-${
this.sense ? 's' : 'j'
}${this.storeKey}`,
};
if (tip) {
state.tip = tip;
......@@ -363,9 +375,7 @@ class FacePage extends Component {
}
if (!res.openid) {
// 返回错误出现二维码扫码
this.phone = '';
Speech.speak('请扫码开门');
this.setQrcode({action: this.action, tip: '请扫码开门', qrcode: true});
this.goTips();
return;
}
if (res.sub_openid) {
......@@ -379,6 +389,7 @@ class FacePage extends Component {
nickname: res.nickname,
};
if (validity.phone.test(this.phone)) action.phone = this.phone;
if (this.sense) action.sense = true;
const ret = await this.props.dispatch(action);
this.phone = '';
this.loading(false);
......@@ -412,15 +423,16 @@ class FacePage extends Component {
const res = await Smilepay.verify(JSON.parse(data.data));
if (res.code !== '1000') {
Toast.show(res.msg);
Speech.speak('请扫码开门');
this.setQrcode({action: this.action, tip: '请扫码开门', qrcode: true});
this.goTips();
return;
}
this.loading(true);
const ret = await this.props.dispatch({
const action = {
type: 'store/wxdoor',
alipayUid: res.uid,
});
};
if (this.sense) action.sense = true;
const ret = await this.props.dispatch(action);
this.loading(false);
this.handleDoorLogin(ret);
}
......@@ -491,7 +503,7 @@ class FacePage extends Component {
};
goTips = async () => {
Speech.speak('请扫码确认');
Speech.speak('请扫码开门');
this.setQrcode({action: this.action, tip: '请扫码开门', qrcode: true});
};
......@@ -586,9 +598,9 @@ class FacePage extends Component {
<TipsModal
visible={goTipsModal}
transparent
title={'扫码开门'}
title="温馨提示"
qrCode={qrCode}
tip="请扫码确认"
tip={tip}
onMaskPress={() => this.setState({goTipsModal: false})}
faceType={faceType}
/>
......
......@@ -43,10 +43,20 @@ export function wxdoor({
alipayUid,
fToken,
phone,
sense,
}) {
return axios.post(
'/store/wxdoor',
qs.stringify({userId, openid, wxtoken, nickname, alipayUid, fToken, phone}),
qs.stringify({
userId,
openid,
wxtoken,
nickname,
alipayUid,
fToken,
phone,
sense,
}),
);
}
......
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