更新优化,修复bug
This commit is contained in:
parent
fbdb8fe8c6
commit
9b8aa5389a
|
@ -60,6 +60,7 @@
|
||||||
content: '',
|
content: '',
|
||||||
c_content: '',
|
c_content: '',
|
||||||
n_content: '',
|
n_content: '',
|
||||||
|
params: [], // 发送的消息内容
|
||||||
timer: '',
|
timer: '',
|
||||||
socketTask: {},
|
socketTask: {},
|
||||||
TEXT: '',
|
TEXT: '',
|
||||||
|
@ -350,11 +351,12 @@
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// };
|
// };
|
||||||
if (this.historyTextList.length > 8) this.historyTextList = this.historyTextList.splice(-8);
|
if (this.historyTextList.length > 8) this.params = JSON.parse(JSON.stringify(this.historyTextList.splice(-8)));
|
||||||
|
else this.params = JSON.parse(JSON.stringify(this.historyTextList));
|
||||||
|
console.log(this.params);
|
||||||
this.isSurpass();
|
this.isSurpass();
|
||||||
let params = this.historyTextList;
|
|
||||||
realThis.socketTask.send({ // 发送消息,,都用uni的官方版本
|
realThis.socketTask.send({ // 发送消息,,都用uni的官方版本
|
||||||
data: JSON.stringify(params),
|
data: JSON.stringify(this.params),
|
||||||
success() {
|
success() {
|
||||||
console.log('第一帧发送成功')
|
console.log('第一帧发送成功')
|
||||||
}
|
}
|
||||||
|
@ -408,11 +410,11 @@
|
||||||
},
|
},
|
||||||
// 判断文字是否超过五千字
|
// 判断文字是否超过五千字
|
||||||
isSurpass(){
|
isSurpass(){
|
||||||
let sum = this.historyTextList.reduce((accumulator, currentValue) => {
|
let sum = this.params.reduce((accumulator, currentValue) => {
|
||||||
return accumulator + currentValue.content;
|
return accumulator + currentValue.content;
|
||||||
}, '');
|
}, '');
|
||||||
if(sum.length>5000){
|
if(sum.length>5000){
|
||||||
this.historyTextList.shift();
|
this.params.shift();
|
||||||
return this.isSurpass();
|
return this.isSurpass();
|
||||||
}else {
|
}else {
|
||||||
console.log(`本次发送${sum.length}字`);
|
console.log(`本次发送${sum.length}字`);
|
||||||
|
|
Loading…
Reference in New Issue