|
@@ -13,12 +13,7 @@
|
|
|
<el-col class="time" v-if="item.time != ''">{{ item.time }}</el-col>
|
|
|
<el-col :span="24" class="content">
|
|
|
<el-col :span="2" class="logo">
|
|
|
- <el-image
|
|
|
- v-if="user && user.logo.length != 0"
|
|
|
- :src="user.logo[0].url || '../../assets/bglogin.jpg'"
|
|
|
- style="width: 60px; height: 60px; border-radius: 60px"
|
|
|
- mode="widthFix"
|
|
|
- ></el-image>
|
|
|
+ <el-image v-if="user" :src="bglogin" style="width: 60px; height: 60px; border-radius: 60px" mode="widthFix"></el-image>
|
|
|
</el-col>
|
|
|
<el-col :span="8" v-if="item.msg_type == '0'">
|
|
|
<text class="text">{{ item.content }}</text>
|
|
@@ -72,6 +67,7 @@ import { onMounted, ref, getCurrentInstance } from 'vue';
|
|
|
import { useRoute } from 'vue-router';
|
|
|
import store from '@/stores/counter';
|
|
|
import { ElMessage } from 'element-plus';
|
|
|
+import bglogin from '@/assets/bglogin.jpg';
|
|
|
// 接口
|
|
|
import { ChatStore } from '@/stores/users/chat';
|
|
|
import { ConfigStore } from '@/stores/system/config';
|
|
@@ -105,8 +101,8 @@ onMounted(async () => {
|
|
|
loading.value = false;
|
|
|
});
|
|
|
const search = async (e: { skip: number; limit: number }) => {
|
|
|
- if (user.value._id) {
|
|
|
- const info = { skip: e.skip, limit: e.limit, user: user.value._id };
|
|
|
+ if (route.query.id) {
|
|
|
+ const info = { skip: e.skip, limit: e.limit, user: route.query.id };
|
|
|
const res: any = await chatAxios.query(info);
|
|
|
if (res.errcode == '0') {
|
|
|
list.value = res.data.reverse();
|
|
@@ -132,7 +128,14 @@ const searchOther = async () => {
|
|
|
// 发送
|
|
|
const toSend = async () => {
|
|
|
let res: IQueryResult;
|
|
|
- let form: any = { user: user.value._id, speaker: admin.value._id, content: input.value, msg_type: '0', time: moment().format('YYYY-MM-DD HH:mm:ss') };
|
|
|
+ let form: any = {
|
|
|
+ user: user.value._id,
|
|
|
+ admin: admin.value._id,
|
|
|
+ speaker: admin.value._id,
|
|
|
+ content: input.value,
|
|
|
+ msg_type: '0',
|
|
|
+ time: moment().format('YYYY-MM-DD HH:mm:ss')
|
|
|
+ };
|
|
|
// 发送给服务器消息
|
|
|
res = await chatAxios.create(form);
|
|
|
if (res.errcode == 0) {
|