|
|
@@ -105,39 +105,40 @@ Page({ |
|
|
|
send() { |
|
|
|
if (!this.data.message) return |
|
|
|
|
|
|
|
this.msgSec(this.data.message) |
|
|
|
.then(() => { |
|
|
|
console.log('非敏感词,放行'); |
|
|
|
// 当socket连接被关闭时,重新连接socket |
|
|
|
if (this.data.reLoadSocket) { |
|
|
|
this.socketLink() |
|
|
|
this.setData({ |
|
|
|
waitingMessage: this.data.message |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
const data = { |
|
|
|
message: this.data.message, |
|
|
|
id: 1 // 带id为用户发送的讯息,不带则为服务器返回的讯息 |
|
|
|
} |
|
|
|
// 当socket连接被关闭时,重新连接socket |
|
|
|
if (this.data.reLoadSocket) { |
|
|
|
this.socketLink() |
|
|
|
this.setData({ |
|
|
|
waitingMessage: this.data.message |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
const data = { |
|
|
|
message: this.data.message, |
|
|
|
id: 1 // 带id为用户发送的讯息,不带则为服务器返回的讯息 |
|
|
|
} |
|
|
|
|
|
|
|
const arr = this.data.chatList |
|
|
|
arr.push(data) |
|
|
|
const arr = this.data.chatList |
|
|
|
arr.push(data) |
|
|
|
|
|
|
|
// 非重载状态下向服务器发送讯息 |
|
|
|
if (!this.data.reLoadSocket) { |
|
|
|
this.socketSend(this.data.message) |
|
|
|
} |
|
|
|
// 非重载状态下向服务器发送讯息 |
|
|
|
if (!this.data.reLoadSocket) { |
|
|
|
this.socketSend(this.data.message) |
|
|
|
} |
|
|
|
|
|
|
|
this.setData({ |
|
|
|
chatList: arr, |
|
|
|
message: '', |
|
|
|
messageFlag: true |
|
|
|
}) |
|
|
|
console.log(this.data.chatList, 'chatList'); |
|
|
|
this.setData({ |
|
|
|
chatList: arr, |
|
|
|
message: '', |
|
|
|
messageFlag: true |
|
|
|
}) |
|
|
|
console.log(this.data.chatList, 'chatList'); |
|
|
|
|
|
|
|
this.msgSec(this.data.message) |
|
|
|
.then(() => { |
|
|
|
console.log('非敏感词,放行'); |
|
|
|
}).catch(() => { |
|
|
|
console.log('触发敏感词!'); |
|
|
|
return |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|