Merge remote-tracking branch 'origin/master' into feature-guji
# Conflicts: # .env.dev_prod # components.d.ts # src/api/user.js # src/router/index.ts # src/store/modules/user.ts # src/views/login/index.vue
This commit is contained in:
commit
5293fc2840
@ -4,4 +4,4 @@ NODE_ENV = 'development'
|
|||||||
# 开发模式连生产服
|
# 开发模式连生产服
|
||||||
VUE_APP_BASE_API = '/api-prod'
|
VUE_APP_BASE_API = '/api-prod'
|
||||||
VUE_APP_COOKIE = ''
|
VUE_APP_COOKIE = ''
|
||||||
VUE_APP_BASE_API2 = 'http://nbxt.oa.x-lf.cn'
|
VUE_APP_INNER='http://nbxt.oa.x-lf.cn'
|
17
components.d.ts
vendored
17
components.d.ts
vendored
@ -13,17 +13,13 @@ declare module '@vue/runtime-core' {
|
|||||||
DropdownMenu: typeof import('./src/components/Share/DropdownMenu.vue')['default']
|
DropdownMenu: typeof import('./src/components/Share/DropdownMenu.vue')['default']
|
||||||
Dropzone: typeof import('./src/components/Dropzone/index.vue')['default']
|
Dropzone: typeof import('./src/components/Dropzone/index.vue')['default']
|
||||||
EditorImage: typeof import('./src/components/Tinymce/components/EditorImage.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']
|
ElBadge: typeof import('element-plus/es')['ElBadge']
|
||||||
ElBreadcrumb: typeof import('element-plus/es')['ElBreadcrumb']
|
ElBreadcrumb: typeof import('element-plus/es')['ElBreadcrumb']
|
||||||
ElBreadcrumbItem: typeof import('element-plus/es')['ElBreadcrumbItem']
|
ElBreadcrumbItem: typeof import('element-plus/es')['ElBreadcrumbItem']
|
||||||
ElButton: typeof import('element-plus/es')['ElButton']
|
ElButton: typeof import('element-plus/es')['ElButton']
|
||||||
ElButtonGroup: typeof import('element-plus/es')['ElButtonGroup']
|
|
||||||
ElCard: typeof import('element-plus/es')['ElCard']
|
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']
|
ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider']
|
||||||
ElDatePicker: typeof import('element-plus/es')['ElDatePicker']
|
|
||||||
ElDialog: typeof import('element-plus/es')['ElDialog']
|
ElDialog: typeof import('element-plus/es')['ElDialog']
|
||||||
ElDropdown: typeof import('element-plus/es')['ElDropdown']
|
ElDropdown: typeof import('element-plus/es')['ElDropdown']
|
||||||
ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem']
|
ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem']
|
||||||
@ -35,22 +31,14 @@ declare module '@vue/runtime-core' {
|
|||||||
ElMenu: typeof import('element-plus/es')['ElMenu']
|
ElMenu: typeof import('element-plus/es')['ElMenu']
|
||||||
ElMenuItem: typeof import('element-plus/es')['ElMenuItem']
|
ElMenuItem: typeof import('element-plus/es')['ElMenuItem']
|
||||||
ElOption: typeof import('element-plus/es')['ElOption']
|
ElOption: typeof import('element-plus/es')['ElOption']
|
||||||
ElPagination: typeof import('element-plus/es')['ElPagination']
|
|
||||||
ElPopover: typeof import('element-plus/es')['ElPopover']
|
|
||||||
ElProgress: typeof import('element-plus/es')['ElProgress']
|
ElProgress: typeof import('element-plus/es')['ElProgress']
|
||||||
ElRadio: typeof import('element-plus/es')['ElRadio']
|
|
||||||
ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup']
|
|
||||||
ElRate: typeof import('element-plus/es')['ElRate']
|
|
||||||
ElRow: typeof import('element-plus/es')['ElRow']
|
ElRow: typeof import('element-plus/es')['ElRow']
|
||||||
ElScrollbar: typeof import('element-plus/es')['ElScrollbar']
|
ElScrollbar: typeof import('element-plus/es')['ElScrollbar']
|
||||||
ElSelect: typeof import('element-plus/es')['ElSelect']
|
ElSelect: typeof import('element-plus/es')['ElSelect']
|
||||||
ElSlider: typeof import('element-plus/es')['ElSlider']
|
|
||||||
ElSubMenu: typeof import('element-plus/es')['ElSubMenu']
|
ElSubMenu: typeof import('element-plus/es')['ElSubMenu']
|
||||||
ElSwitch: typeof import('element-plus/es')['ElSwitch']
|
ElSwitch: typeof import('element-plus/es')['ElSwitch']
|
||||||
ElTable: typeof import('element-plus/es')['ElTable']
|
ElTable: typeof import('element-plus/es')['ElTable']
|
||||||
ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
|
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']
|
ElTag: typeof import('element-plus/es')['ElTag']
|
||||||
ElTooltip: typeof import('element-plus/es')['ElTooltip']
|
ElTooltip: typeof import('element-plus/es')['ElTooltip']
|
||||||
ErrorLog: typeof import('./src/components/ErrorLog/index.vue')['default']
|
ErrorLog: typeof import('./src/components/ErrorLog/index.vue')['default']
|
||||||
@ -79,7 +67,4 @@ declare module '@vue/runtime-core' {
|
|||||||
UploadExcel: typeof import('./src/components/UploadExcel/index.vue')['default']
|
UploadExcel: typeof import('./src/components/UploadExcel/index.vue')['default']
|
||||||
VueCountTo: typeof import('./src/components/vue-count-to/vue-countTo.vue')['default']
|
VueCountTo: typeof import('./src/components/vue-count-to/vue-countTo.vue')['default']
|
||||||
}
|
}
|
||||||
export interface ComponentCustomProperties {
|
|
||||||
vLoading: typeof import('element-plus/es')['ElLoadingDirective']
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,24 +1,39 @@
|
|||||||
import request from '@/utils/request';
|
import request from '@/utils/request';
|
||||||
|
|
||||||
|
|
||||||
|
function getCurrentTimestamp() {
|
||||||
|
return new Date().getTime();
|
||||||
|
}
|
||||||
export function login(data) {
|
export function login(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/auth/login',
|
url: '/auth/login',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data
|
data,
|
||||||
|
headers: {
|
||||||
|
'Timestamp':getCurrentTimestamp()
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getInfo(token) {
|
export function getInfo(token) {
|
||||||
return request({
|
return request({
|
||||||
url: '/vue-element-admin/user/info',
|
url: '/user/profile/get',
|
||||||
method: 'get',
|
method: 'post',
|
||||||
params: { token }
|
params: {token},
|
||||||
|
headers: {
|
||||||
|
'Timestamp': getCurrentTimestamp()
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export function logout(token) {
|
export function logout(token) {
|
||||||
return request({
|
return request({
|
||||||
url: '/vue-element-admin/user/logout',
|
url: '/auth/logout',
|
||||||
method: 'post',
|
method: 'get',
|
||||||
params: { token }
|
params: { token },
|
||||||
|
headers: {
|
||||||
|
'Timestamp': getCurrentTimestamp()
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ router.beforeEach(async (to, from, next) => {
|
|||||||
|
|
||||||
// determine whether the user has logged in
|
// determine whether the user has logged in
|
||||||
const hasToken = getToken();
|
const hasToken = getToken();
|
||||||
|
console.log('88888',hasToken)
|
||||||
if (hasToken) {
|
if (hasToken) {
|
||||||
if (to.path === '/login') {
|
if (to.path === '/login') {
|
||||||
// if is logged in, redirect to the home page
|
// if is logged in, redirect to the home page
|
||||||
@ -28,7 +28,9 @@ router.beforeEach(async (to, from, next) => {
|
|||||||
next({ path: '/' });
|
next({ path: '/' });
|
||||||
} else {
|
} else {
|
||||||
// determine whether the user has obtained his permission roles through getInfo
|
// determine whether the user has obtained his permission roles through getInfo
|
||||||
const hasRoles = userStore().roles && userStore().roles.length > 0;
|
// const hasRoles = userStore().roles && userStore().roles.length > 0;
|
||||||
|
const hasRoles = true;
|
||||||
|
|
||||||
// console.log('hasRoles=', hasRoles);
|
// console.log('hasRoles=', hasRoles);
|
||||||
if (hasRoles) {
|
if (hasRoles) {
|
||||||
next();
|
next();
|
||||||
@ -38,6 +40,7 @@ router.beforeEach(async (to, from, next) => {
|
|||||||
// note: roles must be a object array! such as: ['admin'] or ,['developer','editor']
|
// note: roles must be a object array! such as: ['admin'] or ,['developer','editor']
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
const infoRes = await userStore().getInfo() as any;
|
const infoRes = await userStore().getInfo() as any;
|
||||||
|
console.log('permissionuserinfor:',infoRes)
|
||||||
let roles = [];
|
let roles = [];
|
||||||
if (infoRes.roles) {
|
if (infoRes.roles) {
|
||||||
roles = infoRes.roles;
|
roles = infoRes.roles;
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
// import { markRaw } from 'vue';
|
import { markRaw } from 'vue';
|
||||||
import { createRouter, createWebHistory } from 'vue-router'; // createWebHashHistory, createWebHistory
|
import { createRouter, createWebHistory } from 'vue-router'; // createWebHashHistory, createWebHistory
|
||||||
import type { Router, RouteRecordRaw, RouteComponent } from 'vue-router';
|
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 */
|
/* Layout */
|
||||||
const Layout = ():RouteComponent => import('@/layout/index.vue');
|
const Layout = ():RouteComponent => import('@/layout/index.vue');
|
||||||
|
|
||||||
/* Router Modules */
|
/* Router Modules */
|
||||||
// import componentsRouter from './modules/components';
|
import componentsRouter from './modules/components';
|
||||||
// import chartsRouter from './modules/charts';
|
import chartsRouter from './modules/charts';
|
||||||
// import nestedRouter from './modules/nested';
|
import nestedRouter from './modules/nested';
|
||||||
import tableRouter from './modules/table';
|
import tableRouter from './modules/table';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -51,44 +51,44 @@ export const constantRoutes:RouteRecordRaw[] = [
|
|||||||
component: () => import('@/views/error-page/401.vue'),
|
component: () => import('@/views/error-page/401.vue'),
|
||||||
meta: { hidden: true }
|
meta: { hidden: true }
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// path: '/',
|
path: '/',
|
||||||
// component: Layout,
|
component: Layout,
|
||||||
// redirect: '/dashboard',
|
redirect: '/dashboard',
|
||||||
// children: [
|
children: [
|
||||||
// {
|
{
|
||||||
// path: 'dashboard',
|
path: 'dashboard',
|
||||||
// component: () => import('@/views/dashboard/index.vue'),
|
component: () => import('@/views/dashboard/index.vue'),
|
||||||
// name: 'Dashboard',
|
name: 'Dashboard',
|
||||||
// meta: { title: 'Dashboard', icon: 'dashboard', affix: true }
|
meta: { title: '我管理的', icon: 'dashboard', affix: true }
|
||||||
// }
|
}
|
||||||
// ]
|
]
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// path: '/documentation',
|
path: '/documentation',
|
||||||
// component: Layout,
|
component: Layout,
|
||||||
// children: [
|
children: [
|
||||||
// {
|
{
|
||||||
// path: 'index',
|
path: 'index',
|
||||||
// component: () => import('@/views/documentation/index.vue'),
|
component: () => import('@/views/documentation/index.vue'),
|
||||||
// name: 'Documentation',
|
name: 'Documentation',
|
||||||
// meta: { title: 'Documentation', icon: 'documentation', affix: true }
|
meta: { title: 'Documentation', icon: 'documentation', affix: true }
|
||||||
// }
|
}
|
||||||
// ]
|
]
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// path: '/guide',
|
path: '/guide',
|
||||||
// component: Layout,
|
component: Layout,
|
||||||
// redirect: '/guide/index',
|
redirect: '/guide/index',
|
||||||
// children: [
|
children: [
|
||||||
// {
|
{
|
||||||
// path: 'index',
|
path: 'index',
|
||||||
// component: () => import('@/views/guide/index.vue'),
|
component: () => import('@/views/guide/index.vue'),
|
||||||
// name: 'Guide',
|
name: 'Guide',
|
||||||
// meta: { title: 'Guide', icon: 'guide', noCache: true }
|
meta: { title: 'Guide', icon: 'guide', noCache: true }
|
||||||
// }
|
}
|
||||||
// ]
|
]
|
||||||
// },
|
},
|
||||||
{
|
{
|
||||||
path: '/profile',
|
path: '/profile',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
@ -118,91 +118,91 @@ export const asyncRoutes:RouteRecordRaw[] = [
|
|||||||
redirect: '/permission/page',
|
redirect: '/permission/page',
|
||||||
name: 'Permission',
|
name: 'Permission',
|
||||||
meta: {
|
meta: {
|
||||||
// alwaysShow: true, // will always show the root menu
|
alwaysShow: true, // will always show the root menu
|
||||||
title: '内部系统'
|
title: 'Permission',
|
||||||
// icon: 'lock'
|
icon: 'lock',
|
||||||
// roles: ['admin', 'editor'] // you can set roles in root nav
|
roles: ['admin', 'editor','teacher_user'] // you can set roles in root nav
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
// {
|
{
|
||||||
// path: 'page',
|
path: 'page',
|
||||||
// component: () => import('@/views/permission/page.vue'),
|
component: () => import('@/views/permission/page.vue'),
|
||||||
// name: 'PagePermission',
|
name: 'PagePermission',
|
||||||
// meta: {
|
meta: {
|
||||||
// title: 'Page Permission',
|
title: 'Page Permission',
|
||||||
// roles: ['admin'] // or you can only set roles in sub nav
|
roles: ['admin','teacher_user'] // or you can only set roles in sub nav
|
||||||
// }
|
}
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// path: 'directive',
|
path: 'directive',
|
||||||
// component: () => import('@/views/permission/directive.vue'),
|
component: () => import('@/views/permission/directive.vue'),
|
||||||
// name: 'DirectivePermission',
|
name: 'DirectivePermission',
|
||||||
// meta: {
|
meta: {
|
||||||
// title: 'Directive Permission'
|
title: 'Directive Permission'
|
||||||
// // if do not set roles, means: this page does not require permission
|
// if do not set roles, means: this page does not require permission
|
||||||
// }
|
}
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// path: 'role',
|
path: 'role',
|
||||||
// component: () => import('@/views/permission/role.vue'),
|
component: () => import('@/views/permission/role.vue'),
|
||||||
// name: 'RolePermission',
|
name: 'RolePermission',
|
||||||
// meta: {
|
meta: {
|
||||||
// title: 'Role Permission',
|
title: 'Role Permission',
|
||||||
// roles: ['admin']
|
roles: ['admin','teacher']
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
// {
|
{
|
||||||
// path: '/icon',
|
path: '/icon',
|
||||||
// component: Layout,
|
component: Layout,
|
||||||
// children: [
|
children: [
|
||||||
// {
|
{
|
||||||
// path: 'index',
|
path: 'index',
|
||||||
// component: () => import('@/views/icons/index.vue'),
|
component: () => import('@/views/icons/index.vue'),
|
||||||
// name: 'Icons',
|
name: 'Icons',
|
||||||
// meta: { title: 'Icons', icon: 'icon', noCache: true }
|
meta: { title: 'Icons', icon: 'icon', noCache: true }
|
||||||
// }
|
}
|
||||||
// ]
|
]
|
||||||
// },
|
},
|
||||||
|
|
||||||
// /** when your routing map is too long, you can split it into small modules **/
|
// /** when your routing map is too long, you can split it into small modules **/
|
||||||
// componentsRouter,
|
componentsRouter,
|
||||||
// chartsRouter,
|
chartsRouter,
|
||||||
// nestedRouter,
|
nestedRouter,
|
||||||
tableRouter,
|
tableRouter,
|
||||||
//
|
|
||||||
// {
|
{
|
||||||
// path: '/example',
|
path: '/example',
|
||||||
// component: Layout,
|
component: Layout,
|
||||||
// redirect: '/example/list',
|
redirect: '/example/list',
|
||||||
// name: 'Example',
|
name: 'Example',
|
||||||
// meta: {
|
meta: {
|
||||||
// title: 'Example',
|
title: 'Example',
|
||||||
// icon: markRaw(IconHelp)
|
icon: markRaw(IconHelp)
|
||||||
// },
|
},
|
||||||
// children: [
|
children: [
|
||||||
// {
|
{
|
||||||
// path: 'create',
|
path: 'create',
|
||||||
// component: () => import('@/views/example/create.vue'),
|
component: () => import('@/views/example/create.vue'),
|
||||||
// name: 'CreateArticle',
|
name: 'CreateArticle',
|
||||||
// meta: { title: 'Create Article', icon: 'edit' }
|
meta: { title: 'Create Article', icon: 'edit' }
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// path: 'edit/:id(\\d+)',
|
path: 'edit/:id(\\d+)',
|
||||||
// component: () => import('@/views/example/edit.vue'),
|
component: () => import('@/views/example/edit.vue'),
|
||||||
// name: 'EditArticle',
|
name: 'EditArticle',
|
||||||
// meta: { hidden: true, title: 'Edit Article', noCache: true, activeMenu: '/example/list' }
|
meta: { hidden: true, title: 'Edit Article', noCache: true, activeMenu: '/example/list' }
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// path: 'list',
|
path: 'list',
|
||||||
// component: () => import('@/views/example/list.vue'),
|
component: () => import('@/views/example/list.vue'),
|
||||||
// name: 'ArticleList',
|
name: 'ArticleList',
|
||||||
// meta: { title: 'Article List', icon: 'list' }
|
meta: { title: 'Article List', icon: 'list' }
|
||||||
// }
|
}
|
||||||
// ]
|
]
|
||||||
// },
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
path: '/tab',
|
path: '/tab',
|
||||||
@ -212,35 +212,35 @@ export const asyncRoutes:RouteRecordRaw[] = [
|
|||||||
path: 'index',
|
path: 'index',
|
||||||
component: () => import('@/views/tab/index.vue'),
|
component: () => import('@/views/tab/index.vue'),
|
||||||
name: 'Tab',
|
name: 'Tab',
|
||||||
meta: { title: '日报', icon: 'tab' }
|
meta: { title: 'Tab', icon: 'tab' }
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
// {
|
{
|
||||||
// path: '/error',
|
path: '/error',
|
||||||
// component: Layout,
|
component: Layout,
|
||||||
// redirect: 'noRedirect',
|
redirect: 'noRedirect',
|
||||||
// name: 'ErrorPages',
|
name: 'ErrorPages',
|
||||||
// meta: {
|
meta: {
|
||||||
// title: 'Error Pages',
|
title: 'Error Pages',
|
||||||
// icon: '404'
|
icon: '404'
|
||||||
// },
|
},
|
||||||
// children: [
|
children: [
|
||||||
// {
|
{
|
||||||
// path: '401',
|
path: '401',
|
||||||
// component: () => import('@/views/error-page/401.vue'),
|
component: () => import('@/views/error-page/401.vue'),
|
||||||
// name: 'Page401',
|
name: 'Page401',
|
||||||
// meta: { title: '401', noCache: true }
|
meta: { title: '401', noCache: true }
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// path: '404',
|
path: '404',
|
||||||
// component: () => import('@/views/error-page/404.vue'),
|
component: () => import('@/views/error-page/404.vue'),
|
||||||
// name: 'Page404',
|
name: 'Page404',
|
||||||
// meta: { title: '404', noCache: true }
|
meta: { title: '404', noCache: true }
|
||||||
// }
|
}
|
||||||
// ]
|
]
|
||||||
// },
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
path: '/error-log',
|
path: '/error-log',
|
||||||
@ -250,7 +250,7 @@ export const asyncRoutes:RouteRecordRaw[] = [
|
|||||||
path: 'log',
|
path: 'log',
|
||||||
component: () => import('@/views/error-log/index.vue'),
|
component: () => import('@/views/error-log/index.vue'),
|
||||||
name: 'ErrorLog',
|
name: 'ErrorLog',
|
||||||
meta: { title: '消息', icon: 'bug' }
|
meta: { title: 'Error Log', icon: 'bug' }
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -261,7 +261,7 @@ export const asyncRoutes:RouteRecordRaw[] = [
|
|||||||
redirect: '/excel/export-excel',
|
redirect: '/excel/export-excel',
|
||||||
name: 'Excel',
|
name: 'Excel',
|
||||||
meta: {
|
meta: {
|
||||||
title: '申请和审批',
|
title: 'Excel',
|
||||||
icon: 'excel'
|
icon: 'excel'
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
@ -269,63 +269,63 @@ export const asyncRoutes:RouteRecordRaw[] = [
|
|||||||
path: 'export-excel',
|
path: 'export-excel',
|
||||||
component: () => import('@/views/excel/export-excel.vue'),
|
component: () => import('@/views/excel/export-excel.vue'),
|
||||||
name: 'ExportExcel',
|
name: 'ExportExcel',
|
||||||
meta: { title: '提交申请' }
|
meta: { title: 'Export Excel' }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'export-selected-excel',
|
path: 'export-selected-excel',
|
||||||
component: () => import('@/views/excel/select-excel.vue'),
|
component: () => import('@/views/excel/select-excel.vue'),
|
||||||
name: 'SelectExcel',
|
name: 'SelectExcel',
|
||||||
meta: { title: '我的审批' }
|
meta: { title: 'Export Selected' }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'export-merge-header',
|
path: 'export-merge-header',
|
||||||
component: () => import('@/views/excel/merge-header.vue'),
|
component: () => import('@/views/excel/merge-header.vue'),
|
||||||
name: 'MergeHeader',
|
name: 'MergeHeader',
|
||||||
meta: { title: '记录查询' }
|
meta: { title: 'Merge Header' }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'upload-excel',
|
||||||
|
component: () => import('@/views/excel/upload-excel.vue'),
|
||||||
|
name: 'UploadExcel',
|
||||||
|
meta: { title: 'Upload Excel' }
|
||||||
}
|
}
|
||||||
// {
|
|
||||||
// path: 'upload-excel',
|
|
||||||
// component: () => import('@/views/excel/upload-excel.vue'),
|
|
||||||
// name: 'UploadExcel',
|
|
||||||
// meta: { title: 'Upload Excel' }
|
|
||||||
// }
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
// {
|
{
|
||||||
// path: '/zip',
|
path: '/zip',
|
||||||
// component: Layout,
|
component: Layout,
|
||||||
// redirect: '/zip/download',
|
redirect: '/zip/download',
|
||||||
// name: 'Zip',
|
name: 'Zip',
|
||||||
// meta: { alwaysShow: true, title: 'Zip', icon: 'zip' },
|
meta: { alwaysShow: true, title: 'Zip', icon: 'zip' },
|
||||||
// children: [
|
children: [
|
||||||
// {
|
{
|
||||||
// path: 'download',
|
path: 'download',
|
||||||
// component: () => import('@/views/zip/index.vue'),
|
component: () => import('@/views/zip/index.vue'),
|
||||||
// name: 'ExportZip',
|
name: 'ExportZip',
|
||||||
// meta: { title: 'Export Zip' }
|
meta: { title: 'Export Zip' }
|
||||||
// }
|
}
|
||||||
// ]
|
]
|
||||||
// },
|
},
|
||||||
|
|
||||||
// {
|
{
|
||||||
// path: '/pdf',
|
path: '/pdf',
|
||||||
// component: Layout,
|
component: Layout,
|
||||||
// redirect: '/pdf/index',
|
redirect: '/pdf/index',
|
||||||
// children: [
|
children: [
|
||||||
// {
|
{
|
||||||
// path: 'index',
|
path: 'index',
|
||||||
// component: () => import('@/views/pdf/index.vue'),
|
component: () => import('@/views/pdf/index.vue'),
|
||||||
// name: 'PDF',
|
name: 'PDF',
|
||||||
// meta: { title: 'PDF', icon: 'pdf' }
|
meta: { title: 'PDF', icon: 'pdf' }
|
||||||
// }
|
}
|
||||||
// ]
|
]
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// path: '/pdf/download',
|
path: '/pdf/download',
|
||||||
// component: () => import('@/views/pdf/download.vue'),
|
component: () => import('@/views/pdf/download.vue'),
|
||||||
// meta: { hidden: true }
|
meta: { hidden: true }
|
||||||
// },
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
path: '/theme',
|
path: '/theme',
|
||||||
@ -335,65 +335,65 @@ export const asyncRoutes:RouteRecordRaw[] = [
|
|||||||
path: 'index',
|
path: 'index',
|
||||||
component: () => import('@/views/theme/index.vue'),
|
component: () => import('@/views/theme/index.vue'),
|
||||||
name: 'Theme',
|
name: 'Theme',
|
||||||
meta: { title: '个人信息管理', icon: 'theme' }
|
meta: { title: 'Theme', icon: 'theme' }
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
// {
|
{
|
||||||
// path: '/clipboard',
|
path: '/clipboard',
|
||||||
// component: Layout,
|
component: Layout,
|
||||||
// children: [
|
children: [
|
||||||
// {
|
{
|
||||||
// path: 'index',
|
path: 'index',
|
||||||
// component: () => import('@/views/clipboard/index.vue'),
|
component: () => import('@/views/clipboard/index.vue'),
|
||||||
// name: 'ClipboardDemo',
|
name: 'ClipboardDemo',
|
||||||
// meta: { title: 'Clipboard', icon: 'clipboard' }
|
meta: { title: 'Clipboard', icon: 'clipboard' }
|
||||||
// }
|
}
|
||||||
// ]
|
]
|
||||||
// },
|
},
|
||||||
|
|
||||||
// {
|
{
|
||||||
// path: '/external-link',
|
path: '/external-link',
|
||||||
// component: Layout,
|
component: Layout,
|
||||||
// children: [
|
children: [
|
||||||
// {
|
{
|
||||||
// path: 'https://element-plus.midfar.com',
|
path: 'https://element-plus.midfar.com',
|
||||||
// meta: { title: 'External Link', icon: 'link' },
|
meta: { title: 'External Link', icon: 'link' },
|
||||||
// redirect: ''
|
redirect: ''
|
||||||
// }
|
}
|
||||||
// ]
|
]
|
||||||
// },
|
},
|
||||||
//
|
|
||||||
// {
|
{
|
||||||
// path: '/my-demo',
|
path: '/my-demo',
|
||||||
// component: Layout,
|
component: Layout,
|
||||||
// name: 'MyDemo',
|
name: 'MyDemo',
|
||||||
// meta: {
|
meta: {
|
||||||
// title: 'MyDemo',
|
title: 'MyDemo',
|
||||||
// icon: 'component'
|
icon: 'component'
|
||||||
// },
|
},
|
||||||
// children: [
|
children: [
|
||||||
// {
|
{
|
||||||
// path: 'element-demo',
|
path: 'element-demo',
|
||||||
// component: () => import('@/views/mydemo/ElementDemo.vue'),
|
component: () => import('@/views/mydemo/ElementDemo.vue'),
|
||||||
// name: 'ElementDemo',
|
name: 'ElementDemo',
|
||||||
// meta: { title: 'ElementDemo', icon: 'skill' }
|
meta: { title: 'ElementDemo', icon: 'skill' }
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// path: 'store-demo',
|
path: 'store-demo',
|
||||||
// component: () => import('@/views/mydemo/StoreDemo.vue'),
|
component: () => import('@/views/mydemo/StoreDemo.vue'),
|
||||||
// name: 'StoreDemo',
|
name: 'StoreDemo',
|
||||||
// meta: { title: 'StoreDemo', icon: 'lock' }
|
meta: { title: 'StoreDemo', icon: 'lock' }
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// path: 'webSocket-demo',
|
path: 'webSocket-demo',
|
||||||
// component: () => import('@/views/mydemo/WebSocketDemo.vue'),
|
component: () => import('@/views/mydemo/WebSocketDemo.vue'),
|
||||||
// name: 'WebSocketDemo',
|
name: 'WebSocketDemo',
|
||||||
// meta: { title: 'WebSocketDemo', icon: 'lock' }
|
meta: { title: 'WebSocketDemo', icon: 'lock' }
|
||||||
// }
|
}
|
||||||
// ]
|
]
|
||||||
// },
|
},
|
||||||
|
|
||||||
// 404 page must be placed at the end !!!
|
// 404 page must be placed at the end !!!
|
||||||
{ path: '/:pathMatch(.*)*', redirect: '/404', meta: { hidden: true }}
|
{ path: '/:pathMatch(.*)*', redirect: '/404', meta: { hidden: true }}
|
||||||
|
@ -56,7 +56,7 @@ export default defineStore({
|
|||||||
},
|
},
|
||||||
generateRoutes(roles: string[]) {
|
generateRoutes(roles: string[]) {
|
||||||
let accessedRoutes;
|
let accessedRoutes;
|
||||||
if (roles.includes('admin')) {
|
if (roles.includes('teacher_user')) {
|
||||||
accessedRoutes = asyncRoutes || [];
|
accessedRoutes = asyncRoutes || [];
|
||||||
} else {
|
} else {
|
||||||
accessedRoutes = filterAsyncRoutes(asyncRoutes, roles);
|
accessedRoutes = filterAsyncRoutes(asyncRoutes, roles);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
import { login as apiLogin, logout as apiLogout, getInfo as apiGetInfo } from '@/api/user';
|
import {login as apiLogin, logout as apiLogout, getInfo as apiGetInfo, } from '@/api/user';
|
||||||
import { getToken, setToken, removeToken } from '@/utils/auth';
|
import { getToken, setToken, removeToken } from '@/utils/auth';
|
||||||
import router, { resetRouter } from '@/router';
|
import router, { resetRouter } from '@/router';
|
||||||
import tagsViewStore from './tagsView';
|
import tagsViewStore from './tagsView';
|
||||||
@ -16,26 +16,52 @@ export interface IUserState {
|
|||||||
|
|
||||||
export default defineStore({
|
export default defineStore({
|
||||||
id: 'user',
|
id: 'user',
|
||||||
state: ():IUserState => ({
|
state: ():{
|
||||||
|
address: string;
|
||||||
|
signature: string;
|
||||||
|
sex: string;
|
||||||
|
roles: any[];
|
||||||
|
description: string;
|
||||||
|
avatar: string;
|
||||||
|
token: any;
|
||||||
|
phone: string;
|
||||||
|
nickname: string;
|
||||||
|
id: string;
|
||||||
|
email: string;
|
||||||
|
age: string;
|
||||||
|
username: string
|
||||||
|
} => ({
|
||||||
token: getToken(),
|
token: getToken(),
|
||||||
userId: '',
|
id:'',
|
||||||
name: '',
|
username:'',
|
||||||
avatar: '',
|
address:'',
|
||||||
introduction: '',
|
phone:'',
|
||||||
roles: []
|
email:'',
|
||||||
|
age:'',
|
||||||
|
signature:'',
|
||||||
|
avatar:'',
|
||||||
|
nickname:'',
|
||||||
|
sex:'',
|
||||||
|
description:'',
|
||||||
|
roles:['admin']
|
||||||
}),
|
}),
|
||||||
getters: {},
|
getters: {},
|
||||||
actions: {
|
actions: {
|
||||||
// user login
|
// user login
|
||||||
login({ commit }, userInfo):Promise<void> {
|
|
||||||
|
|
||||||
|
login(userInfo):Promise<void> {
|
||||||
const { username, password } = userInfo;
|
const { username, password } = userInfo;
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
apiLogin({ username: username.trim(), password: password }).then(response => {
|
apiLogin({ user: username.trim(), password: password }).then(response => {
|
||||||
const { data } = response;
|
const { data } = response;
|
||||||
commit('SET_TOKEN', data.token);
|
this.token = data.token;
|
||||||
setToken(data.token);
|
setToken(data.token);
|
||||||
|
router.push('/')
|
||||||
resolve();
|
resolve();
|
||||||
|
console.log('2222',response)
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
|
console.log('3333',error)
|
||||||
reject(error);
|
reject(error);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -46,22 +72,28 @@ export default defineStore({
|
|||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
apiGetInfo(this.token).then(response => {
|
apiGetInfo(this.token).then(response => {
|
||||||
const { data } = response;
|
const { data } = response;
|
||||||
|
console.log('66666',data)
|
||||||
if (!data) {
|
if (!data) {
|
||||||
reject('Verification failed, please Login again.');
|
reject('Verification failed, please Login again.');
|
||||||
}
|
}
|
||||||
|
const { id,username,address,phone,email,age,signature,avatar,nickname,sex,description,roles } = data;
|
||||||
const { roles, name, avatar, introduction } = data;
|
|
||||||
|
|
||||||
// roles must be a non-empty array
|
// roles must be a non-empty array
|
||||||
if (!roles || roles.length <= 0) {
|
if (!roles || roles.length <= 0) {
|
||||||
reject('getInfo: roles must be a non-null array!');
|
reject('getInfo: roles must be a non-null array!');
|
||||||
}
|
}
|
||||||
|
this.id = id;
|
||||||
this.roles = roles;
|
// this.roles = roles;
|
||||||
this.name = name;
|
// this.roles =['admin'];
|
||||||
|
this.username = username;
|
||||||
this.avatar = avatar;
|
this.avatar = avatar;
|
||||||
this.introduction = introduction;
|
this.description = description;
|
||||||
|
this.sex = sex;
|
||||||
|
this.age = age;
|
||||||
|
this.address = address;
|
||||||
|
this.phone = phone;
|
||||||
|
this.email = email;
|
||||||
|
this.signature = signature;
|
||||||
|
this.nickname = nickname;
|
||||||
resolve(data);
|
resolve(data);
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
reject(error);
|
reject(error);
|
||||||
|
@ -2,11 +2,12 @@ import axios from 'axios';
|
|||||||
import store from '@/store';
|
import store from '@/store';
|
||||||
import { getToken } from '@/utils/auth';
|
import { getToken } from '@/utils/auth';
|
||||||
|
|
||||||
|
const BaseURL ='https://nbxt.oa.x-lf.cn'
|
||||||
// create an axios instance
|
// create an axios instance
|
||||||
const service = axios.create({
|
const service = axios.create({
|
||||||
baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url
|
baseURL: BaseURL, // url = base url + request url
|
||||||
// withCredentials: true, // send cookies when cross-domain requests
|
// withCredentials: true, // send cookies when cross-domain requests
|
||||||
timeout: 5000 // request timeout
|
timeout: 10000 // request timeout
|
||||||
});
|
});
|
||||||
|
|
||||||
const service2 = axios.create({
|
const service2 = axios.create({
|
||||||
@ -24,7 +25,7 @@ service.interceptors.request.use(
|
|||||||
// let each request carry token
|
// let each request carry token
|
||||||
// ['X-Token'] is a custom headers key
|
// ['X-Token'] is a custom headers key
|
||||||
// please modify it according to the actual situation
|
// please modify it according to the actual situation
|
||||||
config.headers['X-Token'] = getToken();
|
config.headers['token'] = getToken();
|
||||||
}
|
}
|
||||||
return config;
|
return config;
|
||||||
},
|
},
|
||||||
@ -49,9 +50,9 @@ service.interceptors.response.use(
|
|||||||
*/
|
*/
|
||||||
response => {
|
response => {
|
||||||
const res = response.data;
|
const res = response.data;
|
||||||
|
console.log('999999',res)
|
||||||
// if the custom code is not 20000, it is judged as an error.
|
// if the custom code is not 20000, it is judged as an error.
|
||||||
if (res.code !== 20000) {
|
if (res.code !== 20000 && res.code !== 200) {
|
||||||
ElMessage({
|
ElMessage({
|
||||||
message: res.message || 'Error',
|
message: res.message || 'Error',
|
||||||
type: 'error',
|
type: 'error',
|
||||||
|
@ -15,7 +15,7 @@ export function isExternal(path) {
|
|||||||
* @returns {Boolean}
|
* @returns {Boolean}
|
||||||
*/
|
*/
|
||||||
export function validUsername(str) {
|
export function validUsername(str) {
|
||||||
const valid_map = ['admin', 'editor'];
|
const valid_map = ['admin', 'editor', 'teacher_user'];
|
||||||
return valid_map.indexOf(str.trim()) >= 0;
|
return valid_map.indexOf(str.trim()) >= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
|
|
||||||
<el-button :loading="loading" type="primary" style="width:100%;margin-bottom:30px;" @click.prevent="handleLogin">
|
<el-button :loading="loading" type="primary" style="width:100%;margin-bottom:30px;" @click.prevent="handleLogin">
|
||||||
登录</el-button>
|
Login</el-button>
|
||||||
|
|
||||||
<div style="position:relative">
|
<div style="position:relative">
|
||||||
<div class="tips">
|
<div class="tips">
|
||||||
@ -65,6 +65,7 @@ import SocialSign from './components/SocialSignin.vue';
|
|||||||
import type { FormItemRule } from 'element-plus';
|
import type { FormItemRule } from 'element-plus';
|
||||||
import type { IForm } from '@/types/element-plus';
|
import type { IForm } from '@/types/element-plus';
|
||||||
import store from '@/store';
|
import store from '@/store';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'Login',
|
name: 'Login',
|
||||||
components: { SocialSign },
|
components: { SocialSign },
|
||||||
@ -85,7 +86,7 @@ export default defineComponent({
|
|||||||
};
|
};
|
||||||
return {
|
return {
|
||||||
loginForm: {
|
loginForm: {
|
||||||
username: 'teacher_demo',
|
username: 'teacher_user',
|
||||||
password: '123456'
|
password: '123456'
|
||||||
},
|
},
|
||||||
loginRules: {
|
loginRules: {
|
||||||
@ -144,7 +145,7 @@ export default defineComponent({
|
|||||||
(this.$refs.loginForm as IForm).validate(valid => {
|
(this.$refs.loginForm as IForm).validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
this.$store.dispatch("login", this.loginForm)
|
store.user().login(this.loginForm)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.$router.push({ path: this.redirect || '/', query: this.otherQuery });
|
this.$router.push({ path: this.redirect || '/', query: this.otherQuery });
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
@ -166,6 +167,24 @@ export default defineComponent({
|
|||||||
return acc;
|
return acc;
|
||||||
}, {});
|
}, {});
|
||||||
}
|
}
|
||||||
|
// afterQRScan() {
|
||||||
|
// if (e.key === 'x-admin-oauth-code') {
|
||||||
|
// const code = getQueryObject(e.newValue)
|
||||||
|
// const codeMap = {
|
||||||
|
// wechat: 'code',
|
||||||
|
// tencent: 'code'
|
||||||
|
// }
|
||||||
|
// const type = codeMap[this.auth_type]
|
||||||
|
// const codeName = code[type]
|
||||||
|
// if (codeName) {
|
||||||
|
// store.user().LoginByThirdparty(codeName).then(() => {
|
||||||
|
// this.$router.push({ path: this.redirect || '/' })
|
||||||
|
// })
|
||||||
|
// } else {
|
||||||
|
// alert('第三方登录失败')
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
@ -65,13 +65,12 @@ export default defineConfig(({ command, mode }) => {
|
|||||||
host: 'localhost',
|
host: 'localhost',
|
||||||
port: 8001,
|
port: 8001,
|
||||||
proxy: {
|
proxy: {
|
||||||
'/api-test': {
|
'/api-prod': {
|
||||||
target: 'https://api.midfar.com/dspt_test/api',
|
target: 'https://nbxt.oa.x-lf.cn',
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
rewrite: (path) => path.replace(/^\/api-test/, '')
|
pathRewrite: {
|
||||||
},
|
'^/api-prod': ''
|
||||||
headers: {
|
}
|
||||||
Cookie: env.VUE_APP_COOKIE
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user