zs пре 1 година
родитељ
комит
a49e945a00
3 измењених фајлова са 80 додато и 2 уклоњено
  1. 5 0
      src/router/index.ts
  2. 65 0
      src/views/user/user/chat.vue
  3. 10 2
      src/views/user/user/index.vue

+ 5 - 0
src/router/index.ts

@@ -75,6 +75,11 @@ const router = createRouter({
           meta: { title: '普通用户' },
           meta: { title: '普通用户' },
           component: () => import('@/views/user/user/index.vue')
           component: () => import('@/views/user/user/index.vue')
         },
         },
+        {
+          path: '/user/chat',
+          meta: { title: '聊天记录' },
+          component: () => import('@/views/user/user/chat.vue')
+        },
         {
         {
           path: '/user/admin',
           path: '/user/admin',
           meta: { title: '区域管理员' },
           meta: { title: '区域管理员' },

+ 65 - 0
src/views/user/user/chat.vue

@@ -0,0 +1,65 @@
+<template>
+  <div id="detail">
+    <el-row>
+      <el-col :span="24" class="main animate__animated animate__backInRight" v-loading="loading">
+        <el-col :span="24" class="one">
+          <cSearch :is_back="true" @toBack="toBack"></cSearch>
+        </el-col>
+        <el-col :span="24" class="two"> 聊天记录{{ list }} </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+<script setup lang="ts">
+// 基础
+import type { Ref } from 'vue';
+import { onMounted, ref, getCurrentInstance } from 'vue';
+import { useRoute } from 'vue-router';
+// 接口
+import { ProblemStore } from '@/stores/customer/problem';
+import { UserStore } from '@/stores/users/user';
+import type { IQueryResult } from '@/util/types.util';
+const { proxy } = getCurrentInstance() as any;
+const problemAxios = ProblemStore();
+const userAxios = UserStore();
+// 路由
+const route = useRoute();
+// 加载中
+const loading: Ref<any> = ref(false);
+let list: Ref<any> = ref([]);
+let total: Ref<number> = ref(0);
+let skip = 0;
+let limit: number = proxy.$limit;
+const user: Ref<any> = ref({ logo: [] });
+// 字典表
+// 请求
+onMounted(async () => {
+  loading.value = true;
+  await searchOther();
+  await search({ skip, limit });
+  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 };
+    const res: IQueryResult = await problemAxios.query(info);
+    if (res.errcode == '0') {
+      list.value = res.data;
+      total.value = res.total;
+    }
+  }
+};
+// 查询其他信息
+const searchOther = async () => {
+  let id = route.query.id;
+  if (id) {
+    let res: IQueryResult = await userAxios.fetch(id);
+    if (res.errcode == '0') user.value = res.data;
+  }
+};
+// 返回上一页
+const toBack = () => {
+  window.history.go(-1);
+};
+</script>
+<style scoped lang="scss"></style>

+ 10 - 2
src/views/user/user/index.vue

@@ -6,7 +6,7 @@
           <cSearch :is_title="false" :is_search="true" :fields="fields" @search="toSearch"> </cSearch>
           <cSearch :is_title="false" :is_search="true" :fields="fields" @search="toSearch"> </cSearch>
         </el-col>
         </el-col>
         <el-col :span="24" class="two">
         <el-col :span="24" class="two">
-          <cTable :fields="fields" :opera="opera" :list="list" @query="search" :total="total" @edit="toEdit" @del="toDel"> </cTable>
+          <cTable :fields="fields" :opera="opera" :list="list" @query="search" :total="total" @chat="toChat" @edit="toEdit" @del="toDel"> </cTable>
         </el-col>
         </el-col>
       </el-col>
       </el-col>
     </el-row>
     </el-row>
@@ -32,6 +32,7 @@
 import type { Ref } from 'vue';
 import type { Ref } from 'vue';
 import { onMounted, ref, getCurrentInstance } from 'vue';
 import { onMounted, ref, getCurrentInstance } from 'vue';
 import { ElMessage } from 'element-plus';
 import { ElMessage } from 'element-plus';
+import { useRouter } from 'vue-router';
 // 接口
 // 接口
 import { UserStore } from '@/stores/users/user';
 import { UserStore } from '@/stores/users/user';
 import { DictDataStore } from '@/stores/basic/dictData'; // 字典表
 import { DictDataStore } from '@/stores/basic/dictData'; // 字典表
@@ -39,6 +40,8 @@ import type { IQueryResult } from '@/util/types.util';
 const userAxios = UserStore();
 const userAxios = UserStore();
 const dictAxios = DictDataStore();
 const dictAxios = DictDataStore();
 const { proxy } = getCurrentInstance() as any;
 const { proxy } = getCurrentInstance() as any;
+// 路由
+const router = useRouter();
 // 加载中
 // 加载中
 const loading: Ref<any> = ref(false);
 const loading: Ref<any> = ref(false);
 let list: Ref<any> = ref([]);
 let list: Ref<any> = ref([]);
@@ -57,7 +60,8 @@ let fields: Ref<any[]> = ref([
 // 操作
 // 操作
 let opera: Ref<any[]> = ref([
 let opera: Ref<any[]> = ref([
   { label: '修改', method: 'edit' },
   { label: '修改', method: 'edit' },
-  { label: '删除', method: 'del', confirm: true, type: 'danger' }
+  { label: '删除', method: 'del', confirm: true, type: 'danger' },
+  { label: '聊天记录', method: 'chat' }
 ]);
 ]);
 // 查询数据
 // 查询数据
 let searchForm: Ref<any> = ref({});
 let searchForm: Ref<any> = ref({});
@@ -119,6 +123,10 @@ const toEdit = async (data: any) => {
     dialog.value = { title: '信息管理', show: true, type: '1' };
     dialog.value = { title: '信息管理', show: true, type: '1' };
   }
   }
 };
 };
+// 聊天记录
+const toChat = async (data: any) => {
+  router.push({ path: '/user/chat', query: { id: data._id } });
+};
 // 删除
 // 删除
 const toDel = async (data: any) => {
 const toDel = async (data: any) => {
   let res: IQueryResult = await userAxios.del(data._id);
   let res: IQueryResult = await userAxios.del(data._id);