Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
施宇
/
icsalesProgram
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
60f42551
authored
Aug 05, 2019
by
施宇
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
111
parent
25e6e733
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
314 additions
and
259 deletions
app.js
components/chat/chat.js
components/chat/chat.wxml
components/chat/inputbar/suit/main/main.js
components/chat/msglist/msglist.js
components/chat/msglist/msglist.wxml
components/swipedelete/swipedelete.js
components/swipedelete/swipedelete.wxml
components/swipedelete/swipedelete.wxss
pages/detail/chat/index.js
pages/search/result/index.js
pages/search/result/index.wxml
pages/tab/message/message.js
pages/tab/message/message.wxml
utils/chat.js
app.js
View file @
60f42551
const
WebIM
=
require
(
"utils/WebIM"
)[
"default"
];
const
WebIM
=
require
(
"utils/WebIM"
)[
"default"
];
// let msgStorage = require("components/chat/msgstorage");
// let msgType = require("components/chat/msgtype");
// let disp = require("utils/broadcast");
let
chat
=
require
(
'utils/chat.js'
);
let
chat
=
require
(
'utils/chat.js'
);
import
{
getData
}
from
'./utils/util.js'
;
import
{
getData
}
from
'./utils/util.js'
;
import
{
apis
}
from
'./utils/api.js'
;
import
{
apis
}
from
'./utils/api.js'
;
// function calcUnReadSpot(message) {
// let myName = wx.getStorageSync("myUsername");
// let allMembers = wx.getStorageSync("member") || []; //好友
// let count = allMembers.reduce(function (result, curMember, idx) {
// let chatMsgs = wx.getStorageSync(curMember.toLowerCase() + myName.toLowerCase()) || [];
// return result + chatMsgs.length;
// }, 0);
// getApp().globalData.unReadMessageNum = count;
// disp.fire("em.xmpp.unreadspot", message);
// }
// function onMessageError(err) {
// if (err.type === "error") {
// wx.showToast({
// title: err.errorText
// });
// return false;
// }
// return true;
// }
// function addMember(id) {
// let member = wx.getStorageSync("member") || [];
// let index = member.indexOf(id);
// if (index == -1) {
// member.push(id)
// }
// wx.setStorage({
// key: "member",
// data: member
// });
// }
App
({
App
({
globalData
:
{
globalData
:
{
unReadMessageNum
:
0
,
unReadMessageNum
:
0
,
token
:
wx
.
getStorageSync
(
'access_token'
),
token
:
wx
.
getStorageSync
(
'access_token'
),
isIPX
:
false
,
//是否为iphone X
isIPX
:
false
,
//是否为iphone X
customerNum
:
"18664936975
"
,
customerNum
:
"001
"
,
customerName
:
"IC业务助手
"
customerName
:
"IC助手客服
"
},
},
// conn: {
// closed: false,
// curOpenOpt: {},
// open(opt) {
// // /* wx.showLoading({
// // title: '正在初始化客户端...',
// // mask: true
// // }) */
// this.curOpenOpt = opt;
// WebIM.conn.open(opt);
// this.closed = false;
// },
// reopen() {
// if (this.closed) {
// WebIM.conn.open(this.curOpenOpt);
// this.closed = false;
// }
// }
// },
getImUser
:
chat
.
getImUser
,
getImUser
:
chat
.
getImUser
,
addChatMember
:
function
(
id
)
{
addChatMember
:
function
(
id
)
{
let
token
=
wx
.
getStorageSync
(
'access_token'
)
||
''
let
token
=
wx
.
getStorageSync
(
'access_token'
)
||
''
;
let
member
=
wx
.
getStorageSync
(
"member"
)
||
[];
this
.
addChatMemberStorage
(
id
);
let
index
=
member
.
indexOf
(
id
);
if
(
index
==
-
1
)
{
member
.
push
(
id
)
}
wx
.
setStorage
({
key
:
"member"
,
data
:
member
});
getData
(
apis
.
addrecord
,
'GET'
,
{
getData
(
apis
.
addrecord
,
'GET'
,
{
"token"
:
token
,
"token"
:
token
,
"user_id"
:
id
"user_id"
:
id
...
@@ -87,6 +25,17 @@ App({
...
@@ -87,6 +25,17 @@ App({
}
}
},
false
);
},
false
);
},
},
addChatMemberStorage
:
function
(
id
)
{
let
member
=
wx
.
getStorageSync
(
"member"
)
||
[];
let
index
=
member
.
indexOf
(
id
);
if
(
index
==
-
1
)
{
member
.
push
(
id
)
}
wx
.
setStorage
({
key
:
"member"
,
data
:
member
});
},
onLaunch
()
{
onLaunch
()
{
let
me
=
this
;
let
me
=
this
;
...
@@ -94,7 +43,7 @@ App({
...
@@ -94,7 +43,7 @@ App({
wx
.
getStorage
({
wx
.
getStorage
({
key
:
'access_token'
,
key
:
'access_token'
,
success
(
res
)
{
success
(
res
)
{
if
(
res
.
data
)
{
if
(
res
.
data
)
{
wx
.
switchTab
({
wx
.
switchTab
({
url
:
'/pages/tab/home/home'
url
:
'/pages/tab/home/home'
...
@@ -116,68 +65,8 @@ App({
...
@@ -116,68 +65,8 @@ App({
}
}
}
}
})
})
this
.
getImUser
()
this
.
getImUser
();
// wx.setStorage({
// key: "myUsername",
// data: '7a2765fc7caa5e512a6d1270bcf98bf0'
// });
// this.conn.open({
// apiUrl: WebIM.config.apiURL,
// user: '7a2765fc7caa5e512a6d1270bcf98bf0',
// pwd: 'ic_55028838',
// appKey: WebIM.config.appkey
// });
chat
.
webimListen
();
chat
.
webimListen
();
// WebIM.conn.listen({
// onOpened(message) {
// },
// onReconnect() {
// wx.showToast({
// title: "重连中...",
// duration: 2000
// });
// },
// onSocketConnected() {
// /* wx.showToast({
// title: "socket连接成功",
// duration: 2000
// }); */
// },
// onClosed() {
// wx.showToast({
// title: "网络已断开",
// icon: 'none',
// duration: 2000
// });
// me.conn.closed = true;
// WebIM.conn.close();
// },
// onCmdMessage(message) {
// },
// onTextMessage(message) {
// chat.addMember(message.from)
// if (message) {
// if (chat.onMessageError(message)) {
// msgStorage.saveReceiveMsg(message, msgType.TEXT);
// }
// chat.calcUnReadSpot(message);
// }
// },
// onPictureMessage(message) {
// },
// // 各种异常
// onError(error) {
// console.log(error)
// },
// });
this
.
checkIsIPhoneX
();
this
.
checkIsIPhoneX
();
},
},
checkIsIPhoneX
:
function
()
{
checkIsIPhoneX
:
function
()
{
...
...
components/chat/chat.js
View file @
60f42551
...
@@ -30,9 +30,8 @@ Component({
...
@@ -30,9 +30,8 @@ Component({
saveSendMsg
(
evt
){
saveSendMsg
(
evt
){
msgStorage
.
saveMsg
(
evt
.
detail
.
msg
,
evt
.
detail
.
type
);
msgStorage
.
saveMsg
(
evt
.
detail
.
msg
,
evt
.
detail
.
type
);
if
(
evt
.
detail
.
type
!==
'cmd'
){
if
((
evt
.
detail
.
type
!==
'cmd'
)
&&
(
!
evt
.
detail
.
customer
)
){
this
.
data
.
__comps__
.
inputbar
.
cancelEmoji
();
this
.
data
.
__comps__
.
inputbar
.
cancelEmoji
();
}
}
}
}
},
},
...
...
components/chat/chat.wxml
View file @
60f42551
<view class="main">
<view class="main">
<chat-suit-audio
id="chat-suit-audio"
username="{{ username }}"
chatType="{{ chatType }}"
bind:newAudioMsg="saveSendMsg"></chat-suit-audio>
<chat-msglist
<chat-msglist
id="chat-msglist"
id="chat-msglist"
username="{{ username }}"
username="{{ username }}"
...
...
components/chat/inputbar/suit/main/main.js
View file @
60f42551
...
@@ -51,6 +51,10 @@ Component({
...
@@ -51,6 +51,10 @@ Component({
sendMessage
()
{
sendMessage
()
{
let
me
=
this
;
let
me
=
this
;
let
customer
=
wx
.
getStorageSync
(
'customer'
)
||
''
;
if
(
customer
)
{
wx
.
removeStorageSync
(
'customer'
);
}
String
.
prototype
.
trim
=
function
()
{
String
.
prototype
.
trim
=
function
()
{
return
this
.
replace
(
/
(
^
\s
*
)
|
(\s
*$
)
/g
,
''
);
return
this
.
replace
(
/
(
^
\s
*
)
|
(\s
*$
)
/g
,
''
);
}
}
...
@@ -90,6 +94,7 @@ Component({
...
@@ -90,6 +94,7 @@ Component({
"newTextMsg"
,
{
"newTextMsg"
,
{
msg
:
msg
,
msg
:
msg
,
type
:
msgType
.
TEXT
,
type
:
msgType
.
TEXT
,
customer
:
customer
?
true
:
false
},
{
},
{
bubbles
:
true
,
bubbles
:
true
,
composed
:
true
composed
:
true
...
@@ -126,16 +131,14 @@ Component({
...
@@ -126,16 +131,14 @@ Component({
success
:
function
()
{
success
:
function
()
{
console
.
log
(
'发送模板成功'
)
console
.
log
(
'发送模板成功'
)
console
.
log
(
me
.
data
.
username
.
your
)
console
.
log
(
me
.
data
.
username
.
your
)
getApp
().
addChatMember
(
me
.
data
.
username
.
your
)
//
getApp().addChatMember(me.data.username.your)
disp
.
fire
(
'em.chat.sendSuccess'
,
id
);
disp
.
fire
(
'em.chat.sendSuccess'
,
id
);
},
},
fail
:
function
()
{
fail
:
function
()
{
console
.
log
(
'发送模板失败'
);
console
.
log
(
'发送模板失败'
);
}
}
});
});
console
.
log
(
msg
.
body
)
getApp
().
addChatMember
(
me
.
data
.
username
.
your
)
getApp
().
addChatMember
(
me
.
data
.
username
.
your
)
WebIM
.
conn
.
send
(
msg
.
body
);
WebIM
.
conn
.
send
(
msg
.
body
);
this
.
triggerEvent
(
this
.
triggerEvent
(
"newTextMsg"
,
{
"newTextMsg"
,
{
...
@@ -162,14 +165,19 @@ Component({
...
@@ -162,14 +165,19 @@ Component({
detached
()
{
},
detached
()
{
},
ready
()
{
ready
()
{
let
template
=
wx
.
getStorageSync
(
'template'
)
||
''
;
let
template
=
wx
.
getStorageSync
(
'template'
)
||
''
;
if
(
!
template
)
{
let
customer
=
wx
.
getStorageSync
(
'customer'
)
||
''
;
return
if
(
template
)
{
}
else
{
this
.
setData
({
this
.
setData
({
template
:
template
template
:
template
});
});
wx
.
removeStorageSync
(
'template'
);
wx
.
removeStorageSync
(
'template'
);
this
.
sendCmd
();
this
.
sendCmd
();
};
if
(
customer
){
this
.
setData
({
userMessage
:
customer
});
this
.
sendMessage
();
}
}
},
},
});
});
\ No newline at end of file
components/chat/msglist/msglist.js
View file @
60f42551
...
@@ -19,37 +19,40 @@ Component({
...
@@ -19,37 +19,40 @@ Component({
toView
:
""
,
toView
:
""
,
chatMsg
:
[],
chatMsg
:
[],
__visibility__
:
false
,
__visibility__
:
false
,
customerNum
:
getApp
().
globalData
.
customerNum
},
},
methods
:
{
methods
:
{
normalScroll
()
{
normalScroll
()
{
this
.
setData
({
this
.
setData
({
view
:
LIST_STATUS
.
NORMAL
view
:
LIST_STATUS
.
NORMAL
});
});
},
},
shortScroll
()
{
shortScroll
()
{
this
.
setData
({
this
.
setData
({
view
:
LIST_STATUS
.
SHORT
view
:
LIST_STATUS
.
SHORT
});
});
},
},
onTap
(){
onTap
()
{
this
.
triggerEvent
(
"msglistTap"
,
null
,
{
bubbles
:
true
});
this
.
triggerEvent
(
"msglistTap"
,
null
,
{
bubbles
:
true
});
},
},
previewImage
(
event
)
{
previewImage
(
event
)
{
var
url
=
event
.
target
.
dataset
.
url
;
var
url
=
event
.
target
.
dataset
.
url
;
wx
.
previewImage
({
wx
.
previewImage
({
urls
:
[
url
]
// 需要预览的图片 http 链接列表
urls
:
[
url
]
// 需要预览的图片 http 链接列表
});
});
},
},
renderMsg
(
renderableMsg
,
type
,
curChatMsg
,
sessionKey
,
isnew
)
{
renderMsg
(
renderableMsg
,
type
,
curChatMsg
,
sessionKey
,
isnew
)
{
let
me
=
this
let
me
=
this
if
(
curChatMsg
.
length
>
1
)
{
if
(
curChatMsg
.
length
>
1
)
{
this
.
data
.
chatMsg
.
map
(
function
(
elem
,
index
)
{
this
.
data
.
chatMsg
.
map
(
function
(
elem
,
index
)
{
curChatMsg
.
map
(
function
(
item
,
i
)
{
curChatMsg
.
map
(
function
(
item
,
i
)
{
if
(
elem
.
mid
==
item
.
mid
)
{
if
(
elem
.
mid
==
item
.
mid
)
{
//me.data.chatMsg.splice(index, 1)
//me.data.chatMsg.splice(index, 1)
curChatMsg
.
splice
(
i
,
1
)
curChatMsg
.
splice
(
i
,
1
)
}
}
...
@@ -57,15 +60,22 @@ Component({
...
@@ -57,15 +60,22 @@ Component({
})
})
}
}
var
historyChatMsgs
=
wx
.
getStorageSync
(
"rendered_"
+
sessionKey
)
||
[];
var
historyChatMsgs
=
wx
.
getStorageSync
(
"rendered_"
+
sessionKey
)
||
[];
var
curLen
=
curChatMsg
.
length
;
var
hisLen
=
historyChatMsgs
.
length
;
var
moreLLen
=
hisLen
+
curLen
-
50
;
if
(
moreLLen
>
0
)
{
//超过存储最大值
historyChatMsgs
.
splice
(
0
,
moreLLen
);
}
historyChatMsgs
=
historyChatMsgs
.
concat
(
curChatMsg
);
historyChatMsgs
=
historyChatMsgs
.
concat
(
curChatMsg
);
if
(
!
historyChatMsgs
.
length
)
return
;
if
(
!
historyChatMsgs
.
length
)
return
;
if
(
isnew
==
'newMsg'
)
{
if
(
isnew
==
'newMsg'
)
{
this
.
setData
({
this
.
setData
({
chatMsg
:
this
.
data
.
chatMsg
.
concat
(
curChatMsg
),
// chatMsg: this.data.chatMsg.concat(curChatMsg),
chatMsg
:
historyChatMsgs
,
// 跳到最后一条
// 跳到最后一条
toView
:
historyChatMsgs
[
historyChatMsgs
.
length
-
1
].
mid
,
toView
:
historyChatMsgs
[
historyChatMsgs
.
length
-
1
].
mid
,
});
});
}
else
{
}
else
{
this
.
setData
({
this
.
setData
({
chatMsg
:
historyChatMsgs
,
chatMsg
:
historyChatMsgs
,
// 跳到最后一条
// 跳到最后一条
...
@@ -94,10 +104,10 @@ Component({
...
@@ -94,10 +104,10 @@ Component({
this
.
renderFail
(
sessionKey
)
this
.
renderFail
(
sessionKey
)
}
}
},
},
renderFail
(
sessionKey
)
{
renderFail
(
sessionKey
)
{
let
me
=
this
let
me
=
this
let
msgList
=
me
.
data
.
chatMsg
let
msgList
=
me
.
data
.
chatMsg
msgList
.
map
((
item
)
=>
{
msgList
.
map
((
item
)
=>
{
if
(
item
.
mid
.
substring
(
item
.
mid
.
length
-
10
)
==
curMsgMid
.
substring
(
curMsgMid
.
length
-
10
))
{
if
(
item
.
mid
.
substring
(
item
.
mid
.
length
-
10
)
==
curMsgMid
.
substring
(
curMsgMid
.
length
-
10
))
{
item
.
msg
.
data
[
0
].
isFail
=
true
item
.
msg
.
data
[
0
].
isFail
=
true
item
.
isFail
=
true
item
.
isFail
=
true
...
@@ -117,16 +127,17 @@ Component({
...
@@ -117,16 +127,17 @@ Component({
},
},
// lifetimes
// lifetimes
created
(){
created
()
{
},
},
attached
()
{
attached
()
{
this
.
__visibility__
=
true
;
this
.
__visibility__
=
true
;
},
},
moved
()
{},
moved
()
{},
detached
()
{
detached
()
{
this
.
__visibility__
=
false
;
this
.
__visibility__
=
false
;
},
},
ready
(
event
)
{
ready
(
event
)
{
let
me
=
this
;
let
me
=
this
;
if
(
getApp
().
globalData
.
isIPX
)
{
if
(
getApp
().
globalData
.
isIPX
)
{
this
.
setData
({
this
.
setData
({
...
@@ -136,9 +147,9 @@ Component({
...
@@ -136,9 +147,9 @@ Component({
let
username
=
this
.
data
.
username
;
let
username
=
this
.
data
.
username
;
let
myUsername
=
wx
.
getStorageSync
(
"myUsername"
);
let
myUsername
=
wx
.
getStorageSync
(
"myUsername"
);
let
sessionKey
=
username
.
groupId
let
sessionKey
=
username
.
groupId
?
?
username
.
groupId
+
myUsername
username
.
groupId
+
myUsername
:
:
username
.
your
+
myUsername
;
username
.
your
+
myUsername
;
let
chatMsg
=
wx
.
getStorageSync
(
sessionKey
)
||
[];
let
chatMsg
=
wx
.
getStorageSync
(
sessionKey
)
||
[];
...
@@ -150,7 +161,7 @@ Component({
...
@@ -150,7 +161,7 @@ Component({
return
return
console
.
log
(
'发送失败了'
)
console
.
log
(
'发送失败了'
)
let
msgList
=
me
.
data
.
chatMsg
let
msgList
=
me
.
data
.
chatMsg
msgList
.
map
((
item
)
=>
{
msgList
.
map
((
item
)
=>
{
if
(
item
.
mid
.
substring
(
item
.
mid
.
length
-
10
)
==
curMsgMid
.
substring
(
curMsgMid
.
length
-
10
))
{
if
(
item
.
mid
.
substring
(
item
.
mid
.
length
-
10
)
==
curMsgMid
.
substring
(
curMsgMid
.
length
-
10
))
{
item
.
msg
.
data
[
0
].
isFail
=
true
item
.
msg
.
data
[
0
].
isFail
=
true
item
.
isFail
=
true
item
.
isFail
=
true
...
@@ -167,24 +178,25 @@ Component({
...
@@ -167,24 +178,25 @@ Component({
wx
.
setStorageSync
(
"rendered_"
+
sessionKey
,
msgList
);
wx
.
setStorageSync
(
"rendered_"
+
sessionKey
,
msgList
);
});
});
msgStorage
.
on
(
"newChatMsg"
,
function
(
renderableMsg
,
type
,
curChatMsg
,
sesskey
)
{
msgStorage
.
on
(
"newChatMsg"
,
function
(
renderableMsg
,
type
,
curChatMsg
,
sesskey
)
{
me
.
curChatMsg
=
curChatMsg
;
me
.
curChatMsg
=
curChatMsg
;
if
(
!
me
.
__visibility__
)
return
;
if
(
!
me
.
__visibility__
)
return
;
// 判断是否属于当前会话
// 判断是否属于当前会话
if
(
username
.
groupId
){
// if(username.groupId){
// 群消息的 to 是 id,from 是 name
// // 群消息的 to 是 id,from 是 name
if
(
renderableMsg
.
info
.
from
==
username
.
groupId
||
renderableMsg
.
info
.
to
==
username
.
groupId
){
// if(renderableMsg.info.from == username.groupId || renderableMsg.info.to == username.groupId){
// if (sesskey == sessionKey) {
// me.renderMsg(renderableMsg, type, curChatMsg, sessionKey, 'newMsg');
// }
// }
// }
// else if(renderableMsg.info.from == username.your || renderableMsg.info.to == username.your){
if
(
sesskey
==
sessionKey
)
{
if
(
sesskey
==
sessionKey
)
{
console
.
log
(
renderableMsg
,
curChatMsg
)
me
.
renderMsg
(
renderableMsg
,
type
,
curChatMsg
,
sessionKey
,
'newMsg'
);
me
.
renderMsg
(
renderableMsg
,
type
,
curChatMsg
,
sessionKey
,
'newMsg'
);
}
}
// }
}
}
else
if
(
renderableMsg
.
info
.
from
==
username
.
your
||
renderableMsg
.
info
.
to
==
username
.
your
){
if
(
sesskey
==
sessionKey
)
{
me
.
renderMsg
(
renderableMsg
,
type
,
curChatMsg
,
sessionKey
,
'newMsg'
);
}
}
});
});
...
...
components/chat/msglist/msglist.wxml
View file @
60f42551
...
@@ -38,7 +38,12 @@
...
@@ -38,7 +38,12 @@
<view scroll-y="true" class="{{ view }} wrap {{isIPX?'scroll_view_X': ''}}" bind:tap="onTap" scroll-into-view="{{ toView }}">
<view scroll-y="true" class="{{ view }} wrap {{isIPX?'scroll_view_X': ''}}" bind:tap="onTap" scroll-into-view="{{ toView }}">
<view class="message" wx:for="{{ chatMsg }}" wx:key="{{ item.mid }}" id="{{ item.mid }}">
<view class="message" wx:for="{{ chatMsg }}" wx:key="{{ item.mid }}" id="{{ item.mid }}">
<view class="{{ item.style }}">
<view class="{{ item.style }}">
<block wx:if="{{item.yourname == customerNum}}">
<image class="avatar" src="/res/images/imgs/timg.jpg" />
</block>
<block wx:else>
<image class="avatar" src="{{item.ext.img?item.ext.img:'/res/images/imgs/s.png'}}" />
<image class="avatar" src="{{item.ext.img?item.ext.img:'/res/images/imgs/s.png'}}" />
</block>
<view class="msg {{item.msg.type=='cmd'?'cmd-msg':''}}">
<view class="msg {{item.msg.type=='cmd'?'cmd-msg':''}}">
<image class="err {{(item.style == 'self' && item.isFail) ? 'show' : 'hide'}}" src="../../../images/msgerr.png" />
<image class="err {{(item.style == 'self' && item.isFail) ? 'show' : 'hide'}}" src="../../../images/msgerr.png" />
<view wx:if="{{ item.msg.type == 'img'}}">
<view wx:if="{{ item.msg.type == 'img'}}">
...
...
components/swipedelete/swipedelete.js
View file @
60f42551
...
@@ -14,7 +14,13 @@ Component({
...
@@ -14,7 +14,13 @@ Component({
this
.
setData
({
this
.
setData
({
translateX
:
0
translateX
:
0
})
})
this
.
triggerEvent
(
'deleteChatItem'
,
{},
{
bubbles
:
true
})
this
.
triggerEvent
(
'deleteChatItem'
)
},
deleteChat
:
function
(
e
)
{
this
.
setData
({
translateX
:
0
})
this
.
triggerEvent
(
'deleteChat'
)
},
},
/**
/**
* 滑动删除事件-滑动开始
* 滑动删除事件-滑动开始
...
@@ -41,11 +47,11 @@ Component({
...
@@ -41,11 +47,11 @@ Component({
})
})
}
}
}
else
{
// 左滑 显示删除
}
else
{
// 左滑 显示删除
if
(
Math
.
abs
(
this
.
data
.
translateX
)
>=
16
0
)
{
if
(
Math
.
abs
(
this
.
data
.
translateX
)
>=
32
0
)
{
return
return
}
else
{
}
else
{
this
.
setData
({
this
.
setData
({
translateX
:
-
16
0
translateX
:
-
32
0
})
})
}
}
}
}
...
...
components/swipedelete/swipedelete.wxml
View file @
60f42551
<view class='swipedelete-wrapper' bindtouchmove='touchMoveHandler' bindtouchstart='touchStartHandler' style="transform:translateX({{translateX}}rpx)">
<view class='swipedelete-wrapper' bindtouchmove='touchMoveHandler' bindtouchstart='touchStartHandler' style="transform:translateX({{translateX}}rpx)">
<slot></slot>
<slot></slot>
<view class='swipedelete-btn' bindtap='deleteItem'>删除</view>
<view class='swipedelete-btn' bindtap='deleteItem'>拉入黑名单</view>
<view class='delete-btn' bindtap='deleteChat'>删除聊天</view>
</view>
</view>
\ No newline at end of file
components/swipedelete/swipedelete.wxss
View file @
60f42551
...
@@ -4,21 +4,24 @@
...
@@ -4,21 +4,24 @@
position: relative;
position: relative;
}
}
.swipedelete-btn {
.swipedelete-btn {
/* position:absolute;
position:absolute;
right: -320rpx;
top:0;
top:0;
right:-180rpx;
background-color:#F03737;
text-align:center;
background: #f00;
color:#fff;
width:160rpx;
width:160rpx;
height:100%;
height:100%;
text-align:center;
color: #fff;
display:flex;
display:flex;
align-items:center;
justify-content:center;
justify-content:center;
align-items:center;*/
font-size: 24rpx;
}
.delete-btn{
position:absolute;
position:absolute;
right: -160rpx;
right: -160rpx;
top:0;
top:0;
background-color:#
D0021B
;
background-color:#
8A9299
;
width:160rpx;
width:160rpx;
height:100%;
height:100%;
text-align:center;
text-align:center;
...
@@ -26,4 +29,5 @@
...
@@ -26,4 +29,5 @@
display:flex;
display:flex;
align-items:center;
align-items:center;
justify-content:center;
justify-content:center;
font-size: 24rpx;
}
}
\ No newline at end of file
pages/detail/chat/index.js
View file @
60f42551
...
@@ -13,9 +13,16 @@ Page({
...
@@ -13,9 +13,16 @@ Page({
let
username
=
JSON
.
parse
(
options
.
username
);
let
username
=
JSON
.
parse
(
options
.
username
);
this
.
setData
({
username
:
username
});
this
.
setData
({
username
:
username
});
console
.
log
(
username
)
console
.
log
(
username
)
if
(
getApp
().
globalData
.
customerNum
==
username
.
your
){
wx
.
setNavigationBarTitle
({
title
:
'IC助手客服'
});
}
else
{
wx
.
setNavigationBarTitle
({
wx
.
setNavigationBarTitle
({
title
:
username
.
title
title
:
username
.
title
});
});
}
},
},
onUnload
()
{
onUnload
()
{
...
...
pages/search/result/index.js
View file @
60f42551
...
@@ -217,5 +217,26 @@ Page({
...
@@ -217,5 +217,26 @@ Page({
wx
.
navigateTo
({
wx
.
navigateTo
({
url
:
"/pages/form/good/index"
url
:
"/pages/form/good/index"
})
})
}
},
sendCustomer
:
function
()
{
let
my
=
wx
.
getStorageSync
(
"myUsername"
);
let
companyName
=
wx
.
getStorageSync
(
"company_name"
);
let
userId
=
wx
.
getStorageSync
(
"user_id"
);
let
avatar
=
wx
.
getStorageSync
(
"avatar"
);
let
queryObj
=
{
myName
:
my
,
your
:
getApp
().
globalData
.
customerNum
,
name
:
getApp
().
globalData
.
customerName
,
name1
:
companyName
,
id
:
userId
,
touserid
:
''
,
title
:
getApp
().
globalData
.
customerName
,
img
:
''
,
img1
:
avatar
};
wx
.
setStorageSync
(
'customer'
,
this
.
data
.
confirmKey
);
wx
.
navigateTo
({
url
:
"/pages/detail/chat/index?username="
+
JSON
.
stringify
(
queryObj
)
})
},
})
})
\ No newline at end of file
pages/search/result/index.wxml
View file @
60f42551
...
@@ -44,7 +44,7 @@
...
@@ -44,7 +44,7 @@
</view>
</view>
</view>
</view>
<view class="concat_custom" wx:if="{{priceList&&priceList.length==0&&tabIndex == 2}}">
<view class="concat_custom" wx:if="{{priceList&&priceList.length==0&&tabIndex == 2}}">
<text class="icon iconfont iconiconxiantiaoshouji11"></text>
<text class="icon iconfont iconiconxiantiaoshouji11"
bindtap="sendCustomer"
></text>
<text>联系客服帮您找</text>
<text
bindtap="sendCustomer"
>联系客服帮您找</text>
</view>
</view>
</view>
</view>
\ No newline at end of file
pages/tab/message/message.js
View file @
60f42551
// pages/tab/message/message.js
// pages/tab/message/message.js
let
disp
=
require
(
"../../../utils/broadcast"
);
let
disp
=
require
(
"../../../utils/broadcast"
);
var
WebIM
=
require
(
"../../../utils/WebIM"
)[
"default"
];
let
WebIM
=
require
(
"../../../utils/WebIM"
)[
"default"
];
Page
({
Page
({
/**
/**
...
@@ -8,24 +8,70 @@ Page({
...
@@ -8,24 +8,70 @@ Page({
*/
*/
data
:
{
data
:
{
unReadSpotNum
:
0
,
unReadSpotNum
:
0
,
arr
:
[],
arr
:
null
,
userId
:
""
,
userId
:
""
,
customer
:{}
customer
:
{},
isCustomer
:
true
,
},
},
/**
/**
* 生命周期函数--监听页面加载
* 生命周期函数--监听页面加载
*/
*/
onLoad
:
function
(
options
)
{
onLoad
:
function
(
options
)
{
let
me
=
this
;
let
me
=
this
;
let
my
=
wx
.
getStorageSync
(
"myUsername"
);
//监听未读消息数
//监听未读消息数
disp
.
on
(
"em.xmpp.unreadspot"
,
function
(
message
)
{
disp
.
on
(
"em.xmpp.unreadspot"
,
function
(
message
)
{
if
(
getApp
().
globalData
.
customerNum
!=
my
)
{
me
.
getCustom
()
}
me
.
setData
({
me
.
setData
({
arr
:
me
.
getChatList
(),
arr
:
me
.
getChatList
(),
unReadSpotNum
:
getApp
().
globalData
.
unReadMessageNum
>
99
?
'99+'
:
getApp
().
globalData
.
unReadMessageNum
,
unReadSpotNum
:
getApp
().
globalData
.
unReadMessageNum
>
99
?
'99+'
:
getApp
().
globalData
.
unReadMessageNum
,
});
});
});
});
},
},
getCustom
:
function
()
{
let
my
=
wx
.
getStorageSync
(
"myUsername"
);
let
companyName
=
wx
.
getStorageSync
(
"company_name"
)
||
''
;
let
userId
=
wx
.
getStorageSync
(
"user_id"
)
||
''
;
let
avatar
=
wx
.
getStorageSync
(
"avatar"
)
||
''
;
let
newChatMsgs
=
wx
.
getStorageSync
(
getApp
().
globalData
.
customerNum
+
my
)
||
[];
let
historyChatMsgs
=
wx
.
getStorageSync
(
"rendered_"
+
getApp
().
globalData
.
customerNum
+
my
)
||
[];
let
curChatMsgs
=
historyChatMsgs
.
concat
(
newChatMsgs
);
if
(
curChatMsgs
.
length
)
{
let
lastChatMsg
=
curChatMsgs
[
curChatMsgs
.
length
-
1
];
let
dateArr
=
lastChatMsg
.
time
.
split
(
' '
)[
0
].
split
(
'-'
)
let
timeArr
=
lastChatMsg
.
time
.
split
(
' '
)[
1
].
split
(
':'
)
let
month
=
dateArr
[
2
]
<
10
?
'0'
+
dateArr
[
2
]
:
dateArr
[
2
];
lastChatMsg
.
time
=
`
${
dateArr
[
1
]}
月
${
dateArr
[
2
]}
日
${
timeArr
[
0
]}
时
${
timeArr
[
1
]}
分`
;
lastChatMsg
.
unReadCount
=
newChatMsgs
.
length
;
if
(
lastChatMsg
.
unReadCount
>
99
)
{
lastChatMsg
.
unReadCount
=
"99+"
;
}
this
.
setData
({
customer
:
lastChatMsg
})
}
else
{
this
.
setData
({
customer
:
{
username
:
getApp
().
globalData
.
customerNum
,
ext
:
{
name
:
getApp
().
globalData
.
customerName
,
name1
:
companyName
,
id
:
userId
,
touserid
:
''
,
img
:
''
,
img1
:
avatar
},
name
:
getApp
().
globalData
.
customerName
,
unReadCount
:
0
}
})
}
},
getChatList
()
{
getChatList
()
{
let
array
=
[];
let
array
=
[];
let
member
=
wx
.
getStorageSync
(
"member"
);
let
member
=
wx
.
getStorageSync
(
"member"
);
...
@@ -55,33 +101,31 @@ Page({
...
@@ -55,33 +101,31 @@ Page({
return
array
;
return
array
;
},
},
into_singleChatRoom
:
function
(
detail
)
{
into_singleChatRoom
:
function
(
detail
)
{
var
my
=
wx
.
getStorageSync
(
"myUsername"
);
let
my
=
wx
.
getStorageSync
(
"myUsername"
);
console
.
log
(
detail
)
let
nameList
=
{
var
nameList
=
{
myName
:
my
,
myName
:
my
,
your
:
detail
.
username
,
your
:
detail
.
username
,
name
:
detail
.
ext
.
name
,
name
:
detail
.
ext
.
name
,
name1
:
detail
.
ext
.
name1
,
name1
:
detail
.
ext
.
name1
,
id
:
detail
.
ext
.
id
,
id
:
detail
.
ext
.
id
,
touserid
:
detail
.
ext
.
touserid
,
touserid
:
detail
.
ext
.
touserid
,
title
:
detail
.
name
,
title
:
detail
.
name
,
img
:
detail
.
ext
.
img
,
img
:
detail
.
ext
.
img
,
img1
:
detail
.
ext
.
img1
img1
:
detail
.
ext
.
img1
};
};
console
.
log
(
JSON
.
stringify
(
nameList
))
wx
.
navigateTo
({
wx
.
navigateTo
({
url
:
"/pages/detail/chat/index?username="
+
JSON
.
stringify
(
nameList
)
url
:
"/pages/detail/chat/index?username="
+
JSON
.
stringify
(
nameList
)
});
});
},
},
into_chatRoom
:
function
(
event
)
{
into_chatRoom
:
function
(
event
)
{
let
detail
=
event
.
currentTarget
.
dataset
.
item
;
let
detail
=
event
.
currentTarget
.
dataset
.
item
;
this
.
into_singleChatRoom
(
detail
)
this
.
into_singleChatRoom
(
detail
)
},
},
/**
/**
* 生命周期函数--监听页面初次渲染完成
* 生命周期函数--监听页面初次渲染完成
*/
*/
onReady
:
function
()
{
onReady
:
function
()
{
},
},
...
@@ -89,40 +133,21 @@ Page({
...
@@ -89,40 +133,21 @@ Page({
* 生命周期函数--监听页面显示
* 生命周期函数--监听页面显示
*/
*/
onShow
:
function
()
{
onShow
:
function
()
{
let
my
=
wx
.
getStorageSync
(
"myUsername"
);
let
my
=
wx
.
getStorageSync
(
"myUsername"
);
let
companyName
=
wx
.
getStorageSync
(
"company_name"
)
||
''
;
if
(
getApp
().
globalData
.
customerNum
!=
my
)
{
let
userId
=
wx
.
getStorageSync
(
"user_id"
)
||
''
;
this
.
getCustom
();
let
avatar
=
wx
.
getStorageSync
(
"avatar"
)
||
''
;
let
customerKey
=
'rendered_'
+
getApp
().
globalData
.
customerNum
+
my
let
customer
=
wx
.
getStorageSync
(
customerKey
)
||
''
;
if
(
customer
){
this
.
setData
({
this
.
setData
({
customer
:
customer
[
customer
.
length
-
1
]
isCustomer
:
false
})
})
console
.
log
(
this
.
data
.
customer
)
}
else
{
}
else
{
this
.
setData
({
this
.
setData
({
customer
:
{
isCustomer
:
true
username
:
getApp
().
globalData
.
customerNum
,
ext
:{
name
:
getApp
().
globalData
.
customerName
,
name1
:
companyName
,
id
:
userId
,
touserid
:
''
,
img
:
''
,
img1
:
avatar
},
name
:
getApp
().
globalData
.
customerName
,
}
})
})
}
}
this
.
setData
({
this
.
setData
({
arr
:
this
.
getChatList
(),
arr
:
this
.
getChatList
(),
userId
:
wx
.
getStorageSync
(
'user_id'
),
userId
:
wx
.
getStorageSync
(
'user_id'
),
unReadSpotNum
:
getApp
().
globalData
.
unReadMessageNum
>
99
?
'99+'
:
getApp
().
globalData
.
unReadMessageNum
,
unReadSpotNum
:
getApp
().
globalData
.
unReadMessageNum
>
99
?
'99+'
:
getApp
().
globalData
.
unReadMessageNum
,
});
});
},
},
...
@@ -130,35 +155,102 @@ Page({
...
@@ -130,35 +155,102 @@ Page({
/**
/**
* 生命周期函数--监听页面隐藏
* 生命周期函数--监听页面隐藏
*/
*/
onHide
:
function
()
{
onHide
:
function
()
{
},
},
/**
/**
* 生命周期函数--监听页面卸载
* 生命周期函数--监听页面卸载
*/
*/
onUnload
:
function
()
{
onUnload
:
function
()
{
},
},
/**
/**
* 页面相关事件处理函数--监听用户下拉动作
* 页面相关事件处理函数--监听用户下拉动作
*/
*/
onPullDownRefresh
:
function
()
{
onPullDownRefresh
:
function
()
{
},
},
/**
/**
* 页面上拉触底事件的处理函数
* 页面上拉触底事件的处理函数
*/
*/
onReachBottom
:
function
()
{
onReachBottom
:
function
()
{
},
},
/**
/**
* 用户点击右上角分享
* 用户点击右上角分享
*/
*/
onShareAppMessage
:
function
()
{
onShareAppMessage
:
function
()
{
},
deleteChatItem
:
function
(
e
)
{
//拉黑
this
.
del_chat
(
e
,
2
)
},
deleteChat
:
function
(
e
)
{
//删除记录
this
.
del_chat
(
e
,
1
)
},
del_chat
:
function
(
event
,
type
)
{
let
detail
=
event
.
currentTarget
.
dataset
.
item
;
let
your
=
detail
.
username
;
let
myName
=
wx
.
getStorageSync
(
"myUsername"
);
let
currentPage
=
getCurrentPages
();
let
title
=
type
==
1
?
'是否删除记录'
:
'是否加入黑名单?'
wx
.
showModal
({
title
:
title
,
confirmText
:
"确定"
,
success
:
function
(
res
)
{
if
(
res
.
confirm
)
{
if
(
type
==
1
)
{
let
member
=
wx
.
getStorageSync
(
'member'
);
let
index
=
member
.
indexOf
(
your
);
member
.
splice
(
index
,
1
);
wx
.
setStorageSync
(
'member'
,
member
)
wx
.
removeStorageSync
(
your
+
myName
);
wx
.
removeStorageSync
(
"rendered_"
+
your
+
myName
);
if
(
currentPage
[
0
])
{
currentPage
[
0
].
onShow
();
}
disp
.
fire
(
"em.chat.session.remove"
);
}
else
{
let
list
=
{
your
:
{
jid
:
WebIM
.
config
.
appkey
+
'_'
+
your
+
'@easemob.com'
,
name
:
your
,
order
:
1
,
},
};
WebIM
.
conn
.
addToBlackList
({
list
:
list
,
type
:
'jid'
,
success
:
function
()
{
let
member
=
wx
.
getStorageSync
(
'member'
);
let
index
=
member
.
indexOf
(
your
);
member
.
splice
(
index
,
1
);
wx
.
setStorageSync
(
'member'
,
member
)
wx
.
removeStorageSync
(
your
+
myName
);
wx
.
removeStorageSync
(
"rendered_"
+
your
+
myName
);
if
(
currentPage
[
0
])
{
currentPage
[
0
].
onShow
();
}
disp
.
fire
(
"em.chat.session.remove"
);
},
error
:
function
()
{
wx
.
showToast
({
title
:
'加入黑名单失败'
,
icon
:
'none'
,
duration
:
2000
});
}
});
}
}
}
},
fail
:
function
(
err
)
{}
});
},
})
})
\ No newline at end of file
pages/tab/message/message.wxml
View file @
60f42551
<!--pages/tab/message/message.wxml-->
<!--pages/tab/message/message.wxml-->
<scroll-view scroll-y="true" class="message-view">
<scroll-view scroll-y="true" class="message-view">
<
!-- <view class="nodata" wx:if="{{arr.length == 0
}}">
<
view class="nodata" wx:if="{{arr.length==0&&isCustomer
}}">
<image src="/res/images/imgs/nomessage.png" class="img"></image>
<image src="/res/images/imgs/nomessage.png" class="img"></image>
<view class="h3 bold">暂无询价消息</view>
<view class="h3 bold">暂无询价消息</view>
</view>
-->
</view>
<view class="message-content">
<view class="message-content"
wx:if="{{!isCustomer||arr.length}}"
>
<view class="tip row bothSide verCenter">
<view class="tip row bothSide verCenter">
<view class="tip-left">
<view class="tip-left">
<text class="icon iconfont iconiconxiantiaoshouji12 tip-icon"></text>
<text class="icon iconfont iconiconxiantiaoshouji12 tip-icon"></text>
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
<text class="icon iconfont iconiconxiantiaoshouji13 close-icon"></text>
<text class="icon iconfont iconiconxiantiaoshouji13 close-icon"></text>
</view>
</view>
<view class="message-list">
<view class="message-list">
<view catchtap="into_chatRoom" data-item="{{c
ustomer}}">
<view catchtap="into_chatRoom" data-item="{{customer}}" wx:if="{{!isC
ustomer}}">
<view class="message-item px-hr-bottom row bothSide nowrap">
<view class="message-item px-hr-bottom row bothSide nowrap">
<view class="message-l row ellipsis">
<view class="message-l row ellipsis">
<image src="/res/images/imgs/timg.jpg" class="message-avar"></image>
<image src="/res/images/imgs/timg.jpg" class="message-avar"></image>
...
@@ -30,9 +30,9 @@
...
@@ -30,9 +30,9 @@
</view>
</view>
</view>
</view>
</view>
</view>
<view
wx:for="{{ arr }}" wx:key="index" catchtap="into_chatRoom" data-item="{{ item
}}">
<view
wx:for="{{ arr }}" wx:key="index" wx:if="{{arr
}}">
<swipe-delete
>
<swipe-delete binddeleteChatItem="deleteChatItem" data-item="{{ item }}" binddeleteChat="deleteChat"
>
<view class="message-item px-hr-bottom row bothSide nowrap
">
<view class="message-item px-hr-bottom row bothSide nowrap" catchtap="into_chatRoom" data-item="{{ item }}
">
<view class="message-l row ellipsis">
<view class="message-l row ellipsis">
<image src="{{item.img?item.img:'/res/images/imgs/s.png'}}" class="message-avar"></image>
<image src="{{item.img?item.img:'/res/images/imgs/s.png'}}" class="message-avar"></image>
<view class="message-l-view ellipsis">
<view class="message-l-view ellipsis">
...
...
utils/chat.js
View file @
60f42551
import
{
getData
}
from
'../utils/util.js'
;
import
{
import
{
apis
}
from
'../utils/api.js'
;
getData
}
from
'../utils/util.js'
;
import
{
apis
}
from
'../utils/api.js'
;
const
WebIM
=
require
(
"./WebIM"
)[
"default"
];
const
WebIM
=
require
(
"./WebIM"
)[
"default"
];
let
msgStorage
=
require
(
"../components/chat/msgstorage"
);
let
msgStorage
=
require
(
"../components/chat/msgstorage"
);
let
msgType
=
require
(
"../components/chat/msgtype"
);
let
msgType
=
require
(
"../components/chat/msgtype"
);
...
@@ -26,9 +30,8 @@ let conn = {
...
@@ -26,9 +30,8 @@ let conn = {
const
calcUnReadSpot
=
(
message
)
=>
{
const
calcUnReadSpot
=
(
message
)
=>
{
let
myName
=
wx
.
getStorageSync
(
"myUsername"
);
let
myName
=
wx
.
getStorageSync
(
"myUsername"
);
let
allMembers
=
wx
.
getStorageSync
(
"member"
)
||
[];
//好友
let
allMembers
=
wx
.
getStorageSync
(
"member"
)
||
[];
//好友
let
count
=
allMembers
.
reduce
(
function
(
result
,
curMember
,
idx
)
{
let
count
=
allMembers
.
reduce
(
function
(
result
,
curMember
,
idx
)
{
let
chatMsgs
=
wx
.
getStorageSync
(
curMember
.
toLowerCase
()
+
myName
.
toLowerCase
())
||
[];
let
chatMsgs
=
wx
.
getStorageSync
(
curMember
.
toLowerCase
()
+
myName
.
toLowerCase
())
||
[];
return
result
+
chatMsgs
.
length
;
return
result
+
chatMsgs
.
length
;
},
0
);
},
0
);
getApp
().
globalData
.
unReadMessageNum
=
count
;
getApp
().
globalData
.
unReadMessageNum
=
count
;
...
@@ -48,9 +51,9 @@ const getImUser = () => {
...
@@ -48,9 +51,9 @@ const getImUser = () => {
let
token
=
wx
.
getStorageSync
(
'access_token'
)
||
''
let
token
=
wx
.
getStorageSync
(
'access_token'
)
||
''
getData
(
apis
.
authme
,
'get'
,
{
getData
(
apis
.
authme
,
'get'
,
{
"token"
:
token
,
"token"
:
token
,
},
function
(
res
)
{
},
function
(
res
)
{
if
(
res
.
err_code
==
0
)
{
if
(
res
.
err_code
==
0
)
{
wx
.
setStorageSync
(
'user_id'
,
res
.
data
.
user_id
+
''
);
wx
.
setStorageSync
(
'user_id'
,
res
.
data
.
user_id
+
''
);
wx
.
setStorageSync
(
'avatar'
,
res
.
data
.
avatar
);
wx
.
setStorageSync
(
'avatar'
,
res
.
data
.
avatar
);
wx
.
setStorageSync
(
'company_name'
,
res
.
data
.
company_name
);
wx
.
setStorageSync
(
'company_name'
,
res
.
data
.
company_name
);
wx
.
setStorageSync
(
"myUsername"
,
res
.
data
.
im_username
);
wx
.
setStorageSync
(
"myUsername"
,
res
.
data
.
im_username
);
...
@@ -67,9 +70,10 @@ const getImUser = () => {
...
@@ -67,9 +70,10 @@ const getImUser = () => {
},
false
)
},
false
)
};
};
const
webimListen
=
()
=>
{
const
webimListen
=
()
=>
{
let
my
=
wx
.
getStorageSync
(
'myUsername'
)
||
''
;
WebIM
.
conn
.
listen
({
WebIM
.
conn
.
listen
({
onOpened
(
message
)
{
onOpened
(
message
)
{
WebIM
.
conn
.
setPresence
();
},
},
onReconnect
()
{
onReconnect
()
{
wx
.
showToast
({
wx
.
showToast
({
...
@@ -93,19 +97,22 @@ const webimListen = () => {
...
@@ -93,19 +97,22 @@ const webimListen = () => {
WebIM
.
conn
.
close
();
WebIM
.
conn
.
close
();
},
},
onCmdMessage
(
message
)
{
onCmdMessage
(
message
)
{
getApp
().
addChatMember
(
message
.
from
)
if
(
message
)
{
if
(
message
)
{
if
(
onMessageError
(
message
))
{
if
(
onMessageError
(
message
))
{
getApp
().
addChatMember
(
message
.
from
);
msgStorage
.
saveReceiveMsg
(
message
,
msgType
.
CMD
);
msgStorage
.
saveReceiveMsg
(
message
,
msgType
.
CMD
);
}
}
calcUnReadSpot
(
message
);
calcUnReadSpot
(
message
);
}
}
},
},
onTextMessage
(
message
)
{
onTextMessage
(
message
)
{
console
.
log
(
'接受信息'
)
if
(
message
)
{
if
(
message
)
{
if
(
onMessageError
(
message
))
{
if
(
onMessageError
(
message
))
{
if
(
getApp
().
globalData
.
customerNum
!=
message
.
from
)
{
getApp
().
addChatMember
(
message
.
from
);
}
msgStorage
.
saveReceiveMsg
(
message
,
msgType
.
TEXT
);
msgStorage
.
saveReceiveMsg
(
message
,
msgType
.
TEXT
);
// console.log(111)
}
}
calcUnReadSpot
(
message
);
calcUnReadSpot
(
message
);
}
}
...
@@ -116,6 +123,9 @@ const webimListen = () => {
...
@@ -116,6 +123,9 @@ const webimListen = () => {
console
.
log
(
"onEmojiMessage"
,
message
);
console
.
log
(
"onEmojiMessage"
,
message
);
if
(
message
)
{
if
(
message
)
{
if
(
onMessageError
(
message
))
{
if
(
onMessageError
(
message
))
{
if
(
getApp
().
globalData
.
customerNum
!=
message
.
from
)
{
getApp
().
addChatMember
(
message
.
from
);
}
msgStorage
.
saveReceiveMsg
(
message
,
msgType
.
EMOJI
);
msgStorage
.
saveReceiveMsg
(
message
,
msgType
.
EMOJI
);
}
}
calcUnReadSpot
(
message
);
calcUnReadSpot
(
message
);
...
@@ -125,6 +135,9 @@ const webimListen = () => {
...
@@ -125,6 +135,9 @@ const webimListen = () => {
console
.
log
(
"onPictureMessage"
,
message
);
console
.
log
(
"onPictureMessage"
,
message
);
if
(
message
)
{
if
(
message
)
{
if
(
onMessageError
(
message
))
{
if
(
onMessageError
(
message
))
{
if
(
getApp
().
globalData
.
customerNum
!=
message
.
from
)
{
getApp
().
addChatMember
(
message
.
from
);
}
msgStorage
.
saveReceiveMsg
(
message
,
msgType
.
IMAGE
);
msgStorage
.
saveReceiveMsg
(
message
,
msgType
.
IMAGE
);
}
}
calcUnReadSpot
(
message
);
calcUnReadSpot
(
message
);
...
@@ -137,8 +150,6 @@ const webimListen = () => {
...
@@ -137,8 +150,6 @@ const webimListen = () => {
});
});
};
};
module
.
exports
=
{
module
.
exports
=
{
// calcUnReadSpot: calcUnReadSpot,
// onMessageError: onMessageError,
webimListen
:
webimListen
,
webimListen
:
webimListen
,
conn
:
conn
,
conn
:
conn
,
getImUser
:
getImUser
getImUser
:
getImUser
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment