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
9ec8efa5
Commit
9ec8efa5
authored
Oct 17, 2019
by
罗超
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://gitlab.oytour.com/viitto/madara
# Conflicts: # src/renderer/components/msssage/index.vue
parents
93156bb9
0bc25050
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
417 additions
and
402 deletions
+417
-402
index.vue
src/renderer/components/index.vue
+144
-116
login.vue
src/renderer/components/login.vue
+1
-0
chateditor.vue
src/renderer/components/msssage/chateditor.vue
+8
-10
chatitem.vue
src/renderer/components/msssage/chatitem.vue
+8
-7
index.vue
src/renderer/components/msssage/index.vue
+67
-91
msgs.js
src/store/actions/msgs.js
+5
-8
team.js
src/store/actions/team.js
+169
-168
index.js
src/store/mutations/index.js
+15
-2
No files found.
src/renderer/components/index.vue
View file @
9ec8efa5
<
template
>
<transition
name=
"el-zoom-in-top"
>
<div
class=
"homebox"
id=
'homebox'
:class=
"
{'full':isMaxed}">
<div
class=
"homebox"
id=
"homebox"
:class=
"
{'full':isMaxed}">
<div
class=
"leftPannel"
>
<div
class=
"head"
>
<img
:src=
"user.Icon"
draggable=
"false"
@
click
.
stop=
"showCard"
>
<img
:src=
"user.Icon"
draggable=
"false"
@
click
.
stop=
"showCard"
/
>
</div>
<ul
class=
"menu"
>
<li
:class=
"
{'active':chosenState.val==0}">
...
...
@@ -51,29 +51,38 @@
</div>
<div
class=
"error-msg"
>
当前网络不稳定,你已经和组织失去联系,稍后系统将自动链接或者
<span
class=
"goconnect"
v-if=
"!reconnecloading"
@
click=
"reconnect"
>
手动呼叫组织
</span>
<span
class=
"goconnect"
v-if=
"!reconnecloading"
@
click=
"reconnect"
>
手动呼叫组织
</span>
<span
v-else
>
正在呼叫组织
</span>
</div>
</div>
<div
class=
"contentarea"
>
<msg
:user=
user
v-show=
"chosenState.val==0"
></msg>
<msg
:user=
"user"
v-show=
"chosenState.val==0"
></msg>
<mail
v-show=
"chosenState.val==1"
></mail>
<empty
v-show=
"chosenState.val==2"
></empty>
<Collection
v-if=
"chosenState.val==3"
></Collection>
</div>
</div>
<user-card
v-if=
'usercardInfo.searchName!=""'
:usercard=
'usercardInfo'
></user-card>
<div
class=
"at-him-box"
:style=
"
{'top': atInfo.top+'px','left': atInfo.left+'px'}" v-if="atInfo.atName!=''" @click="atMsg">@
{{
atInfo
.
atName
}}
</div>
<user-card
v-if=
"usercardInfo.searchName!=''"
:usercard=
"usercardInfo"
></user-card>
<div
class=
"at-him-box"
:style=
"
{'top': atInfo.top+'px','left': atInfo.left+'px'}"
v-if="atInfo.atName!=''"
@click="atMsg"
>@
{{
atInfo
.
atName
}}
</div>
</div>
</transition>
</
template
>
<
script
>
import
msg
from
'./msssage/index'
import
mail
from
'./team/maillist'
import
userCard
from
'./team/usercard'
import
empty
from
'./tools/emptyPage'
import
Collection
from
'./tools/Collection'
import
{
setInterval
}
from
'timers'
import
msg
from
"./msssage/index"
;
import
mail
from
"./team/maillist"
;
import
userCard
from
"./team/usercard"
;
import
empty
from
"./tools/emptyPage"
;
import
Collection
from
"./tools/Collection"
;
import
{
setInterval
}
from
"timers"
;
export
default
{
components
:
{
msg
,
...
...
@@ -94,35 +103,35 @@ export default {
left
:
0
,
top
:
0
,
atId
:
0
,
atName
:
''
,
scene
:
''
,
atName
:
""
,
scene
:
""
},
noticeObj
:{},
noticeObj
:
{},
isMaxed
:
false
,
usercardInfo
:{
searchName
:
''
,
top
:
0
,
left
:
0
,
currentAccount
:
''
usercardInfo
:
{
searchName
:
""
,
top
:
0
,
left
:
0
,
currentAccount
:
""
},
reconnecloading
:
false
,
isdissconnection
:
false
reconnecloading
:
false
,
isdissconnection
:
false
};
},
mounted
()
{
const
updateOnlineStatus
=
()
=>
{
if
(
navigator
.
onLine
&&
this
.
isdissconnection
)
{
this
.
isdissconnection
=
false
if
(
navigator
.
onLine
&&
this
.
isdissconnection
)
{
this
.
isdissconnection
=
false
;
setTimeout
(()
=>
{
this
.
reconnect
()
this
.
reconnect
();
},
5000
);
}
else
if
(
!
navigator
.
onLine
){
this
.
isdissconnection
=
true
}
}
else
if
(
!
navigator
.
onLine
)
{
this
.
isdissconnection
=
true
;
}
window
.
addEventListener
(
'online'
,
updateOnlineStatus
)
window
.
addEventListener
(
'offline'
,
updateOnlineStatus
)
updateOnlineStatus
()
};
window
.
addEventListener
(
"online"
,
updateOnlineStatus
);
window
.
addEventListener
(
"offline"
,
updateOnlineStatus
);
updateOnlineStatus
();
// var devInnerHeight = 658.0;
// var devDevicePixelRatio = 1.5;
// var devScaleFactor = 1.5;
...
...
@@ -134,103 +143,122 @@ export default {
// scaleFactor;
// this.$electron.webFrame.setZoomFactor(zoomFactor);
this
.
user
=
this
.
$electron
.
remote
.
getGlobal
(
"LOGINUSER"
);
this
.
usercardInfo
.
currentAccount
=
this
.
user
.
ImAccount
this
.
$electron
.
ipcRenderer
.
send
(
'create-session'
)
let
that
=
this
this
.
MsgBus
.
$on
(
"open-card"
,
function
(
name
,
top
,
left
,
id
,
openChat
)
{
this
.
usercardInfo
.
currentAccount
=
this
.
user
.
ImAccount
;
this
.
$electron
.
ipcRenderer
.
send
(
"create-session"
);
let
that
=
this
;
this
.
MsgBus
.
$on
(
"open-card"
,
function
(
name
,
top
,
left
,
id
,
openChat
)
{
if
(
id
&&
that
.
usercardInfo
.
currentAccount
!==
id
)
{
that
.
usercardInfo
.
searchName
=
""
that
.
usercardInfo
.
searchName
=
""
;
}
setTimeout
(()
=>
{
that
.
usercardInfo
=
{
setTimeout
(()
=>
{
that
.
usercardInfo
=
{
searchName
:
name
,
top
,
left
,
currentAccount
:
id
?
id
:
that
.
user
.
ImAccount
,
currentAccount
:
id
?
id
:
that
.
user
.
ImAccount
,
openChat
:
openChat
?
openChat
:
false
}
that
.
atInfo
.
atName
=
''
},
10
)
}
;
that
.
atInfo
.
atName
=
""
;
},
10
)
;
});
this
.
MsgBus
.
$on
(
"open-atBox"
,
function
(
name
,
top
,
left
,
id
,
scene
)
{
this
.
MsgBus
.
$on
(
"open-atBox"
,
function
(
name
,
top
,
left
,
id
,
scene
)
{
if
(
id
&&
that
.
atInfo
.
atId
!==
id
)
{
that
.
atInfo
.
atName
=
""
that
.
atInfo
.
atName
=
""
;
}
setTimeout
(()
=>
{
that
.
atInfo
=
{
setTimeout
(()
=>
{
that
.
atInfo
=
{
atName
:
name
,
top
,
left
,
atId
:
id
?
id
:
that
.
user
.
ImAccount
,
scene
:
scene
,
}
that
.
usercardInfo
.
searchName
=
''
},
10
)
atId
:
id
?
id
:
that
.
user
.
ImAccount
,
scene
:
scene
}
;
that
.
usercardInfo
.
searchName
=
""
;
},
10
)
;
});
this
.
MsgBus
.
$on
(
"change-create-session"
,
function
(
obj
)
{
that
.
chosenState
=
{
that
.
chosenState
=
{
val
:
0
,
name
:
"消息"
}
that
.
MsgBus
.
$emit
(
'create-session'
,
obj
)
};
that
.
MsgBus
.
$emit
(
"create-session"
,
obj
);
});
this
.
$electron
.
ipcRenderer
.
on
(
"openMsgBox"
,
(
event
,
session
)
=>
{
that
.
changeMenu
(
0
,
"消息"
);
this
.
MsgBus
.
$emit
(
"set-current-session"
,
session
);
});
this
.
$electron
.
ipcRenderer
.
on
(
"ignore-all-unRead"
,
(
event
,
session
)
=>
{
this
.
MsgBus
.
$emit
(
"ignore-all-unRead"
);
});
this
.
$electron
.
ipcRenderer
.
on
(
'openMsgBox'
,
(
event
,
session
)
=>
{
that
.
changeMenu
(
0
,
'消息'
)
this
.
MsgBus
.
$emit
(
"set-current-session"
,
session
)
})
this
.
$electron
.
ipcRenderer
.
on
(
'ignore-all-unRead'
,
(
event
,
session
)
=>
{
this
.
MsgBus
.
$emit
(
"ignore-all-unRead"
)
})
this
.
$electron
.
ipcRenderer
.
on
(
'new-screen-hot'
,
(
event
,
dataurl
)
=>
{
this
.
$electron
.
ipcRenderer
.
on
(
"new-screen-hot"
,
(
event
,
dataurl
)
=>
{
this
.
$electron
.
remote
.
getCurrentWindow
().
show
();
this
.
MsgBus
.
$emit
(
"new-screen-hot"
,
dataurl
)
})
this
.
MsgBus
.
$emit
(
"new-screen-hot"
,
dataurl
);
})
;
//
this
.
$electron
.
ipcRenderer
.
on
(
'save-team-members'
,
(
event
,
obj
)
=>
{
if
(
obj
.
action
==
'add'
)
{
this
.
MsgBus
.
$emit
(
"save-members"
,
obj
.
teamMembers
)
}
else
if
(
obj
.
action
==
'delete'
)
{
this
.
MsgBus
.
$emit
(
"delete-members"
,
obj
.
teamMembers
)
}
else
if
(
obj
.
action
==
'create'
)
{
this
.
MsgBus
.
$emit
(
"create-group"
,
obj
.
teamMembers
)
}
else
if
(
obj
.
action
==
'forward'
)
{
this
.
MsgBus
.
$emit
(
"goForward"
,
obj
.
sessions
)
this
.
$electron
.
ipcRenderer
.
on
(
"save-team-members"
,
(
event
,
obj
)
=>
{
if
(
obj
.
action
==
"add"
)
{
this
.
MsgBus
.
$emit
(
"save-members"
,
obj
.
teamMembers
);
}
else
if
(
obj
.
action
==
"delete"
)
{
this
.
MsgBus
.
$emit
(
"delete-members"
,
obj
.
teamMembers
);
}
else
if
(
obj
.
action
==
"create"
)
{
this
.
MsgBus
.
$emit
(
"create-group"
,
obj
.
teamMembers
);
}
else
if
(
obj
.
action
==
"forward"
)
{
this
.
MsgBus
.
$emit
(
"goForward"
,
obj
.
sessions
);
}
//
})
document
.
getElementById
(
'homebox'
).
addEventListener
(
"click"
,
function
(
e
)
{
if
((
that
.
usercardInfo
.
searchName
!=
""
||
that
.
atInfo
.
atName
!=
''
)
&&
e
.
target
.
className
.
indexOf
(
'u-circle'
)
==
-
1
)
{
that
.
usercardInfo
.
searchName
=
""
that
.
atInfo
.
atName
=
''
});
document
.
getElementById
(
"homebox"
).
addEventListener
(
"click"
,
function
(
e
)
{
if
(
(
that
.
usercardInfo
.
searchName
!=
""
||
that
.
atInfo
.
atName
!=
""
)
&&
e
.
target
.
className
.
indexOf
(
"u-circle"
)
==
-
1
)
{
that
.
usercardInfo
.
searchName
=
""
;
that
.
atInfo
.
atName
=
""
;
}
that
.
MsgBus
.
$emit
(
"close-copy"
)
that
.
MsgBus
.
$emit
(
"hide-this-winShow"
)
that
.
MsgBus
.
$emit
(
"close-copy"
)
;
that
.
MsgBus
.
$emit
(
"hide-this-winShow"
)
;
});
this
.
listenAts
();
},
methods
:
{
reconnect
(){
this
.
reconnecloading
=
true
listenAts
(){
let
that
=
this
var
orignalSetItem
=
localStorage
.
setItem
localStorage
.
setItem
=
function
(
key
,
newValue
){
var
setItemEvent
=
new
Event
(
"setItemEvent"
);
setItemEvent
.
key
=
key
;
setItemEvent
.
newValue
=
newValue
;
window
.
dispatchEvent
(
setItemEvent
);
orignalSetItem
.
apply
(
this
,
arguments
);
}
window
.
addEventListener
(
"setItemEvent"
,
function
(
e
)
{
if
(
e
.
key
==
'currentAts'
){
that
.
MsgBus
.
$emit
(
'changeAts'
)
}
});
},
reconnect
()
{
this
.
reconnecloading
=
true
;
this
.
$store
.
dispatch
(
"logout"
);
this
.
$store
.
dispatch
(
"connect"
);
this
.
$electron
.
ipcRenderer
.
send
(
'reconnect'
)
this
.
$electron
.
ipcRenderer
.
send
(
"reconnect"
);
setTimeout
(()
=>
{
this
.
reconnecloading
=
false
},
8
*
1000
);
this
.
reconnecloading
=
false
;
},
8
*
1000
);
},
atMsg
(){
this
.
MsgBus
.
$emit
(
'send-at-name'
,
this
.
atInfo
.
atName
)
atMsg
()
{
this
.
MsgBus
.
$emit
(
"send-at-name"
,
this
.
atInfo
.
atName
);
},
showCard
(
e
){
this
.
MsgBus
.
$emit
(
'open-card'
,
this
.
user
.
emName
,
e
.
clientY
,
e
.
clientX
)
showCard
(
e
)
{
this
.
MsgBus
.
$emit
(
"open-card"
,
this
.
user
.
emName
,
e
.
clientY
,
e
.
clientX
);
},
changeMenu
(
i
,
n
)
{
this
.
chosenState
=
{
val
:
i
,
name
:
n
};
if
(
i
!=
0
)
{
this
.
MsgBus
.
$emit
(
"dispose-session"
)
if
(
i
!=
0
)
{
this
.
MsgBus
.
$emit
(
"dispose-session"
)
;
}
},
minWin
()
{
...
...
@@ -247,13 +275,13 @@ export default {
}
},
hideWin
()
{
this
.
MsgBus
.
$emit
(
"dispose-session"
)
this
.
MsgBus
.
$emit
(
"dispose-session"
)
;
this
.
$electron
.
remote
.
getCurrentWindow
().
hide
();
}
},
computed
:
{
netState
(){
return
this
.
$store
.
state
.
isNetError
netState
()
{
return
this
.
$store
.
state
.
isNetError
;
}
}
};
...
...
@@ -267,7 +295,7 @@ export default {
box-shadow
:
0
0
2px
#333
;
margin
:
0px
;
box-sizing
:
border-box
;
border
:
1px
solid
#ccc
;
border
:
1px
solid
#ccc
;
}
.homebox.full
{
width
:
100%
;
...
...
@@ -308,7 +336,7 @@ export default {
padding
:
0
;
position
:
relative
;
}
.homebox
.leftPannel
.last
{
.homebox
.leftPannel
.last
{
left
:
0
;
bottom
:
8px
;
position
:
absolute
;
...
...
@@ -316,7 +344,7 @@ export default {
text-align
:
center
;
color
:
#eee
;
}
.homebox
.leftPannel
.last
i
{
.homebox
.leftPannel
.last
i
{
font-size
:
24px
;
}
.homebox
.leftPannel
.menu
li
{
...
...
@@ -349,24 +377,24 @@ export default {
}
.homebox
.rightPannel
.navtool
{
height
:
40px
;
box-shadow
:
1px
2px
8px
0px
rgba
(
0
,
0
,
0
,
.1
);
box-shadow
:
1px
2px
8px
0px
rgba
(
0
,
0
,
0
,
0
.1
);
display
:
flex
;
-webkit-app-region
:
drag
!important
;
}
.homebox
.rightPannel
.navtool
.error-msg
{
.homebox
.rightPannel
.navtool
.error-msg
{
display
:
none
;
top
:
0px
;
left
:
0px
;
height
:
40px
;
line-height
:
40px
;
margin
:
0
130px
;
margin
:
0
130px
;
text-align
:
center
;
font-size
:
12px
;
font-family
:
'microsoft yahei'
;
font-family
:
"microsoft yahei"
;
color
:
#f5f5f5
;
position
:
absolute
;
}
.homebox
.rightPannel
.navtool
.error-msg
.goconnect
{
.homebox
.rightPannel
.navtool
.error-msg
.goconnect
{
margin-left
:
10px
;
color
:
yellow
!important
;
text-decoration
:
underline
;
...
...
@@ -374,13 +402,13 @@ export default {
-webkit-app-region
:
no-drag
!important
;
}
.homebox
.rightPannel
.navtool.errornet
{
.homebox
.rightPannel
.navtool.errornet
{
background
:
#d25050
!important
;
}
.homebox
.rightPannel
.navtool.errornet
.error-msg
{
.homebox
.rightPannel
.navtool.errornet
.error-msg
{
display
:
block
;
}
.homebox
.rightPannel
.navtool.errornet
*
{
.homebox
.rightPannel
.navtool.errornet
*
{
color
:
#f1f1f1
!important
;
}
.homebox
.rightPannel
.navtool
.child__item
{
...
...
@@ -417,7 +445,7 @@ export default {
background
:
#eb3b5a
;
color
:
#f1f1f1
;
}
.homebox
.rightPannel
.navtool
.child__item
.header__opera
.close
{
.homebox
.rightPannel
.navtool
.child__item
.header__opera
.close
{
font-size
:
18px
;
}
.homebox
...
...
@@ -428,8 +456,8 @@ export default {
.opera__item.min
:hover
{
background
:
rgba
(
0
,
0
,
0
,
0.1
);
}
.homebox
.rightPannel
.contentarea
{
position
:
absolute
;
.homebox
.rightPannel
.contentarea
{
position
:
absolute
;
top
:
40px
;
z-index
:
0
;
bottom
:
0
;
...
...
@@ -449,7 +477,7 @@ export default {
font-size
:
14px
;
padding
:
5px
10px
;
}
.at-him-box
:hover
{
.at-him-box
:hover
{
background
:
#eeeeee
;
}
</
style
>
src/renderer/components/login.vue
View file @
9ec8efa5
...
...
@@ -129,6 +129,7 @@ export default {
if
(
!
localStorage
.
currentAts
){
localStorage
.
currentAts
=
'{}'
}
localStorage
.
selfNam
=
userData
.
emName
if
(
this
.
usermodel
.
remeber
)
{
this
.
usermodel
.
userpic
=
userData
.
Icon
;
this
.
usermodel
.
username
=
userData
.
emName
;
...
...
src/renderer/components/msssage/chateditor.vue
View file @
9ec8efa5
...
...
@@ -406,28 +406,26 @@ export default {
let
accids
=
[]
ats
.
forEach
(
x
=>
{
if
(
x
==
'@全体成员(all)'
){
accids
.
push
({
account
:
'-1'
,
alias
:
'@全体成员(all)'
})
accids
.
push
(
'-1'
)
}
else
{
this
.
members
.
forEach
(
y
=>
{
if
(
x
==
`@
${
y
.
alias
}
`
){
accids
.
push
({
account
:
y
.
account
,
alias
:
'@'
+
y
.
alias
})
accids
.
push
(
`
${
y
.
account
}
`
)
}
})
}
})
let
apns
=
{
accounts
:
accids
,
content
:
`
${
localStorage
.
selfNam
}
在群里@了你`
,
forcePush
:
true
}
this
.
$store
.
dispatch
(
"sendMsg"
,
{
type
:
"at"
,
scene
:
this
.
scene
,
to
:
this
.
to
,
text
:
this
.
msgToSent
,
content
:
accids
,
callbackTeam
:
this
.
callBackTeam
apns
});
}
else
{
console
.
log
(
'in start...........'
,
new
Date
())
...
...
src/renderer/components/msssage/chatitem.vue
View file @
9ec8efa5
...
...
@@ -512,13 +512,14 @@ export default {
// 文本消息
item
.
showText
=
util
.
escape
(
item
.
text
);
let
ats
=
item
.
showText
.
replace
(
/ /ig
,
" "
).
match
(
/@
[^\s
@$
]
+/g
)
if
(
ats
&&
item
.
scene
==
'team'
&&
item
.
custom
){
let
atUser
=
JSON
.
parse
(
item
.
custom
)
if
(
ats
&&
item
.
scene
==
'team'
&&
item
.
apns
&&
item
.
apns
.
accounts
&&
item
.
apns
.
accounts
.
length
>
0
){
//let atUser=item.apns
console
.
log
(
item
)
ats
.
forEach
(
at
=>
{
let
isExsit
=
atUser
.
find
(
x
=>
{
return
x
.
alias
==
at
})
if
(
isExsit
)
//
let isExsit=atUser.find(x=>{
//
return x.alias==at
//
})
//
if(isExsit)
item
.
showText
=
item
.
showText
.
replace
(
at
,
`<p class='at-user'>
${
at
}
</p>`
)
})
}
...
...
src/renderer/components/msssage/index.vue
View file @
9ec8efa5
...
...
@@ -78,58 +78,13 @@
</div>
</li>
</
template
>
<
template
v-for=
"(session, index) in sessionlist"
>
<li
:class=
"
{'active':currentSession.id==session.id}"
style="background:rgb(238,238,238)"
v-if="session.top
&&
(sessionKey=='' || session.name.indexOf(sessionKey)!=-1)"
:key="index"
@contextmenu.prevent='showMenu(session,$event)'
@click="enterChat(session)"
>
<el-badge
:value=
"session.unread"
:max=
"99"
class=
"item"
:hidden=
"session.unread==0"
:is-dot=
"session.isMute && session.unread>0"
>
<div
class=
"headinfo"
:class=
"
{'notice':!session.avatar,'blue':session.groupType==0,'green':session.groupType==1,'user':session.groupType==-1}"
>
<img
:src=
"session.avatar"
v-if=
"session.avatar"
>
<i
class=
"iconfont icontaolun"
v-else-if=
"session.groupType == 0"
></i>
<i
class=
"iconfont iconqunzu"
v-else-if=
"session.groupType == 1"
></i>
<i
class=
"iconfont iconyonghutouxiang"
v-else
></i>
</div>
</el-badge>
<div
class=
"baseinfo"
>
<div
class=
"userbase"
>
<div
class=
"name"
>
{{
session
.
name
}}
</div>
<div
class=
"time"
>
{{
session
.
updateTimeShow
}}
</div>
</div>
<div
class=
"msgbase"
>
<div
class=
"last"
>
<span
class=
"at-me"
v-if=
"session.atId"
>
[有人@我]
</span>
<template
v-if=
"session.isMute && session.unread>0 && !session.historiMsg"
>
<span>
[
{{
session
.
unread
}}
]
</span>
</
template
>
<span
v-if=
"!session.historiMsg"
>
{{session.lastMsgShow}}
</span>
<span
v-if=
"session.historiMsg && currentSession.id !== session.id"
style=
"color: red"
>
[草稿]
</span>
{{session.historiMsg}}
</div>
<div
class=
"no-tip"
v-if=
"session.isMute"
>
<i
class=
"iconfont iconmiandarao-kai"
></i>
</div>
</div>
</div>
</li>
</template>
<
template
v-for=
"(session, index) in sessionlist"
>
<!-- && session.lastMsgShow!== '[未知消息类型]' -->
<li
:class=
"
{'active':currentSession.id==session.id}"
v-if="!session.top
&&
(sessionKey=='' || session.name.indexOf(sessionKey)!=-1)
&&
session.name!== ''"
v-if="(sessionKey=='' || session.name.indexOf(sessionKey)!=-1)
&&
session.name!== ''"
:style="{background: session.top ? 'rgb(238,238,238)' : ''}"
:key="index"
@contextmenu.prevent='showMenu(session,$event)'
@click="enterChat(session)"
...
...
@@ -158,7 +113,7 @@
</div>
<div
class=
"msgbase"
>
<div
class=
"last"
>
<span
class=
"at-me"
v-if=
"session.atId"
>
[有人@我]
</span>
<span
class=
"at-me"
v-if=
"session.atId
&& session.unread>0
"
>
[有人@我]
</span>
<template
v-if=
"session.isMute && session.unread>0 && !session.historiMsg"
>
<span>
[
{{
session
.
unread
}}
]
</span>
</
template
>
...
...
@@ -235,7 +190,8 @@ export default {
atIds
:
null
,
forwardMsgInfo
:{},
sessionlistArr
:
[],
initSessionList
:[]
initSessionList
:[],
localAts
:{}
};
},
updated
()
{
...
...
@@ -383,33 +339,38 @@ export default {
}
},
clearAtMe
(){
let
teamInfo
=
null
;
if
(
this
.
currentSession
.
scene
===
"team"
)
{
t
eamInfo
=
this
.
$store
.
state
.
teamlist
.
find
(
team
=>
{
return
team
.
teamId
===
this
.
currentSession
.
to
;
});
t
his
.
$store
.
state
.
teamlist
.
forEach
(
team
=>
{
if
(
team
.
teamId
===
this
.
currentSession
.
to
){
delete
team
.
atId
}
if
(
teamInfo
&&
teamInfo
.
custom
){
let
custom
=
JSON
.
parse
(
teamInfo
.
custom
)
if
(
custom
.
ats
){
custom
.
ats
=
custom
.
ats
.
filter
(
x
=>
{
if
(
x
.
account
==
this
.
$store
.
state
.
userUID
)
return
return
x
})
});
this
.
localAts
=
JSON
.
parse
(
localStorage
.
currentAts
)
if
(
this
.
localAts
[
this
.
currentSession
.
to
])
delete
this
.
localAts
[
this
.
currentSession
.
to
]
localStorage
.
currentAts
=
JSON
.
stringify
(
this
.
localAts
)
}
// if(teamInfo && teamInfo.custom){
// let custom=JSON.parse(teamInfo.custom)
// if(custom.ats){
// custom.ats=custom.ats.filter(x=>{
// if(x.account==this.$store.state.userUID)
// return
// return x
// })
this
.
$store
.
dispatch
(
"delegateTeamFunction"
,
{
functionName
:
'updateTeam'
,
options
:
{
teamId
:
teamInfo
.
teamId
,
custom
:
JSON
.
stringify
(
custom
),
done
:
(
error
,
team
)
=>
{
// console.log('serverCustom Error:',error)
}
}
})
}
}
//
this.$store.dispatch("delegateTeamFunction", {
//
functionName: 'updateTeam',
//
options: {
//
teamId: teamInfo.teamId,
//
custom: JSON.stringify(custom),
//
done: (error, team) => {
//
// console.log('serverCustom Error:',error)
//
}
//
}
//
})
//
}
//
}
},
openNotice
(){
this
.
$store
.
dispatch
(
"resetCurrSession"
)
...
...
@@ -496,6 +457,7 @@ export default {
},
mounted
()
{
this
.
audio_base
=
this
.
$electron
.
remote
.
getGlobal
(
"AUDIO_PATH"
)
+
'audio/'
this
.
localAts
=
JSON
.
parse
(
localStorage
.
currentAts
)
if
(
window
.
localStorage
.
top
)
{
this
.
TOPSESSION
=
JSON
.
parse
(
window
.
localStorage
.
top
);
}
...
...
@@ -543,17 +505,18 @@ export default {
this
.
MsgBus
.
$on
(
"create-session"
,
function
(
obj
)
{
that
.
createSession
(
obj
)
});
this
.
MsgBus
.
$on
(
'reload-ats'
,
function
(){
this
.
localAts
=
JSON
.
parse
(
localStorage
.
currentAts
)
})
//
setTimeout
(()
=>
{
this
.
initSessionList
=
this
.
sessionlist
.
filter
(
x
=>
{
console
.
log
(
x
.
lastMsg
)
if
(
x
.
scene
==
'team'
&&
x
.
unread
>
0
&&
x
.
unread
<
100
){
if
(
x
.
scene
==
'team'
&&
x
.
unread
>
0
&&
x
.
unread
<
100
&&
!
this
.
localAts
[
x
.
to
]){
return
x
}
else
{
return
false
}
})
console
.
log
(
this
.
initSessionList
)
if
(
this
.
initSessionList
.
length
>
0
){
this
.
getAts
()
}
...
...
@@ -622,23 +585,35 @@ export default {
?
this
.
myGroupIcon
:
this
.
myAdvancedIcon
);
item
.
isMute
=
teamInfo
.
usermute
?
teamInfo
.
usermute
:
false
;
try
{
if
(
teamInfo
.
custom
){
let
custom
=
JSON
.
parse
(
teamInfo
.
custom
)
if
(
custom
.
ats
){
let
atme
=
custom
.
ats
.
find
(
x
=>
{
return
x
.
account
==
this
.
$store
.
state
.
userUID
})
if
(
atme
&&
this
.
currentSession
.
id
!=
item
.
id
){
item
.
atId
=
atme
.
id
}
else
if
(
atme
&&
this
.
currentSession
.
id
==
item
.
id
){
setTimeout
(()
=>
{
this
.
clearAtMe
()
},
1000
);
// try {
// if(teamInfo.custom){
// let custom=JSON.parse(teamInfo.custom)
// if(custom.ats){
// let atme =custom.ats.find(x=>{
// return x.account==this.$store.state.userUID
// })
// if(atme && this.currentSession.id!=item.id){
// item.atId=atme.id
// }else if(atme && this.currentSession.id==item.id){
// setTimeout(() => {
// this.clearAtMe()
// }, 1000);
// }
// }
// }
// } catch (error) {}
if
(
item
.
lastMsg
.
apns
&&
item
.
lastMsg
.
apns
.
accounts
&&
(
item
.
lastMsg
.
apns
.
accounts
.
indexOf
(
localStorage
.
imAccount
)
!=
-
1
||
item
.
lastMsg
.
apns
.
accounts
[
0
]
==
-
1
)){
item
.
atId
=
item
.
lastMsg
.
idServer
}
else
{
if
(
teamInfo
.
atId
){
item
.
atId
=
teamInfo
.
atId
}
else
{
item
.
atId
=
null
if
(
this
.
localAts
[
item
.
to
]){
item
.
atId
=
this
.
localAts
[
item
.
to
]
}
}
}
}
catch
(
error
)
{}
}
else
{
return
;
item
.
groupType
=
"normal"
;
...
...
@@ -751,6 +726,7 @@ export default {
this
.
newMsgList
=
unreadList
;
sessionlist
.
sort
((
a
,
b
)
=>
b
.
top
-
a
.
top
)
return
sessionlist
;
}
// netState(){
...
...
src/store/actions/msgs.js
View file @
9ec8efa5
...
...
@@ -233,7 +233,6 @@ export function sendMsg({ state, commit }, obj) {
done
:
onSendMsgDone
,
needMsgReceipt
:
obj
.
needMsgReceipt
||
false
})
console
.
log
(
'start sdk.........'
)
util
.
getDate
()
break
case
'at'
:
...
...
@@ -241,13 +240,11 @@ export function sendMsg({ state, commit }, obj) {
scene
:
obj
.
scene
,
to
:
obj
.
to
,
text
:
obj
.
text
,
done
:
function
(
err
,
msg
)
{
obj
.
callbackTeam
(
obj
.
content
,
msg
.
idServer
)
onMsg
(
msg
)
},
needMsgReceipt
:
obj
.
needMsgReceipt
||
false
,
custom
:
JSON
.
stringify
(
obj
.
content
)
apns
:
obj
.
apns
,
done
:
onSendMsgDone
,
needMsgReceipt
:
obj
.
needMsgReceipt
||
false
})
util
.
getDate
()
break
case
'custom'
:
nim
.
sendCustomMsg
({
...
...
src/store/actions/team.js
View file @
9ec8efa5
...
...
@@ -7,16 +7,16 @@ export function onTeams(teams) {
}
teams
=
teams
.
filter
(
item
=>
!!
item
)
let
teamIds
=
[]
teams
.
forEach
(
team
=>
{
teams
.
forEach
(
team
=>
{
teamIds
.
push
(
team
.
teamId
)
if
(
team
.
validToCurrentUser
===
undefined
)
{
team
.
validToCurrentUser
=
true
}
if
(
team
.
avatar
&&
team
.
avatar
.
indexOf
(
'nim.nosdn.127'
)
>
0
&&
team
.
avatar
.
indexOf
(
'?imageView'
)
===
-
1
)
{
if
(
team
.
avatar
&&
team
.
avatar
.
indexOf
(
'nim.nosdn.127'
)
>
0
&&
team
.
avatar
.
indexOf
(
'?imageView'
)
===
-
1
)
{
team
.
avatar
=
team
.
avatar
+
'?imageView&thumbnail=300y300'
}
})
getNotifyForNewTeamMsg
(
store
,
teamIds
)
getNotifyForNewTeamMsg
(
store
,
teamIds
)
store
.
commit
(
'updateTeamList'
,
teams
)
}
...
...
@@ -35,7 +35,7 @@ export function onCreateTeam(team) {
})
}
export
function
onSynCreateTeam
(
team
){
export
function
onSynCreateTeam
(
team
)
{
onTeams
(
team
)
}
...
...
@@ -46,10 +46,11 @@ export function onDismissTeam(obj) {
}
export
function
onUpdateTeam
(
team
)
{
console
.
log
(
'team update..........'
)
onTeams
(
team
)
}
export
function
onTeamNotificationMsg
({
state
,
commit
},
msg
)
{
export
function
onTeamNotificationMsg
({
state
,
commit
},
msg
)
{
if
(
msg
.
attach
.
type
===
'updateTeam'
&&
msg
.
attach
.
team
)
{
store
.
commit
(
'updateTeamInfo'
,
msg
.
attach
.
team
)
}
...
...
@@ -62,7 +63,7 @@ export function onTeamNotificationMsg({state, commit}, msg) {
}
export
function
onAddTeamMembers
(
obj
)
{
obj
.
accounts
.
forEach
(
account
=>
{
obj
.
accounts
.
forEach
(
account
=>
{
// 自己被拉入群时更新群列表
if
(
account
===
store
.
state
.
userUID
)
{
let
team
=
[
obj
.
team
]
...
...
@@ -120,7 +121,7 @@ export function onTeamMsgReceipt(obj) {
}
// 进入可配置的群信息设置页,进入前改变state中的配置信息,进入页面后读取配置信息更新视图
export
function
enterSettingPage
({
commit
},
obj
)
{
export
function
enterSettingPage
({
commit
},
obj
)
{
commit
(
'updateTeamSettingConfig'
,
obj
)
// setTimeout(() => {
// location.href = `#/teamsetting`
...
...
@@ -129,16 +130,16 @@ export function enterSettingPage({commit}, obj) {
/*
* 代理nim sdk中对群组的操作方法
* @functionName nim sdk中的方法名
* @options 传递给sdk方法的参数
*/
export
function
delegateTeamFunction
({
state
},
{
functionName
,
options
})
{
* 代理nim sdk中对群组的操作方法
* @functionName nim sdk中的方法名
* @options 传递给sdk方法的参数
*/
export
function
delegateTeamFunction
({
state
},
{
functionName
,
options
})
{
const
nim
=
state
.
nim
if
(
functionName
&&
nim
[
functionName
]
&&
typeof
nim
[
functionName
]
===
'function'
)
{
nim
[
functionName
](
options
)
}
else
{
throw
(
`There is not property of '
${
functionName
}
' in nim or '
${
functionName
}
' is not a function`
)
throw
(
`There is not property of '
${
functionName
}
' in nim or '
${
functionName
}
' is not a function`
)
}
}
...
...
@@ -168,26 +169,26 @@ export function getTeamMembers({ state }, teamId) {
})
}
export
function
getNotifyForNewTeamMsg
({
state
,
commit
},
teamIds
)
{
export
function
getNotifyForNewTeamMsg
({
state
,
commit
},
teamIds
)
{
const
nim
=
state
.
nim
nim
.
notifyForNewTeamMsg
({
teamIds
:
teamIds
,
done
:
(
err
,
obj
)
=>
{
commit
(
'updateTeamUserMute'
,
obj
)
commit
(
'updateTeamUserMute'
,
obj
)
}
})
}
export
function
checkTeamMsgReceipt
({
state
},
msgs
)
{
export
function
checkTeamMsgReceipt
({
state
},
msgs
)
{
var
result
=
/team-
(\d
+
)
/
.
exec
(
state
.
currSessionId
)
if
(
!
result
)
{
return
null
}
var
teamId
=
result
[
1
]
var
needToPeceiptList
=
getMsgNeedToReceipt
(
state
,
teamId
,
msgs
)
if
(
needToPeceiptList
&&
needToPeceiptList
.
length
>
0
)
{
var
needToPeceiptList
=
getMsgNeedToReceipt
(
state
,
teamId
,
msgs
)
if
(
needToPeceiptList
&&
needToPeceiptList
.
length
>
0
)
{
nim
.
sendTeamMsgReceipt
({
teamMsgReceipts
:
needToPeceiptList
,
done
:
(
err
,
obj
,
content
)
=>
{
...
...
@@ -225,8 +226,8 @@ export function getTeamMsgReads({ state }, needQuery) {
done
:
(
error
,
obj
,
content
)
=>
{
if
(
error
)
{
//console.log('获取群组消息已读' + error)
let
a
=
0
;
}
else
{
let
a
=
0
;
}
else
{
//('获取群组消息已读:', content)
store
.
commit
(
'updateTeamMsgReads'
,
content
)
}
...
...
src/store/mutations/index.js
View file @
9ec8efa5
...
...
@@ -260,12 +260,25 @@ export default {
// 装入未读消息
unreadListHis
(
state
,
obj
)
{
let
currentAts
=
JSON
.
parse
(
localStorage
.
currentAts
)
let
tempteamlist
=
store
.
state
.
teamlist
let
teamObj
=
[]
obj
.
msgs
.
forEach
(
x
=>
{
if
(
x
.
apns
&&
x
.
apns
.
accounts
&&
x
.
apns
.
accounts
.
indexOf
(
localStorage
.
imAccount
)
!=
-
1
)
{
if
(
x
.
apns
&&
x
.
apns
.
accounts
&&
(
x
.
apns
.
accounts
.
indexOf
(
localStorage
.
imAccount
)
!=
-
1
||
x
.
apns
.
accounts
[
0
]
==
-
1
))
{
console
.
log
(
x
.
apns
)
currentAts
[
obj
.
to
]
=
x
.
idServer
localStorage
.
setItem
(
"currentAts"
,
JSON
.
stringify
(
currentAts
)
||
{});
tempteamlist
.
forEach
(
t
=>
{
if
(
t
.
teamId
==
obj
.
to
)
{
t
.
atId
=
x
.
idServer
}
teamObj
.
push
(
t
)
})
}
})
localStorage
.
currentAts
=
JSON
.
stringify
(
currentAts
)
||
{}
if
(
teamObj
.
length
>
0
)
{
store
.
commit
(
'updateTeamList'
,
teamObj
)
}
},
// clearMsgs(state, obj) {
// state.msgs = []
...
...
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