-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
178 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
<template> | ||
<div> | ||
<el-table | ||
:data="friendsList" | ||
style="width: 100%"> | ||
<el-table-column | ||
label="昵称" | ||
width="580"> | ||
<template slot-scope="scope"> | ||
<span style="margin-left: 10px">{{ scope.row.chatName }}</span> | ||
</template> | ||
</el-table-column> | ||
<el-table-column label="操作"> | ||
<template slot-scope="scope"> | ||
<el-button | ||
size="mini" | ||
type="danger" | ||
@click="handleAccept(scope.$index, scope.row)">邀请</el-button> | ||
</template> | ||
</el-table-column> | ||
</el-table> | ||
<div class = "footer"> | ||
<el-button @click="close()">取 消</el-button> | ||
<el-button type="primary" @click="creatGroup()">创建群聊</el-button> | ||
</div> | ||
|
||
</div> | ||
|
||
</template> | ||
|
||
<script> | ||
import {loadUserFriendsPage,createGroup} from '../api/commonApi' | ||
export default { | ||
name: "GroupFriendsList", | ||
props:['socket'], | ||
data() { | ||
return { | ||
friendsList: [], | ||
userInfo:JSON.parse(window.sessionStorage.getItem("userInfo")), | ||
invitedUserIds:[], | ||
} | ||
}, | ||
created() { | ||
this.loadFriends() | ||
}, | ||
mounted() { | ||
}, | ||
methods: { | ||
creatGroup(){ | ||
const that = this; | ||
that.invitedUserIds.push(that.userInfo.userId) | ||
let createGroupParams = {userId:that.userInfo.userId,invitedUserIds:that.invitedUserIds} | ||
createGroup(createGroupParams).then(res=>{ | ||
if(res.code===200){ | ||
that.$message.info("群聊创建成功") | ||
this.$emit('friendsDialogHide'); | ||
}else { | ||
that.$message.error(res.message) | ||
} | ||
}) | ||
}, | ||
handleAccept(index, row) { | ||
const that = this; | ||
that.invitedUserIds.push(row.userId) | ||
}, | ||
close(){ | ||
this.$emit('friendsDialogHide'); | ||
}, | ||
loadFriends(){ | ||
const that = this; | ||
loadUserFriendsPage({userId:that.userInfo.userId}).then(res=>{ | ||
if(res.code === 200){ | ||
that.friendsList = res.data; | ||
} | ||
}) | ||
} | ||
}, | ||
watch:{ | ||
}, | ||
} | ||
</script> | ||
|
||
<style scoped> | ||
.footer{ | ||
margin-top: 20px; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters