feat: 初始化提交
笑笑 authored at 2025-05-13 21:25:06
2.01 KiB
cube-front
import type { CubeFrontConfig } from '../types';
import type { AxiosRequestConfig } from 'axios';

export const defaultConfig: CubeFrontConfig = {
  base: {
    title: '魔方系统',
    logo: '/logo.png',
    footer: '版权所有',
    env: process.env.NODE_ENV as 'development' | 'production' | 'test',
  },
  menu: {
    getMenuAxiosConfig: () => {
      return {
        method: 'get',
        url: '/Admin/Menu',
      };
    },
    isMenuTree: false,
    dataKey: 'data',
    idField: 'id',
    parentField: 'parentID',
    nameField: 'title',
    pathField: 'url',
    titleField: 'displayName',
    iconField: 'icon',
    sortField: 'sort',
    childrenField: 'children',
  },
  user: {
    getUserInfoAxiosConfig: (): AxiosRequestConfig => {
      return {
        method: 'get',
        url: '/Admin/User/Info',
      };
    },
  },
  ui: {
    layout: {
      header: {
        show: true,
        fixed: true,
        theme: 'light',
      },
      sider: {
        show: true,
        collapsible: true,
        defaultCollapsed: false,
        width: 200,
        collapsedWidth: 80,
        theme: 'light',
      },
      footer: {
        show: true,
        fixed: false,
      },
    },
    theme: {
      primaryColor: '#1890ff',
      linkColor: '#1890ff',
      successColor: '#52c41a',
      warningColor: '#faad14',
      errorColor: '#f5222d',
      font: {
        baseSize: 14,
        family:
          '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',
      },
    },
  },
  request: {
    baseURL: '',
    timeout: 10000,
    responseIntercept: (response) => response,
  },
  auth: {
    tokenKey: 'token',
    oauthUrl: '/Sso/Login?name=NewLife&source=front-end&r=',
    redirectUrl: '/login',
    pageTitle: '登录',
    background: '',
    logoutAxiosConfig: (): AxiosRequestConfig => {
      return {
        method: 'GET',
        url: '/Admin/User/Logout',
      };
    },
    reLoginParams: {
      // 默认的重新登录参数
    },
  },
};

export default defaultConfig;