config.ts 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. import { AuthModule } from "..";
  2. type BgStyle = {
  3. image: string;
  4. repeat?: string;
  5. position?: string;
  6. size?: string;
  7. };
  8. const jumpActions = {
  9. success: createOpts({
  10. action() {
  11. const redirectUrl = this.helper.getRedirectPath();
  12. this.helper.linkTo(redirectUrl || this.config.loginJumpPath, {
  13. replace: !!redirectUrl,
  14. });
  15. },
  16. }),
  17. needLogin: createOpts({
  18. action() {
  19. this.helper.linkTo(this.config.loginPath, {
  20. replace: true,
  21. redirect: true,
  22. });
  23. },
  24. }),
  25. logout: createOpts({
  26. action() {
  27. this.helper.linkTo(this.config.loginPath);
  28. },
  29. }),
  30. };
  31. export const User_Config = {
  32. singlePage: false,
  33. key: "", //queentreesku3d
  34. companyKey: "",
  35. regInfo: {
  36. key: "", //usercenter
  37. },
  38. loginPath: "/login",
  39. loginJumpPath: "/",
  40. logoutJumpPath: "/",
  41. needCompanyLogin: false,
  42. needRegister: false,
  43. needResetPwd: false,
  44. perms: null as {
  45. baseURL: string;
  46. } | null,
  47. banner: null as {
  48. mode?: string;
  49. background: BgStyle;
  50. title?: string;
  51. subTitle?: string;
  52. } | null,
  53. layout: null as {
  54. background?: BgStyle;
  55. } | null,
  56. jumpOptions: {
  57. loginSucc: jumpActions.success,
  58. needLogin: jumpActions.needLogin,
  59. tokenExpire: jumpActions.needLogin,
  60. logout: jumpActions.logout,
  61. },
  62. };
  63. function createOpts<T extends { action: (this: AuthModule) => void }>(
  64. opts: T
  65. ): T {
  66. return opts;
  67. }