|
@@ -7,8 +7,6 @@ import FingerprintJS from '@fingerprintjs/fingerprintjs';
|
|
|
import { initSocket } from '@api/index.js';
|
|
import { initSocket } from '@api/index.js';
|
|
|
import { AntOutline, SetOutline } from 'antd-mobile-icons';
|
|
import { AntOutline, SetOutline } from 'antd-mobile-icons';
|
|
|
import { Toast } from 'antd-mobile';
|
|
import { Toast } from 'antd-mobile';
|
|
|
-// // 安卓相关处理
|
|
|
|
|
-import audioSrc from './../../assets/mp3.wav';
|
|
|
|
|
|
|
|
|
|
window.webGetDeviceId = function (callback) {
|
|
window.webGetDeviceId = function (callback) {
|
|
|
window.callback = callback;
|
|
window.callback = callback;
|
|
@@ -280,7 +278,6 @@ class Home extends React.Component {
|
|
|
if (start > 13) {
|
|
if (start > 13) {
|
|
|
start = 0;
|
|
start = 0;
|
|
|
}
|
|
}
|
|
|
- this.initVoice('/mp3.wav');
|
|
|
|
|
}, 3000);
|
|
}, 3000);
|
|
|
};
|
|
};
|
|
|
//test();
|
|
//test();
|
|
@@ -294,10 +291,6 @@ class Home extends React.Component {
|
|
|
}, () => {
|
|
}, () => {
|
|
|
this.soundPaly();
|
|
this.soundPaly();
|
|
|
});
|
|
});
|
|
|
- Toast.show({
|
|
|
|
|
- duration: 10000,
|
|
|
|
|
- content: '播放完成',
|
|
|
|
|
- });
|
|
|
|
|
}else {
|
|
}else {
|
|
|
Toast.show({
|
|
Toast.show({
|
|
|
duration: 10000,
|
|
duration: 10000,
|
|
@@ -324,58 +317,7 @@ class Home extends React.Component {
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- // 音频播放事件
|
|
|
|
|
- initVoice = (src) => {
|
|
|
|
|
- const { voiceSrc } = this.state;
|
|
|
|
|
- voiceSrc.push(src);
|
|
|
|
|
- this.setState({
|
|
|
|
|
- voiceSrc,
|
|
|
|
|
- }, () => {
|
|
|
|
|
- if (voiceSrc.length == 1) {
|
|
|
|
|
- playVioce(src);
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- const playVioce = (audioSrc) => {
|
|
|
|
|
- if (this.state.isPlay) {
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
- this.setState({
|
|
|
|
|
- isPlay: true,
|
|
|
|
|
- }, () => {
|
|
|
|
|
- const domAudio = document.querySelector('#audio');
|
|
|
|
|
- domAudio.src = audioSrc;
|
|
|
|
|
- domAudio.playbackRate = 1;
|
|
|
|
|
- domAudio.currentTime = 0;
|
|
|
|
|
- domAudio.load();
|
|
|
|
|
- domAudio.play();
|
|
|
|
|
- const mes = () => {
|
|
|
|
|
- Toast.show({
|
|
|
|
|
- duration: 10000,
|
|
|
|
|
- content: '播放完成',
|
|
|
|
|
- });
|
|
|
|
|
- const { voiceSrc } = this.state;
|
|
|
|
|
- voiceSrc.splice(0, 1);
|
|
|
|
|
- const newArr = voiceSrc;
|
|
|
|
|
- this.setState({
|
|
|
|
|
- isPlay: false,
|
|
|
|
|
- voiceSrc: newArr,
|
|
|
|
|
- }, () => {
|
|
|
|
|
- if (newArr.length > 0) {
|
|
|
|
|
- playVioce(newArr[0]);
|
|
|
|
|
- }
|
|
|
|
|
- domAudio.removeEventListener('ended', mes);
|
|
|
|
|
- });
|
|
|
|
|
- };
|
|
|
|
|
- domAudio.addEventListener('ended', mes);
|
|
|
|
|
- // 10s看是否播放结束
|
|
|
|
|
- // setTimeout(() => {
|
|
|
|
|
- // if (this.state.isPlay) {
|
|
|
|
|
- // mes();
|
|
|
|
|
- // }
|
|
|
|
|
- // }, 10000);
|
|
|
|
|
- });
|
|
|
|
|
- };
|
|
|
|
|
- };
|
|
|
|
|
|
|
+
|
|
|
initDevice = async () => {
|
|
initDevice = async () => {
|
|
|
//接收Android端身份证信息函数
|
|
//接收Android端身份证信息函数
|
|
|
window.webGetDeviceId = (deviceId) => {
|
|
window.webGetDeviceId = (deviceId) => {
|
|
@@ -486,7 +428,6 @@ class Home extends React.Component {
|
|
|
this.soundPaly();
|
|
this.soundPaly();
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
- // this.initVoice(data.path + data.voiceFileName);
|
|
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
};
|
|
};
|