Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
杨俊
/
spread_im
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
f96995a7
...
f96995a79ba81e543b4ff16cc83ffc112e201064
authored
2021-10-20 14:14:30 +0800
by
杨俊
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
更新
1 parent
f5e26bd2
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
387 additions
and
265 deletions
src/components/conversation/conversationProfile/group-profile.vue
src/components/friend/friend-item.vue
src/components/friend/friend-list.vue
src/components/layout/side-bar.vue
src/index.vue
src/store/modules/friend.js
src/components/conversation/conversationProfile/group-profile.vue
View file @
f96995a
<
template
>
<div>
<group-member-list
:groupProfile=
"groupProfile"
/>
<group-member-list
:groupProfile=
"groupProfile"
/>
<div
class=
"group-info-content"
>
<div
class=
"info-item"
>
<div
class=
"label"
>
群ID
</div>
...
...
@@ -34,10 +34,10 @@
/>
</div>
<
div
class=
"info-item"
>
<div
class=
"label"
>
群类型
</div
>
<div
class=
"content"
>
{{
groupType
}}
</div
>
<
/div
>
<
!--
<div
class=
"info-item"
>
--
>
<!--
<div
class=
"label"
>
群类型
</div>
--
>
<!--
<div
class=
"content"
>
{{
groupType
}}
</div>
--
>
<
!--
</div>
--
>
<div
class=
"info-item"
>
<div
class=
"label"
>
群名称
...
...
@@ -104,50 +104,50 @@
style=
"cursor:pointer; font-size:16px;"
/>
</div>
<div
class=
"long-content"
:title=
"
groupProfile.notification
"
v-if=
"!showEditNotification"
>
{{
groupProfile
.
notification
||
'暂无'
}}
<div
class=
"long-content"
:title=
"
notice
"
v-if=
"!showEditNotification"
>
{{
notice
||
'暂无'
}}
</div>
<el-input
ref=
"editNotification"
v-else
autofocus
v-model=
"notification"
size=
"mini"
@
blur=
"showEditNotification = false"
@
keydown
.
enter
.
native=
"editNotification"
/>
</div>
<div
class=
"info-item"
v-if=
"groupProfile.type !== 'Private'"
>
<div
class=
"label"
>
申请加群方式
<!--
<i-->
<!-- class="el-icon-edit"-->
<!-- v-if="editable"-->
<!-- @click="-->
<!-- showEditJoinOption = true-->
<!-- inputFocus('editJoinOption')-->
<!-- "-->
<!-- style="cursor:pointer; font-size:16px;"-->
<!-- />-->
</div>
<div
class=
"content"
v-show=
"!showEditJoinOption"
>
{{
joinOptionMap
[
groupProfile
.
joinOption
]
}}
</div>
<el-select
ref=
"editJoinOption"
v-model=
"joinOption"
v-show=
"showEditJoinOption"
size=
"mini"
automatic-dropdown
@
blur=
"showEditJoinOption = false"
@
change=
"editJoinOption"
>
<el-option
label=
"自由加入"
value=
"FreeAccess"
></el-option>
<el-option
label=
"需要验证"
value=
"NeedPermission"
></el-option>
<el-option
label=
"禁止加群"
value=
"DisableApply"
></el-option>
</el-select>
<!--
<el-input-->
<!-- ref="editNotification"-->
<!-- v-else-->
<!-- autofocus-->
<!-- v-model="notification"-->
<!-- size="mini"-->
<!-- @blur="showEditNotification = false"-->
<!-- @keydown.enter.native="editNotification"-->
<!-- />-->
</div>
<!--
<div
class=
"info-item"
v-if=
"groupProfile.type !== 'Private'"
>
-->
<!--
<div
class=
"label"
>
-->
<!-- 申请加群方式-->
<!-- <!–
<i
&
ndash
;&
gt
;
--
>
<!-- <!– class="el-icon-edit"–>-->
<!-- <!– v-if="editable"–>-->
<!-- <!– @click="–>-->
<!-- <!– showEditJoinOption = true–>-->
<!-- <!– inputFocus('editJoinOption')–>-->
<!-- <!– "–>-->
<!-- <!– style="cursor:pointer; font-size:16px;"–>-->
<!-- <!– />–>-->
<!--
</div>
-->
<!--
<div
class=
"content"
v-show=
"!showEditJoinOption"
>
-->
<!--
{{
joinOptionMap
[
groupProfile
.
joinOption
]
}}
-->
<!--
</div>
-->
<!--
<el-select-->
<!-- ref="editJoinOption"-->
<!-- v-model="joinOption"-->
<!-- v-show="showEditJoinOption"-->
<!-- size="mini"-->
<!-- automatic-dropdown-->
<!-- @blur="showEditJoinOption = false"-->
<!-- @change="editJoinOption"-->
<!-- >-->
<!--
<el-option
label=
"自由加入"
value=
"FreeAccess"
></el-option>
-->
<!--
<el-option
label=
"需要验证"
value=
"NeedPermission"
></el-option>
-->
<!--
<el-option
label=
"禁止加群"
value=
"DisableApply"
></el-option>
-->
<!--
</el-select>
-->
<!--
</div>
-->
<div
class=
"info-item"
>
<div
class=
"label"
>
群消息提示类型
...
...
@@ -178,64 +178,66 @@
<el-option
label=
"屏蔽消息"
value=
"Discard"
></el-option>
</el-select>
</div>
<
div
class=
"info-item"
>
<div
class=
"label"
>
我的群名片
<i
class=
"el-icon-edit"
@
click=
"
showEditNameCard = true
inputFocus('editNameCard')
"
style=
"cursor:pointer; font-size:16px;"
/
>
</div
>
<div
class=
"content cursor-pointer"
v-if=
"!showEditNameCard"
>
{{
groupProfile
.
selfInfo
.
nameCard
||
'暂无'
}}
</div
>
<el-input
ref=
"editNameCard"
v-else
autofocus
v-model=
"nameCard"
size=
"mini"
@
blur=
"showEditNameCard = false"
@
keydown
.
enter
.
native=
"editNameCard"
/
>
<
/div
>
<!--
<div
class=
"info-item"
>
-->
<!--
<div
class=
"label"
:class=
"
{'active' : active}">全体禁言
</div>
-->
<!--
<el-switch-->
<!-- v-model="muteAllMembers"-->
<!-- active-color="#409eff"-->
<!-- inactive-color="#dcdfe6"-->
<!-- @change='changeMuteStatus'>-->
<!--
</el-switch>
-->
<!--
</div>
-->
<!--
<div
v-if=
"isOwner"
>
-->
<!--
<el-button
type=
"text"
@
click=
"showChangeGroupOwner = true"
>
转让群组
</el-button>
-->
<!--
<el-input-->
<!-- v-if="showChangeGroupOwner"-->
<!-- v-model="newOwnerUserID"-->
<!-- placeholder="新群主的userID"-->
<!-- size="mini"-->
<!-- @blur="showChangeGroupOwner = false"-->
<!-- @keydown.enter.native="changeOwner"-->
<!-- />-->
<!--
</div>
-->
<
!--
<div
class=
"info-item"
>
--
>
<!--
<div
class=
"label"
>
--
>
<!-- 我的群名片-->
<!--
<i-->
<!-- class="el-icon-edit"-->
<!-- @click="-->
<!-- showEditNameCard = true-->
<!-- inputFocus('editNameCard')-->
<!-- "-->
<!-- style="cursor:pointer; font-size:16px;"-->
<!-- />--
>
<!--
</div>
--
>
<!--
<div
class=
"content cursor-pointer"
v-if=
"!showEditNameCard"
>
--
>
<!--
{{
groupProfile
.
selfInfo
.
nameCard
||
'暂无'
}}
-->
<!--
</div>
--
>
<!--
<el-input-->
<!-- ref="editNameCard"-->
<!-- v-else-->
<!-- autofocus-->
<!-- v-model="nameCard"-->
<!-- size="mini"-->
<!-- @blur="showEditNameCard = false"-->
<!-- @keydown.enter.native="editNameCard"-->
<!-- />--
>
<
!--
</div>
--
>
<!--
<div
class=
"info-item"
>
-->
<!--
<div
class=
"label"
:class=
"
{'active' : active}">全体禁言
</div>
-->
<!--
<el-switch-->
<!-- v-model="muteAllMembers"-->
<!-- active-color="#409eff"-->
<!-- inactive-color="#dcdfe6"-->
<!-- @change='changeMuteStatus'>-->
<!--
</el-switch>
-->
<!--
</div>
-->
<!--
<div
v-if=
"isOwner"
>
-->
<!--
<el-button
type=
"text"
@
click=
"showChangeGroupOwner = true"
>
转让群组
</el-button>
-->
<!--
<el-input-->
<!-- v-if="showChangeGroupOwner"-->
<!-- v-model="newOwnerUserID"-->
<!-- placeholder="新群主的userID"-->
<!-- size="mini"-->
<!-- @blur="showChangeGroupOwner = false"-->
<!-- @keydown.enter.native="changeOwner"-->
<!-- />-->
<!--
</div>
-->
<div>
<el-button
type=
"text"
style=
"color:red;"
@
click=
"quitGroup"
>
退出群组
</el-button>
</div>
<!--
<div
v-if=
"showDissmissGroup"
>
-->
<!--
<el-button
type=
"text"
style=
"color:red;"
@
click=
"dismissGroup"
>
解散群组
</el-button>
-->
<!--
</div>
-->
<!--
<div
v-if=
"showDissmissGroup"
>
-->
<!--
<el-button
type=
"text"
style=
"color:red;"
@
click=
"dismissGroup"
>
解散群组
</el-button>
-->
<!--
</div>
-->
</div>
</div>
</
template
>
<
script
>
import
GroupMemberList
from
'./group-member-list.vue'
import
{
Select
,
Option
,
Switch
}
from
'element-ui'
import
{
Option
,
Select
,
Switch
}
from
'element-ui'
import
_
from
'loadsh'
export
default
{
props
:
[
'groupProfile'
],
components
:
{
...
...
@@ -273,14 +275,14 @@ export default {
NeedPermission
:
'需要验证'
,
DisableApply
:
'禁止加群'
},
active
:
false
active
:
false
}
},
computed
:
{
editable
()
{
return
(
this
.
groupProfile
.
type
===
this
.
TIM
.
TYPES
.
GRP_WORK
||
[
this
.
TIM
.
TYPES
.
GRP_MBR_ROLE_OWNER
,
this
.
TIM
.
TYPES
.
GRP_MBR_ROLE_ADMIN
].
includes
(
this
.
groupProfile
.
selfInfo
.
role
)
this
.
groupProfile
.
type
===
this
.
TIM
.
TYPES
.
GRP_WORK
||
[
this
.
TIM
.
TYPES
.
GRP_MBR_ROLE_OWNER
,
this
.
TIM
.
TYPES
.
GRP_MBR_ROLE_ADMIN
].
includes
(
this
.
groupProfile
.
selfInfo
.
role
)
)
},
isOwner
()
{
...
...
@@ -306,6 +308,11 @@ export default {
default
:
return
''
}
},
notice
()
{
let
val
=
_
.
get
(
_
.
first
(
this
.
groupProfile
.
groupCustomField
.
filter
(
item
=>
item
.
key
===
'ActivityNotice'
)),
'value'
,
''
)
return
val
.
length
===
0
?
''
:
_
.
get
(
JSON
.
parse
(
val
),
'notice'
,
''
)
}
},
watch
:
{
...
...
@@ -337,63 +344,63 @@ export default {
},
editName
()
{
this
.
tim
.
updateGroupProfile
({
groupID
:
this
.
groupProfile
.
groupID
,
name
:
this
.
name
.
trim
()
})
.
then
(()
=>
{
this
.
showEditName
=
false
})
.
catch
(
error
=>
{
this
.
$store
.
commit
(
'showMessage'
,
{
type
:
'error'
,
message
:
error
.
message
.
updateGroupProfile
({
groupID
:
this
.
groupProfile
.
groupID
,
name
:
this
.
name
.
trim
()
})
.
then
(()
=>
{
this
.
showEditName
=
false
})
.
catch
(
error
=>
{
this
.
$store
.
commit
(
'showMessage'
,
{
type
:
'error'
,
message
:
error
.
message
})
})
})
},
editFaceUrl
()
{
this
.
tim
.
updateGroupProfile
({
groupID
:
this
.
groupProfile
.
groupID
,
avatar
:
this
.
avatar
.
trim
()
})
.
then
(()
=>
{
this
.
showEditFaceUrl
=
false
})
.
catch
(
error
=>
{
this
.
$store
.
commit
(
'showMessage'
,
{
type
:
'error'
,
message
:
error
.
message
.
updateGroupProfile
({
groupID
:
this
.
groupProfile
.
groupID
,
avatar
:
this
.
avatar
.
trim
()
})
.
then
(()
=>
{
this
.
showEditFaceUrl
=
false
})
.
catch
(
error
=>
{
this
.
$store
.
commit
(
'showMessage'
,
{
type
:
'error'
,
message
:
error
.
message
})
})
})
},
changeMuteStatus
()
{
if
(
this
.
isOwner
||
this
.
isAdmin
)
{
this
.
tim
.
updateGroupProfile
({
muteAllMembers
:
this
.
muteAllMembers
,
groupID
:
this
.
groupProfile
.
groupID
})
.
then
(
imResponse
=>
{
this
.
muteAllMembers
=
imResponse
.
data
.
group
.
muteAllMembers
if
(
this
.
muteAllMembers
)
{
this
.
active
=
true
this
.
$store
.
commit
(
'showMessage'
,
{
message
:
'全体禁言'
.
updateGroupProfile
({
muteAllMembers
:
this
.
muteAllMembers
,
groupID
:
this
.
groupProfile
.
groupID
})
}
else
{
this
.
active
=
false
this
.
$store
.
commit
(
'showMessage'
,
{
message
:
'取消全体禁言'
.
then
(
imResponse
=>
{
this
.
muteAllMembers
=
imResponse
.
data
.
group
.
muteAllMembers
if
(
this
.
muteAllMembers
)
{
this
.
active
=
true
this
.
$store
.
commit
(
'showMessage'
,
{
message
:
'全体禁言'
})
}
else
{
this
.
active
=
false
this
.
$store
.
commit
(
'showMessage'
,
{
message
:
'取消全体禁言'
})
}
})
.
catch
(
error
=>
{
this
.
$store
.
commit
(
'showMessage'
,
{
type
:
'error'
,
message
:
error
.
message
})
})
}
})
.
catch
(
error
=>
{
this
.
$store
.
commit
(
'showMessage'
,
{
type
:
'error'
,
message
:
error
.
message
})
})
}
else
{
this
.
muteAllMembers
=
this
.
groupProfile
.
muteAllMembers
this
.
$store
.
commit
(
'showMessage'
,
{
...
...
@@ -404,74 +411,74 @@ export default {
},
editIntroduction
()
{
this
.
tim
.
updateGroupProfile
({
groupID
:
this
.
groupProfile
.
groupID
,
introduction
:
this
.
introduction
.
trim
()
})
.
then
(()
=>
{
this
.
showEditIntroduction
=
false
})
.
catch
(
error
=>
{
this
.
$store
.
commit
(
'showMessage'
,
{
type
:
'error'
,
message
:
error
.
message
.
updateGroupProfile
({
groupID
:
this
.
groupProfile
.
groupID
,
introduction
:
this
.
introduction
.
trim
()
})
.
then
(()
=>
{
this
.
showEditIntroduction
=
false
})
.
catch
(
error
=>
{
this
.
$store
.
commit
(
'showMessage'
,
{
type
:
'error'
,
message
:
error
.
message
})
})
})
},
editNotification
()
{
this
.
tim
.
updateGroupProfile
({
groupID
:
this
.
groupProfile
.
groupID
,
notification
:
this
.
notification
.
trim
()
})
.
then
(()
=>
{
this
.
showEditNotification
=
false
})
.
catch
(
error
=>
{
this
.
$store
.
commit
(
'showMessage'
,
{
type
:
'error'
,
message
:
error
.
message
.
updateGroupProfile
({
groupID
:
this
.
groupProfile
.
groupID
,
notification
:
this
.
notification
.
trim
()
})
.
then
(()
=>
{
this
.
showEditNotification
=
false
})
.
catch
(
error
=>
{
this
.
$store
.
commit
(
'showMessage'
,
{
type
:
'error'
,
message
:
error
.
message
})
})
})
},
editJoinOption
()
{
this
.
tim
.
updateGroupProfile
({
groupID
:
this
.
groupProfile
.
groupID
,
joinOption
:
this
.
joinOption
})
.
then
(()
=>
{
this
.
showEditJoinOption
=
false
})
.
catch
(
error
=>
{
this
.
$store
.
commit
(
'showMessage'
,
{
type
:
'error'
,
message
:
error
.
message
.
updateGroupProfile
({
groupID
:
this
.
groupProfile
.
groupID
,
joinOption
:
this
.
joinOption
})
.
then
(()
=>
{
this
.
showEditJoinOption
=
false
})
.
catch
(
error
=>
{
this
.
$store
.
commit
(
'showMessage'
,
{
type
:
'error'
,
message
:
error
.
message
})
})
})
},
changeOwner
()
{
this
.
tim
.
changeGroupOwner
({
groupID
:
this
.
groupProfile
.
groupID
,
newOwnerID
:
this
.
newOwnerUserID
})
.
then
(()
=>
{
this
.
showChangeGroupOwner
=
false
this
.
$store
.
commit
(
'showMessage'
,
{
message
:
`转让群主成功,新群主ID:
${
this
.
newOwnerUserID
}
`
.
changeGroupOwner
({
groupID
:
this
.
groupProfile
.
groupID
,
newOwnerID
:
this
.
newOwnerUserID
})
this
.
newOwnerUserID
=
''
})
.
catch
(
error
=>
{
this
.
$store
.
commit
(
'showMessage'
,
{
type
:
'error'
,
message
:
error
.
message
.
then
(()
=>
{
this
.
showChangeGroupOwner
=
false
this
.
$store
.
commit
(
'showMessage'
,
{
message
:
`转让群主成功,新群主ID:
${
this
.
newOwnerUserID
}
`
})
this
.
newOwnerUserID
=
''
})
.
catch
(
error
=>
{
this
.
$store
.
commit
(
'showMessage'
,
{
type
:
'error'
,
message
:
error
.
message
})
})
})
},
quitGroup
()
{
this
.
tim
.
quitGroup
(
this
.
groupProfile
.
groupID
).
then
(({
data
:
{
groupID
}
})
=>
{
this
.
tim
.
quitGroup
(
this
.
groupProfile
.
groupID
).
then
(({
data
:
{
groupID
}
})
=>
{
this
.
$store
.
commit
(
'showMessage'
,
{
message
:
'退群成功'
})
...
...
@@ -479,15 +486,15 @@ export default {
this
.
$store
.
commit
(
'resetCurrentConversation'
)
}
})
.
catch
(
error
=>
{
this
.
$store
.
commit
(
'showMessage'
,
{
type
:
'error'
,
message
:
error
.
message
.
catch
(
error
=>
{
this
.
$store
.
commit
(
'showMessage'
,
{
type
:
'error'
,
message
:
error
.
message
})
})
})
},
dismissGroup
()
{
this
.
tim
.
dismissGroup
(
this
.
groupProfile
.
groupID
).
then
(({
data
:
{
groupID
}
})
=>
{
this
.
tim
.
dismissGroup
(
this
.
groupProfile
.
groupID
).
then
(({
data
:
{
groupID
}
})
=>
{
this
.
$store
.
commit
(
'showMessage'
,
{
message
:
`群:
${
this
.
groupProfile
.
name
||
this
.
groupProfile
.
groupID
}
解散成功!`
,
type
:
'success'
...
...
@@ -496,28 +503,28 @@ export default {
this
.
$store
.
commit
(
'resetCurrentConversation'
)
}
})
.
catch
(
error
=>
{
this
.
$store
.
commit
(
'showMessage'
,
{
type
:
'error'
,
message
:
error
.
message
.
catch
(
error
=>
{
this
.
$store
.
commit
(
'showMessage'
,
{
type
:
'error'
,
message
:
error
.
message
})
})
})
},
editMessageRemindType
()
{
this
.
tim
.
setMessageRemindType
({
groupID
:
this
.
groupProfile
.
groupID
,
messageRemindType
:
this
.
messageRemindType
})
.
then
(()
=>
{
this
.
showEditMessageRemindType
=
false
})
.
catch
(
error
=>
{
this
.
$store
.
commit
(
'showMessage'
,
{
type
:
'error'
,
message
:
error
.
message
.
setMessageRemindType
({
groupID
:
this
.
groupProfile
.
groupID
,
messageRemindType
:
this
.
messageRemindType
})
.
then
(()
=>
{
this
.
showEditMessageRemindType
=
false
})
.
catch
(
error
=>
{
this
.
$store
.
commit
(
'showMessage'
,
{
type
:
'error'
,
message
:
error
.
message
})
})
})
},
editNameCard
()
{
if
(
this
.
nameCard
.
trim
().
length
===
0
)
{
...
...
@@ -528,19 +535,19 @@ export default {
return
}
this
.
tim
.
setGroupMemberNameCard
({
groupID
:
this
.
groupProfile
.
groupID
,
nameCard
:
this
.
nameCard
.
trim
()
})
.
then
(()
=>
{
this
.
showEditNameCard
=
false
})
.
catch
(
error
=>
{
this
.
$store
.
commit
(
'showMessage'
,
{
type
:
'error'
,
message
:
error
.
message
.
setGroupMemberNameCard
({
groupID
:
this
.
groupProfile
.
groupID
,
nameCard
:
this
.
nameCard
.
trim
()
})
.
then
(()
=>
{
this
.
showEditNameCard
=
false
})
.
catch
(
error
=>
{
this
.
$store
.
commit
(
'showMessage'
,
{
type
:
'error'
,
message
:
error
.
message
})
})
})
}
}
}
...
...
@@ -549,10 +556,12 @@ export default {
<
style
lang=
"stylus"
>
.group-info-content
padding
10px
10px
.avatar
width
40px
height
40px
border-radius
50
%
.info-item
{
margin-bottom
:
12px
;
...
...
@@ -560,16 +569,19 @@ export default {
font-size
:
14px
;
color
:
$
secondary
;
}
.active
{
color
:
$
black
}
.content
{
color
:
$
background
;
word-wrap
:
break-word
;
word-break
:
break-all
;
}
.long-content
{
word-wrap
:
break-word
;
word-wrap
:
break-word
;
overflow
:
hidden
;
text-overflow
:
ellipsis
;
display
:
-webkit-box
;
...
...
@@ -577,9 +589,11 @@ export default {
-webkit-line-clamp
:
3
;
}
}
.cursor-pointer
{
cursor
:
pointer
;
}
/* 设置滚动条的样式 */
::-webkit-scrollbar
{
width
:
0px
;
...
...
src/components/friend/friend-item.vue
View file @
f96995a
...
...
@@ -34,16 +34,19 @@ export default {
</
script
>
<
style
lang=
"stylus"
scoped
>
.avatar
height
48px
width
48px
.friend-item-container
color
#f7f7f8
padding
10px
15px
:hover
background-color
#404953
cursor
pointer
.friend-list
padding
10px
15px
.friend-avatar
height
48px
width
48px
...
...
src/components/friend/friend-list.vue
View file @
f96995a
<
template
>
<div
class=
"list-container"
>
<div
class=
"header-bar"
>
<el-input
v-model=
"select"
size=
"mini"
placeholder=
"筛选昵称"
prefix-icon=
"el-icon-search"
/>
<el-input
v-model=
"search"
size=
"mini"
placeholder=
"筛选昵称"
@
keyup
.
enter
.
native=
"handleSearch"
>
</el-input>
<el-button
icon=
"el-icon-search"
size=
"mini"
circle
@
click=
"handleSearch"
title=
"搜索"
/>
</div>
<el-collapse
v-model=
"activeNames"
class=
"friend-list-container"
>
<el-collapse-item
title=
"用户组"
name=
"user"
>
<friend-item
v-for=
"friend in userList"
:key=
"friend.ems_id"
:friend=
"friend"
/>
<friend-item
v-for=
"friend in user.list"
:key=
"friend.ems_id"
:friend=
"friend"
/>
<el-button
:loading=
"user.loading"
v-show=
"user.list.length
< user
.
paginate
.
total
"
type=
"text"
style=
"width: 100%"
@
click=
"$store.dispatch('getFriendList',
{ type: 'user', page: user.paginate.page + 1, method:'append' })">
加载更多
</el-button>
</el-collapse-item>
<el-collapse-item
title=
"策划组"
name=
"scheme"
>
<friend-item
v-for=
"friend in schemeList"
:key=
"friend.ems_id"
:friend=
"friend"
/>
<friend-item
v-for=
"friend in scheme.list"
:key=
"friend.ems_id"
:friend=
"friend"
/>
<el-button
:loading=
"scheme.loading"
v-show=
"scheme.list.length
< scheme
.
paginate
.
total
"
type=
"text"
style=
"width: 100%"
@
click=
"$store.dispatch('getFriendList',
{ type: 'scheme', page: scheme.paginate.page + 1, method:'append' })">
加载更多
</el-button>
</el-collapse-item>
<el-collapse-item
title=
"管理组"
name=
"admin"
>
<friend-item
v-for=
"friend in adminList"
:key=
"friend.ems_id"
:friend=
"friend"
/>
<friend-item
v-for=
"friend in admin.list"
:key=
"friend.ems_id"
:friend=
"friend"
/>
<el-button
:loading=
"admin.loading"
v-show=
"admin.list.length
< admin
.
paginate
.
total
"
type=
"text"
style=
"width: 100%"
@
click=
"$store.dispatch('getFriendList',
{ type: 'admin', page: admin.paginate.page + 1, method:'append' })">
加载更多
</el-button>
</el-collapse-item>
</el-collapse>
</div>
...
...
@@ -27,28 +44,37 @@ export default {
FriendItem
,
},
computed
:
{
search
:
{
set
(
val
)
{
this
.
$store
.
commit
(
'updateFriendSearch'
,
val
)
},
get
()
{
return
this
.
$store
.
state
.
friend
.
search
}
},
...
mapState
({
adminList
(
state
)
{
const
list
=
state
.
friend
.
adminList
||
[]
return
this
.
select
.
length
===
0
?
list
:
list
.
filter
(
item
=>
item
.
name
.
indexOf
(
this
.
select
)
>
-
1
)
user
(
state
)
{
return
state
.
friend
.
user
},
userList
(
state
)
{
const
list
=
state
.
friend
.
userList
||
[]
return
this
.
select
.
length
===
0
?
list
:
list
.
filter
(
item
=>
item
.
name
.
indexOf
(
this
.
select
)
>
-
1
)
scheme
(
state
)
{
return
state
.
friend
.
scheme
},
admin
(
state
)
{
return
state
.
friend
.
admin
},
schemeList
(
state
)
{
const
list
=
state
.
friend
.
schemeList
||
[]
return
this
.
select
.
length
===
0
?
list
:
list
.
filter
(
item
=>
item
.
name
.
indexOf
(
this
.
select
)
>
-
1
)
}
}),
},
data
()
{
return
{
activeNames
:
[],
select
:
''
}
},
methods
:
{}
methods
:
{
handleSearch
()
{
this
.
$store
.
dispatch
(
'getAllFriendList'
,
{
page
:
1
,
size
:
20
})
// this.activeNames = ['user', 'scheme', 'admin']
}
},
}
</
script
>
...
...
@@ -89,6 +115,11 @@ export default {
border-bottom
1px
solid
$
background-deep-dark
padding
10px
10px
10px
20px
>>>
.el-button
color
$
first
border
none
background-color
$
deep-background
!
important
>>>
.el-input
width
100
%
margin-right
10px
...
...
src/components/layout/side-bar.vue
View file @
f96995a
...
...
@@ -114,6 +114,7 @@ export default {
break
case
activeName
.
FRIEND_LIST
:
this
.
checkoutActive
(
activeName
.
FRIEND_LIST
)
this
.
getFriendList
()
break
case
activeName
.
BLACK_LIST
:
this
.
checkoutActive
(
activeName
.
BLACK_LIST
)
...
...
@@ -148,7 +149,8 @@ export default {
.
catch
(
error
=>
this
.
$store
.
commit
(
'showMessage'
,
{
type
:
'error'
,
message
:
error
.
message
}))
},
getFriendList
()
{
Helper
.
contactList
().
then
(
res
=>
this
.
$store
.
commit
(
'updateFriendList'
,
res
.
data
))
this
.
$store
.
commit
(
'updateFriendSearch'
,
''
)
this
.
$store
.
dispatch
(
'getAllFriendList'
,
{
page
:
1
,
size
:
20
})
// this.tim
// .getFriendList()
// .then(({data: friendList}) => {
...
...
src/index.vue
View file @
f96995a
...
...
@@ -142,9 +142,12 @@ export default {
.
then
(({
data
})
=>
this
.
$store
.
commit
(
'updateCurrentUserProfile'
,
data
))
.
catch
(
error
=>
this
.
$store
.
commit
(
'showMessage'
,
{
type
:
'error'
,
message
:
error
.
message
}))
this
.
$store
.
dispatch
(
'getBlacklist'
)
Helper
.
contactList
({
type
:
'admin'
}).
then
(
res
=>
this
.
$store
.
commit
(
'updateAdminList'
,
res
.
data
))
Helper
.
contactList
({
type
:
'scheme'
}).
then
(
res
=>
this
.
$store
.
commit
(
'updateSchemeList'
,
res
.
data
))
Helper
.
contactList
({
type
:
'user'
}).
then
(
res
=>
this
.
$store
.
commit
(
'updateUserList'
,
res
.
data
))
// Helper.contactList({type: 'admin'}).then(res => this.$store.commit('updateAdminList', res.data))
// Helper.contactList({
// type: 'scheme',
// method: 'forPaginate'
// }).then(res => this.$store.commit('updateSchemeList', res.data))
// Helper.contactList({type: 'user'}).then(res => this.$store.commit('updateUserList', res.data))
// 登录trtc calling
// this.trtcCalling.login({sdkAppID: this.sdkAppID, userID: this.userID, userSig: this.userSig})
}
...
...
src/store/modules/friend.js
View file @
f96995a
import
_
from
'loadsh'
import
Helper
from
'../../utils/helper'
const
friendModules
=
{
state
:
{
friendList
:
[],
adminList
:
[],
schemeList
:
[],
userList
:
[],
search
:
''
,
user
:
{
loading
:
false
,
list
:
[],
paginate
:
{
page
:
1
,
size
:
20
,
total
:
0
}
},
admin
:
{
loading
:
false
,
list
:
[],
paginate
:
{
page
:
1
,
size
:
20
,
total
:
0
}
},
scheme
:
{
loading
:
false
,
list
:
[],
paginate
:
{
page
:
1
,
size
:
20
,
total
:
0
}
},
createGroupModelVisible
:
false
,
},
getters
:
{},
...
...
@@ -11,18 +33,65 @@ const friendModules = {
updateFriendList
(
state
,
friendList
)
{
state
.
friendList
=
friendList
},
updateAdminList
(
state
,
friendList
)
{
state
.
adminList
=
friendList
updateFriendSearch
(
state
,
search
)
{
state
.
search
=
search
},
updateLoading
(
state
,
{
type
,
loading
})
{
state
[
type
].
loading
=
loading
},
updateSchemeList
(
state
,
friendList
)
{
state
.
schemeList
=
friendList
updateList
(
state
,
{
type
,
resource
})
{
state
[
type
].
list
=
resource
.
data
state
[
type
].
paginate
=
resource
.
meta
},
updateUserList
(
state
,
friendList
)
{
state
.
userList
=
friendList
appendList
(
state
,
{
type
,
resource
})
{
state
[
type
].
list
=
state
[
type
].
list
.
concat
(
resource
.
data
)
state
[
type
].
paginate
=
resource
.
meta
},
reset
(
state
)
{
Object
.
assign
(
state
,
{
friendList
:
[],
createGroupModelVisible
:
false
})
Object
.
assign
(
state
,
{
friendList
:
[],
search
:
''
,
user
:
{
loading
:
false
,
list
:
[],
paginate
:
{
page
:
1
,
size
:
20
,
total
:
0
}
},
admin
:
{
loading
:
false
,
list
:
[],
paginate
:
{
page
:
1
,
size
:
20
,
total
:
0
}
},
scheme
:
{
loading
:
false
,
list
:
[],
paginate
:
{
page
:
1
,
size
:
20
,
total
:
0
}
},
createGroupModelVisible
:
false
,
})
}
},
actions
:
{
getAllFriendList
({
dispatch
},
payload
)
{
dispatch
(
'getFriendList'
,
{
type
:
'user'
,
...
payload
})
dispatch
(
'getFriendList'
,
{
type
:
'scheme'
,
...
payload
})
dispatch
(
'getFriendList'
,
{
type
:
'admin'
,
...
payload
})
},
getFriendList
({
state
,
commit
},
payload
)
{
const
type
=
_
.
get
(
payload
,
'type'
,
''
)
const
page
=
_
.
get
(
payload
,
'page'
,
_
.
get
(
state
,
`
${
type
}
.paginate.page`
,
1
))
const
size
=
_
.
get
(
payload
,
'size'
,
_
.
get
(
state
,
`
${
type
}
.paginate.size`
,
20
))
const
search
=
state
.
search
const
method
=
_
.
get
(
payload
,
'method'
,
'update'
)
commit
(
'updateLoading'
,
{
type
,
loading
:
true
})
Helper
.
contactList
({
method
:
'forPaginate'
,
search
,
type
,
page
,
size
}).
then
(
resource
=>
commit
(
method
+
'List'
,
{
type
,
resource
})).
finally
(()
=>
commit
(
'updateLoading'
,
{
type
,
loading
:
false
}))
},
}
}
...
...
Please
register
or
sign in
to post a comment