|
|
@@ -104,6 +104,8 @@
|
|
|
selected:"",
|
|
|
name:"",
|
|
|
errorSum:0,
|
|
|
+ jwtToken:"{{$jwtToken}}",
|
|
|
+ voiceLoadSign:false,
|
|
|
},
|
|
|
mounted() {
|
|
|
this.registerEvent();
|
|
|
@@ -124,8 +126,43 @@
|
|
|
}
|
|
|
return '当前存在失败数据未处理';
|
|
|
};
|
|
|
+ setTimeout(()=>{
|
|
|
+ this.refreshToken();
|
|
|
+ },600800000);
|
|
|
},
|
|
|
methods:{
|
|
|
+ playAudio(src){
|
|
|
+ let audio = document.createElement('audio');
|
|
|
+ audio.src = src;
|
|
|
+ document.body.append(audio);
|
|
|
+ setTimeout(()=>{
|
|
|
+ audio.play();
|
|
|
+ },10);
|
|
|
+ setTimeout(()=>{
|
|
|
+ audio.remove();
|
|
|
+ },5000);
|
|
|
+ },
|
|
|
+ refreshToken(){
|
|
|
+ window.axios.post('{{url('record/refreshToken')}}',{},{
|
|
|
+ headers: {
|
|
|
+ "jwtToken" : this.jwtToken
|
|
|
+ }
|
|
|
+ }).then(body=>{
|
|
|
+ let res = body.data;
|
|
|
+ if (!res.success){
|
|
|
+ this.playAudio('storage/logonFailure.mp3');
|
|
|
+ this.buildToast(false,"tokenFailure");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.jwtToken = res.data;
|
|
|
+ setTimeout(()=>{
|
|
|
+ this.refreshToken();
|
|
|
+ },600800000);
|
|
|
+ }).catch(err=>{
|
|
|
+ this.playAudio('storage/networkError.mp3');
|
|
|
+ this.buildToast(false,"tokenFailure");
|
|
|
+ });
|
|
|
+ },
|
|
|
selectedWarehouse(warehouse){
|
|
|
this.selected = warehouse.id;
|
|
|
this.name = warehouse.name;
|
|
|
@@ -164,6 +201,19 @@
|
|
|
},
|
|
|
registerEvent(){
|
|
|
$(document).on('keypress', e=>{
|
|
|
+ if (!this.voiceLoadSign){
|
|
|
+ this.voiceLoadSign = true;
|
|
|
+ let audio = document.createElement('audio');
|
|
|
+ let audio1 = document.createElement('audio');
|
|
|
+ audio.src = 'storage/logonFailure.mp3';
|
|
|
+ audio1.src = 'storage/networkError.mp3';
|
|
|
+ document.body.append(audio);
|
|
|
+ document.body.append(audio1);
|
|
|
+ setTimeout(()=>{
|
|
|
+ audio.remove();
|
|
|
+ audio1.remove();
|
|
|
+ },10);
|
|
|
+ }
|
|
|
if (e.keyCode===13){
|
|
|
if(this.logisticNumber==="")return;
|
|
|
this.submitRecord(this.logisticNumber,this.recordAt);
|
|
|
@@ -185,7 +235,7 @@
|
|
|
this.recordAt = yy+'-'+(mm<10 ? '0'+mm : mm)+'-'+(dd<10 ? '0'+dd : dd)+" "+(hh<10 ? '0'+hh : hh)+":"+(m<10 ? '0'+m : m)+":"+(ss<10 ? '0'+ss : ss);
|
|
|
}
|
|
|
this.logisticNumber += e.key;
|
|
|
- }else console.log(e.key);
|
|
|
+ }
|
|
|
});
|
|
|
},
|
|
|
failRetry(){
|
|
|
@@ -193,7 +243,7 @@
|
|
|
if (!item.status){
|
|
|
window.axios.post('{{url('record')}}',{logisticNumber:item.logisticNumber,warehouse:this.selected},{
|
|
|
headers: {
|
|
|
- "jwtToken" : "{{$jwtToken}}"
|
|
|
+ "jwtToken" : this.jwtToken
|
|
|
}
|
|
|
}).then(body=>{
|
|
|
let res = body.data;
|
|
|
@@ -209,6 +259,7 @@
|
|
|
this.errorSum--;
|
|
|
}
|
|
|
}).catch(err=>{
|
|
|
+ this.playAudio('storage/networkError.mp3');
|
|
|
this.buildToast(false,item.logisticNumber);
|
|
|
});
|
|
|
}
|
|
|
@@ -217,7 +268,7 @@
|
|
|
submitRecord(logisticNumber,recordAt){
|
|
|
window.axios.post('{{url('record')}}',{logisticNumber:logisticNumber,warehouse:this.selected},{
|
|
|
headers: {
|
|
|
- "jwtToken" : "{{$jwtToken}}"
|
|
|
+ "jwtToken" : this.jwtToken,
|
|
|
}
|
|
|
}).then(body=>{
|
|
|
let res = body.data;
|
|
|
@@ -236,6 +287,7 @@
|
|
|
if (!status)this.errorSum++;
|
|
|
this.sum++;
|
|
|
}).catch(err=>{
|
|
|
+ this.playAudio('storage/networkError.mp3');
|
|
|
this.buildToast(false,logisticNumber);
|
|
|
this.data.unshift({
|
|
|
logisticNumber:logisticNumber,logistic:"未知",recordAt:recordAt,status:false
|