Преглед изворни кода

Merge branch 'master' of http://gitlab.smartai.com/zhupei/smartai2dian0

张涛 пре 1 година
родитељ
комит
f1807d8eb1

+ 3 - 1
public/i18n/lang-en.json

@@ -35,7 +35,9 @@
     "noAccount": "Don't have an account?",
     "usernameLength": "Username must be between 3 and 20 characters long",
     "passwordLength": "Password must be between 6 and 20 characters long",
-    "emailFormat": "Incorrect email format"
+    "emailFormat": "Incorrect email format",
+
+    "logout": "Exit"
   },
   "management": {
     "knowledgeTitle": "Welcome back, GuanLi4",

+ 3 - 1
public/i18n/lang-zh.json

@@ -35,7 +35,9 @@
     "noAccount": "没有账号?",
     "usernameLength": "用户名长度必须在3-20个字符之间",
     "passwordLength": "密码长度必须在6-20个字符之间",
-    "emailFormat": "邮箱格式不正确"
+    "emailFormat": "邮箱格式不正确",
+
+    "logout": "退出登录"
   },
   "management": {
     "knowledgeTitle": "欢迎回来,GuanLi4",

+ 21 - 0
src/modules/conversation-chat/ChatName.vue

@@ -0,0 +1,21 @@
+<template>
+  <div class="conversation-history-title">
+    <div>{{ $t('conversation.chat_history') }}</div>
+  </div>
+</template>
+
+<script setup></script>
+
+<style lang="css" scoped>
+.conversation-history-title {
+  margin-top: 30px;
+  margin-bottom: 30px;
+
+  text-align: center;
+
+  font-size: 32px;
+  font-weight: bold;
+
+  color: var(--color-text-1);
+}
+</style>

+ 5 - 1
src/views/ConversationQA.vue

@@ -3,7 +3,9 @@
     <ContentContainer>
       <ChatAsideMenu />
 
-      <div class="conversation-qa">会话进行中</div>
+      <ConversationChatContainer>
+        <div class="conversation-qa">会话进行中</div>
+      </ConversationChatContainer>
     </ContentContainer>
   </LayoutExperience>
 </template>
@@ -13,4 +15,6 @@ import LayoutExperience from './layout/LayoutExperience.vue';
 import ContentContainer from './layout/ContentContainer.vue';
 
 import ChatAsideMenu from './conversation/ChatAsideMenu.vue';
+
+import ConversationChatContainer from './conversation/ConversationChatContainer.vue';
 </script>

+ 2 - 6
src/views/common/Header.vue

@@ -29,9 +29,7 @@
 
         <BtnSettings class="header-right-item" @click="handleNameChange" />
 
-        <div class="header-right-profile">
-          <span>{{ currentUser.name }}</span>
-        </div>
+        <BtnCurrentUser />
       </a-space>
     </div>
   </div>
@@ -53,6 +51,7 @@ import BtnLanguage from './header-btns/BtnLanguage.vue';
 import BtnTheme from './header-btns/BtnTheme.vue';
 import BtnFullScreen from './header-btns/BtnFullScreen.vue';
 import BtnSettings from './header-btns/BtnSettings.vue';
+import BtnCurrentUser from './header-btns/BtnCurrentUser.vue';
 
 const currentUser = useCurrentUserStore();
 
@@ -145,7 +144,4 @@ const handleNameChange = () => {
 
   cursor: pointer;
 }
-
-.header-right-profile {
-}
 </style>

+ 31 - 0
src/views/common/header-btns/BtnCurrentUser.vue

@@ -0,0 +1,31 @@
+<template>
+  <a-dropdown trigger="hover" @select="handleSelect">
+    <div class="header-right-profile">
+      <span>{{ currentUser.name }}</span>
+    </div>
+
+    <template #content>
+      <a-doption value="logout"><icon-export />{{ $t('login.logout') }}</a-doption>
+    </template>
+  </a-dropdown>
+</template>
+
+<script setup>
+import { useRouter } from 'vue-router';
+import { useCurrentUserStore } from '../../../base/store/use-current-user';
+
+const router = useRouter();
+
+const currentUser = useCurrentUserStore();
+
+const handleSelect = (value) => {
+  console.log(value, '退出登录');
+
+  router.push({ path: '/login', replace: true });
+};
+</script>
+
+<style lang="css" scoped>
+.header-right-profile {
+}
+</style>

+ 37 - 0
src/views/conversation/ConversationChatContainer.vue

@@ -0,0 +1,37 @@
+<template>
+  <div class="conversation-chat-container">
+    <HistoryName />
+
+    <div class="conversation-chat-placeholder"></div>
+  </div>
+</template>
+
+<script setup>
+import { ref, onMounted } from 'vue';
+
+import ChatName from '../../modules/conversation-chat/ChatName.vue';
+</script>
+
+<style lang="css" scoped>
+.conversation-chat-container {
+  width: 60%;
+  height: 100%;
+  margin-left: auto;
+  margin-right: auto;
+
+  display: flex;
+  flex-direction: column;
+}
+
+/* 底部占位元素 */
+.conversation-chat-placeholder {
+  height: 50px;
+}
+
+.conversation-chat-container .infomations-container {
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  min-height: 200px;
+}
+</style>

+ 1 - 1
src/views/routes.js

@@ -4,7 +4,7 @@ import Home from './Home.vue';
  * 路由表配置
  */
 const routes = [
-  { path: '/', component: Home },
+  { path: '/', component: Home, redirect: '/chat/qa' },
 
   // 登录与注册
   { path: '/login', component: () => import('./Login.vue') },