Commit ecc91797 by 修福龙

修复手机号码验证后闪退的问题

parent cbc8eed5
...@@ -3,8 +3,8 @@ import {View, Text, Image, Dimensions} from 'react-native'; ...@@ -3,8 +3,8 @@ import {View, Text, Image, Dimensions} from 'react-native';
import AsyncStorage from '@react-native-community/async-storage'; import AsyncStorage from '@react-native-community/async-storage';
import {connect} from 'react-redux'; import {connect} from 'react-redux';
// import {RtcEngineEvents} from 'react-native-agora/lib/RtcEvents'; // import {RtcEngineEvents} from 'react-native-agora/lib/RtcEvents';
import RtcEngine from 'react-native-agora'; // import RtcEngine from 'react-native-agora';
import {RtcChannel} from 'react-native-agora'; // import {RtcChannel} from 'react-native-agora';
import Touch from '../components/Touch'; import Touch from '../components/Touch';
import PhoneModal from '../components/PhoneModal'; import PhoneModal from '../components/PhoneModal';
import VerifyCodeModal from '../components/VerifyCodeModal'; import VerifyCodeModal from '../components/VerifyCodeModal';
...@@ -181,66 +181,66 @@ class FacePage extends Component { ...@@ -181,66 +181,66 @@ class FacePage extends Component {
} }
}; };
handleTalkCall = async () => { // handleTalkCall = async () => {
try { // try {
// const {talkCall} = this.state; // // const {talkCall} = this.state;
// 加入语音通话 // // 加入语音通话
clearInterval(this.noTalkCall); // clearInterval(this.noTalkCall);
const {data} = await this.props.dispatch({ // const {data} = await this.props.dispatch({
type: 'store/agora', // type: 'store/agora',
}); // });
console.log(data); // console.log(data);
if (!this.engine) { // if (!this.engine) {
this.engine = await RtcEngine.create(data.appid); // this.engine = await RtcEngine.create(data.appid);
// await this.engine.setLogFile('./engine.log'); //设置日志文件 // // await this.engine.setLogFile('./engine.log'); //设置日志文件
// await this.engine.setLogFileSize(1024); //指定 SDK 输出日志文件的内存大小,单位为 KB // // await this.engine.setLogFileSize(1024); //指定 SDK 输出日志文件的内存大小,单位为 KB
} // }
this.engine.createRtcChannel(data.channel); // this.engine.createRtcChannel(data.channel);
this.engine.addListener('Warning', data => { // this.engine.addListener('Warning', data => {
console.log('Warning' + data); // console.log('Warning' + data);
}); // });
this.engine.addListener('Error', data => { // this.engine.addListener('Error', data => {
console.log('Error' + data); // console.log('Error' + data);
}); // });
this.engine.addListener('JoinChannelSuccess', data => { // this.engine.addListener('JoinChannelSuccess', data => {
console.warn('JoinChannelSuccess'); // console.warn('JoinChannelSuccess');
console.warn(data); // console.warn(data);
}); // });
RtcChannel.joinChannel(data.token, null, 99, { // RtcChannel.joinChannel(data.token, null, 99, {
autoSubscribeAudio: true, // autoSubscribeAudio: true,
autoSubscribeVideo: false, // autoSubscribeVideo: false,
}); //Join Channel // }); //Join Channel
RtcChannel.enableAudio(); // RtcChannel.enableAudio();
// await this.engine.disableVideo(true); // 关闭视频模块 // // await this.engine.disableVideo(true); // 关闭视频模块
// await this.engine.enableLocalAudio(false); //调用 enableLocalAudio(false) 关闭本地采集后,系统会走媒体音量 // // await this.engine.enableLocalAudio(false); //调用 enableLocalAudio(false) 关闭本地采集后,系统会走媒体音量
// await this.engine.muteAllRemoteAudioStreams(false); //停止/恢复接收所有音频流。 // // await this.engine.muteAllRemoteAudioStreams(false); //停止/恢复接收所有音频流。
// await this.engine.setDefaultMuteAllRemoteAudioStreams(false); // 设置是否默认接收音频流 // // await this.engine.setDefaultMuteAllRemoteAudioStreams(false); // 设置是否默认接收音频流
// await this.engine.setDefaultMuteAllRemoteVideoStreams(true); // 设置是否默认接收视频流 // // await this.engine.setDefaultMuteAllRemoteVideoStreams(true); // 设置是否默认接收视频流
// await this.engine.disableVideo(); //关闭视频模块 // // await this.engine.disableVideo(); //关闭视频模块
// await this.engine.setAudioProfile(4, 3); //设置音频编码配置 // // await this.engine.setAudioProfile(4, 3); //设置音频编码配置
// await this.engine.adjustPlaybackSignalVolume(400); //调节本地播放的所有远端用户音量 // // await this.engine.adjustPlaybackSignalVolume(400); //调节本地播放的所有远端用户音量
// await this.engine.adjustAudioMixingPlayoutVolume(100); //调节音乐文件的本地播放音量 // // await this.engine.adjustAudioMixingPlayoutVolume(100); //调节音乐文件的本地播放音量
// await this.engine.setDefaultAudioRoutetoSpeakerphone(true); //默认从外放(扬声器)出声 // // await this.engine.setDefaultAudioRoutetoSpeakerphone(true); //默认从外放(扬声器)出声
// // //
// // await this.engine.addHandler(); //添加主回调事件 // // // await this.engine.addHandler(); //添加主回调事件
// await this.engine.enableWebSdkInteroperability(true); //打开与webSDK的互通 // // await this.engine.enableWebSdkInteroperability(true); //打开与webSDK的互通
// await this.engine.setChannelProfile(0); // // await this.engine.setChannelProfile(0);
// await this.engine.setClientRole(1); //设置为主播角色 // // await this.engine.setClientRole(1); //设置为主播角色
// // await this.engine.enableAudio(); // // // await this.engine.enableAudio();
// await this.engine.joinChannel(data.token, data.channel, null, 99); // // await this.engine.joinChannel(data.token, data.channel, null, 99);
// // await this.engine.setEnableSpeakerphone(true); //切换到外放 // // // await this.engine.setEnableSpeakerphone(true); //切换到外放
// if (!(await this.engine.isSpeakerphoneEnabled())) { // // if (!(await this.engine.isSpeakerphoneEnabled())) {
// console.warn(await this.engine.setEnableSpeakerphone(true)); // // console.warn(await this.engine.setEnableSpeakerphone(true));
// await this.engine.setEnableSpeakerphone(true); //切换到外放 // // await this.engine.setEnableSpeakerphone(true); //切换到外放
// } // // }
// console.warn(await this.engine.getCallId()); // // console.warn(await this.engine.getCallId());
this.setState({ // this.setState({
talkCall: 1, // talkCall: 1,
}); // });
} catch (e) { // } catch (e) {
console.log(e); // console.log(e);
} // }
}; // };
//设置事件监听 //设置事件监听
// setAgoreEventListener = () => { // setAgoreEventListener = () => {
...@@ -274,30 +274,31 @@ class FacePage extends Component { ...@@ -274,30 +274,31 @@ class FacePage extends Component {
// // }; // // };
// }; // };
leaveC = async () => { // leaveC = async () => {
const {data} = await this.props.dispatch({ // const {data} = await this.props.dispatch({
type: 'store/agora', // type: 'store/agora',
}); // });
if (!this.engine) { // if (!this.engine) {
this.engine = await RtcEngine.create(data.appid); // this.engine = await RtcEngine.create(data.appid);
} // }
// if (this.engine) { // // if (this.engine) {
console.warn('121212'); // console.warn('121212');
await this.engine.leaveChannel(); // await this.engine.leaveChannel();
// } // // }
}; // };
// device 代表当前打开的门 // device 代表当前打开的门
handleScaleChange = ({count}) => { handleScaleChange = ({count}) => {
console.warn(count);
if (count === -1) { if (count === -1) {
// 重力感应开始识别 // 重力感应开始识别
this.wechatFace(); this.wechatFace();
} else if (count === 0) { } else if (count === 0) {
// 重力感应归零 // 重力感应归零
clearInterval(this.noTalkCall); // clearInterval(this.noTalkCall);
if (!this.engine) { // if (!this.engine) {
this.engine.leaveChannel(); // this.engine.leaveChannel();
} // }
this.setState({ this.setState({
orderDetailsModal: false, orderDetailsModal: false,
phoneModal: false, phoneModal: false,
...@@ -317,6 +318,7 @@ class FacePage extends Component { ...@@ -317,6 +318,7 @@ class FacePage extends Component {
if (ret.code === 401) { if (ret.code === 401) {
// 需要验证手机号 // 需要验证手机号
this.setState({phoneModal: true}); this.setState({phoneModal: true});
this.handleScaleChange({count: 0});
} else if (ret.orders) { } else if (ret.orders) {
let goodsArr = []; let goodsArr = [];
ret.orders.map(v1 => { ret.orders.map(v1 => {
...@@ -334,7 +336,6 @@ class FacePage extends Component { ...@@ -334,7 +336,6 @@ class FacePage extends Component {
} else if (ret.msg) { } else if (ret.msg) {
let tipText = ret.msg.replace(/扫码/g, '人脸识别'); let tipText = ret.msg.replace(/扫码/g, '人脸识别');
Speech.speak(tipText); Speech.speak(tipText);
this.setState({tip: tipText});
} }
} else { } else {
Speech.speak('正在重新识别,请靠中间站稳'); Speech.speak('正在重新识别,请靠中间站稳');
...@@ -357,8 +358,8 @@ class FacePage extends Component { ...@@ -357,8 +358,8 @@ class FacePage extends Component {
} // 出现订单弹窗,不做人脸识别 } // 出现订单弹窗,不做人脸识别
const tipText = '正在人脸识别,请看向屏幕,靠中间站稳'; const tipText = '正在人脸识别,请看向屏幕,靠中间站稳';
Speech.speak(tipText); Speech.speak(tipText);
this.setState({tip: tipText});
let auth = (await this.authinfo()) || {}; let auth = (await this.authinfo()) || {};
console.warn(auth);
if ( if (
auth.return_code === 'SUCCESS' || auth.return_code === 'SUCCESS' ||
(auth.code === 1 && auth.data.bizCode === '0000') (auth.code === 1 && auth.data.bizCode === '0000')
...@@ -375,6 +376,7 @@ class FacePage extends Component { ...@@ -375,6 +376,7 @@ class FacePage extends Component {
ask_unionid: 1, ask_unionid: 1,
}; };
let res = (await WxFacepay.faceinfo(params)) || {}; let res = (await WxFacepay.faceinfo(params)) || {};
console.warn(res);
if (window.socket) { if (window.socket) {
window.socket.connect(); window.socket.connect();
} // 返回结果,立即重新连接socket } // 返回结果,立即重新连接socket
...@@ -395,25 +397,25 @@ class FacePage extends Component { ...@@ -395,25 +397,25 @@ class FacePage extends Component {
}; };
// 语音通话请求 // 语音通话请求
onCall = async () => { // onCall = async () => {
// const {data} = await this.props.dispatch({ // // const {data} = await this.props.dispatch({
// type: 'store/agora', // // type: 'store/agora',
// }); // // });
// const engine = await RtcEngine.create(data.appid); // // const engine = await RtcEngine.create(data.appid);
// await engine.joinChannel(data.token, data.channel, null, 0); // // await engine.joinChannel(data.token, data.channel, null, 0);
// this.noTalkCall = setInterval(async () => { // // this.noTalkCall = setInterval(async () => {
// await this.props.dispatch({ // // await this.props.dispatch({
// type: 'store/talkCall', // // type: 'store/talkCall',
// }); // // });
// }, 10000); // // }, 10000);
Speech.speak('正在接通中请稍候'); // Speech.speak('正在接通中请稍候');
this.talkCall(); // this.talkCall();
clearInterval(this.noTalkCall); // clearInterval(this.noTalkCall);
this.noTalkCall = setInterval(() => this.talkCall(), 10000); // this.noTalkCall = setInterval(() => this.talkCall(), 10000);
this.setState({ // this.setState({
talkCall: 0, // talkCall: 0,
}); // });
}; // };
talkCall = () => { talkCall = () => {
this.props.dispatch({ this.props.dispatch({
......
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