From d27b1ebe104b8fa8cdce62e00eadf1b6f5c90d35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CXCYH=E2=80=9D?= <“1561381013@qq.com”> Date: Mon, 15 Apr 2024 16:30:41 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=81=87=E7=95=8C=E9=9D=A2=E5=90=88?= =?UTF-8?q?=E5=B9=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/components.d.ts b/components.d.ts index 1a0f360..d378ba0 100644 --- a/components.d.ts +++ b/components.d.ts @@ -38,6 +38,7 @@ declare module '@vue/runtime-core' { ElOption: typeof import('element-plus/es')['ElOption'] ElPagination: typeof import('element-plus/es')['ElPagination'] ElProgress: typeof import('element-plus/es')['ElProgress'] + ElRate: typeof import('element-plus/es')['ElRate'] ElRow: typeof import('element-plus/es')['ElRow'] ElScrollbar: typeof import('element-plus/es')['ElScrollbar'] ElSelect: typeof import('element-plus/es')['ElSelect'] From 3f12fda7f384bd7ad94ae73c89ecacfbd289f44b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CXCYH=E2=80=9D?= <“1561381013@qq.com”> Date: Mon, 15 Apr 2024 19:27:31 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BE=A7=E8=BE=B9=E6=A0=8F=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- auto-imports.d.ts | 1 + components.d.ts | 12 +- src/router/index.ts | 613 +++++++++++---------- src/router/modules/table.ts | 1 + src/views/personal/project/charge.vue | 3 + src/views/personal/project/manage.vue | 124 +++++ src/views/personal/project/participate.vue | 3 + 7 files changed, 468 insertions(+), 289 deletions(-) create mode 100644 src/views/personal/project/charge.vue create mode 100644 src/views/personal/project/manage.vue create mode 100644 src/views/personal/project/participate.vue diff --git a/auto-imports.d.ts b/auto-imports.d.ts index 24e619c..07b6235 100644 --- a/auto-imports.d.ts +++ b/auto-imports.d.ts @@ -3,4 +3,5 @@ export {} declare global { const ElMessage: typeof import('element-plus/es')['ElMessage'] const ElMessageBox: typeof import('element-plus/es')['ElMessageBox'] + const ElNotification: typeof import('element-plus/es')['ElNotification'] } diff --git a/components.d.ts b/components.d.ts index d378ba0..99f3489 100644 --- a/components.d.ts +++ b/components.d.ts @@ -13,19 +13,17 @@ declare module '@vue/runtime-core' { DropdownMenu: typeof import('./src/components/Share/DropdownMenu.vue')['default'] Dropzone: typeof import('./src/components/Dropzone/index.vue')['default'] EditorImage: typeof import('./src/components/Tinymce/components/EditorImage.vue')['default'] - ElAutocomplete: typeof import('element-plus/es')['ElAutocomplete'] + ElAlert: typeof import('element-plus/es')['ElAlert'] ElBadge: typeof import('element-plus/es')['ElBadge'] ElBreadcrumb: typeof import('element-plus/es')['ElBreadcrumb'] ElBreadcrumbItem: typeof import('element-plus/es')['ElBreadcrumbItem'] ElButton: typeof import('element-plus/es')['ElButton'] ElCard: typeof import('element-plus/es')['ElCard'] ElCheckbox: typeof import('element-plus/es')['ElCheckbox'] - ElCheckboxGroup: typeof import('element-plus/es')['ElCheckboxGroup'] ElCol: typeof import('element-plus/es')['ElCol'] ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider'] ElDatePicker: typeof import('element-plus/es')['ElDatePicker'] ElDialog: typeof import('element-plus/es')['ElDialog'] - ElDivider: typeof import('element-plus/es')['ElDivider'] ElDropdown: typeof import('element-plus/es')['ElDropdown'] ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem'] ElDropdownMenu: typeof import('element-plus/es')['ElDropdownMenu'] @@ -38,16 +36,24 @@ declare module '@vue/runtime-core' { ElOption: typeof import('element-plus/es')['ElOption'] ElPagination: typeof import('element-plus/es')['ElPagination'] ElProgress: typeof import('element-plus/es')['ElProgress'] + ElRadio: typeof import('element-plus/es')['ElRadio'] + ElRadioButton: typeof import('element-plus/es')['ElRadioButton'] + ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup'] ElRate: typeof import('element-plus/es')['ElRate'] ElRow: typeof import('element-plus/es')['ElRow'] ElScrollbar: typeof import('element-plus/es')['ElScrollbar'] ElSelect: typeof import('element-plus/es')['ElSelect'] + ElSlider: typeof import('element-plus/es')['ElSlider'] ElSubMenu: typeof import('element-plus/es')['ElSubMenu'] ElSwitch: typeof import('element-plus/es')['ElSwitch'] ElTable: typeof import('element-plus/es')['ElTable'] ElTableColumn: typeof import('element-plus/es')['ElTableColumn'] + ElTabPane: typeof import('element-plus/es')['ElTabPane'] + ElTabs: typeof import('element-plus/es')['ElTabs'] ElTag: typeof import('element-plus/es')['ElTag'] ElTooltip: typeof import('element-plus/es')['ElTooltip'] + ElTree: typeof import('element-plus/es')['ElTree'] + ElUpload: typeof import('element-plus/es')['ElUpload'] ErrorLog: typeof import('./src/components/ErrorLog/index.vue')['default'] GithubCorner: typeof import('./src/components/GithubCorner/index.vue')['default'] Hamburger: typeof import('./src/components/Hamburger/index.vue')['default'] diff --git a/src/router/index.ts b/src/router/index.ts index 334b763..c133cd0 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -1,16 +1,16 @@ -import { markRaw } from 'vue'; +// import { markRaw } from 'vue'; import { createRouter, createWebHistory } from 'vue-router'; // createWebHashHistory, createWebHistory import type { Router, RouteRecordRaw, RouteComponent } from 'vue-router'; -import { Help as IconHelp } from '@element-plus/icons-vue'; +// import { Help as IconHelp } from '@element-plus/icons-vue'; /* Layout */ const Layout = ():RouteComponent => import('@/layout/index.vue'); /* Router Modules */ -import componentsRouter from './modules/components'; -import chartsRouter from './modules/charts'; -import nestedRouter from './modules/nested'; -import tableRouter from './modules/table'; +// import componentsRouter from './modules/components'; +// import chartsRouter from './modules/charts'; +// import nestedRouter from './modules/nested'; +// import tableRouter from './modules/table'; /** * constantRoutes @@ -64,31 +64,31 @@ export const constantRoutes:RouteRecordRaw[] = [ } ] }, - { - path: '/documentation', - component: Layout, - children: [ - { - path: 'index', - component: () => import('@/views/documentation/index.vue'), - name: 'Documentation', - meta: { title: 'Documentation', icon: 'documentation', affix: true } - } - ] - }, - { - path: '/guide', - component: Layout, - redirect: '/guide/index', - children: [ - { - path: 'index', - component: () => import('@/views/guide/index.vue'), - name: 'Guide', - meta: { title: 'Guide', icon: 'guide', noCache: true } - } - ] - }, + // { + // path: '/documentation', + // component: Layout, + // children: [ + // { + // path: 'index', + // component: () => import('@/views/documentation/index.vue'), + // name: 'Documentation', + // meta: { title: 'Documentation', icon: 'documentation', affix: true } + // } + // ] + // }, + // { + // path: '/guide', + // component: Layout, + // redirect: '/guide/index', + // children: [ + // { + // path: 'index', + // component: () => import('@/views/guide/index.vue'), + // name: 'Guide', + // meta: { title: 'Guide', icon: 'guide', noCache: true } + // } + // ] + // }, { path: '/profile', component: Layout, @@ -112,288 +112,329 @@ export const constantRoutes:RouteRecordRaw[] = [ * 注意:hidden、alwaysShow 属性配置移动到了meta中!!! */ export const asyncRoutes:RouteRecordRaw[] = [ + // { + // path: '/permission', + // component: Layout, + // redirect: '/permission/page', + // name: 'Permission', + // meta: { + // alwaysShow: true, // will always show the root menu + // title: 'Permission', + // icon: 'lock', + // roles: ['admin', 'editor','teacher_user'] // you can set roles in root nav + // }, + // children: [ + // { + // path: 'page', + // component: () => import('@/views/permission/page.vue'), + // name: 'PagePermission', + // meta: { + // title: 'Page Permission', + // roles: ['admin','teacher_user'] // or you can only set roles in sub nav + // } + // }, + // { + // path: 'directive', + // component: () => import('@/views/permission/directive.vue'), + // name: 'DirectivePermission', + // meta: { + // title: 'Directive Permission' + // // if do not set roles, means: this page does not require permission + // } + // }, + // { + // path: 'role', + // component: () => import('@/views/permission/role.vue'), + // name: 'RolePermission', + // meta: { + // title: 'Role Permission', + // roles: ['admin','teacher'] + // } + // } + // ] + // }, + + // 个人项目 { - path: '/permission', + path: '/myself', component: Layout, - redirect: '/permission/page', - name: 'Permission', + redirect: '/myself', meta: { alwaysShow: true, // will always show the root menu - title: 'Permission', - icon: 'lock', - roles: ['admin', 'editor','teacher_user'] // you can set roles in root nav + title: '个人项目', + icon: 'nested', + roles: ['admin', 'teacher_user'] }, children: [ { - path: 'page', - component: () => import('@/views/permission/page.vue'), - name: 'PagePermission', - meta: { - title: 'Page Permission', - roles: ['admin','teacher_user'] // or you can only set roles in sub nav - } + // 我负责的 + path: 'charge', + component: () => import('@/views/personal/project/charge.vue'), + name: 'Charge', + meta: { title: '我负责的', icon: 'user', affix: true } }, { - path: 'directive', - component: () => import('@/views/permission/directive.vue'), - name: 'DirectivePermission', - meta: { - title: 'Directive Permission' - // if do not set roles, means: this page does not require permission - } + // 我管理的 + path: 'manage', + component: () => import('@/views/personal/project/manage.vue'), + name: 'Manage', + meta: { title: '我管理的', icon: 'user', affix: true } }, { - path: 'role', - component: () => import('@/views/permission/role.vue'), - name: 'RolePermission', - meta: { - title: 'Role Permission', - roles: ['admin','teacher'] - } - } - ] - }, + // 我参与的 + path: 'participate', + component: () => import('@/views/personal/project/participate.vue'), + name: 'Participate', + meta: { title: '我参与的', icon: 'user', affix: true } + }, + + + - { - path: '/icon', - component: Layout, - children: [ - { - path: 'index', - component: () => import('@/views/icons/index.vue'), - name: 'Icons', - meta: { title: 'Icons', icon: 'icon', noCache: true } - } ] }, + + + // { + // path: '/icon', + // component: Layout, + // children: [ + // { + // path: 'index', + // component: () => import('@/views/icons/index.vue'), + // name: 'Icons', + // meta: { title: 'Icons', icon: 'icon', noCache: true } + // } + // ] + // }, // /** when your routing map is too long, you can split it into small modules **/ - componentsRouter, - chartsRouter, - nestedRouter, - tableRouter, + // componentsRouter, + // chartsRouter, + // nestedRouter, + // tableRouter, - { - path: '/example', - component: Layout, - redirect: '/example/list', - name: 'Example', - meta: { - title: 'Example', - icon: markRaw(IconHelp) - }, - children: [ - { - path: 'create', - component: () => import('@/views/example/create.vue'), - name: 'CreateArticle', - meta: { title: 'Create Article', icon: 'edit' } - }, - { - path: 'edit/:id(\\d+)', - component: () => import('@/views/example/edit.vue'), - name: 'EditArticle', - meta: { hidden: true, title: 'Edit Article', noCache: true, activeMenu: '/example/list' } - }, - { - path: 'list', - component: () => import('@/views/example/list.vue'), - name: 'ArticleList', - meta: { title: 'Article List', icon: 'list' } - } - ] - }, + // { + // path: '/example', + // component: Layout, + // redirect: '/example/list', + // name: 'Example', + // meta: { + // title: 'Example', + // icon: markRaw(IconHelp) + // }, + // children: [ + // { + // path: 'create', + // component: () => import('@/views/example/create.vue'), + // name: 'CreateArticle', + // meta: { title: 'Create Article', icon: 'edit' } + // }, + // { + // path: 'edit/:id(\\d+)', + // component: () => import('@/views/example/edit.vue'), + // name: 'EditArticle', + // meta: { hidden: true, title: 'Edit Article', noCache: true, activeMenu: '/example/list' } + // }, + // { + // path: 'list', + // component: () => import('@/views/example/list.vue'), + // name: 'ArticleList', + // meta: { title: 'Article List', icon: 'list' } + // } + // ] + // }, - { - path: '/tab', - component: Layout, - children: [ - { - path: 'index', - component: () => import('@/views/tab/index.vue'), - name: 'Tab', - meta: { title: 'Tab', icon: 'tab' } - } - ] - }, + // { + // path: '/tab', + // component: Layout, + // children: [ + // { + // path: 'index', + // component: () => import('@/views/tab/index.vue'), + // name: 'Tab', + // meta: { title: 'Tab', icon: 'tab' } + // } + // ] + // }, - { - path: '/error', - component: Layout, - redirect: 'noRedirect', - name: 'ErrorPages', - meta: { - title: 'Error Pages', - icon: '404' - }, - children: [ - { - path: '401', - component: () => import('@/views/error-page/401.vue'), - name: 'Page401', - meta: { title: '401', noCache: true } - }, - { - path: '404', - component: () => import('@/views/error-page/404.vue'), - name: 'Page404', - meta: { title: '404', noCache: true } - } - ] - }, + // { + // path: '/error', + // component: Layout, + // redirect: 'noRedirect', + // name: 'ErrorPages', + // meta: { + // title: 'Error Pages', + // icon: '404' + // }, + // children: [ + // { + // path: '401', + // component: () => import('@/views/error-page/401.vue'), + // name: 'Page401', + // meta: { title: '401', noCache: true } + // }, + // { + // path: '404', + // component: () => import('@/views/error-page/404.vue'), + // name: 'Page404', + // meta: { title: '404', noCache: true } + // } + // ] + // }, - { - path: '/error-log', - component: Layout, - children: [ - { - path: 'log', - component: () => import('@/views/error-log/index.vue'), - name: 'ErrorLog', - meta: { title: 'Error Log', icon: 'bug' } - } - ] - }, + // { + // path: '/error-log', + // component: Layout, + // children: [ + // { + // path: 'log', + // component: () => import('@/views/error-log/index.vue'), + // name: 'ErrorLog', + // meta: { title: 'Error Log', icon: 'bug' } + // } + // ] + // }, - { - path: '/excel', - component: Layout, - redirect: '/excel/export-excel', - name: 'Excel', - meta: { - title: 'Excel', - icon: 'excel' - }, - children: [ - { - path: 'export-excel', - component: () => import('@/views/excel/export-excel.vue'), - name: 'ExportExcel', - meta: { title: 'Export Excel' } - }, - { - path: 'export-selected-excel', - component: () => import('@/views/excel/select-excel.vue'), - name: 'SelectExcel', - meta: { title: 'Export Selected' } - }, - { - path: 'export-merge-header', - component: () => import('@/views/excel/merge-header.vue'), - name: 'MergeHeader', - meta: { title: 'Merge Header' } - }, - { - path: 'upload-excel', - component: () => import('@/views/excel/upload-excel.vue'), - name: 'UploadExcel', - meta: { title: 'Upload Excel' } - } - ] - }, + // { + // path: '/excel', + // component: Layout, + // redirect: '/excel/export-excel', + // name: 'Excel', + // meta: { + // title: 'Excel', + // icon: 'excel' + // }, + // children: [ + // { + // path: 'export-excel', + // component: () => import('@/views/excel/export-excel.vue'), + // name: 'ExportExcel', + // meta: { title: 'Export Excel' } + // }, + // { + // path: 'export-selected-excel', + // component: () => import('@/views/excel/select-excel.vue'), + // name: 'SelectExcel', + // meta: { title: 'Export Selected' } + // }, + // { + // path: 'export-merge-header', + // component: () => import('@/views/excel/merge-header.vue'), + // name: 'MergeHeader', + // meta: { title: 'Merge Header' } + // }, + // { + // path: 'upload-excel', + // component: () => import('@/views/excel/upload-excel.vue'), + // name: 'UploadExcel', + // meta: { title: 'Upload Excel' } + // } + // ] + // }, - { - path: '/zip', - component: Layout, - redirect: '/zip/download', - name: 'Zip', - meta: { alwaysShow: true, title: 'Zip', icon: 'zip' }, - children: [ - { - path: 'download', - component: () => import('@/views/zip/index.vue'), - name: 'ExportZip', - meta: { title: 'Export Zip' } - } - ] - }, + // { + // path: '/zip', + // component: Layout, + // redirect: '/zip/download', + // name: 'Zip', + // meta: { alwaysShow: true, title: 'Zip', icon: 'zip' }, + // children: [ + // { + // path: 'download', + // component: () => import('@/views/zip/index.vue'), + // name: 'ExportZip', + // meta: { title: 'Export Zip' } + // } + // ] + // }, - { - path: '/pdf', - component: Layout, - redirect: '/pdf/index', - children: [ - { - path: 'index', - component: () => import('@/views/pdf/index.vue'), - name: 'PDF', - meta: { title: 'PDF', icon: 'pdf' } - } - ] - }, - { - path: '/pdf/download', - component: () => import('@/views/pdf/download.vue'), - meta: { hidden: true } - }, + // { + // path: '/pdf', + // component: Layout, + // redirect: '/pdf/index', + // children: [ + // { + // path: 'index', + // component: () => import('@/views/pdf/index.vue'), + // name: 'PDF', + // meta: { title: 'PDF', icon: 'pdf' } + // } + // ] + // }, + // { + // path: '/pdf/download', + // component: () => import('@/views/pdf/download.vue'), + // meta: { hidden: true } + // }, - { - path: '/theme', - component: Layout, - children: [ - { - path: 'index', - component: () => import('@/views/theme/index.vue'), - name: 'Theme', - meta: { title: 'Theme', icon: 'theme' } - } - ] - }, + // { + // path: '/theme', + // component: Layout, + // children: [ + // { + // path: 'index', + // component: () => import('@/views/theme/index.vue'), + // name: 'Theme', + // meta: { title: 'Theme', icon: 'theme' } + // } + // ] + // }, - { - path: '/clipboard', - component: Layout, - children: [ - { - path: 'index', - component: () => import('@/views/clipboard/index.vue'), - name: 'ClipboardDemo', - meta: { title: 'Clipboard', icon: 'clipboard' } - } - ] - }, + // { + // path: '/clipboard', + // component: Layout, + // children: [ + // { + // path: 'index', + // component: () => import('@/views/clipboard/index.vue'), + // name: 'ClipboardDemo', + // meta: { title: 'Clipboard', icon: 'clipboard' } + // } + // ] + // }, - { - path: '/external-link', - component: Layout, - children: [ - { - path: 'https://element-plus.midfar.com', - meta: { title: 'External Link', icon: 'link' }, - redirect: '' - } - ] - }, + // { + // path: '/external-link', + // component: Layout, + // children: [ + // { + // path: 'https://element-plus.midfar.com', + // meta: { title: 'External Link', icon: 'link' }, + // redirect: '' + // } + // ] + // }, - { - path: '/my-demo', - component: Layout, - name: 'MyDemo', - meta: { - title: 'MyDemo', - icon: 'component' - }, - children: [ - { - path: 'element-demo', - component: () => import('@/views/mydemo/ElementDemo.vue'), - name: 'ElementDemo', - meta: { title: 'ElementDemo', icon: 'skill' } - }, - { - path: 'store-demo', - component: () => import('@/views/mydemo/StoreDemo.vue'), - name: 'StoreDemo', - meta: { title: 'StoreDemo', icon: 'lock' } - }, - { - path: 'webSocket-demo', - component: () => import('@/views/mydemo/WebSocketDemo.vue'), - name: 'WebSocketDemo', - meta: { title: 'WebSocketDemo', icon: 'lock' } - } - ] - }, + // { + // path: '/my-demo', + // component: Layout, + // name: 'MyDemo', + // meta: { + // title: 'MyDemo', + // icon: 'component' + // }, + // children: [ + // { + // path: 'element-demo', + // component: () => import('@/views/mydemo/ElementDemo.vue'), + // name: 'ElementDemo', + // meta: { title: 'ElementDemo', icon: 'skill' } + // }, + // { + // path: 'store-demo', + // component: () => import('@/views/mydemo/StoreDemo.vue'), + // name: 'StoreDemo', + // meta: { title: 'StoreDemo', icon: 'lock' } + // }, + // { + // path: 'webSocket-demo', + // component: () => import('@/views/mydemo/WebSocketDemo.vue'), + // name: 'WebSocketDemo', + // meta: { title: 'WebSocketDemo', icon: 'lock' } + // } + // ] + // }, // 404 page must be placed at the end !!! { path: '/:pathMatch(.*)*', redirect: '/404', meta: { hidden: true }} diff --git a/src/router/modules/table.ts b/src/router/modules/table.ts index 63869e6..eb67326 100644 --- a/src/router/modules/table.ts +++ b/src/router/modules/table.ts @@ -2,6 +2,7 @@ const Layout = () => import('@/layout/index.vue'); +//侧边栏 const tableRouter = { path: '/table', component: Layout, diff --git a/src/views/personal/project/charge.vue b/src/views/personal/project/charge.vue new file mode 100644 index 0000000..b8461c3 --- /dev/null +++ b/src/views/personal/project/charge.vue @@ -0,0 +1,3 @@ + + hello + \ No newline at end of file diff --git a/src/views/personal/project/manage.vue b/src/views/personal/project/manage.vue new file mode 100644 index 0000000..a704adf --- /dev/null +++ b/src/views/personal/project/manage.vue @@ -0,0 +1,124 @@ + + + + 项目1 + + + 名称 + + + + 状态 + + + + 查询 + 重置 + + + + + + 子系统列表 + + + + + {{ scope.row.date }} + + + + + + + + + + 查看详情 + + + + + + + + + + \ No newline at end of file diff --git a/src/views/personal/project/participate.vue b/src/views/personal/project/participate.vue new file mode 100644 index 0000000..5cd477b --- /dev/null +++ b/src/views/personal/project/participate.vue @@ -0,0 +1,3 @@ + + hi + \ No newline at end of file From a0991d6d3ca1dbacff2338c0f1f724a895a63241 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A6=96=E5=A7=90?= <2981176548@qq.com> Date: Mon, 15 Apr 2024 20:37:53 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E7=99=BB=E5=BD=95=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E5=AE=8C=E5=96=841=E4=BB=A5=E5=8F=8A=E6=97=A5=E5=BF=97?= =?UTF-8?q?=EF=BC=8C=E4=BF=A1=E6=81=AF=E5=81=87=E7=95=8C=E9=9D=A2=E5=BC=95?= =?UTF-8?q?=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components.d.ts | 14 +- src/layout/components/Navbar.vue | 3 +- src/permission.ts | 3 +- src/router/index.ts | 64 ++--- src/store/modules/user.ts | 60 ++++- src/utils/request.js | 60 +++-- src/utils/validate.ts | 2 +- src/views/login/Register.vue | 417 ++++++++++++++++++++++++++++++ src/views/login/index.vue | 423 ++++++++++++++++++++++++++----- 9 files changed, 908 insertions(+), 138 deletions(-) create mode 100644 src/views/login/Register.vue diff --git a/components.d.ts b/components.d.ts index 99f3489..6de8fe2 100644 --- a/components.d.ts +++ b/components.d.ts @@ -13,17 +13,17 @@ declare module '@vue/runtime-core' { DropdownMenu: typeof import('./src/components/Share/DropdownMenu.vue')['default'] Dropzone: typeof import('./src/components/Dropzone/index.vue')['default'] EditorImage: typeof import('./src/components/Tinymce/components/EditorImage.vue')['default'] - ElAlert: typeof import('element-plus/es')['ElAlert'] + ElAutocomplete: typeof import('element-plus/es')['ElAutocomplete'] ElBadge: typeof import('element-plus/es')['ElBadge'] ElBreadcrumb: typeof import('element-plus/es')['ElBreadcrumb'] ElBreadcrumbItem: typeof import('element-plus/es')['ElBreadcrumbItem'] ElButton: typeof import('element-plus/es')['ElButton'] ElCard: typeof import('element-plus/es')['ElCard'] - ElCheckbox: typeof import('element-plus/es')['ElCheckbox'] ElCol: typeof import('element-plus/es')['ElCol'] ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider'] ElDatePicker: typeof import('element-plus/es')['ElDatePicker'] ElDialog: typeof import('element-plus/es')['ElDialog'] + ElDivider: typeof import('element-plus/es')['ElDivider'] ElDropdown: typeof import('element-plus/es')['ElDropdown'] ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem'] ElDropdownMenu: typeof import('element-plus/es')['ElDropdownMenu'] @@ -31,15 +31,14 @@ declare module '@vue/runtime-core' { ElFormItem: typeof import('element-plus/es')['ElFormItem'] ElIcon: typeof import('element-plus/es')['ElIcon'] ElInput: typeof import('element-plus/es')['ElInput'] + ElInputNumber: typeof import('element-plus/es')['ElInputNumber'] ElMenu: typeof import('element-plus/es')['ElMenu'] ElMenuItem: typeof import('element-plus/es')['ElMenuItem'] ElOption: typeof import('element-plus/es')['ElOption'] ElPagination: typeof import('element-plus/es')['ElPagination'] ElProgress: typeof import('element-plus/es')['ElProgress'] ElRadio: typeof import('element-plus/es')['ElRadio'] - ElRadioButton: typeof import('element-plus/es')['ElRadioButton'] ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup'] - ElRate: typeof import('element-plus/es')['ElRate'] ElRow: typeof import('element-plus/es')['ElRow'] ElScrollbar: typeof import('element-plus/es')['ElScrollbar'] ElSelect: typeof import('element-plus/es')['ElSelect'] @@ -48,12 +47,8 @@ declare module '@vue/runtime-core' { ElSwitch: typeof import('element-plus/es')['ElSwitch'] ElTable: typeof import('element-plus/es')['ElTable'] ElTableColumn: typeof import('element-plus/es')['ElTableColumn'] - ElTabPane: typeof import('element-plus/es')['ElTabPane'] - ElTabs: typeof import('element-plus/es')['ElTabs'] ElTag: typeof import('element-plus/es')['ElTag'] ElTooltip: typeof import('element-plus/es')['ElTooltip'] - ElTree: typeof import('element-plus/es')['ElTree'] - ElUpload: typeof import('element-plus/es')['ElUpload'] ErrorLog: typeof import('./src/components/ErrorLog/index.vue')['default'] GithubCorner: typeof import('./src/components/GithubCorner/index.vue')['default'] Hamburger: typeof import('./src/components/Hamburger/index.vue')['default'] @@ -80,7 +75,4 @@ declare module '@vue/runtime-core' { UploadExcel: typeof import('./src/components/UploadExcel/index.vue')['default'] VueCountTo: typeof import('./src/components/vue-count-to/vue-countTo.vue')['default'] } - export interface ComponentCustomProperties { - vLoading: typeof import('element-plus/es')['ElLoadingDirective'] - } } diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue index e6425cb..88c2bf4 100644 --- a/src/layout/components/Navbar.vue +++ b/src/layout/components/Navbar.vue @@ -89,7 +89,8 @@ export default defineComponent({ async logout() { console.log('5989569898') // store.user().login() - await store.user().logout(); + // await store.user().logout(); + await store.user().logout(); this.$router.push(`/login?redirect=${this.$route.fullPath}`); } } diff --git a/src/permission.ts b/src/permission.ts index 9ec568c..1c06398 100644 --- a/src/permission.ts +++ b/src/permission.ts @@ -5,10 +5,11 @@ import NProgress from 'nprogress'; // progress bar import 'nprogress/nprogress.css'; // progress bar style import { getToken } from '@/utils/auth'; // get token from cookie import getPageTitle from '@/utils/get-page-title'; +import {ElMessage} from "element-plus"; NProgress.configure({ showSpinner: false }); // NProgress Configuration -const whiteList = ['/login', '/auth-redirect']; // no redirect whitelist +const whiteList = ['/login', '/auth-redirect', '/register']; // no redirect whitelist //每次路由变动,都会调用这个路由守卫 router.beforeEach(async (to, from, next) => { diff --git a/src/router/index.ts b/src/router/index.ts index c133cd0..3e8bd0d 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -60,7 +60,7 @@ export const constantRoutes:RouteRecordRaw[] = [ path: 'dashboard', component: () => import('@/views/dashboard/index.vue'), name: 'Dashboard', - meta: { title: '我管理的', icon: 'dashboard', affix: true } + meta: { title: '首页', icon: 'dashboard', affix: true } } ] }, @@ -153,7 +153,7 @@ export const asyncRoutes:RouteRecordRaw[] = [ // } // ] // }, - + // 个人项目 { path: '/myself', @@ -163,7 +163,7 @@ export const asyncRoutes:RouteRecordRaw[] = [ alwaysShow: true, // will always show the root menu title: '个人项目', icon: 'nested', - roles: ['admin', 'teacher_user'] + roles: ['admin', 'teacher_user'] }, children: [ { @@ -187,13 +187,13 @@ export const asyncRoutes:RouteRecordRaw[] = [ name: 'Participate', meta: { title: '我参与的', icon: 'user', affix: true } }, - - - + + + ] }, - + // { // path: '/icon', @@ -245,18 +245,18 @@ export const asyncRoutes:RouteRecordRaw[] = [ // ] // }, - // { - // path: '/tab', - // component: Layout, - // children: [ - // { - // path: 'index', - // component: () => import('@/views/tab/index.vue'), - // name: 'Tab', - // meta: { title: 'Tab', icon: 'tab' } - // } - // ] - // }, + { + path: '/daily', + component: Layout, + children: [ + { + path: 'd', + component: () => import('@/views/tab/index.vue'), + name: 'Tab', + meta: { title: '日报', icon: 'tab' } + } + ] + }, // { // path: '/error', @@ -283,18 +283,18 @@ export const asyncRoutes:RouteRecordRaw[] = [ // ] // }, - // { - // path: '/error-log', - // component: Layout, - // children: [ - // { - // path: 'log', - // component: () => import('@/views/error-log/index.vue'), - // name: 'ErrorLog', - // meta: { title: 'Error Log', icon: 'bug' } - // } - // ] - // }, + { + path: '/message', + component: Layout, + children: [ + { + path: 'ms', + component: () => import('@/views/error-log/index.vue'), + name: 'ErrorLog', + meta: { title: '信息', icon: 'bug' } + } + ] + }, // { // path: '/excel', @@ -367,7 +367,7 @@ export const asyncRoutes:RouteRecordRaw[] = [ // component: () => import('@/views/pdf/download.vue'), // meta: { hidden: true } // }, - + // // { // path: '/theme', // component: Layout, diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index f667c0e..7d2e77d 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -4,6 +4,7 @@ import { getToken, setToken, removeToken } from '@/utils/auth'; import router, { resetRouter } from '@/router'; import tagsViewStore from './tagsView'; import permissionStore from './permission'; +// import {response} from "express"; export interface IUserState { token: string; @@ -57,12 +58,18 @@ export default defineStore({ const { data } = response; this.token = data.token; setToken(data.token); - console.log("token", this.token) + // console.log("token", this.token) + console.log("response", response) + // @ts-ignore + ElMessage.success(response.message) router.push('/') resolve(); - console.log('2222',response) + // console.log('2222',response) }).catch(error => { - console.log('3333',error) + //@ts-ignore + // ElMessage.error(response.message) + console.log("login ERROR:", error) + // console.log('3333',error) reject(error); }); }); @@ -77,13 +84,13 @@ export default defineStore({ if (!data) { reject('Verification failed, please Login again.'); } - const { id,username,address,phone,email,age,signature,avatar,nickname,sex,description } = data; + const { id,username,address,phone,email,age,signature,avatar,nickname,sex,description,role } = data; // roles must be a non-empty array // if (!roles || roles.length <= 0) { // reject('getInfo: roles must be a non-null array!'); // } this.id = id; - // this.roles = roles; + this.roles = role.name; // this.roles =['admin']; this.username = username; this.avatar = avatar; @@ -96,6 +103,7 @@ export default defineStore({ this.signature = signature; this.nickname = nickname; resolve(data); + }).catch(error => { reject(error); }); @@ -109,9 +117,27 @@ export default defineStore({ apiLogout(this.token).then(() => { this.token = ''; this.roles = []; - console.log('退出',this.token) + // console.log('退出',this.token) removeToken(); resetRouter(); + ElMessage.success("退出成功") + // reset visited views and cached views + // to fixed https://github.com/PanJiaChen/vue-element-admin/issues/2485 + tagsViewStore().delAllViews(); + resolve(); + }).catch(error => { + reject(error); + }); + + }); + }, + logoutBug():Promise { + console.log("token",this.token) + return new Promise((resolve, reject) => { + apiLogout(this.token).then(() => { + this.token = ''; + this.roles = []; + resetRouter(); // reset visited views and cached views // to fixed https://github.com/PanJiaChen/vue-element-admin/issues/2485 tagsViewStore().delAllViews(); @@ -119,8 +145,30 @@ export default defineStore({ }).catch(error => { reject(error); }); + }); }, + logoutTest(): void { + removeToken(); + console.log("removeTokenTestSuccess"); + // console.log("token",this.token) + // return new Promise((resolve, reject) => { + // apiLogout(this.token).then(() => { + // this.token = ''; + // this.roles = []; + // console.log('退出',this.token) + // // removeToken(); + // resetRouter(); + // // reset visited views and cached views + // // to fixed https://github.com/PanJiaChen/vue-element-admin/issues/2485 + // tagsViewStore().delAllViews(); + // resolve(); + // }).catch(error => { + // reject(error); + // }); + // + // }); + }, // remove token resetToken() { diff --git a/src/utils/request.js b/src/utils/request.js index f53feda..16fa54b 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -1,8 +1,11 @@ import axios from 'axios'; import store from '@/store'; +import {useRouter} from 'vue-router' import {getToken, removeToken} from '@/utils/auth'; +import {resetRouter} from "@/router"; const BaseURL ='https://nbxt.oa.x-lf.cn' +const router = useRouter(); // create an axios instance const service = axios.create({ baseURL: BaseURL, // url = base url + request url @@ -45,31 +48,42 @@ service.interceptors.response.use( response => { const res = response.data; // console.log("removeToken:",removeToken()) - console.log('999999',response) - // if the custom code is not 20000, it is judged as an error. - if (res.code !== 20000 && res.code !== 200) { - ElMessage({ - message: res.message || 'Error', - type: 'error', - duration: 5 * 1000 - }); + console.log('999999',res) + if (res.code === 40103) { + store.user().logoutTest(); + console.log("返回登录成功") + location.reload(); - // 50008: Illegal token; 50012: Other clients logged in; 50014: Token expired; - if (res.code === 50008 || res.code === 50012 || res.code === 50014) { - // to re-login - ElMessageBox.confirm('You have been logged out, you can cancel to stay on this page, or log in again', 'Confirm logout', { - confirmButtonText: 'Re-Login', - cancelButtonText: 'Cancel', - type: 'warning' - }).then(() => { - store.user().resetToken(); - location.reload(); - }); - } - return Promise.reject(new Error(res.message || 'Error')); - } else { - return res; + // resetRouter() + // router.push("/login") + } else if (res.code !== 200) { + ElMessage.error(res.message) } + // if the custom code is not 20000, it is judged as an error. + // if (res.code !== 20000 && res.code !== 200) { + // ElMessage({ + // message: res.message || 'Error', + // type: 'error', + // duration: 5 * 1000 + // }); + // + // // 50008: Illegal token; 50012: Other clients logged in; 50014: Token expired; + // if (res.code === 50008 || res.code === 50012 || res.code === 50014) { + // // to re-login + // ElMessageBox.confirm('You have been logged out, you can cancel to stay on this page, or log in again', 'Confirm logout', { + // confirmButtonText: 'Re-Login', + // cancelButtonText: 'Cancel', + // type: 'warning' + // }).then(() => { + // store.user().resetToken(); + // location.reload(); + // }); + // } + // return Promise.reject(new Error(res.message || 'Error')); + // } else { + // return res; + // } + return res; }, error => { console.log('err' + error); // for debug diff --git a/src/utils/validate.ts b/src/utils/validate.ts index 9ad5080..da6633c 100644 --- a/src/utils/validate.ts +++ b/src/utils/validate.ts @@ -15,7 +15,7 @@ export function isExternal(path) { * @returns {Boolean} */ export function validUsername(str) { - const valid_map = ['admin', 'editor', 'teacher_user']; + const valid_map = ['admin', 'editor', 'teacher_user', 'teacher_demo', 'demo', 'xiao_lfeng', 'yangna']; return valid_map.indexOf(str.trim()) >= 0; } diff --git a/src/views/login/Register.vue b/src/views/login/Register.vue new file mode 100644 index 0000000..bf9e9d6 --- /dev/null +++ b/src/views/login/Register.vue @@ -0,0 +1,417 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 注册 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/views/login/index.vue b/src/views/login/index.vue index 145d3ef..7f54039 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -1,65 +1,92 @@ - - + + + + + + + - - Login Form - + + Login Form + - - - - - - + + + + + + - - - - - - - + + + + + + + - - + + - - Login + + Login - - - Username : admin - Password : any - - - Username : editor - Password : any + + + + + + + + + + + + Or connect with + + + + + + Can not be simulated on local, so please combine you own business simulation! ! ! + + + + + + + + + + + + + + + 加入我们 + + 加入我们,成为团队的一份子。 + + + 去注册 + + + + + + - - Or connect with - - - - - - Can not be simulated on local, so please combine you own business simulation! ! ! - - - - - -
+ 加入我们,成为团队的一份子。 +