新消息提醒机制,调整为uni.$emit全局事件,网络状态变化亦然
This commit is contained in:
@@ -2,19 +2,10 @@ import im from "@/utils/im/index.js"
|
||||
|
||||
export default {
|
||||
state: {
|
||||
newMsg: {},
|
||||
friends: {},
|
||||
sender: {},
|
||||
// IM连接状态,0是正常
|
||||
connection: 0
|
||||
},
|
||||
getters: {
|
||||
newMessage(state) {
|
||||
return state.newMsg
|
||||
},
|
||||
connection(state) {
|
||||
return state.connection
|
||||
},
|
||||
friends(state) {
|
||||
return state.friends
|
||||
},
|
||||
@@ -40,28 +31,14 @@ export default {
|
||||
}
|
||||
},
|
||||
mutations: {
|
||||
newMessage(state, msg) {
|
||||
Vue.set(state, 'newMsg', msg)
|
||||
},
|
||||
updateFriends(state, userInfo) {
|
||||
Vue.set(state.friends, userInfo.userId, userInfo)
|
||||
},
|
||||
SET_state_sender(state, userInfo) {
|
||||
state.sender = userInfo
|
||||
},
|
||||
SET_connection_status(state, status) {
|
||||
state.connection = status
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
updateConnectionStatus({commit}, status) {
|
||||
commit('SET_connection_status', status)
|
||||
},
|
||||
newMessage({
|
||||
commit
|
||||
}, msg) {
|
||||
commit('newMessage', msg)
|
||||
},
|
||||
actions: {
|
||||
setSenderInfo({
|
||||
commit
|
||||
}, userInfo) {
|
||||
|
||||
Reference in New Issue
Block a user