Commit e09493fe by zeven

刷脸设备兼容共享客服店

parent 47ce025e
{
"name": "zm-face-counter",
"version": "1.3.8",
"version": "1.3.9",
"private": true,
"scripts": {
"android": "react-native run-android",
......
......@@ -55,7 +55,7 @@ export default {
if (data && data.code === 1) {
if (data.data && data.data.type) {
// 设备类型
yield call(AsyncStorage.setItem, 'DTYPE', data.data.type);
yield call(AsyncStorage.setItem, 'STYPE', data.data.type);
}
if (data.data && data.data.contact) {
yield call(AsyncStorage.setItem, 'CONTACT', data.data.contact);
......
......@@ -58,7 +58,8 @@ class FacePage extends Component {
this.storeKey = await AsyncStorage.getItem('KEY');
let contact = await AsyncStorage.getItem('CONTACT');
let storeName = await AsyncStorage.getItem('NAME');
this.setState({contact, storeName});
let stype = await AsyncStorage.getItem('STYPE');
this.setState({contact, storeName, stype});
if (!this.init) {
this.init = await WxFacepay.initialize(10000, {
perform_mode: 'LOW_PERFORM',
......@@ -246,7 +247,7 @@ class FacePage extends Component {
else if (action === '出店') this.action = 'enter';
this.loading(false);
// 即拿迷你店,唤醒屏幕时间为1分钟
this.sense ? this.wakeUp(60000) : this.wakeUp();
this.wakeUp();
if (this.sense) {
// 进门自动调起刷脸
if (this.action === 'enter') this.face();
......@@ -570,6 +571,7 @@ class FacePage extends Component {
};
if (validity.phone.test(this.phone)) action.phone = this.phone;
if (this.sense) action.sense = true;
if (this.state.stype) action.stype = this.state.stype;
const ret = await this.props.dispatch(action);
this.phone = '';
this.loading(false);
......@@ -629,6 +631,7 @@ class FacePage extends Component {
alipayUid: res.uid,
};
if (this.sense) action.sense = true;
if (this.state.stype) action.stype = this.state.stype;
const ret = await this.props.dispatch(action);
this.loading(false);
this.handleDoorLogin(ret);
......@@ -701,12 +704,13 @@ class FacePage extends Component {
}
};
wakeUp = (timeout = 18888) => {
wakeUp = (timeout = 60000) => {
this.setState({sleep: false, tipsModal: false, goTipsModal: false});
clearTimeout(this.wakeUpTimeout);
this.wakeUpTimeout = setTimeout(() => {
this.setState({sleep: true, tipsModal: false, goTipsModal: false});
}, timeout);
if (this.state.stype === 'guard') this.face();
};
goTips = async () => {
......
......@@ -54,11 +54,11 @@ class VerticalPage extends Component {
};
async componentWillMount() {
let dtype = await AsyncStorage.getItem('DTYPE');
let stype = await AsyncStorage.getItem('STYPE');
let contact = await AsyncStorage.getItem('CONTACT');
// let lock = await AsyncStorage.getItem('settingLock');
// if (lock) this.props.dispatch({ type: 'app/lock', lock });
this.setState({dtype, contact});
this.setState({stype, contact});
this.storeKey = await AsyncStorage.getItem('KEY');
if (!this.init) {
this.init = await WxFacepay.initialize(10000);
......@@ -361,7 +361,9 @@ class VerticalPage extends Component {
hintVisible: true,
});
clearTimeout(this.callModalTimeout);
this.callModalTimeout = setTimeout(() => { this.setState({ hintVisible: false }); }, 300000);
this.callModalTimeout = setTimeout(() => {
this.setState({hintVisible: false});
}, 300000);
};
onNoBuy = async () => {
......@@ -554,7 +556,7 @@ class VerticalPage extends Component {
logoVisible,
logo,
priceVisible,
dtype,
stype,
} = this.state;
pageSize =
goods && goods.bags.length > 0
......@@ -595,7 +597,7 @@ class VerticalPage extends Component {
this.state.faceType === 'wxpay' ? this.wxFacepay : this.smilepay;
return (
<View style={styles.main}>
{goodsArr.length === 0 && dtype === 'guard' ? (
{goodsArr.length === 0 && stype === 'guard' ? (
<View style={styles.guardModal}>
<View style={styles.guardModal_image}>
<Image style={styles.Imageee} source={guide} />
......@@ -1108,8 +1110,7 @@ class HintPhone extends React.Component {
如无法接通客服,可拨打电话: {contact}
</Text>
</View>
<Touch
onPress={closeHint}>
<Touch onPress={closeHint}>
<View
style={{
width: scaleSize(200),
......
......@@ -46,6 +46,7 @@ export function wxdoor({
sense,
orderId,
authCode,
stype,
}) {
return axios.post(
'/store/wxdoor',
......@@ -60,6 +61,7 @@ export function wxdoor({
sense,
orderId,
authCode,
stype,
}),
);
}
......
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