import('@/views/Home.vue'),
children: [
@@ -14,13 +14,6 @@ const routes = [
meta: {title: '创作中心'},
component: () => import('@/views/ChatPlus.vue'),
},
- {
- name: 'chat-id',
- path: '/chat/:id',
- meta: {title: '创作中心'},
- component: () => import('@/views/ChatPlus.vue'),
- props: true // 将路由参数传递给组件的 props
- },
{
name: 'image-mj',
path: '/mj',
diff --git a/web/src/views/ChatPlus.vue b/web/src/views/ChatPlus.vue
index cc8e2bae..b94b9a0a 100644
--- a/web/src/views/ChatPlus.vue
+++ b/web/src/views/ChatPlus.vue
@@ -342,7 +342,7 @@ onMounted(() => {
newChat();
} else {
// 加载对话
- changeChat(chat)
+ loadChat(chat)
}
}).catch((e) => {
ElMessage.error('获取聊天角色失败: ' + e.messages)
@@ -423,7 +423,6 @@ const newChat = function () {
// 切换会话
const changeChat = (chat) => {
- router.push("/chat/" + chat.chat_id)
localStorage.setItem("chat_id", chat.chat_id)
loadChat(chat)
}
@@ -880,6 +879,5 @@ const getModelValue = (model_id) => {
\ No newline at end of file
diff --git a/web/src/views/Home.vue b/web/src/views/Home.vue
index 9f772033..6ceb6923 100644
--- a/web/src/views/Home.vue
+++ b/web/src/views/Home.vue
@@ -39,16 +39,6 @@ import {isMobile} from "@/utils/libs";
import {ref} from "vue";
const router = useRouter();
-checkSession().then(() => {
- if (isMobile()) {
- router.push("/mobile")
- } else {
- router.push("/chat")
- }
-}).catch(() => {
- router.push("/login")
-})
-
const logo = '/images/logo.png';
const navs = ref([
{path: "/chat", icon: "wechat", title: "对话聊天"},
@@ -60,7 +50,7 @@ const navs = ref([
{path: "/member", icon: "vip-user", title: "会员计划"},
{path: "/invite", icon: "share", title: "推广计划"},
])
-const curPath = ref(navs.value[0].path)
+const curPath = ref(router.currentRoute.value.path)
const changeNav = (item) => {
curPath.value = item.path
@@ -69,6 +59,7 @@ const changeNav = (item) => {