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==2">工作台</div>
<div v-else-if="tabActive==3">通讯录</div> <div v-else-if="tabActive==3">通讯录</div>
</div> </div>
<EditGroup ref="editGroup" /> <EditGroup ref="editGroup" @createGroup="getGroupList" />
</el-dialog> </el-dialog>
</template> </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() { myMemberId() {
this.getGroupList(); this.getGroupList();
} }
@ -272,7 +266,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] && !this.id) { if (this.groupList && this.groupList[0]) {
this.id = this.groupList[0].id; this.id = this.groupList[0].id;
} }
}).catch(err => { }).catch(err => {
@ -315,7 +309,6 @@ 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="群名称:" prop="name"> <el-form-item label="群名称:">
<el-input v-model="form.name" /> <el-input v-model="form.name" />
</el-form-item> </el-form-item>
<el-form-item label="群头像:" prop="imageUrl"> <el-form-item label="群头像:">
<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,11 +159,18 @@ export default {
memberData() { memberData() {
return this.$store.state.training.memberData; return this.$store.state.training.memberData;
}, },
myMemberId() { userId() {
return this.$store.state.training.myMemberId; return this.$store.state.user.id;
}, },
defaultCheckedKeys() { 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: { watch: {
@ -178,7 +185,10 @@ export default {
} }
}, },
mounted() { mounted() {
this.initData(); this.defaultCheckedKeys.forEach(id => {
const node = this.memberData[id];
node && this.selectTreeNode.push(node);
});
}, },
created() { created() {
this.getTreeData(); this.getTreeData();
@ -432,21 +442,15 @@ export default {
}; };
createGroup(this.groupId, params).then(res => { createGroup(this.groupId, params).then(res => {
console.log(res, 'res'); console.log(res, 'res');
this.initData(); this.$refs.form.resetFields();
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]) {
@ -522,7 +526,6 @@ export default {
$imgWidth: 70px; $imgWidth: 70px;
$imgHeight: 70px; $imgHeight: 70px;
.editGroup { .editGroup {
overflow: hidden;
.body { .body {
height: 600px; height: 600px;
.left,.right { .left,.right {