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) {                           var nameStart = msg.MMActualContent.substring(3);         $.ajax({                          url: 'http://127.0.0.1:8888/chengyu/name?name=' + msg.MMActualContent + '¬Names=' + 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);
 
 
 
 
  | 
 
本文地址: https://github.com/maxzhao-it/blog/post/17024/