diff --git a/web/src/main.js b/web/src/main.js index aa4368d9..8b3165d5 100644 --- a/web/src/main.js +++ b/web/src/main.js @@ -1,115 +1,23 @@ -import {createRouter, createWebHistory} from 'vue-router' import {createApp} from 'vue' import ElementPlus from "element-plus" import "element-plus/dist/index.css" +import 'vant/lib/index.css'; import App from './App.vue' -import ChatPlus from "@/views/ChatPlus.vue"; -import NotFound from './views/404.vue' -import Home from "@/views/Home.vue"; -import Login from "@/views/Login.vue" -import Register from "@/views/Register.vue"; import {createPinia} from "pinia"; - -const routes = [ - {name: 'home', path: '/', component: Home, meta: {title: 'ChatGPT-Plus'}}, - {name: 'login', path: '/login', component: Login, meta: {title: '用户登录'}}, - {name: 'register', path: '/register', component: Register, meta: {title: '用户注册'}}, - {name: 'plus', path: '/chat', component: ChatPlus, meta: {title: 'ChatGPT-智能助手V3'}}, - { - path: '/admin/login', - name: 'admin-login', - meta: {title: 'Chat-Plus 控制台登录'}, - component: () => import('@/views/admin/Login.vue'), - }, - { - name: 'admin', - path: '/admin', - redirect: '/admin/welcome', - component: () => import("@/views/admin/Home.vue"), - meta: {title: 'ChatGPT-Plus 管理后台'}, - children: [ - { - path: '/admin/welcome', - name: 'admin-home', - meta: {title: '系统首页'}, - component: () => import('@/views/admin/Welcome.vue'), - }, - { - path: '/admin/system', - name: 'admin-system', - meta: {title: '系统设置'}, - component: () => import('@/views/admin/SysConfig.vue'), - }, - { - path: '/admin/user', - name: 'admin-user', - meta: {title: '用户管理'}, - component: () => import('@/views/admin/UserList.vue'), - }, - { - path: '/admin/role', - name: 'admin-role', - meta: {title: '角色管理'}, - component: () => import('@/views/admin/RoleList.vue'), - }, - { - path: '/admin/apikey', - name: 'admin-apikey', - meta: {title: 'API-KEY 管理'}, - component: () => import('@/views/admin/ApiKey.vue'), - }, - { - path: '/admin/loginLog', - name: 'admin-loginLog', - meta: {title: '登录日志'}, - component: () => import('@/views/admin/LoginLog.vue'), - }, - { - path: '/admin/demo/form', - name: 'admin-form', - meta: {title: '表单页面'}, - component: () => import('@/views/admin/demo/Form.vue'), - }, - { - path: '/admin/demo/table', - name: 'admin-table', - meta: {title: '数据列表'}, - component: () => import('@/views/admin/demo/Table.vue'), - }, - { - path: '/admin/demo/import', - name: 'admin-import', - meta: {title: '导入数据'}, - component: () => import('@/views/admin/demo/Import.vue'), - }, - { - path: '/admin/demo/editor', - name: 'admin-editor', - meta: {title: '富文本编辑器'}, - component: () => import('@/views/admin/demo/Editor.vue'), - }, - ] - }, - {name: 'test', path: '/test', component: () => import('@/views/Test.vue'), meta: {title: '测试页面'}}, - {name: 'NotFound', path: '/:all(.*)', component: NotFound, meta: {title: '页面没有找到'}}, -] - -// console.log(MY_VARIABLE) -const router = createRouter({ - history: createWebHistory(), - routes: routes, -}) - -// dynamic change the title when router change -router.beforeEach((to, from, next) => { - if (to.meta.title) { - document.title = `${to.meta.title} | ChatGPT-PLUS` - } - next() -}) +import {Cell, Image, List, NavBar, Notify, Search, Tabbar, TabbarItem, TextEllipsis} from "vant"; +import router from "@/router"; const app = createApp(App) app.use(createPinia()) +app.use(Tabbar); +app.use(TabbarItem); +app.use(NavBar); +app.use(Search); +app.use(Cell) +app.use(Image) +app.use(TextEllipsis) +app.use(Notify) +app.use(List); app.use(router).use(ElementPlus).mount('#app') diff --git a/web/src/router.js b/web/src/router.js new file mode 100644 index 00000000..97f21a94 --- /dev/null +++ b/web/src/router.js @@ -0,0 +1,157 @@ +import {createRouter, createWebHistory} from "vue-router"; + +const routes = [ + { + name: 'home', + path: '/', + meta: {title: 'ChatGPT-Plus'}, + component: () => import('@/views/Home.vue'), + }, + { + name: 'login', + path: '/login', + meta: {title: '用户登录'}, + component: () => import('@/views/Login.vue'), + }, + { + name: 'register', + path: '/register', + + meta: {title: '用户注册'}, + component: () => import('@/views/Register.vue'), + }, + { + name: 'plus', + path: '/chat', + meta: {title: 'ChatGPT-智能助手V3'}, + component: () => import('@/views/ChatPlus.vue'), + }, + { + path: '/admin/login', + name: 'admin-login', + meta: {title: 'Chat-Plus 控制台登录'}, + component: () => import('@/views/admin/Login.vue'), + }, + { + name: 'admin', + path: '/admin', + redirect: '/admin/welcome', + component: () => import("@/views/admin/Home.vue"), + meta: {title: 'ChatGPT-Plus 管理后台'}, + children: [ + { + path: '/admin/welcome', + name: 'admin-home', + meta: {title: '系统首页'}, + component: () => import('@/views/admin/Welcome.vue'), + }, + { + path: '/admin/system', + name: 'admin-system', + meta: {title: '系统设置'}, + component: () => import('@/views/admin/SysConfig.vue'), + }, + { + path: '/admin/user', + name: 'admin-user', + meta: {title: '用户管理'}, + component: () => import('@/views/admin/UserList.vue'), + }, + { + path: '/admin/role', + name: 'admin-role', + meta: {title: '角色管理'}, + component: () => import('@/views/admin/RoleList.vue'), + }, + { + path: '/admin/apikey', + name: 'admin-apikey', + meta: {title: 'API-KEY 管理'}, + component: () => import('@/views/admin/ApiKey.vue'), + }, + { + path: '/admin/loginLog', + name: 'admin-loginLog', + meta: {title: '登录日志'}, + component: () => import('@/views/admin/LoginLog.vue'), + }, + { + path: '/admin/demo/form', + name: 'admin-form', + meta: {title: '表单页面'}, + component: () => import('@/views/admin/demo/Form.vue'), + }, + { + path: '/admin/demo/table', + name: 'admin-table', + meta: {title: '数据列表'}, + component: () => import('@/views/admin/demo/Table.vue'), + }, + { + path: '/admin/demo/import', + name: 'admin-import', + meta: {title: '导入数据'}, + component: () => import('@/views/admin/demo/Import.vue'), + }, + { + path: '/admin/demo/editor', + name: 'admin-editor', + meta: {title: '富文本编辑器'}, + component: () => import('@/views/admin/demo/Editor.vue'), + }, + ] + }, + + { + name: 'mobile', + path: '/mobile', + meta: {title: 'ChatGPT-智能助手V3'}, + component: () => import('@/views/mobile/Home.vue'), + redirect: '/mobile/chat', + children: [ + { + path: '/mobile/chat', + name: 'mobile-chat', + component: () => import('@/views/mobile/Chat.vue'), + }, + { + path: '/mobile/setting', + name: 'mobile-setting', + component: () => import('@/views/mobile/Setting.vue'), + }, + { + path: '/mobile/profile', + name: 'mobile-profile', + component: () => import('@/views/mobile/Profile.vue'), + }, + ] + }, + { + name: 'test', + path: '/test', + meta: {title: '测试页面'}, + component: () => import('@/views/Test.vue'), + }, + { + name: 'NotFound', + path: '/:all(.*)', + meta: {title: '页面没有找到'}, + component: () => import('@/views/404.vue'), + }, +] + +// console.log(MY_VARIABLE) +const router = createRouter({ + history: createWebHistory(), + routes: routes, +}) + +// dynamic change the title when router change +router.beforeEach((to, from, next) => { + if (to.meta.title) { + document.title = `${to.meta.title} | ChatGPT-PLUS` + } + next() +}) + +export default router; \ No newline at end of file diff --git a/web/src/views/ChatPlus.vue b/web/src/views/ChatPlus.vue index 1d5e0e64..bb727b53 100644 --- a/web/src/views/ChatPlus.vue +++ b/web/src/views/ChatPlus.vue @@ -694,11 +694,12 @@ const chatName = ref('') // 搜索会话 const searchChat = function () { if (chatName.value === '') { + chatList.value = allChats.value return } const roles = []; for (let i = 0; i < allChats.value.length; i++) { - if (allChats.value[i].title.indexOf(chatName.value) !== -1) { + if (allChats.value[i].title.toLowerCase().indexOf(chatName.value.toLowerCase()) !== -1) { roles.push(allChats.value[i]); } } diff --git a/web/src/views/mobile/Chat.vue b/web/src/views/mobile/Chat.vue new file mode 100644 index 00000000..3c8e89ef --- /dev/null +++ b/web/src/views/mobile/Chat.vue @@ -0,0 +1,105 @@ + + + + + \ No newline at end of file diff --git a/web/src/views/mobile/Home.vue b/web/src/views/mobile/Home.vue new file mode 100644 index 00000000..03e3b6a2 --- /dev/null +++ b/web/src/views/mobile/Home.vue @@ -0,0 +1,29 @@ + + + + + \ No newline at end of file diff --git a/web/src/views/mobile/Profile.vue b/web/src/views/mobile/Profile.vue new file mode 100644 index 00000000..288f8a33 --- /dev/null +++ b/web/src/views/mobile/Profile.vue @@ -0,0 +1,15 @@ + + + + + \ No newline at end of file diff --git a/web/src/views/mobile/Setting.vue b/web/src/views/mobile/Setting.vue new file mode 100644 index 00000000..db4daf9e --- /dev/null +++ b/web/src/views/mobile/Setting.vue @@ -0,0 +1,15 @@ + + + + + \ No newline at end of file