Bläddra i källkod

feat: 水务报警

sunxiao 10 månader sedan
förälder
incheckning
c1bb5453ce

+ 9 - 79
src/App.vue

@@ -20,14 +20,14 @@ const themeOverrides: GlobalThemeOverrides = {
 
   },
   Menu: {
-    itemTextColor: primaryColor,
-    itemTextColorActive: primaryColor,
-    itemTextColorActiveHover: primaryColor,
-    itemTextColorChildActiveHover: primaryColor,
-    itemTextColorChildActive: primaryColor,
-    itemColorActive: '#FCFDFE',
-    itemColorActiveHover: '#FCFDFE',
-    arrowColorChildActive: primaryColor
+    // itemTextColor: primaryColor,
+    // itemTextColorActive: primaryColor,
+    // itemTextColorActiveHover: primaryColor,
+    // itemTextColorChildActiveHover: primaryColor,
+    // itemTextColorChildActive: primaryColor,
+    // itemColorActive: '#FCFDFE',
+    // itemColorActiveHover: '#FCFDFE',
+    // arrowColorChildActive: primaryColor
   },
   Scrollbar: {
     width: '0px',
@@ -101,74 +101,4 @@ const themeOverrides: GlobalThemeOverrides = {
       <RouterView />
     </NMessageProvider>
   </NConfigProvider>
-</template>
-
-<style scoped lang="scss">
-header {
-  @include flex(x, center, cetner);
-  background: $el-bg-color;
-  line-height: 1.5;
-  max-height: 100vh;
-
-  img {
-    width: 200px;
-  }
-}
-
-.logo {
-  display: block;
-  margin: 0 auto 2rem;
-}
-
-nav {
-  width: 100%;
-  font-size: 12px;
-  text-align: center;
-  margin-top: 2rem;
-}
-
-nav a.router-link-exact-active {
-  color: var(--color-text);
-}
-
-nav a.router-link-exact-active:hover {
-  background-color: transparent;
-}
-
-nav a {
-  display: inline-block;
-  padding: 0 1rem;
-  border-left: 1px solid var(--color-border);
-}
-
-nav a:first-of-type {
-  border: 0;
-}
-
-@media (min-width: 1024px) {
-  header {
-    display: flex;
-    place-items: center;
-    padding-right: calc(var(--section-gap) / 2);
-  }
-
-  .logo {
-    margin: 0 2rem 0 0;
-  }
-
-  header .wrapper {
-    display: flex;
-    place-items: flex-start;
-    flex-wrap: wrap;
-  }
-
-  nav {
-    text-align: left;
-    margin-left: -1rem;
-    font-size: 1rem;
-
-    padding: 1rem 0;
-    margin-top: 1rem;
-  }
-}
-</style>
+</template>

+ 3 - 0
src/api/chat.js

@@ -2,6 +2,9 @@ import http from "@/utils/request";
 
 
 export const chatApi = {
+
+  getRecordFetch: ({ path, params }) => http.get(path, { params }),
+
   /**
    * 问答历史记录
    * module

+ 0 - 10
src/api/login.js

@@ -1,10 +0,0 @@
-import http from "@/utils/request";
-
-export const loginApi = {
-  /**
-   * 用户登录
-   */
-  postLogin: data => http.post('/login', data),
-}
-
-

+ 18 - 0
src/api/user.js

@@ -0,0 +1,18 @@
+import http from "@/utils/request";
+
+export const userApi = {
+  /**
+   * 用户登录
+   */
+  postLogin: data => http.post('/login', data),
+
+  /**
+   * 登录信息
+   */
+  getUserInfo: () => http.get('/getInfo'),
+
+  /**
+   * 退出登录
+   */
+  postLogout: () => http.post('/logout'),
+}

+ 27 - 0
src/api/water.js

@@ -0,0 +1,27 @@
+import http from "@/utils/request";
+
+export const waterApi = {
+
+  // 取报警统计信息
+  getWarningCount: params => http.get('/front/bigModel/warningCount', { params }),
+
+  /**
+   * 预警记录列表
+  */
+  getWaringList: params => http.get('/front/bigModel/warning/pageList', params),
+  
+    
+  // getAnswerHistoryList: params => http.get('/front/bigModel/qa/pageList', { params }),
+
+  // getAnswerHistoryDetail: params => http.get('/front/bigModel/qa/qaListBySessionId', { params }),
+
+  // getChatStream: ({ data, onDownloadProgress, signal }) => http.post('/grpc/inferStreamRag', data, { onDownloadProgress, signal }),
+
+  // getChatSessionTag: params =>http.get('/front/bigModel/chat/generateSessionId', { params }),
+
+  // getWelcomeRecommend: params => http.get('/front/bigModel/home/recommendQAList/' + params),
+
+  // deleteHistory: params => http.delete('/front/bigModel/chat/deleteOneChtById/' + params),
+
+  // putIsSatisfiedAnswer: data => http.put(`/front/bigModel/chat/isSatisfiedAnswer`, data),
+}

+ 5 - 0
src/components/Chat/ChatAsk.vue

@@ -5,6 +5,10 @@ defineProps({
   content: {
     type: String,
     default: ''
+  },
+  sessionId: {
+    type: String,
+    default: ''
   }
 })
 
@@ -16,5 +20,6 @@ defineProps({
       <SvgIcon name="chat-avatar" size="20" />
     </div>
     <p class="flex-1 pt-[6px] ml-[16px] text-[15px] font-bold leading-[24px]" v-html="content"></p>
+    {{ sessionId }}
   </div>
 </template>

+ 71 - 9
src/components/Layout/TheChatView.vue

@@ -1,13 +1,33 @@
 <script setup>
-import { ref, unref,computed } from 'vue';
-import { NSelect } from 'naive-ui';
-import SvgIcon from '@/components/SvgIcon';
-import BasePopover from "@/components/BasePopover";
+import { ref, unref, computed, onMounted } from 'vue';
+import { NSelect, NDropdown, NPopover } from 'naive-ui';
+import { SvgIcon, BasePopover } from '@/components';
+import { userApi } from '@/api/user';
+
+import TheUserAvatar from './TheUserAvatar.vue';
+
+
+const userInfo = ref({});
 
 const targetScrollDom = ref(null);
 const selectValue = ref('water');
 const voiceSwitchStatus = ref(false);
 
+const userMenuOptions = [
+  {
+    label: '个人中心',
+    key: "1"
+  },
+  {
+    label: '修改密码',
+    key: "2"
+  },
+  {
+    label: '退出登录',
+    key: "3"
+  },
+]
+
 const options = [
   {
     label: "信义污水厂",
@@ -21,6 +41,29 @@ const changeVoiceStatus = () => {
   voiceSwitchStatus.value = !voiceSwitchStatus.value;
 }
 
+const handleUserMenuOptions = (key) => {
+  // switch (key) {
+  //   case 'copyText':
+  //     copyText({ text: props.text ?? '' })
+  //     return
+  //   case 'toggleRenderType':
+  //     asRawText.value = !asRawText.value
+  //     return
+  //   case 'delete':
+  //     emit('delete')
+  // }
+}
+
+onMounted(async () => {
+  try {
+    const { user } = await userApi.getUserInfo()
+    userInfo.value = user;
+  }
+  catch (error) {
+    console.log("err", error);
+  }
+})
+
 defineExpose({ targetScrollDom });
 </script>
 
@@ -42,10 +85,29 @@ defineExpose({ targetScrollDom });
         <NSelect v-model:value="selectValue" placeholder="" :options="options" class="w-[114px]" size="medium"
           :consistent-menu-width="false" />
         <!-- 用户头像 -->
-        <div class="flex items-center">
-          <img src="@/assets/images/chat/img-user-avatar.png" alt="" class="w-[32px] mr-[10px] cursor-pointer">
-          <span class="text-[#272D35] text-[12px]">我的昵称</span>
-        </div>
+        <TheUserAvatar></TheUserAvatar>
+        <!-- <NPopover trigger="click" raw :show-arrow="false" style="box-shadow: 0px 10px 31px 0px #B1B6B933;">
+          <template #trigger>
+            <div class="flex items-center cursor-pointer">
+              <img src="@/assets/images/chat/img-user-avatar.png" alt="" class="w-[32px] mr-[10px]" />
+              <span class="text-[#272D35] text-[12px]">{{ userInfo.nickName }}</span>
+            </div>
+          </template>
+          <ul class="
+            w-[120px] px-[10px] py-[10px]
+            rounded-[4px] bg-white
+            text-[12px] text-[#272D35] leading-[30px] text-center
+          ">
+            <li 
+              class="h-[30px] rounded-[4px] hover:bg-[#F4F6F8] hover:text-[#2454FF] cursor-pointer"
+              v-for="item in userMenuOptions" 
+              :key="item.key"
+              @click="handleUserMenuOptions"
+            >
+              {{ item.label }}
+            </li>
+          </ul>
+        </NPopover> -->
       </div>
       <main class="chat-main h-full m-auto flex flex-col justify-between">
         <div class="chat-scroll" ref="targetScrollDom">
@@ -55,7 +117,7 @@ defineExpose({ targetScrollDom });
         </div>
       </main>
       <footer class="chat-footer relative w-[800px] m-auto pb-[30px]">
-        <slot name="footer"/>
+        <slot name="footer" />
       </footer>
     </div>
   </div>

+ 0 - 2
src/components/Layout/TheMenu.vue

@@ -115,8 +115,6 @@ const handleUpdateValue = (key, { url }) => {
       @update:value="handleUpdateValue"
     >
     </n-menu>
-
-    
   </n-scrollbar>
 </template>
 

+ 11 - 11
src/components/Layout/ThePublicLayout.vue

@@ -1,17 +1,22 @@
 <script setup>
+import { ref, onMounted } from 'vue';
 import { RouterView } from 'vue-router';
 import { NScrollbar } from 'naive-ui';
+import { SvgIcon, TheLogo, TheMenu } from '@/components';
+import { waterApi } from '@/api/water';
 
-import TheLogo from './TheLogo.vue';
-import SvgIcon from '@/components/SvgIcon';
-import TheMenu from "@/components/Layout/TheMenu.vue";
+const warningCountMseeage = ref([]);
+
+onMounted(async () => {
+  const { data } = await waterApi.getWarningCount();
+  warningCountMseeage.value = data;
+})
 
 </script>
 
 <template>
 
   <div class="viewport">
-    <!-- 侧边栏 -->
     <aside class="aside-container flex flex-col flex-shrink-0 items-center justify-between w-[240px] h-full">
       <div class="aside-main_top flex-1 w-full overflow-hidden">
         <TheLogo />
@@ -26,18 +31,13 @@ import TheMenu from "@/components/Layout/TheMenu.vue";
           <dt class="w-[64px] h-[20px] mb-[12px] text-[16px] flex items-center justify-center">
             <img src="@/assets/images/menu/bg-warn-text.png" alt="">
           </dt>
-          <dd class="info">
-            <SvgIcon name="menu-warn-tips"></SvgIcon>
-            <span class="pl-[4px] block">您有100个报警信息,请解决</span>
-          </dd>
-          <dd class="info">
+          <dd class="info" v-for="item in warningCountMseeage" :key="item">
             <SvgIcon name="menu-warn-tips"></SvgIcon>
-            <span class="pl-[4px] block">您有100个报警信息,请解决</span>
+            <span class="pl-[4px] block">{{ item }}</span>
           </dd>
         </dl>
       </div>
     </aside>
-    <!-- 主体 -->
     <main class="main-container">
       <RouterView />
     </main>

+ 104 - 0
src/components/Layout/TheUserAvatar.vue

@@ -0,0 +1,104 @@
+<script lang="jsx">
+import { computed, defineComponent, unref, ref } from 'vue';
+import { useRouter } from 'vue-router';
+import { NPopover } from 'naive-ui';
+import { userApi } from '@/api/user';
+import { useUserStore } from '@/stores/modules/userStore'
+
+const RenderUserAvatar = ({ store }) => {
+  const router = useRouter();
+  const user = store.userInfo;
+ 
+  const clearLoginStatus = async () => {
+    await userApi.postLogout();
+    store.clearUserInfo();
+    router.push("/login");
+  }
+
+  const userMenuOptions = [
+    {
+      label: '个人中心',
+      key: "1"
+    },
+    {
+      label: '修改密码',
+      key: "2"
+    },
+    {
+      label: '退出登录',
+      key: "logout"
+    },
+  ]
+  
+  const handleUserMenuOptions = async ({ key }) => {
+    switch (key) {
+      case 'copyText':
+        copyText({ text: props.text ?? '' })
+        return
+      case 'toggleRenderType':
+        asRawText.value = !asRawText.value
+        return
+      case 'logout':
+        clearLoginStatus();
+    }
+  }
+
+  const slots = {
+    default: () => (
+      <ul class="
+        w-[120px] px-[10px] py-[10px]
+        rounded-[4px] bg-white
+        text-[12px] text-[#272D35] leading-[30px] text-center
+      ">
+        {
+          userMenuOptions.map(item => (
+            <li 
+              class="h-[30px] rounded-[4px] hover:bg-[#F4F6F8] hover:text-[#2454FF] cursor-pointer"
+              key={ item.key }
+              onClick={() => handleUserMenuOptions(item) }
+            >
+              {item.label}
+            </li>
+          ))
+        }
+      </ul>
+    ),
+    trigger: () => (
+      <div class="flex items-center cursor-pointer">
+        <img src={ user.avatar } alt="" class="w-[32px] mr-[10px]" />
+        <span class="text-[#272D35] text-[12px]">{ user.nickName }</span>
+      </div>
+    )
+  };
+
+  return (
+    <NPopover 
+      v-slots={ slots }
+      trigger="click"
+      raw={ true }
+      show-arrow={ false }
+      style="box-shadow: 0px 10px 31px 0px #B1B6B933"
+    ></NPopover>
+  )
+}
+
+export default defineComponent({
+  setup(props, context) {
+
+    const userStore =  useUserStore();
+
+    const clearLoginStatus = async () => {
+      // await userApi.postLogout();
+      // userStore.clearUserInfo();
+      // router.push("/login");
+    }
+
+    // console.log(userStore.userInfo);
+    // userStore.userInfo
+    return () => (
+      <div >{<RenderUserAvatar store={userStore}/>}</div>
+    );
+  },
+});
+
+</script>

+ 130 - 0
src/components/RecodeSquareCardItem/index.vue

@@ -0,0 +1,130 @@
+<script setup>
+import { ref, computed } from 'vue';
+import { BaseButton, SvgIcon } from '@/components';
+
+const props = defineProps({
+  item: {
+    type: Object,
+    default: () => ({})
+  }
+});
+
+const emit = defineEmits(['on-click']);
+
+const warningType = computed(() => {
+  const item = props.item;
+  const waterWhite = {
+    '0': {
+      label: '报警中',
+      cls: 'tips_warning'
+    },
+    '1': {
+      label: '用户关闭',
+      cls: 'tips_success'
+    },
+    '2': {
+      label: '系统自动关闭',
+      cls: 'tips_success'
+    },
+    '3': {
+      label: '用户转为应急处理中',
+      cls: 'tips_warning'
+    }
+  }
+  if (item.type == 0) {
+    return waterWhite[item.type + '']
+  }
+})
+
+const dataSources = computed(() => {
+  const item = props.item;
+  if ( item.type == 0 ) {
+    return [
+      {label: '报警时间',   value: item.time},
+      {label: '报警值',     value: item.warningVal, type: 'wraning'},
+      {label: '报警级别',   value: item.level},
+      {label: '报警次数',   value: item.counts},
+    ]
+    return {
+      ...props.item,
+      customWraningVal: props.item.warningVal,
+    }
+  }
+});
+
+const handleEmitParent = () => {
+  emit('on-click', props.item)
+}
+
+</script>
+
+<template>
+  <div class="warning-item-inner">
+    <div :class="['tips', warningType.cls]">
+      <span>{{ warningType.label }}</span>
+    </div>
+    <dl class="warning-info">
+      <dt>
+        <n-ellipsis class="font-bold text-[#1A2029] leading-[20px]">{{ item.reason }}</n-ellipsis>
+      </dt>
+      <dd class="flex items-center" v-for="(item, index) in dataSources" :key="index">
+        <span>{{ item.label }}: {{ item.value }}</span>
+        <SvgIcon name="tool-up" class="ml-[4px]" v-if="item.type"></SvgIcon>
+      </dd>
+    </dl>
+    <BaseButton type="gray" class="mt-[8px]" @click="handleEmitParent">操作</BaseButton>
+  </div>
+</template>
+
+<style scoped lang="scss">
+.warning-item-inner {
+  position: relative;
+  padding: 20px 8px 8px 8px;
+  border-radius: 4px;
+  background: #DDE5EF;
+
+  .tips {
+    position: absolute;
+    width: 36px;
+    height: 14px;
+    top: 0;
+    right: 0px;
+    border-radius: 0px 4px 0px 4px;
+    font-size: 8px;
+    text-align: center;
+    line-height: 14px;
+
+    &_warning,
+    &_being {
+      color: #F44C49;
+      background: #FFF0ED;
+    }
+  
+    &_success {
+      color: #51BF8E;
+      background: #E9FAF2;
+    }
+
+    &_close {
+      color: #999999;
+      background: #D5D5D5;
+    }
+  }
+}
+
+.warning-info {
+  line-height: 16px;
+  font-size: 11px;
+  color: #5E5E5E;
+
+  dd {
+    margin-top: 4px;
+  }
+
+  &_medium {
+    line-height: 26px;
+    font-size: 14px;
+    color: #1A2029;
+  }
+}
+</style>

+ 3 - 0
src/components/index.js

@@ -11,6 +11,7 @@ import ThePublicLayout from './Layout/ThePublicLayout';
 import TheSubMenu from './Layout/TheSubMenu';
 
 import RecodeCardItem from './RecodeCardItem';
+import RecodeSquareCardItem from './RecodeSquareCardItem';
 
 import SvgIcon from './SvgIcon';
 
@@ -31,6 +32,8 @@ export {
   TheSubMenu,
 
   RecodeCardItem,
+  RecodeSquareCardItem,
+  
   SvgIcon,
   ChatWelcome,
 

+ 22 - 26
src/composables/useInfinite.js

@@ -1,15 +1,16 @@
 import { ref, unref, onMounted, computed } from "vue";
 import { chatApi } from '@/api/chat';
+import { config } from "process";
 
 export const useInfinite = props => {
-  const pageParams = { page: 1, pageSize: 20 };
+  const pageParams = ref({ page: 1, pageSize: 20 });
 
   const recordList = ref([]);
   const isFetching = ref(false);
   const counter = ref(0);
   const noMore = ref(false);
 
-  const isMore = computed(() => pageParams.page * pageParams.pageSize < counter.value);
+  const isMore = computed(() => pageParams.value.page * pageParams.value.pageSize < counter.value);
 
   const addHistoryRecord = record => {
     recordList.value.unshift(...record);
@@ -28,7 +29,7 @@ export const useInfinite = props => {
     counter.value = total;
 
     if (unref(isMore)) {
-      pageParams.page ++;
+      pageParams.value.page ++;
     } else {
       noMore.value = true;
     }
@@ -44,8 +45,22 @@ export const useInfinite = props => {
     noMore.value = !unref(isMore);
   }
 
-  const initRecordData = async () => {
-    return await chatApi.getAnswerHistoryList({ ...props, ...pageParams });
+  const onRestore = (params) => {
+    console.log( "params", params );
+    pageParams.value = { page: 1, pageSize: 20 };
+    initRecordData(params);
+  }
+
+  const initRecordData = async (params = {}) => {
+    console.log( { ...props, ...pageParams.value, ...params} );
+    const d = {
+      ...props,
+      ...params,
+      ...pageParams.value
+    }
+
+    console.log( d );
+    return await chatApi.getRecordFetch({ ...props, ...pageParams.value, ...params});
   }
 
   onMounted(() => onScrolltolower());
@@ -55,26 +70,7 @@ export const useInfinite = props => {
     isFetching,
     onScrolltolower,
     onReset,
+    onRestore,
     addHistoryRecord
   }
-}
-//   {
-//     data,
-//     isLoading,
-//     isError,
-//     isFetching,
-//     isFetchingNextPage,
-//     fetchNextPage,
-//     hasNextPage,
-//   },
-//   {
-//     pageSize = 10,
-//     onSuccess,
-//     onError,
-//     onSettled,
-//     onFetchingNextPage,
-//   } = {},
-// ) => {
-//   const handleFetchNextPage = () => {
-//   }
-// }
+}

+ 1 - 1
src/router/index.js

@@ -43,7 +43,7 @@ const constantRouterMap = [
 ]
 
 const router = createRouter({
-  history: createWebHashHistory(import.meta.env.BASE_URL),
+  history: createWebHistory(import.meta.env.BASE_URL),
   routes: constantRouterMap,
   scrollBehavior: () => ({ left: 0, top: 0 })
 })

+ 9 - 4
src/stores/modules/userStore.js

@@ -1,16 +1,21 @@
-import { ref, computed } from 'vue'
+import { ref, unref, computed } from 'vue'
 import { defineStore } from 'pinia'
 
 export const useUserStore = defineStore('user', () => {
   const userInfo = ref({});
 
-  const setUserInfo = user => {
-    userInfo.value = user;
+  const setUserInfo = params => {
+    userInfo.value = { ...unref(userInfo), ...params};
+  }
+
+  const clearUserInfo = user => {
+    userInfo.value = {};
   }
 
   return {
     userInfo,
-    setUserInfo
+    setUserInfo,
+    clearUserInfo,
   }
 }, {
   persist: true,

+ 27 - 39
src/views/analyse/WaterView.vue

@@ -1,17 +1,12 @@
 <script setup lang="jsx">
 import { ref, h } from 'vue';
 import { NTabs, NTab, NEllipsis, NModal, NInput  } from 'naive-ui';
-import {
-  BaseButton,
-  BaseCard,
-  BaseTable,
-  ChatWelcome,
-  SvgIcon,
-  RecodeCardItem,
-  TheSubMenu,
-  TheChatView,
-} from "@/components";
-import { CustomModal } from "./components"
+import { BaseCard, BaseTable, ChatWelcome, SvgIcon, RecodeSquareCardItem, TheSubMenu, TheChatView } from "@/components";
+
+import { useInfinite } from '@/composables/useInfinite';
+import { CustomModal } from "./components";
+
+const { recordList, isFetching, onScrolltolower, onRestore, addHistoryRecord } = useInfinite({path: '/front/bigModel/warning/pageList', params: { type: 0 }});
 
 const visible = ref(false);
 
@@ -70,7 +65,8 @@ const columns = [
   }
 ]
 
-const inWaterTableData = ref([{ name: 1233, actions: "7.87" }])
+
+const inWaterTableData = ref([{ name: 1233, actions: "7.87" }]);
 
 // 新建对话
 const handleCreateDialog = () => {
@@ -84,45 +80,37 @@ const handleLoad = () => {
 const handleModelVisible = () => {
   visible.value = true
 } 
+
+const handleOpenContent = () => {
+  alert(1)
+}
+
+const onChangeTabs = warningStatus => {
+  console.log( "warningStatus", warningStatus );
+  onRestore({ warningStatus })
+}
 </script>
 
 <template>
   <section class="flex items-start h-full">
-    <TheSubMenu title="水质报警" @onLoad="handleLoad">
+    <TheSubMenu title="水质报警" @scrollToLower="onScrolltolower" :loading="isFetching">
       <template #top>
         <div class="border-[#DAE5ED]">
           <n-tabs type="line" justify-content="space-evenly">
-            <n-tab name="oasis" tab="正在报警"></n-tab>
-            <n-tab name="thebeatles" tab="历史报警"></n-tab>
+            <n-tab name="oasis" tab="正在报警" @click="onChangeTabs(0)"></n-tab>
+            <n-tab name="thebeatles" tab="历史报警" @click="onChangeTabs(1)"></n-tab>
           </n-tabs>
         </div>
       </template>
+
       <div class="px-[12px] py-[14px] text-[#5e5e5e]">
         <div class="grid grid-cols-1 gap-[12px]">
-          <div class="warning-item-inner" v-for="item in 10">
-            <div class="tips tips_warning">
-              <span>报警中</span>
-            </div>
-            <dl class="warning-info">
-              <dt>
-                <n-ellipsis class="font-bold text-[#1A2029] leading-[20px]">进水总磷超标报警</n-ellipsis>
-              </dt>
-              <dd>
-                <span>报警时间:2024-4-25 21:00</span>
-              </dd>
-              <dd class="flex items-center">
-                <span>报警值:7.87mg/L</span>
-                <SvgIcon name="tool-up" class="ml-[4px]"></SvgIcon>
-              </dd>
-              <dd>
-                <span>报警级别:一级</span>
-              </dd>
-              <dd>
-                <span>报警次数:3</span>
-              </dd>
-            </dl>
-            <BaseButton type="gray" class="mt-[8px]">操作</BaseButton>
-          </div>
+          <RecodeSquareCardItem
+            v-for="item in recordList"
+            :key="item.id"
+            :item="item"
+            @on-click="handleOpenContent"
+          />
         </div>
       </div>
     </TheSubMenu>

+ 3 - 2
src/views/answer/AnswerView.vue

@@ -15,7 +15,7 @@ const ANSWER_ID_KEY = '@@id@@';
 let controller = new AbortController();
 
 // TODO: 如果这里的key不一样,将会在拆一层组件出来 - list
-const { recordList, isFetching, onScrolltolower, onReset, addHistoryRecord } = useInfinite({model: 0});
+const { recordList, isFetching, onScrolltolower, onReset, addHistoryRecord } = useInfinite({path: '/front/bigModel/qa/pageList', params: { model: 0 }});
 const { scrollRef, scrollToBottom, scrollToBottomIfAtBottom } = useScroll();
 const { chatDataSource, addChat, updateChat, clearChat, updateById } = useChat();
 const { recommendList } = useRecommend({type: 0});
@@ -190,7 +190,8 @@ const handeChatDelete = async (id) => {
 
       <div class="conversation-item" v-if="chatDataSource.length">
         <template v-for="item in chatDataSource" :key="item.id">
-          <ChatAsk :content="item.question"></ChatAsk>
+          <ChatAsk :content="item.question" :sessionId="item.sessionId"></ChatAsk>
+      
           <ChatAnswer
             :id="item.id"
             :content="item.answer"

+ 5 - 3
src/views/login/LoginView.vue

@@ -4,7 +4,7 @@ import { useRouter } from 'vue-router';
 import { NButton } from 'naive-ui';
 import { SvgIcon } from '@/components';
 import { useUserStore } from '@/stores/modules/userStore';
-import { loginApi } from '@/api/login';
+import { userApi } from '@/api/user';
 
 const router = useRouter();
 const userStore = useUserStore();
@@ -29,9 +29,11 @@ const handleSubmit = async () => {
   
   try {
     loading.value = true;
-    const { token } = await loginApi.postLogin({ username, password });
-    errorMsg.value = '';
+    const { token } = await userApi.postLogin({ username, password });
     userStore.setUserInfo({ token });
+    const { user } = await userApi.getUserInfo();
+    errorMsg.value = '';
+    userStore.setUserInfo({ ...user });
     router.push("/");
   }
   catch (error) {