会话群代码调整
This commit is contained in:
parent
6d848115b3
commit
79fbb8d071
@ -66,7 +66,7 @@
|
||||
<div v-else-if="tabActive==2">工作台</div>
|
||||
<div v-else-if="tabActive==3">通讯录</div>
|
||||
</div>
|
||||
<EditGroup ref="editGroup" @createGroup="getGroupList" />
|
||||
<EditGroup ref="editGroup" />
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
@ -162,6 +162,12 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
'$store.state.socket.conversationGroup.JOIN': function(val) {
|
||||
if (val.messageTips) {
|
||||
this.$message.success(`${val.messageTips}`);
|
||||
}
|
||||
this.getGroupList();
|
||||
},
|
||||
myMemberId() {
|
||||
this.getGroupList();
|
||||
}
|
||||
@ -229,7 +235,7 @@ export default {
|
||||
getGroupList(this.groupId).then(res => {
|
||||
console.log(res, '---res--');
|
||||
this.groupList = res.data;
|
||||
if (this.groupList && this.groupList[0]) {
|
||||
if (this.groupList && this.groupList[0] && !this.id) {
|
||||
this.id = this.groupList[0].id;
|
||||
}
|
||||
}).catch(err => {
|
||||
@ -272,6 +278,7 @@ export default {
|
||||
|
||||
<style lang='scss' scoped>
|
||||
.chatDialog {
|
||||
overflow: hidden;
|
||||
.pointer {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
@ -47,10 +47,10 @@
|
||||
</div>
|
||||
<el-divider />
|
||||
<el-form ref="form" :model="form" label-width="80px">
|
||||
<el-form-item label="群名称:">
|
||||
<el-form-item label="群名称:" prop="name">
|
||||
<el-input v-model="form.name" />
|
||||
</el-form-item>
|
||||
<el-form-item label="群头像:">
|
||||
<el-form-item label="群头像:" prop="imageUrl">
|
||||
<div class="uploadImgDiv">
|
||||
<img v-if="form.imageUrl" :src="getImgUrl(form.imageUrl)" :alt="getImgUrl(form.imageUrl)">
|
||||
<i class="el-icon-plus" />
|
||||
@ -159,18 +159,11 @@ export default {
|
||||
memberData() {
|
||||
return this.$store.state.training.memberData;
|
||||
},
|
||||
userId() {
|
||||
return this.$store.state.user.id;
|
||||
myMemberId() {
|
||||
return this.$store.state.training.myMemberId;
|
||||
},
|
||||
defaultCheckedKeys() {
|
||||
const list = [];
|
||||
const find = this.memberList.find(item => {
|
||||
return item.userId == this.userId;
|
||||
});
|
||||
if (find) {
|
||||
list.push(find.id);
|
||||
}
|
||||
return list;
|
||||
return [this.myMemberId];
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@ -185,10 +178,7 @@ export default {
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.defaultCheckedKeys.forEach(id => {
|
||||
const node = this.memberData[id];
|
||||
node && this.selectTreeNode.push(node);
|
||||
});
|
||||
this.initData();
|
||||
},
|
||||
created() {
|
||||
this.getTreeData();
|
||||
@ -442,15 +432,21 @@ export default {
|
||||
};
|
||||
createGroup(this.groupId, params).then(res => {
|
||||
console.log(res, 'res');
|
||||
this.$refs.form.resetFields();
|
||||
this.initData();
|
||||
this.handleClose();
|
||||
this.$emit('createGroup');
|
||||
this.$message.success('创建会话群成功!');
|
||||
}).catch(err => {
|
||||
console.log(err, 'err');
|
||||
this.$message.error(`创建会话群失败!${err.message}`);
|
||||
});
|
||||
},
|
||||
initData() {
|
||||
this.$refs.form && this.$refs.form.resetFields();
|
||||
this.selectTreeNode = [];
|
||||
const node = this.memberData[this.myMemberId];
|
||||
node && this.selectTreeNode.push(node);
|
||||
this.$refs.tree && this.$refs.tree.setCheckedKeys([this.myMemberId]);
|
||||
},
|
||||
uploadLogo() {
|
||||
const pic = document.getElementById('upload_file_group');
|
||||
if (!pic.files || !pic.files[0]) {
|
||||
@ -526,6 +522,7 @@ export default {
|
||||
$imgWidth: 70px;
|
||||
$imgHeight: 70px;
|
||||
.editGroup {
|
||||
overflow: hidden;
|
||||
.body {
|
||||
height: 600px;
|
||||
.left,.right {
|
||||
|
Loading…
Reference in New Issue
Block a user