mirror of
https://github.com/tencentmusic/supersonic.git
synced 2026-04-29 12:34:28 +08:00
first commit
This commit is contained in:
83
webapp/packages/supersonic-fe/config/config.ts
Normal file
83
webapp/packages/supersonic-fe/config/config.ts
Normal file
@@ -0,0 +1,83 @@
|
||||
// https://umijs.org/config/
|
||||
import { defineConfig } from 'umi';
|
||||
import defaultSettings from './defaultSettings';
|
||||
import themeSettings from './themeSettings';
|
||||
import proxy from './proxy';
|
||||
import routes from './routes';
|
||||
import moment from 'moment';
|
||||
|
||||
const { REACT_APP_ENV, RUN_TYPE } = process.env;
|
||||
|
||||
const publicPath = '/webapp/';
|
||||
|
||||
export default defineConfig({
|
||||
define: {
|
||||
// 添加这个自定义的环境变量
|
||||
// 'process.env.REACT_APP_ENV': process.env.REACT_APP_ENV, // * REACT_APP_ENV 本地开发环境:dev,测试服:test,正式服:prod
|
||||
'process.env': {
|
||||
...process.env,
|
||||
API_BASE_URL: '/api/semantic/', // 直接在define中挂载裸露的全局变量还需要配置eslint,ts相关配置才能导致在使用中不会飘红,冗余较高,这里挂在进程环境下
|
||||
CHAT_API_BASE_URL: '/api/chat/',
|
||||
AUTH_API_BASE_URL: '/api/auth/',
|
||||
},
|
||||
},
|
||||
metas: [
|
||||
{
|
||||
name: 'app_version',
|
||||
content: moment().format('YYYY-MM-DD HH:mm:ss'),
|
||||
},
|
||||
],
|
||||
devServer: { port: 8002 },
|
||||
hash: true,
|
||||
// history: { type: 'hash' },
|
||||
antd: {},
|
||||
dva: {
|
||||
hmr: true,
|
||||
},
|
||||
layout: {
|
||||
name: '',
|
||||
locale: true,
|
||||
siderWidth: 208,
|
||||
...defaultSettings,
|
||||
},
|
||||
locale: {
|
||||
// default zh-CN
|
||||
default: 'zh-CN',
|
||||
antd: true,
|
||||
// default true, when it is true, will use `navigator.language` overwrite default
|
||||
baseNavigator: false,
|
||||
},
|
||||
// dynamicImport: {
|
||||
// loading: '@ant-design/pro-layout/es/PageLoading',
|
||||
// },
|
||||
targets: {
|
||||
ie: 11,
|
||||
},
|
||||
// umi routes: https://umijs.org/docs/routing
|
||||
routes,
|
||||
// Theme for antd: https://ant.design/docs/react/customize-theme-cn
|
||||
theme: {
|
||||
...themeSettings,
|
||||
},
|
||||
esbuild: {},
|
||||
title: false,
|
||||
ignoreMomentLocale: true,
|
||||
proxy: proxy[REACT_APP_ENV || 'dev'],
|
||||
manifest: {
|
||||
basePath: '/',
|
||||
},
|
||||
base: publicPath,
|
||||
publicPath,
|
||||
outputPath: RUN_TYPE === 'local' ? 'supersonic-webapp' : 'dist',
|
||||
// https://github.com/zthxxx/react-dev-inspector
|
||||
plugins: ['react-dev-inspector/plugins/umi/react-inspector'],
|
||||
inspectorConfig: {
|
||||
// loader options type and docs see below
|
||||
exclude: [],
|
||||
babelPlugins: [],
|
||||
babelOptions: {},
|
||||
},
|
||||
resolve: {
|
||||
includes: ['src/components'],
|
||||
},
|
||||
});
|
||||
26
webapp/packages/supersonic-fe/config/defaultSettings.ts
Normal file
26
webapp/packages/supersonic-fe/config/defaultSettings.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { Settings as LayoutSettings } from '@ant-design/pro-layout';
|
||||
|
||||
const Settings: LayoutSettings & {
|
||||
pwa?: boolean;
|
||||
logo?: string;
|
||||
} = {
|
||||
navTheme: 'light',
|
||||
primaryColor: '#296DF3',
|
||||
layout: 'mix',
|
||||
contentWidth: 'Fluid',
|
||||
fixedHeader: false,
|
||||
fixSiderbar: true,
|
||||
colorWeak: false,
|
||||
title: '',
|
||||
pwa: false,
|
||||
// logo: 'https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg',
|
||||
iconfontUrl: '//at.alicdn.com/t/c/font_3201979_rncj6jun6k.js',
|
||||
splitMenus: true,
|
||||
menu: {
|
||||
defaultOpenAll: true,
|
||||
autoClose: false,
|
||||
ignoreFlatMenu: true,
|
||||
},
|
||||
};
|
||||
|
||||
export default Settings;
|
||||
16
webapp/packages/supersonic-fe/config/proxy.ts
Normal file
16
webapp/packages/supersonic-fe/config/proxy.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
export default {
|
||||
dev: {
|
||||
'/api/chat/': {
|
||||
target: 'http://localhost:9080',
|
||||
changeOrigin: true,
|
||||
},
|
||||
'/api/semantic/': {
|
||||
target: 'http://localhost:9081',
|
||||
changeOrigin: true,
|
||||
},
|
||||
'/api/': {
|
||||
target: 'http://localhost:9080',
|
||||
changeOrigin: true,
|
||||
},
|
||||
},
|
||||
};
|
||||
43
webapp/packages/supersonic-fe/config/routes.ts
Normal file
43
webapp/packages/supersonic-fe/config/routes.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
export const ROUTE_AUTH_CODES = {
|
||||
CHAT: 'chat',
|
||||
CHAT_SETTING: 'chatSetting',
|
||||
SEMANTIC: 'semantic',
|
||||
};
|
||||
|
||||
const ROUTES = [
|
||||
{
|
||||
path: '/chat',
|
||||
name: 'chat',
|
||||
component: './Chat',
|
||||
access: ROUTE_AUTH_CODES.CHAT,
|
||||
},
|
||||
{
|
||||
path: '/chatSetting',
|
||||
name: 'chatSetting',
|
||||
component: './SemanticModel/ChatSetting',
|
||||
access: ROUTE_AUTH_CODES.CHAT_SETTING,
|
||||
},
|
||||
{
|
||||
path: '/semanticModel',
|
||||
name: 'semanticModel',
|
||||
component: './SemanticModel/ProjectManager',
|
||||
access: ROUTE_AUTH_CODES.SEMANTIC,
|
||||
},
|
||||
{
|
||||
path: '/login',
|
||||
name: 'login',
|
||||
layout: false,
|
||||
hideInMenu: true,
|
||||
component: './Login',
|
||||
},
|
||||
{
|
||||
path: '/',
|
||||
redirect: '/chat',
|
||||
},
|
||||
{
|
||||
path: '/401',
|
||||
component: './401',
|
||||
},
|
||||
];
|
||||
|
||||
export default ROUTES;
|
||||
52
webapp/packages/supersonic-fe/config/themeSettings.ts
Normal file
52
webapp/packages/supersonic-fe/config/themeSettings.ts
Normal file
@@ -0,0 +1,52 @@
|
||||
// import defaultSettings from './defaultSettings';
|
||||
|
||||
const constants = {
|
||||
black85: 'rgba(0,10,36,0.85)',
|
||||
black65: 'rgba(0,10,36,0.65)',
|
||||
black45: 'rgba(0,10,36,0.45)',
|
||||
black25: 'rgba(0,10,36,0.25)',
|
||||
};
|
||||
|
||||
const settings = {
|
||||
// 'primary-color': defaultSettings.primaryColor,
|
||||
// Colors
|
||||
'blue-6': '#296DF3',
|
||||
'primary-color': '#296DF3',
|
||||
'green-6': '#26C992',
|
||||
'success-color': '#26C992',
|
||||
'red-5': '#EF4872',
|
||||
'error-color': '#EF4872',
|
||||
'gold-6': '#FFB924',
|
||||
'warning-color': '#FFB924',
|
||||
|
||||
// Color used by default to control hover and active backgrounds and for
|
||||
// alert info backgrounds.
|
||||
'primary-1': '#E3ECFD',
|
||||
'primary-2': '#BED2FB',
|
||||
'primary-3': '#86ACF8',
|
||||
'primary-4': '#6193F6',
|
||||
'primary-5': '#4E86F5',
|
||||
'primary-6': '#296DF3',
|
||||
'primary-7': '#0D57E8',
|
||||
'primary-8': '#0B49C3',
|
||||
'primary-9': '#093B9D',
|
||||
'primary-10': '#062666',
|
||||
|
||||
// Base Scaffolding Variables
|
||||
'heading-color': constants.black85,
|
||||
'text-color': constants.black85,
|
||||
'text-color-secondary': constants.black65,
|
||||
'border-radius-base': '4px',
|
||||
|
||||
// Buttons
|
||||
'btn-padding-horizontal-sm': '8px',
|
||||
'btn-padding-horizontal-base': '16px',
|
||||
'btn-padding-horizontal-lg': '16px',
|
||||
'btn-default-color': constants.black65,
|
||||
'btn-default-border': 'rgba(0,0,0,0.15)',
|
||||
'btn-disable-color': constants.black25,
|
||||
'btn-disable-border': 'rgba(0,10,36,0.15)',
|
||||
'btn-disable-bg': 'rgba(0,10,36,0.04)',
|
||||
};
|
||||
|
||||
export default settings;
|
||||
Reference in New Issue
Block a user