Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
Madara
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
viitto
Madara
Commits
0d9bfe5b
Commit
0d9bfe5b
authored
Sep 26, 2019
by
罗超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
4800d9fb
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
578 additions
and
564 deletions
+578
-564
.gitignore
.gitignore
+1
-0
index.js
src/store/actions/index.js
+145
-144
msgs.js
src/store/actions/msgs.js
+432
-420
No files found.
.gitignore
View file @
0d9bfe5b
...
@@ -17,3 +17,4 @@ dist/
...
@@ -17,3 +17,4 @@ dist/
package/
package/
build/
build/
node_modules.rar
node_modules.rar
node_modules.zip
src/store/actions/index.js
View file @
0d9bfe5b
...
@@ -4,162 +4,163 @@ import cookie from '../../utils/cookie'
...
@@ -4,162 +4,163 @@ import cookie from '../../utils/cookie'
import
pageUtil
from
'../../utils/page'
import
pageUtil
from
'../../utils/page'
/* 导出actions方法 */
/* 导出actions方法 */
import
{
showLoading
,
hideLoading
,
showFullscreenImg
,
hideFullscreenImg
}
from
'./widgetUi'
import
{
showLoading
,
hideLoading
,
showFullscreenImg
,
hideFullscreenImg
}
from
'./widgetUi'
import
{
initNimSDK
}
from
'./initNimSDK'
import
{
initNimSDK
}
from
'./initNimSDK'
import
{
initChatroomSDK
,
resetChatroomSDK
}
from
'./initChatroomSDK'
import
{
initChatroomSDK
,
resetChatroomSDK
}
from
'./initChatroomSDK'
import
{
updateBlack
}
from
'./blacks'
import
{
updateBlack
}
from
'./blacks'
import
{
updateFriend
,
addFriend
,
deleteFriend
}
from
'./friends'
import
{
updateFriend
,
addFriend
,
deleteFriend
}
from
'./friends'
import
{
resetSearchResult
,
searchUsers
,
searchTeam
}
from
'./search'
import
{
resetSearchResult
,
searchUsers
,
searchTeam
}
from
'./search'
import
{
deleteSession
,
setCurrSession
,
resetCurrSession
}
from
'./session'
import
{
deleteSession
,
setCurrSession
,
resetCurrSession
}
from
'./session'
import
{
sendMsg
,
sendTip
,
markInMutelist
,
sendFileMsg
,
sendDataUrlMsg
,
sendDataUrlMsgCall
,
sendMsgReceipt
,
sendRobotMsg
,
revocateMsg
,
updateLocalMsg
,
getHistoryMsgs
,
resetNoMoreHistoryMsgs
,
continueRobotMsg
}
from
'./msgs'
import
{
sendMsg
,
sendTip
,
forwardMsg
,
markInMutelist
,
sendFileMsg
,
sendDataUrlMsg
,
sendDataUrlMsgCall
,
sendMsgReceipt
,
sendRobotMsg
,
revocateMsg
,
updateLocalMsg
,
getHistoryMsgs
,
resetNoMoreHistoryMsgs
,
continueRobotMsg
}
from
'./msgs'
import
{
markSysMsgRead
,
resetSysMsgs
,
deleteSysMsgs
,
markCustomSysMsgRead
}
from
'./sysMsgs'
import
{
markSysMsgRead
,
resetSysMsgs
,
deleteSysMsgs
,
markCustomSysMsgRead
}
from
'./sysMsgs'
import
{
sendChatroomMsg
,
sendChatroomRobotMsg
,
sendChatroomFileMsg
,
getChatroomHistoryMsgs
}
from
'./chatroomMsgs'
import
{
sendChatroomMsg
,
sendChatroomRobotMsg
,
sendChatroomFileMsg
,
getChatroomHistoryMsgs
}
from
'./chatroomMsgs'
import
{
initChatroomInfos
,
getChatroomInfo
,
getChatroomMembers
,
clearChatroomMembers
}
from
'./chatroomInfos'
import
{
initChatroomInfos
,
getChatroomInfo
,
getChatroomMembers
,
clearChatroomMembers
}
from
'./chatroomInfos'
import
{
delegateTeamFunction
,
getNotifyForNewTeamMsg
,
onTeamNotificationMsg
,
enterSettingPage
,
getTeamMembers
,
checkTeamMsgReceipt
,
getTeamMsgReads
}
from
'./team'
import
{
delegateTeamFunction
,
getNotifyForNewTeamMsg
,
onTeamNotificationMsg
,
enterSettingPage
,
getTeamMembers
,
checkTeamMsgReceipt
,
getTeamMsgReads
}
from
'./team'
function
connectNim
({
state
,
commit
,
dispatch
},
obj
)
{
function
connectNim
({
state
,
commit
,
dispatch
},
obj
)
{
let
{
force
}
=
Object
.
assign
({},
obj
)
let
{
force
}
=
Object
.
assign
({},
obj
)
// 操作为内容页刷新页面,此时无nim实例
// 操作为内容页刷新页面,此时无nim实例
//
//
if
(
!
state
.
nim
||
force
)
{
if
(
!
state
.
nim
||
force
)
{
let
loginuser
=
require
(
'electron'
).
remote
.
getGlobal
(
"LOGINUSER"
);
let
loginuser
=
require
(
'electron'
).
remote
.
getGlobal
(
"LOGINUSER"
);
let
loginInfo
=
{
let
loginInfo
=
{
uid
:
loginuser
.
ImAccount
,
uid
:
loginuser
.
ImAccount
,
sdktoken
:
loginuser
.
ImToken
,
sdktoken
:
loginuser
.
ImToken
,
}
}
if
(
!
loginInfo
.
uid
)
{
if
(
!
loginInfo
.
uid
)
{
// 无cookie,直接跳转登录页
// 无cookie,直接跳转登录页
// pageUtil.turnPage('无历史登录记录,请重新登录', 'login')
// pageUtil.turnPage('无历史登录记录,请重新登录', 'login')
}
else
{
}
else
{
// 有cookie,重新登录
// 有cookie,重新登录
dispatch
(
'initNimSDK'
,
loginInfo
)
dispatch
(
'initNimSDK'
,
loginInfo
)
}
}
}
}
}
}
function
connectChatroom
({
state
,
commit
,
dispatch
},
obj
)
{
function
connectChatroom
({
state
,
commit
,
dispatch
},
obj
)
{
let
{
chatroomId
}
=
Object
.
assign
({},
obj
)
let
{
chatroomId
}
=
Object
.
assign
({},
obj
)
const
nim
=
state
.
nim
const
nim
=
state
.
nim
if
(
nim
)
{
if
(
nim
)
{
dispatch
(
'showLoading'
)
dispatch
(
'showLoading'
)
nim
.
getChatroomAddress
({
nim
.
getChatroomAddress
({
chatroomId
,
chatroomId
,
done
:
function
getChatroomAddressDone
(
error
,
obj
)
{
done
:
function
getChatroomAddressDone
(
error
,
obj
)
{
if
(
error
)
{
if
(
error
)
{
//alert(error.message)
//alert(error.message)
//location.href = '#/room'
//location.href = '#/room'
return
return
}
}
dispatch
(
'initChatroomSDK'
,
obj
)
dispatch
(
'initChatroomSDK'
,
obj
)
}
}
})
})
}
}
}
}
export
default
{
export
default
{
updateRefreshState
({
commit
})
{
updateRefreshState
({
commit
})
{
commit
(
'updateRefreshState'
)
commit
(
'updateRefreshState'
)
},
},
// UI 及页面状态变更
// UI 及页面状态变更
showLoading
,
showLoading
,
hideLoading
,
hideLoading
,
showFullscreenImg
,
showFullscreenImg
,
hideFullscreenImg
,
hideFullscreenImg
,
continueRobotMsg
,
continueRobotMsg
,
// 连接sdk请求,false表示强制重连
// 连接sdk请求,false表示强制重连
connect
(
store
,
obj
)
{
connect
(
store
,
obj
)
{
let
{
type
}
=
Object
.
assign
({},
obj
)
let
{
type
}
=
Object
.
assign
({},
obj
)
// type 可为 nim chatroom
// type 可为 nim chatroom
type
=
type
||
'nim'
type
=
type
||
'nim'
switch
(
type
)
{
switch
(
type
)
{
case
'nim'
:
case
'nim'
:
connectNim
(
store
,
obj
)
connectNim
(
store
,
obj
)
break
break
case
'chatroom'
:
case
'chatroom'
:
connectChatroom
(
store
,
obj
)
connectChatroom
(
store
,
obj
)
break
break
}
}
},
},
// 用户触发的登出逻辑
// 用户触发的登出逻辑
logout
({
state
,
commit
})
{
logout
({
state
,
commit
})
{
cookie
.
delCookie
(
'uid'
)
cookie
.
delCookie
(
'uid'
)
cookie
.
delCookie
(
'sdktoken'
)
cookie
.
delCookie
(
'sdktoken'
)
if
(
state
.
nim
)
{
if
(
state
.
nim
)
{
state
.
nim
.
disconnect
()
state
.
nim
.
disconnect
()
}
}
pageUtil
.
turnPage
(
''
,
'login'
)
pageUtil
.
turnPage
(
''
,
'login'
)
},
},
// 初始化 重新连接SDK
// 初始化 重新连接SDK
initNimSDK
,
initNimSDK
,
// 清空所有搜索历史纪录
// 清空所有搜索历史纪录
resetSearchResult
,
resetSearchResult
,
// 搜索用户信息
// 搜索用户信息
searchUsers
,
searchUsers
,
// 更新黑名单
// 更新黑名单
updateBlack
,
updateBlack
,
// 更新好友
// 更新好友
addFriend
,
addFriend
,
deleteFriend
,
deleteFriend
,
updateFriend
,
updateFriend
,
// 删除会话
// 删除会话
deleteSession
,
deleteSession
,
// 设置当前会话
// 设置当前会话
setCurrSession
,
setCurrSession
,
// 重置当前会话
// 重置当前会话
resetCurrSession
,
resetCurrSession
,
// 发送消息
// 发送消息
sendMsg
,
sendMsg
,
sendTip
,
forwardMsg
,
sendFileMsg
,
sendTip
,
sendDataUrlMsg
,
sendFileMsg
,
sendDataUrlMsgCall
,
sendDataUrlMsg
,
markInMutelist
,
sendDataUrlMsgCall
,
sendRobotMsg
,
markInMutelist
,
// 发送消息已读回执
sendRobotMsg
,
sendMsgReceipt
,
// 发送消息已读回执
// 消息撤回
sendMsgReceipt
,
revocateMsg
,
// 消息撤回
// 更新本地消息
revocateMsg
,
updateLocalMsg
,
// 更新本地消息
getHistoryMsgs
,
updateLocalMsg
,
// 重置历史消息状态
getHistoryMsgs
,
resetNoMoreHistoryMsgs
,
// 重置历史消息状态
// 标记系统消息已读
resetNoMoreHistoryMsgs
,
markSysMsgRead
,
// 标记系统消息已读
markCustomSysMsgRead
,
markSysMsgRead
,
resetSysMsgs
,
markCustomSysMsgRead
,
deleteSysMsgs
,
resetSysMsgs
,
deleteSysMsgs
,
initChatroomSDK
,
initChatroomSDK
,
initChatroomInfos
,
initChatroomInfos
,
resetChatroomSDK
,
resetChatroomSDK
,
sendChatroomMsg
,
sendChatroomMsg
,
sendChatroomRobotMsg
,
sendChatroomRobotMsg
,
sendChatroomFileMsg
,
sendChatroomFileMsg
,
getChatroomHistoryMsgs
,
getChatroomHistoryMsgs
,
getChatroomInfo
,
getChatroomInfo
,
getChatroomMembers
,
getChatroomMembers
,
clearChatroomMembers
,
clearChatroomMembers
,
// 搜索群
// 搜索群
searchTeam
,
searchTeam
,
// 代理sdk中的群方法
// 代理sdk中的群方法
delegateTeamFunction
,
delegateTeamFunction
,
// 处理群消息回调
// 处理群消息回调
onTeamNotificationMsg
,
onTeamNotificationMsg
,
getNotifyForNewTeamMsg
,
getNotifyForNewTeamMsg
,
// 进入群信息设置页
// 进入群信息设置页
enterSettingPage
,
enterSettingPage
,
// 获取群成员
// 获取群成员
getTeamMembers
,
getTeamMembers
,
// 群消息回执检查
// 群消息回执检查
checkTeamMsgReceipt
,
checkTeamMsgReceipt
,
// 查询群消息回执已读列表
// 查询群消息回执已读列表
getTeamMsgReads
,
getTeamMsgReads
,
}
}
\ No newline at end of file
src/store/actions/msgs.js
View file @
0d9bfe5b
This diff is collapsed.
Click to expand it.
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