网页版wx有选择的回复消息

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43


var scope = angular.element($('.btn_send')).scope();
var notNames = [];
scope.$watch('chatContent', function (newValue, oldValue) {
if (newValue === oldValue) {
return;
}
var msg = newValue[newValue.length - 1];
if (msg.MsgType != 1 || !msg.MMActualContent) {
/*当前不为文字时*/
return;
}
if (msg.MMIsSend) {
/*我发送的消息不考虑*/
console.log('我发送的消息不考虑');
return;
}
if (msg.MMActualContent.length == 4) {
// $('#editArea').html('当前' + msg.MMActualContent + '可能是成语');
// scope.editAreaCtn = '当前' + msg.MMActualContent + '可能是成语';
var nameStart = msg.MMActualContent.substring(3);
$.ajax({
// url: 'http://127.0.0.1:8888/chengyu/name_start?nameStart=' + nameStart + '&notNames=' + notNames.join(','),
url: 'http://127.0.0.1:8888/chengyu/name?name=' + msg.MMActualContent + '&notNames=' + notNames.join(','),
success: (resp) => {
if (resp&&resp!='null') {
console.log('获取成语成功 =====> ' + resp);
scope.editAreaCtn = resp;
setTimeout(() => {
$('.btn_send').click();
}, 200)
}else{
console.log('获取成语失败 =====> ' + resp);
}
}
});
}
console.log("=====custom-====== ", msg.MMActualContent);
}, true);

//var msg=scope.chatContent[scope.chatContent.length-1];
//msg.MMActualContent

本文地址: https://github.com/maxzhao-it/blog/post/17024/