Revert "会话群代码调整"

This reverts commit 79fbb8d071.
This commit is contained in:
fan 2023-05-06 10:53:15 +08:00
parent a7b0609389
commit c4028ee8c6
2 changed files with 20 additions and 24 deletions

View File

@ -66,7 +66,7 @@
<div v-else-if="tabActive==2">工作台</div>
<div v-else-if="tabActive==3">通讯录</div>
</div>
<EditGroup ref="editGroup" />
<EditGroup ref="editGroup" @createGroup="getGroupList" />
</el-dialog>
</template>
@ -162,12 +162,6 @@ export default {
}
}
},
'$store.state.socket.conversationGroup.JOIN': function(val) {
if (val.messageTips) {
this.$message.success(`${val.messageTips}`);
}
this.getGroupList();
},
myMemberId() {
this.getGroupList();
}
@ -272,7 +266,7 @@ export default {
getGroupList(this.groupId).then(res => {
console.log(res, '---res--');
this.groupList = res.data;
if (this.groupList && this.groupList[0] && !this.id) {
if (this.groupList && this.groupList[0]) {
this.id = this.groupList[0].id;
}
}).catch(err => {
@ -315,7 +309,6 @@ export default {
<style lang='scss' scoped>
.chatDialog {
overflow: hidden;
.pointer {
cursor: pointer;
}

View File

@ -47,10 +47,10 @@
</div>
<el-divider />
<el-form ref="form" :model="form" label-width="80px">
<el-form-item label="群名称:" prop="name">
<el-form-item label="群名称:">
<el-input v-model="form.name" />
</el-form-item>
<el-form-item label="群头像:" prop="imageUrl">
<el-form-item label="群头像:">
<div class="uploadImgDiv">
<img v-if="form.imageUrl" :src="getImgUrl(form.imageUrl)" :alt="getImgUrl(form.imageUrl)">
<i class="el-icon-plus" />
@ -159,11 +159,18 @@ export default {
memberData() {
return this.$store.state.training.memberData;
},
myMemberId() {
return this.$store.state.training.myMemberId;
userId() {
return this.$store.state.user.id;
},
defaultCheckedKeys() {
return [this.myMemberId];
const list = [];
const find = this.memberList.find(item => {
return item.userId == this.userId;
});
if (find) {
list.push(find.id);
}
return list;
}
},
watch: {
@ -178,7 +185,10 @@ export default {
}
},
mounted() {
this.initData();
this.defaultCheckedKeys.forEach(id => {
const node = this.memberData[id];
node && this.selectTreeNode.push(node);
});
},
created() {
this.getTreeData();
@ -432,21 +442,15 @@ export default {
};
createGroup(this.groupId, params).then(res => {
console.log(res, 'res');
this.initData();
this.$refs.form.resetFields();
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]) {
@ -522,7 +526,6 @@ export default {
$imgWidth: 70px;
$imgHeight: 70px;
.editGroup {
overflow: hidden;
.body {
height: 600px;
.left,.right {