会话群代码调整

This commit is contained in:
dong 2023-04-24 18:27:36 +08:00
parent 6d848115b3
commit 79fbb8d071
2 changed files with 24 additions and 20 deletions

View File

@ -66,7 +66,7 @@
<div v-else-if="tabActive==2">工作台</div> <div v-else-if="tabActive==2">工作台</div>
<div v-else-if="tabActive==3">通讯录</div> <div v-else-if="tabActive==3">通讯录</div>
</div> </div>
<EditGroup ref="editGroup" @createGroup="getGroupList" /> <EditGroup ref="editGroup" />
</el-dialog> </el-dialog>
</template> </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() { myMemberId() {
this.getGroupList(); this.getGroupList();
} }
@ -229,7 +235,7 @@ export default {
getGroupList(this.groupId).then(res => { getGroupList(this.groupId).then(res => {
console.log(res, '---res--'); console.log(res, '---res--');
this.groupList = res.data; this.groupList = res.data;
if (this.groupList && this.groupList[0]) { if (this.groupList && this.groupList[0] && !this.id) {
this.id = this.groupList[0].id; this.id = this.groupList[0].id;
} }
}).catch(err => { }).catch(err => {
@ -272,6 +278,7 @@ export default {
<style lang='scss' scoped> <style lang='scss' scoped>
.chatDialog { .chatDialog {
overflow: hidden;
.pointer { .pointer {
cursor: pointer; cursor: pointer;
} }

View File

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