开发: 登录等功能

This commit is contained in:
zhengw
2023-04-07 17:38:15 +08:00
parent f639dc8284
commit 5834254a8f
27 changed files with 1475 additions and 153 deletions

View File

@@ -2,7 +2,6 @@
import { defineConfig } from '@umijs/max';
import { join } from 'path';
import defaultSettings from './defaultSettings';
import proxy from './proxy';
import routes from './routes';
const { REACT_APP_ENV = 'dev' } = process.env;
@@ -14,7 +13,10 @@ export default defineConfig({
* @doc https://umijs.org/docs/api/config#hash
*/
hash: true,
// hash 路由
// history: {
// type: 'hash',
// },
/**
* @name 兼容性设置
* @description 设置 ie11 不一定完美兼容,需要检查自己使用的所有依赖
@@ -54,7 +56,14 @@ export default defineConfig({
* @doc 代理介绍 https://umijs.org/docs/guides/proxy
* @doc 代理配置 https://umijs.org/docs/api/config#proxy
*/
proxy: proxy[REACT_APP_ENV as keyof typeof proxy],
// proxy: proxy[REACT_APP_ENV as keyof typeof proxy],
proxy: {
'/api/': {
target: 'http://192.168.1.219:8183/',
changeOrigin: true,
pathRewrite: { '^/api': '' },
},
},
/**
* @name 快速热更新配置
* @description 一个不错的热更新组件,更新时可以保留 state
@@ -76,11 +85,12 @@ export default defineConfig({
* @name layout 插件
* @doc https://umijs.org/docs/max/layout-menu
*/
title: 'Ant Design Pro',
title: 'SCRM',
layout: {
locale: true,
locale: false,
...defaultSettings,
},
/**
* @name moment2dayjs 插件
* @description 将项目中的 moment 替换为 dayjs

View File

@@ -15,7 +15,7 @@ const Settings: ProLayoutProps & {
fixedHeader: false,
fixSiderbar: true,
colorWeak: false,
title: 'Ant Design Pro',
title: 'SCRM',
pwa: true,
logo: 'https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg',
iconfontUrl: '',
@@ -23,7 +23,7 @@ const Settings: ProLayoutProps & {
// 参见ts声明demo 见文档通过token 修改样式
//https://procomponents.ant.design/components/layout#%E9%80%9A%E8%BF%87-token-%E4%BF%AE%E6%94%B9%E6%A0%B7%E5%BC%8F
},
splitMenus: true
splitMenus: true,
};
export default Settings;

View File

@@ -1,4 +1,4 @@
/**
/**
* @name umi 的路由配置
* @description 只支持 path,component,routes,redirect,wrappers,name,icon 的配置
* @param path path 只支持两种占位符配置,第一种是动态参数 :id 的形式,第二种是 * 通配符,通配符只能出现路由字符串的最后。
@@ -22,49 +22,75 @@ export default [
},
],
},
// {
// path: '/welcome',
// name: 'welcome',
// icon: 'smile',
// component: './Welcome',
// },
{
path: '/welcome',
name: 'welcome',
icon: 'smile',
component: './Welcome',
},
{
path: '/admin',
name: 'admin',
path: '/departments',
name: 'scrm',
icon: 'crown',
access: 'canAdmin',
// access: 'canAdmin',
routes: [
{
path: '/admin',
redirect: '/admin/sub-page',
path: '/departments',
redirect: '/departments/page/list',
},
{
path: '/admin/sub-page',
name: 'sub-page',
component: './Admin',
path: '/departments/page',
name: '部门管理',
// hideInBreadcrumb: true,
// component: './Admin',
routes: [
{
path: '/departments/page',
redirect: '/departments/page/list',
},
{
name: '部门员工',
icon: 'table',
path: '/departments/page/list',
component: './DepartmentsList',
},
{
name: '聊天记录',
icon: 'table',
path: '/departments/page/list2',
component: './ChatLogs',
},
],
},
{
path: '/admin/sub-page2',
name: 'sub-page2',
component: './Admin',
}
// {
// path: '/departments/sub-page2',
// name: '商品',
// // component: './TableList',
// routes: [
// {
// name: '列表',
// icon: 'table',
// path: '/departments/sub-page2/list',
// component: './TableList',
// },
// ],
// },
],
},
{
name: 'list.table-list',
icon: 'table',
path: '/list',
component: './TableList',
},
// {
// name: 'list.table-list',
// icon: 'table',
// path: '/list',
// component: './TableList',
// },
{
path: '/',
redirect: '/welcome',
redirect: '/departments',
},
{
path: '*',
layout: false,
component: './404',
},
];