From 4ab9f709deb0116b27b79786757562b37a7a9419 Mon Sep 17 00:00:00 2001 From: Redon <790348264@qq.com> Date: Tue, 21 Feb 2023 08:57:54 +0800 Subject: [PATCH] v2.5.1 (#75) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * perf: 新增会话添加在列表前方 * fix: 路由模式改为 hash 保证兼容性 * perf: 增强移动端体验 * chore: version 2.5.1 --- CHANGELOG.md | 8 ++++++++ package.json | 2 +- src/router/index.ts | 4 ++-- src/store/modules/chat/index.ts | 8 ++++---- src/views/chat/index.vue | 4 ++-- src/views/chat/layout/Layout.vue | 3 +-- src/views/chat/layout/header/index.vue | 2 +- src/views/chat/layout/sider/List.vue | 11 +++++++++-- src/views/chat/layout/sider/index.vue | 8 +++++--- 9 files changed, 33 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e8fc10c..db5c044 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +## v2.5.1 + +`2023-02-21` +### Enhancement +- 调整路由模式为 `hash` +- 调整新增会话添加到列表最前 +- 调整移动端样式 + ## v2.5.0 `2023-02-20` diff --git a/package.json b/package.json index bd4e0d3..180e049 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "chatgpt-web", - "version": "2.5.0", + "version": "2.5.1", "private": false, "description": "ChatGPT Web", "author": "ChenZhaoYu ", diff --git a/src/router/index.ts b/src/router/index.ts index d2a0747..587ad2b 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -1,6 +1,6 @@ import type { App } from 'vue' import type { RouteRecordRaw } from 'vue-router' -import { createRouter, createWebHistory } from 'vue-router' +import { createRouter, createWebHashHistory } from 'vue-router' import { ChatLayout } from '@/views/chat/layout' const routes: RouteRecordRaw[] = [ @@ -20,7 +20,7 @@ const routes: RouteRecordRaw[] = [ ] export const router = createRouter({ - history: createWebHistory(), + history: createWebHashHistory(), routes, scrollBehavior: () => ({ left: 0, top: 0 }), }) diff --git a/src/store/modules/chat/index.ts b/src/store/modules/chat/index.ts index 5141b9e..9db57d4 100644 --- a/src/store/modules/chat/index.ts +++ b/src/store/modules/chat/index.ts @@ -17,8 +17,8 @@ export const useChatStore = defineStore('chat-store', { actions: { addHistory(history: Chat.History, chatData: Chat.Chat[] = []) { - this.history.push(history) - this.chat.push({ uuid: history.uuid, data: chatData }) + this.history.unshift(history) + this.chat.unshift({ uuid: history.uuid, data: chatData }) this.active = history.uuid this.reloadRoute(history.uuid) }, @@ -63,9 +63,9 @@ export const useChatStore = defineStore('chat-store', { } }, - setActive(uuid: number) { + async setActive(uuid: number) { this.active = uuid - this.reloadRoute(uuid) + return await this.reloadRoute(uuid) }, addChatByUuid(uuid: number, chat: Chat.Chat) { diff --git a/src/views/chat/index.vue b/src/views/chat/index.vue index ac19ddc..556daa3 100644 --- a/src/views/chat/index.vue +++ b/src/views/chat/index.vue @@ -227,7 +227,7 @@ const buttonDisabled = computed(() => { const footerClass = computed(() => { let classes = ['p-4'] if (isMobile.value) - classes = [...classes, 'pl-2', 'pt-2', 'pb-2', 'fixed', 'bottom-0', 'left-0', 'right-0', 'z-30'] + classes = ['p-2', 'pr-4', 'fixed', 'bottom-4', 'left-0', 'right-0', 'z-30', 'h-14', 'overflow-hidden'] return classes }) @@ -242,7 +242,7 @@ onUnmounted(() => {