cx-chat 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cx-chat.css +1 -0
- package/dist/cx-chat.es.js +97326 -0
- package/dist/cx-chat.umd.js +734 -0
- package/package.json +21 -1
- package/.cursor/rules/i18n-cn-gloss-comments.mdc +0 -31
- package/.cursor/rules/list-page-view-pageconfig.mdc +0 -32
- package/.cursor/rules/no-over-defensive-programming.mdc +0 -90
- package/.cursor/rules/requirement-description-for-agent.mdc +0 -33
- package/.cursor/rules/use-showToast-not-antd-message.mdc +0 -28
- package/.docker/Dockerfile +0 -7
- package/.env +0 -9
- package/.env.development +0 -7
- package/.env.production +0 -7
- package/.gitlab-ci/docker-build.yaml +0 -28
- package/.gitlab-ci/k8s-deploy-dev-master.yaml +0 -42
- package/.gitlab-ci/npm-build.yaml +0 -17
- package/.gitlab-ci.yml +0 -8
- package/.k8s/0-namespace.yaml +0 -6
- package/.k8s/1-configmap-web.yaml +0 -7
- package/.k8s/1-nginx-conf-dev.yaml +0 -110
- package/.k8s/2-deployment.yaml +0 -27
- package/.k8s/3-service.yaml +0 -16
- package/.k8s/4-ingress-dev.yaml +0 -30
- package/.lingma/rules/use-showToast-not-antd-message.md +0 -34
- package/.nginx/nginx.conf +0 -52
- package/.prettierrc +0 -9
- package/eslint.config.js +0 -32
- package/index.html +0 -13
- package/postcss.config.js +0 -6
- package/src/App.tsx +0 -96
- package/src/_doc/0.docs-overview.md +0 -28
- package/src/_doc/cx-ui/0.docs-overview.md +0 -30
- package/src/_doc/cx-ui/comp.1.cx-ui-overview.md +0 -82
- package/src/_doc/cx-ui/comp.2.cx-modal.md +0 -82
- package/src/_doc/cx-ui/comp.3.cx-button.md +0 -89
- package/src/_doc/cx-ui/comp.4.cx-form.md +0 -72
- package/src/_doc/cx-ui/comp.5.cx-fields.md +0 -76
- package/src/_doc/cx-ui/comp.6.cx-tag.md +0 -57
- package/src/_doc/cx-ui/comp.7.cx-empty-state.md +0 -29
- package/src/_doc/meta/0.docs-overview.md +0 -24
- package/src/_doc/meta/comp.1.enum-runtime.md +0 -33
- package/src/_doc/meta/comp.2.dict-runtime.md +0 -39
- package/src/_doc/router/0.docs-overview.md +0 -14
- package/src/_doc/router/guide.1.menu-component-config.md +0 -181
- package/src/_doc/router/guide.2.router-auto-registration.md +0 -114
- package/src/_doc/table-view/0.docs-overview.md +0 -30
- package/src/_doc/table-view/comp.1.table-view.md +0 -542
- package/src/_doc/table-view/props.1.create-table-view-config.md +0 -193
- package/src/_doc/table-view/props.2.table-view-search-fields.md +0 -106
- package/src/api/_mock/README.md +0 -340
- package/src/api/_mock/api.ts +0 -1642
- package/src/api/_mock/bundle-shim.ts +0 -16
- package/src/api/_mock/handler-shim.ts +0 -6
- package/src/api/_mock/handler.ts +0 -458
- package/src/api/_mock/index.ts +0 -711
- package/src/api/_mock/interceptor.ts +0 -15
- package/src/api/_mock/mod.ts +0 -12
- package/src/api/_mock/utils.ts +0 -65
- package/src/api/base/memory.js +0 -24
- package/src/api/chat.js +0 -210
- package/src/api/common/auth.js +0 -70
- package/src/api/menus/business-rules.js +0 -76
- package/src/api/menus/feedback.js +0 -102
- package/src/api/menus/knowledge.js +0 -159
- package/src/api/menus/model-metadata/manage.js +0 -70
- package/src/api/menus/model-metadata/role.js +0 -50
- package/src/api/menus/model-metadata/training-detail-mock-data.js +0 -569
- package/src/api/menus/model-metadata/training.js +0 -28
- package/src/api/menus/skill.js +0 -40
- package/src/api/system/agent-config.js +0 -16
- package/src/api/system/department.js +0 -94
- package/src/api/system/dict.js +0 -86
- package/src/api/system/menu.js +0 -37
- package/src/api/system/permission.js +0 -26
- package/src/api/system/role.js +0 -34
- package/src/api/system/sys-config.js +0 -16
- package/src/api/system/sys-log.js +0 -17
- package/src/api/system/user.js +0 -75
- package/src/api/upload.js +0 -39
- package/src/assets/react.svg +0 -1
- package/src/components/auth/current-user-avatar.tsx +0 -77
- package/src/components/common/code-view.tsx +0 -149
- package/src/components/common/detail-link.tsx +0 -67
- package/src/components/common/error-boundary.tsx +0 -98
- package/src/components/common/language-switcher.tsx +0 -91
- package/src/components/common/lite-table/index.tsx +0 -135
- package/src/components/common/md-editor.tsx +0 -126
- package/src/components/common/modal/confirm-dialog.tsx +0 -113
- package/src/components/common/modal/dep-user-select-multi.tsx +0 -324
- package/src/components/common/modal/dep-user-select.tsx +0 -249
- package/src/components/common/modal/user-select-multi.tsx +0 -266
- package/src/components/common/pagination.tsx +0 -472
- package/src/components/common/path.tsx +0 -175
- package/src/components/common/system-logo-mark.tsx +0 -48
- package/src/components/cx-ui/button/index.less +0 -208
- package/src/components/cx-ui/button/index.tsx +0 -611
- package/src/components/cx-ui/checkbox/index.tsx +0 -78
- package/src/components/cx-ui/date-picker/index.less +0 -17
- package/src/components/cx-ui/date-picker/index.tsx +0 -193
- package/src/components/cx-ui/drawer/index.tsx +0 -47
- package/src/components/cx-ui/empty-state/index.tsx +0 -20
- package/src/components/cx-ui/floating-shell/CxFloatingShell.tsx +0 -89
- package/src/components/cx-ui/floating-shell/cx-floating-shell.less +0 -283
- package/src/components/cx-ui/floating-shell/has-floating-value.ts +0 -41
- package/src/components/cx-ui/form/CxForm.tsx +0 -15
- package/src/components/cx-ui/form/index.tsx +0 -20
- package/src/components/cx-ui/form-item/index.less +0 -26
- package/src/components/cx-ui/form-item/index.tsx +0 -36
- package/src/components/cx-ui/index.ts +0 -70
- package/src/components/cx-ui/input/auto-complete.tsx +0 -134
- package/src/components/cx-ui/input/index.tsx +0 -259
- package/src/components/cx-ui/input-number/index.jsx +0 -66
- package/src/components/cx-ui/modal/index.jsx +0 -212
- package/src/components/cx-ui/modal/index.less +0 -144
- package/src/components/cx-ui/modal/useCxModal.ts +0 -125
- package/src/components/cx-ui/multi-select/index.jsx +0 -74
- package/src/components/cx-ui/multi-select/index.less +0 -40
- package/src/components/cx-ui/multi-select/index2.tsx +0 -361
- package/src/components/cx-ui/radio/index.tsx +0 -33
- package/src/components/cx-ui/range-picker/index.less +0 -65
- package/src/components/cx-ui/range-picker/index.tsx +0 -219
- package/src/components/cx-ui/select/index.less +0 -34
- package/src/components/cx-ui/select/index.tsx +0 -196
- package/src/components/cx-ui/skeleton/index.tsx +0 -12
- package/src/components/cx-ui/steps/index.tsx +0 -14
- package/src/components/cx-ui/styles/_tokens.less +0 -79
- package/src/components/cx-ui/styles/index.less +0 -246
- package/src/components/cx-ui/switch/index.less +0 -106
- package/src/components/cx-ui/switch/index.tsx +0 -120
- package/src/components/cx-ui/table/index.less +0 -160
- package/src/components/cx-ui/table/index.tsx +0 -152
- package/src/components/cx-ui/tabs/index.less +0 -15
- package/src/components/cx-ui/tabs/index.tsx +0 -34
- package/src/components/cx-ui/tag/index.less +0 -51
- package/src/components/cx-ui/tag/index.tsx +0 -140
- package/src/components/cx-ui/timeline/index.tsx +0 -14
- package/src/components/cx-ui/tooltip/index.tsx +0 -67
- package/src/components/cx-ui/tree/index.tsx +0 -193
- package/src/components/cx-ui/tree-select/index.jsx +0 -91
- package/src/components/cx-ui/tree-select/index.less +0 -27
- package/src/components/cx-ui/upload-file/index.less +0 -223
- package/src/components/cx-ui/upload-file/index.tsx +0 -640
- package/src/components/cx-ui/upload-img/index.tsx +0 -291
- package/src/components/layout/components/Header.tsx +0 -216
- package/src/components/layout/components/Sidebar.tsx +0 -717
- package/src/components/layout/index.tsx +0 -95
- package/src/components/table-view/components/search-area.tsx +0 -411
- package/src/components/table-view/components/table-view-config.tsx +0 -528
- package/src/components/table-view/components/table-view.types.ts +0 -478
- package/src/components/table-view/components/tree-api-normalize.ts +0 -38
- package/src/components/table-view/components/tree-data-annotate.ts +0 -31
- package/src/components/table-view/components/tree-sidebar.tsx +0 -74
- package/src/components/table-view/index.tsx +0 -61
- package/src/components/table-view/list-page-view.tsx +0 -1049
- package/src/components/table-view/select-table-view.tsx +0 -1094
- package/src/components/table-view/styles/select-table-view.less +0 -51
- package/src/config/default-system-name.ts +0 -9
- package/src/config/system.ts +0 -165
- package/src/constants/countryCodes.ts +0 -3
- package/src/contexts/AuthContext.tsx +0 -256
- package/src/contexts/ChatContext.tsx +0 -839
- package/src/contexts/MenuContext.tsx +0 -62
- package/src/contexts/ToastContext.tsx +0 -181
- package/src/hooks/useCopyToClipboard.ts +0 -47
- package/src/hooks/useModalSubmit.ts +0 -104
- package/src/hooks/useRouter.ts +0 -240
- package/src/hooks/useStepForm.ts +0 -46
- package/src/hooks/useStickyHeader.ts +0 -42
- package/src/hooks/useThreadActions.ts +0 -105
- package/src/hooks/useUserPreferences.ts +0 -101
- package/src/http/axios.js +0 -372
- package/src/http/mock.interceptor.ts +0 -9
- package/src/http/obfuscationKey.ts +0 -41
- package/src/i18n.ts +0 -60
- package/src/index.js +0 -1
- package/src/index.less +0 -169
- package/src/locales/en/auth.ts +0 -70
- package/src/locales/en/base/memory.ts +0 -28
- package/src/locales/en/base/settings.ts +0 -41
- package/src/locales/en/chat.ts +0 -40
- package/src/locales/en/common.ts +0 -173
- package/src/locales/en/enum.ts +0 -27
- package/src/locales/en/menus/business-rules.ts +0 -48
- package/src/locales/en/menus/feedback.ts +0 -62
- package/src/locales/en/menus/knowledge.ts +0 -120
- package/src/locales/en/menus/model-metadata/index.ts +0 -10
- package/src/locales/en/menus/model-metadata/manage.ts +0 -151
- package/src/locales/en/menus/model-metadata/role.ts +0 -48
- package/src/locales/en/menus/model-metadata/training.ts +0 -65
- package/src/locales/en/menus/skill.ts +0 -34
- package/src/locales/en/system/agent-config.ts +0 -34
- package/src/locales/en/system/department.ts +0 -68
- package/src/locales/en/system/dict.ts +0 -44
- package/src/locales/en/system/menu.ts +0 -45
- package/src/locales/en/system/permission.ts +0 -89
- package/src/locales/en/system/role.ts +0 -25
- package/src/locales/en/system/sys-config.ts +0 -33
- package/src/locales/en/system/sys-log.ts +0 -38
- package/src/locales/en/system/user.ts +0 -113
- package/src/locales/en.ts +0 -68
- package/src/locales/zh/auth.ts +0 -70
- package/src/locales/zh/base/memory.ts +0 -29
- package/src/locales/zh/base/settings.ts +0 -41
- package/src/locales/zh/chat.ts +0 -47
- package/src/locales/zh/common.ts +0 -178
- package/src/locales/zh/enum.ts +0 -28
- package/src/locales/zh/menus/business-rules.ts +0 -47
- package/src/locales/zh/menus/feedback.ts +0 -62
- package/src/locales/zh/menus/knowledge.ts +0 -117
- package/src/locales/zh/menus/model-metadata/index.ts +0 -10
- package/src/locales/zh/menus/model-metadata/manage.ts +0 -151
- package/src/locales/zh/menus/model-metadata/role.ts +0 -47
- package/src/locales/zh/menus/model-metadata/training.ts +0 -64
- package/src/locales/zh/menus/skill.ts +0 -34
- package/src/locales/zh/system/agent-config.ts +0 -33
- package/src/locales/zh/system/department.ts +0 -69
- package/src/locales/zh/system/dict.ts +0 -44
- package/src/locales/zh/system/menu.ts +0 -47
- package/src/locales/zh/system/permission.ts +0 -94
- package/src/locales/zh/system/role.ts +0 -25
- package/src/locales/zh/system/sys-config.ts +0 -32
- package/src/locales/zh/system/sys-log.ts +0 -38
- package/src/locales/zh/system/user.ts +0 -114
- package/src/locales/zh.ts +0 -67
- package/src/main.tsx +0 -50
- package/src/meta/const/index.ts +0 -40
- package/src/meta/index-dict.ts +0 -56
- package/src/meta/index-enum.ts +0 -95
- package/src/meta/index.ts +0 -14
- package/src/meta/module/dict-data/runtime.ts +0 -199
- package/src/meta/module/dict-data/types.ts +0 -17
- package/src/meta/module/enum-data/runtime.ts +0 -75
- package/src/meta/module/enum-data/types.ts +0 -18
- package/src/router/index.tsx +0 -312
- package/src/styles/AntdThemeProvider.tsx +0 -40
- package/src/styles/antd-theme.ts +0 -20
- package/src/styles/global.less +0 -107
- package/src/styles/variable.less +0 -103
- package/src/types/feedback.ts +0 -43
- package/src/types/index.ts +0 -85
- package/src/types/menu.ts +0 -43
- package/src/utils/aesUtil.ts +0 -123
- package/src/utils/chatUtils.ts +0 -524
- package/src/utils/cn.ts +0 -6
- package/src/utils/crypto.ts +0 -164
- package/src/utils/date.ts +0 -72
- package/src/utils/file-icons.tsx +0 -79
- package/src/utils/index.ts +0 -168
- package/src/utils/markdown-math-plugins.ts +0 -21
- package/src/utils/menuI18n.ts +0 -305
- package/src/utils/menuRouteRegistry.ts +0 -78
- package/src/utils/permission-crud.ts +0 -147
- package/src/utils/routeConfig.ts +0 -350
- package/src/utils/storage.ts +0 -135
- package/src/utils/toastBridge.ts +0 -26
- package/src/utils/url.ts +0 -38
- package/src/utils/validation.ts +0 -16
- package/src/views/auth/auth-code/index.less +0 -169
- package/src/views/auth/auth-code/index.module.less +0 -174
- package/src/views/auth/auth-code/index.tsx +0 -233
- package/src/views/auth/login.tsx +0 -498
- package/src/views/auth/register.tsx +0 -388
- package/src/views/base/memory/index.tsx +0 -136
- package/src/views/base/memory/modal/detail-modal.tsx +0 -89
- package/src/views/base/memory/modal/submit-modal.tsx +0 -134
- package/src/views/base/settings/index.tsx +0 -657
- package/src/views/chat/chat.less +0 -323
- package/src/views/chat/components/chat-input.tsx +0 -298
- package/src/views/chat/components/header-thread-title.tsx +0 -210
- package/src/views/chat/components/message-list/content-answer.tsx +0 -100
- package/src/views/chat/components/message-list/content-question.tsx +0 -18
- package/src/views/chat/components/message-list/index.tsx +0 -520
- package/src/views/chat/components/message-list/message-item.tsx +0 -199
- package/src/views/chat/components/message-list/preparation-demo-items.ts +0 -147
- package/src/views/chat/components/message-list/preparation-steps.tsx +0 -506
- package/src/views/chat/components/message-list/suggestion-list.tsx +0 -36
- package/src/views/chat/components/message-list/thinking-process.tsx +0 -49
- package/src/views/chat/components/message-list/toolbar.tsx +0 -224
- package/src/views/chat/components/message-list/use-message-list-scroll.ts +0 -214
- package/src/views/chat/components/references-knowledge/context.tsx +0 -57
- package/src/views/chat/components/references-knowledge/index.ts +0 -9
- package/src/views/chat/components/references-knowledge/modal/knowledge-detail-drawer.tsx +0 -556
- package/src/views/chat/components/references-knowledge/modal/knowledge-doc-detail-drawer.tsx +0 -529
- package/src/views/chat/components/references-knowledge/panel.tsx +0 -115
- package/src/views/chat/hooks/use-chat-common.ts +0 -19
- package/src/views/chat/index-session.tsx +0 -647
- package/src/views/chat/index.tsx +0 -127
- package/src/views/page-error/401.tsx +0 -56
- package/src/views/page-error/404.tsx +0 -56
- package/src/views/page-menus/business-rules/index.tsx +0 -376
- package/src/views/page-menus/business-rules/modal/detail-modal.tsx +0 -186
- package/src/views/page-menus/business-rules/modal/scope-modal.tsx +0 -272
- package/src/views/page-menus/business-rules/modal/submit-modal.tsx +0 -142
- package/src/views/page-menus/feedback/components/feedback-dataset-list.tsx +0 -471
- package/src/views/page-menus/feedback/index.tsx +0 -166
- package/src/views/page-menus/feedback/modal/export-feedback-modal.tsx +0 -367
- package/src/views/page-menus/knowledge/components/doc-editor-by-type.tsx +0 -32
- package/src/views/page-menus/knowledge/components/doc-editor-type-file.tsx +0 -330
- package/src/views/page-menus/knowledge/detail.tsx +0 -600
- package/src/views/page-menus/knowledge/index.tsx +0 -337
- package/src/views/page-menus/knowledge/modal/detail-modal.tsx +0 -618
- package/src/views/page-menus/knowledge/modal/doc-detail-modal.tsx +0 -550
- package/src/views/page-menus/knowledge/modal/doc-parse.ts +0 -99
- package/src/views/page-menus/knowledge/modal/doc-submit-modal.tsx +0 -349
- package/src/views/page-menus/knowledge/modal/doc-type-picker-modal.tsx +0 -88
- package/src/views/page-menus/knowledge/modal/knowledge-user-select-modal.tsx +0 -283
- package/src/views/page-menus/knowledge/modal/submit-modal.tsx +0 -179
- package/src/views/page-menus/model-metadata/manage/components/metadata-detail-schema-tab.tsx +0 -114
- package/src/views/page-menus/model-metadata/manage/components/step1-basic-info.tsx +0 -232
- package/src/views/page-menus/model-metadata/manage/components/step2-schema.tsx +0 -316
- package/src/views/page-menus/model-metadata/manage/components/step3-permissions.tsx +0 -134
- package/src/views/page-menus/model-metadata/manage/components/step4-documents.tsx +0 -134
- package/src/views/page-menus/model-metadata/manage/components/step5-example-sql.tsx +0 -101
- package/src/views/page-menus/model-metadata/manage/components/submit-add.tsx +0 -338
- package/src/views/page-menus/model-metadata/manage/components/submit-edit.tsx +0 -276
- package/src/views/page-menus/model-metadata/manage/detail.tsx +0 -298
- package/src/views/page-menus/model-metadata/manage/hooks/model-metadata-submit-shared.ts +0 -113
- package/src/views/page-menus/model-metadata/manage/hooks/use-model-metadata-item-state.ts +0 -20
- package/src/views/page-menus/model-metadata/manage/index.tsx +0 -304
- package/src/views/page-menus/model-metadata/manage/modal/components/table-schema.ts +0 -374
- package/src/views/page-menus/model-metadata/manage/modal/components/use-table-detail-tabs.tsx +0 -151
- package/src/views/page-menus/model-metadata/manage/modal/components/use-table-submit-tabs.tsx +0 -423
- package/src/views/page-menus/model-metadata/manage/modal/detail-modal.tsx +0 -218
- package/src/views/page-menus/model-metadata/manage/modal/submit-modal.tsx +0 -261
- package/src/views/page-menus/model-metadata/manage/modal/table-detail-modal.tsx +0 -196
- package/src/views/page-menus/model-metadata/manage/modal/table-submit-modal.tsx +0 -229
- package/src/views/page-menus/model-metadata/manage/submit.tsx +0 -31
- package/src/views/page-menus/model-metadata/role/index.tsx +0 -207
- package/src/views/page-menus/model-metadata/role/modal/detail-modal.tsx +0 -97
- package/src/views/page-menus/model-metadata/role/modal/role-assign-users-modal.tsx +0 -254
- package/src/views/page-menus/model-metadata/role/modal/role-assign-users-panel.tsx +0 -393
- package/src/views/page-menus/model-metadata/role/modal/role-assign-users-utils.ts +0 -120
- package/src/views/page-menus/model-metadata/role/modal/role-permission-assign-panel.tsx +0 -698
- package/src/views/page-menus/model-metadata/role/modal/role-permission-modal.tsx +0 -237
- package/src/views/page-menus/model-metadata/role/modal/submit-modal.tsx +0 -135
- package/src/views/page-menus/model-metadata/training/components/detail-records/index.ts +0 -4
- package/src/views/page-menus/model-metadata/training/components/detail-records/node-card.tsx +0 -72
- package/src/views/page-menus/model-metadata/training/components/detail-records/summary-lines.ts +0 -196
- package/src/views/page-menus/model-metadata/training/components/detail-records/summary-list.tsx +0 -153
- package/src/views/page-menus/model-metadata/training/components/detail-records/timeline.tsx +0 -103
- package/src/views/page-menus/model-metadata/training/components/detail-records/types.ts +0 -82
- package/src/views/page-menus/model-metadata/training/detail.tsx +0 -159
- package/src/views/page-menus/model-metadata/training/index.tsx +0 -236
- package/src/views/page-menus/model-metadata/training/modal/update-detail-modal.tsx +0 -154
- package/src/views/page-menus/skill/index.tsx +0 -201
- package/src/views/page-menus/skill/modal/detail-modal.tsx +0 -156
- package/src/views/page-menus/skill/modal/submit-modal.tsx +0 -214
- package/src/views/page-system/agent-config/index.tsx +0 -370
- package/src/views/page-system/department/departmentFormShared.ts +0 -36
- package/src/views/page-system/department/index.tsx +0 -541
- package/src/views/page-system/department/modal/detail-modal.tsx +0 -94
- package/src/views/page-system/department/modal/member-role-modal.tsx +0 -128
- package/src/views/page-system/department/modal/submit-modal.tsx +0 -265
- package/src/views/page-system/dict/index.tsx +0 -440
- package/src/views/page-system/dict/modal/cate-submit-modal.tsx +0 -315
- package/src/views/page-system/dict/modal/submit-modal.tsx +0 -184
- package/src/views/page-system/logs/components/index.ts +0 -3
- package/src/views/page-system/logs/components/log-message-demo.tsx +0 -30
- package/src/views/page-system/logs/components/log-message-stream.ts +0 -184
- package/src/views/page-system/logs/components/message-list/content-answer.tsx +0 -100
- package/src/views/page-system/logs/components/message-list/content-question.tsx +0 -18
- package/src/views/page-system/logs/components/message-list/index.tsx +0 -515
- package/src/views/page-system/logs/components/message-list/message-item.tsx +0 -193
- package/src/views/page-system/logs/components/message-list/preparation-demo-items.ts +0 -147
- package/src/views/page-system/logs/components/message-list/preparation-steps.tsx +0 -506
- package/src/views/page-system/logs/components/message-list/suggestion-list.tsx +0 -36
- package/src/views/page-system/logs/components/message-list/thinking-process.tsx +0 -49
- package/src/views/page-system/logs/components/message-list/toolbar.tsx +0 -134
- package/src/views/page-system/logs/components/message-list/use-message-list-scroll.ts +0 -214
- package/src/views/page-system/logs/components/message-modal.tsx +0 -239
- package/src/views/page-system/logs/index.tsx +0 -132
- package/src/views/page-system/logs/modal/detail-modal.tsx +0 -157
- package/src/views/page-system/menu/components/menuFormShared.ts +0 -283
- package/src/views/page-system/menu/index.less +0 -12
- package/src/views/page-system/menu/index.tsx +0 -410
- package/src/views/page-system/menu/modal/icon-modal.less +0 -51
- package/src/views/page-system/menu/modal/icon-modal.tsx +0 -87
- package/src/views/page-system/menu/modal/submit-modal.tsx +0 -263
- package/src/views/page-system/permission/index.tsx +0 -562
- package/src/views/page-system/permission/modal/detail-modal.tsx +0 -179
- package/src/views/page-system/permission/modal/submit-modal.less +0 -146
- package/src/views/page-system/permission/modal/submit-modal.tsx +0 -650
- package/src/views/page-system/role/index.tsx +0 -163
- package/src/views/page-system/role/modal/detail-modal.tsx +0 -127
- package/src/views/page-system/role/modal/permission-assign-group-rules.ts +0 -86
- package/src/views/page-system/role/modal/permission-modal.tsx +0 -111
- package/src/views/page-system/role/modal/role-modal-shell-styles.ts +0 -21
- package/src/views/page-system/role/modal/role-permission-assign-panel.tsx +0 -916
- package/src/views/page-system/role/modal/role-permission-assign-shared.ts +0 -1047
- package/src/views/page-system/role/modal/submit-modal.tsx +0 -193
- package/src/views/page-system/sys-config/index.tsx +0 -294
- package/src/views/page-system/user/components/user-role-column.tsx +0 -87
- package/src/views/page-system/user/index.tsx +0 -439
- package/src/views/page-system/user/modal/assign-roles-modal.tsx +0 -389
- package/src/views/page-system/user/modal/detail-modal.tsx +0 -72
- package/src/views/page-system/user/modal/modal-style/submit-modal.less +0 -40
- package/src/views/page-system/user/modal/submit-modal.less +0 -40
- package/src/views/page-system/user/modal/submit-modal.tsx +0 -287
- package/src/views/page-system/user/userFormShared.ts +0 -51
- package/tailwind.config.js +0 -17
- package/tsconfig.app.json +0 -48
- package/tsconfig.json +0 -11
- package/tsconfig.node.json +0 -26
- package/vite.config.ts +0 -264
- /package/{public → dist}/favicon.ico +0 -0
- /package/{public → dist}/vite.svg +0 -0
package/src/views/auth/login.tsx
DELETED
|
@@ -1,498 +0,0 @@
|
|
|
1
|
-
import { loginAPI, recoverPasswordAPI, sendEmailVerifyCodeAPI } from '@/api/common/auth';
|
|
2
|
-
import { setUserCurrentLanguageAPI } from '@/api/system/user';
|
|
3
|
-
import LanguageSwitcher from '@/components/common/language-switcher';
|
|
4
|
-
import { SystemLogoMark } from '@/components/common/system-logo-mark';
|
|
5
|
-
import { useSystemConfig } from '@/config/system';
|
|
6
|
-
import { antdTheme } from '@/styles/antd-theme';
|
|
7
|
-
import { getStore } from '@/utils/storage';
|
|
8
|
-
import { CxInput } from '@cx-ui';
|
|
9
|
-
import aesUtil from '@utils/aesUtil';
|
|
10
|
-
import { ConfigProvider, theme as antdThemePreset, type ThemeConfig } from 'antd';
|
|
11
|
-
import { ArrowRight, Loader2, Lock, Phone } from 'lucide-react';
|
|
12
|
-
import React, { useEffect, useRef, useState } from 'react';
|
|
13
|
-
import { useTranslation } from 'react-i18next';
|
|
14
|
-
import { Link, useNavigate } from 'react-router-dom';
|
|
15
|
-
import { useAuth } from '../../contexts/AuthContext';
|
|
16
|
-
import { useMenu } from '../../contexts/MenuContext';
|
|
17
|
-
import { useToast } from '../../contexts/ToastContext';
|
|
18
|
-
import AuthCode from './auth-code';
|
|
19
|
-
|
|
20
|
-
const loginPageAntdTheme: ThemeConfig = {
|
|
21
|
-
...antdTheme,
|
|
22
|
-
algorithm: antdThemePreset.darkAlgorithm,
|
|
23
|
-
components: {
|
|
24
|
-
Input: {
|
|
25
|
-
colorBgContainer: 'rgba(19, 19, 20, 0.55)',
|
|
26
|
-
colorBorder: '#3f3f46',
|
|
27
|
-
hoverBorderColor: '#52525b',
|
|
28
|
-
activeBorderColor: '#52525b',
|
|
29
|
-
/** 去掉 antd 默认浅色 active 光晕,避免暗色表单聚焦闪白 */
|
|
30
|
-
activeShadow: 'none',
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
const LoginPage: React.FC = () => {
|
|
36
|
-
const { systemName } = useSystemConfig()
|
|
37
|
-
const [phone, setPhone] = useState('');
|
|
38
|
-
const [password, setPassword] = useState('');
|
|
39
|
-
const loginSnapshotRef = useRef({ phone: '', password: '' });
|
|
40
|
-
const [isLoading, setIsLoading] = useState(false);
|
|
41
|
-
const { login, refreshUser, isAuthenticated, isLoading: authLoading } = useAuth();
|
|
42
|
-
const { refreshMenus } = useMenu()
|
|
43
|
-
const { showToast, clearToasts } = useToast();
|
|
44
|
-
const navigate = useNavigate();
|
|
45
|
-
const { t, i18n } = useTranslation();
|
|
46
|
-
const authRef = useRef<any>(null);
|
|
47
|
-
const [isAuthCodeVisible, setIsAuthCodeVisible] = useState(false);
|
|
48
|
-
|
|
49
|
-
const RECOVER_EMAIL_CODE_COOLDOWN_KEY = 'recover_email_code_cooldown_until';
|
|
50
|
-
const [isRecoverOpen, setIsRecoverOpen] = useState(false);
|
|
51
|
-
const [recoverEmail, setRecoverEmail] = useState('');
|
|
52
|
-
const [recoverEmailCode, setRecoverEmailCode] = useState('');
|
|
53
|
-
const [recoverNewPassword, setRecoverNewPassword] = useState('');
|
|
54
|
-
const [recoverConfirmPassword, setRecoverConfirmPassword] = useState('');
|
|
55
|
-
const [recoverCooldownSeconds, setRecoverCooldownSeconds] = useState(0);
|
|
56
|
-
const [recoverCooldownLoading, setRecoverCooldownLoading] = useState(true);
|
|
57
|
-
const [recoverSendingCode, setRecoverSendingCode] = useState(false);
|
|
58
|
-
const [recoverSubmitting, setRecoverSubmitting] = useState(false);
|
|
59
|
-
const recoverAuthSnapshotRef = useRef({ email: '' });
|
|
60
|
-
const [isRecoverAuthCodeVisible, setIsRecoverAuthCodeVisible] = useState(false);
|
|
61
|
-
|
|
62
|
-
/** 刷新落到登录页:token 有效则跳转默认路由,避免再次显示登录页 */
|
|
63
|
-
useEffect(() => {
|
|
64
|
-
const token = getStore('token');
|
|
65
|
-
if (!token) return;
|
|
66
|
-
if (authLoading) return;
|
|
67
|
-
if (isAuthenticated) {
|
|
68
|
-
clearToasts();
|
|
69
|
-
navigate('/chat', { replace: true });
|
|
70
|
-
}
|
|
71
|
-
}, [authLoading, isAuthenticated, navigate, clearToasts]);
|
|
72
|
-
const onReset = () => {
|
|
73
|
-
// loginForm.resetFields();
|
|
74
|
-
};
|
|
75
|
-
const close = () => {
|
|
76
|
-
setIsAuthCodeVisible(false);
|
|
77
|
-
};
|
|
78
|
-
/** 关闭找回密码弹框并清理输入 */
|
|
79
|
-
const closeRecover = () => {
|
|
80
|
-
setIsRecoverOpen(false);
|
|
81
|
-
setRecoverEmail('');
|
|
82
|
-
setRecoverEmailCode('');
|
|
83
|
-
setRecoverNewPassword('');
|
|
84
|
-
setRecoverConfirmPassword('');
|
|
85
|
-
setIsRecoverAuthCodeVisible(false);
|
|
86
|
-
};
|
|
87
|
-
/** 登录前快照当前界面语言:避免登录流程覆盖 localStorage 后丢失用户选择。 */
|
|
88
|
-
const resolvePendingLanguageForLoginSync = () => {
|
|
89
|
-
console.log('getStore(i18nextLng)', getStore('i18nextLng'));
|
|
90
|
-
const raw = i18n.language || getStore('i18nextLng') || 'zh'
|
|
91
|
-
return raw.toLowerCase().startsWith('zh') ? 'zh' : 'en'
|
|
92
|
-
}
|
|
93
|
-
const validImg = async (data: any, callback: any) => {
|
|
94
|
-
const { phone: submitPhone, password: submitPassword } = loginSnapshotRef.current;
|
|
95
|
-
const isSuper = submitPhone === 'super';
|
|
96
|
-
const isValidPhone = /^1\d{10}$/.test(submitPhone);
|
|
97
|
-
if (!isSuper && !isValidPhone) {
|
|
98
|
-
showToast(t('auth.login.invalid_phone'), 'error');
|
|
99
|
-
callback?.();
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
setIsLoading(true);
|
|
104
|
-
|
|
105
|
-
try {
|
|
106
|
-
const body: any = await loginAPI({
|
|
107
|
-
phone: aesUtil.encrypt(submitPhone),
|
|
108
|
-
password: aesUtil.encrypt(submitPassword),
|
|
109
|
-
captchaId: data.uuid,
|
|
110
|
-
imageCaptchaTrack: data.trackData,
|
|
111
|
-
});
|
|
112
|
-
if (!body?.success) {
|
|
113
|
-
console.log(body?.message || t('auth.login.failed'));
|
|
114
|
-
callback?.();
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
const nextLng = resolvePendingLanguageForLoginSync()
|
|
119
|
-
await login(body.data.token);
|
|
120
|
-
await refreshMenus()
|
|
121
|
-
|
|
122
|
-
// 登录页语言切换仅本地;登录成功后将当前语言同步到服务端
|
|
123
|
-
try {
|
|
124
|
-
await setUserCurrentLanguageAPI({
|
|
125
|
-
language: nextLng,
|
|
126
|
-
lang: nextLng,
|
|
127
|
-
code: nextLng,
|
|
128
|
-
} as any);
|
|
129
|
-
await refreshUser();
|
|
130
|
-
} catch (e) {
|
|
131
|
-
// 语言同步失败不影响登录主流程
|
|
132
|
-
}
|
|
133
|
-
setIsAuthCodeVisible(false);
|
|
134
|
-
clearToasts();
|
|
135
|
-
navigate('/chat');
|
|
136
|
-
} catch (err: any) {
|
|
137
|
-
console.error('Login failed', err);
|
|
138
|
-
showToast(err?.message || t('auth.login.failed'), 'error');
|
|
139
|
-
callback?.();
|
|
140
|
-
} finally {
|
|
141
|
-
setIsLoading(false);
|
|
142
|
-
}
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
const handleSubmit = async (e: React.FormEvent) => {
|
|
146
|
-
e.preventDefault();
|
|
147
|
-
if (isLoading) return;
|
|
148
|
-
|
|
149
|
-
const submitPhone = `${phone || ''}`.trim();
|
|
150
|
-
const submitPassword = `${password || ''}`;
|
|
151
|
-
loginSnapshotRef.current = {
|
|
152
|
-
phone: submitPhone,
|
|
153
|
-
password: submitPassword,
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
const isSuper = submitPhone === 'super';
|
|
157
|
-
const isValidPhone = /^1\d{10}$/.test(submitPhone);
|
|
158
|
-
if (!isSuper && !isValidPhone) {
|
|
159
|
-
showToast(t('auth.login.invalid_phone'), 'error');
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
setIsAuthCodeVisible(true);
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
/** 初始化找回密码邮箱验证码倒计时(刷新页面继续) */
|
|
167
|
-
useEffect(() => {
|
|
168
|
-
const raw = localStorage.getItem(RECOVER_EMAIL_CODE_COOLDOWN_KEY) || '0';
|
|
169
|
-
const cooldownUntil = Number(raw);
|
|
170
|
-
const left = Math.ceil((cooldownUntil - Date.now()) / 1000);
|
|
171
|
-
setRecoverCooldownSeconds(left > 0 ? left : 0);
|
|
172
|
-
setRecoverCooldownLoading(false);
|
|
173
|
-
}, []);
|
|
174
|
-
|
|
175
|
-
/** 找回密码倒计时每秒递减 */
|
|
176
|
-
useEffect(() => {
|
|
177
|
-
if (recoverCooldownSeconds <= 0) return;
|
|
178
|
-
const timer = window.setInterval(() => {
|
|
179
|
-
setRecoverCooldownSeconds((prev) => {
|
|
180
|
-
const next = prev - 1;
|
|
181
|
-
if (next <= 0) {
|
|
182
|
-
localStorage.removeItem(RECOVER_EMAIL_CODE_COOLDOWN_KEY);
|
|
183
|
-
return 0;
|
|
184
|
-
}
|
|
185
|
-
return next;
|
|
186
|
-
});
|
|
187
|
-
}, 1000);
|
|
188
|
-
return () => window.clearInterval(timer);
|
|
189
|
-
}, [recoverCooldownSeconds]);
|
|
190
|
-
|
|
191
|
-
/** 打开滑动验证码后发送邮箱验证码 */
|
|
192
|
-
const handleRecoverSendEmailCode = async (data: any, callback?: any) => {
|
|
193
|
-
const email = recoverAuthSnapshotRef.current.email;
|
|
194
|
-
setIsRecoverAuthCodeVisible(false);
|
|
195
|
-
try {
|
|
196
|
-
setRecoverSendingCode(true);
|
|
197
|
-
const resp: any = await sendEmailVerifyCodeAPI({
|
|
198
|
-
email,
|
|
199
|
-
captchaId: data?.uuid,
|
|
200
|
-
imageCaptchaTrack: data?.trackData,
|
|
201
|
-
});
|
|
202
|
-
const leftSeconds = resp?.data ?? resp?.data?.data;
|
|
203
|
-
const nextSeconds = typeof leftSeconds === 'number' ? leftSeconds : 120;
|
|
204
|
-
const cooldownUntil = Date.now() + nextSeconds * 1000;
|
|
205
|
-
localStorage.setItem(RECOVER_EMAIL_CODE_COOLDOWN_KEY, `${cooldownUntil}`);
|
|
206
|
-
setRecoverCooldownSeconds(nextSeconds);
|
|
207
|
-
setRecoverEmailCode('');
|
|
208
|
-
showToast(t('auth.recover.email_code_sent_success'), 'success');
|
|
209
|
-
} catch (e: any) {
|
|
210
|
-
showToast(e?.message || t('auth.recover.email_code_sent_failed'), 'error');
|
|
211
|
-
callback?.();
|
|
212
|
-
} finally {
|
|
213
|
-
setRecoverSendingCode(false);
|
|
214
|
-
}
|
|
215
|
-
};
|
|
216
|
-
|
|
217
|
-
/** 触发找回密码发送验证码:先弹出滑动验证码 */
|
|
218
|
-
const openRecoverSendCode = () => {
|
|
219
|
-
if (recoverSendingCode || recoverCooldownLoading || recoverCooldownSeconds > 0) return;
|
|
220
|
-
const email = `${recoverEmail || ''}`.trim();
|
|
221
|
-
if (!email) {
|
|
222
|
-
showToast(t('auth.recover.email_required'), 'error');
|
|
223
|
-
return;
|
|
224
|
-
}
|
|
225
|
-
recoverAuthSnapshotRef.current = { email };
|
|
226
|
-
setIsRecoverAuthCodeVisible(true);
|
|
227
|
-
};
|
|
228
|
-
|
|
229
|
-
/** 提交找回密码 */
|
|
230
|
-
const submitRecoverPassword = async (e: React.FormEvent) => {
|
|
231
|
-
e.preventDefault();
|
|
232
|
-
if (recoverSubmitting) return;
|
|
233
|
-
const email = `${recoverEmail || ''}`.trim();
|
|
234
|
-
if (!email) {
|
|
235
|
-
showToast(t('auth.recover.email_required'), 'error');
|
|
236
|
-
return;
|
|
237
|
-
}
|
|
238
|
-
if (!recoverEmailCode.trim()) {
|
|
239
|
-
showToast(t('auth.recover.email_code_required'), 'error');
|
|
240
|
-
return;
|
|
241
|
-
}
|
|
242
|
-
if (!recoverNewPassword) {
|
|
243
|
-
showToast(t('auth.recover.new_password_required'), 'error');
|
|
244
|
-
return;
|
|
245
|
-
}
|
|
246
|
-
if (!recoverConfirmPassword) {
|
|
247
|
-
showToast(t('auth.recover.confirm_password_required'), 'error');
|
|
248
|
-
return;
|
|
249
|
-
}
|
|
250
|
-
if (recoverNewPassword !== recoverConfirmPassword) {
|
|
251
|
-
showToast(t('auth.recover.password_mismatch'), 'error');
|
|
252
|
-
return;
|
|
253
|
-
}
|
|
254
|
-
try {
|
|
255
|
-
setRecoverSubmitting(true);
|
|
256
|
-
await recoverPasswordAPI({
|
|
257
|
-
email,
|
|
258
|
-
emailCode: recoverEmailCode.trim(),
|
|
259
|
-
newPassword: recoverNewPassword,
|
|
260
|
-
confirmPassword: recoverConfirmPassword,
|
|
261
|
-
});
|
|
262
|
-
showToast(t('auth.recover.success'), 'success');
|
|
263
|
-
closeRecover();
|
|
264
|
-
} catch (e: any) {
|
|
265
|
-
showToast(e?.message || t('auth.recover.failed'), 'error');
|
|
266
|
-
} finally {
|
|
267
|
-
setRecoverSubmitting(false);
|
|
268
|
-
}
|
|
269
|
-
};
|
|
270
|
-
|
|
271
|
-
const stars = React.useMemo(() => {
|
|
272
|
-
return Array.from({ length: 30 }).map((_, i) => ({
|
|
273
|
-
id: i,
|
|
274
|
-
top: `${Math.random() * 40}%`,
|
|
275
|
-
left: `${Math.random() * 40}%`,
|
|
276
|
-
size: Math.random() * 2 + 1,
|
|
277
|
-
opacity: Math.random() * 0.7 + 0.3,
|
|
278
|
-
delay: Math.random() * 5,
|
|
279
|
-
isBlue: Math.random() > 0.7,
|
|
280
|
-
}));
|
|
281
|
-
}, []);
|
|
282
|
-
|
|
283
|
-
const hasToken = !!getStore('token');
|
|
284
|
-
|
|
285
|
-
if (hasToken && authLoading) {
|
|
286
|
-
return (
|
|
287
|
-
<div className="min-h-screen w-full flex items-center justify-center bg-[#131314]">
|
|
288
|
-
<Loader2 className="animate-spin h-8 w-8 text-blue-600" />
|
|
289
|
-
</div>
|
|
290
|
-
);
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
return (
|
|
294
|
-
<ConfigProvider theme={loginPageAntdTheme}>
|
|
295
|
-
<div className="auth-dark-cx min-h-screen w-full flex items-center justify-center bg-[#131314] relative overflow-hidden">
|
|
296
|
-
<div className="absolute top-0 left-0 w-full h-full pointer-events-none z-0">
|
|
297
|
-
{stars.map((star) => (
|
|
298
|
-
<div
|
|
299
|
-
key={star.id}
|
|
300
|
-
className={`absolute rounded-full ${star.isBlue ? 'bg-blue-200' : 'bg-white'} animate-pulse`}
|
|
301
|
-
style={{
|
|
302
|
-
top: star.top,
|
|
303
|
-
left: star.left,
|
|
304
|
-
width: `${star.size}px`,
|
|
305
|
-
height: `${star.size}px`,
|
|
306
|
-
opacity: star.opacity,
|
|
307
|
-
animationDuration: `${3 + star.delay}s`,
|
|
308
|
-
boxShadow: star.isBlue
|
|
309
|
-
? `0 0 ${star.size * 2}px rgba(147, 197, 253, 0.6)`
|
|
310
|
-
: `0 0 ${star.size}px rgba(255, 255, 255, 0.4)`,
|
|
311
|
-
}}
|
|
312
|
-
/>
|
|
313
|
-
))}
|
|
314
|
-
</div>
|
|
315
|
-
|
|
316
|
-
<div className="absolute top-[-20%] left-[-10%] w-[50%] h-[50%] bg-blue-600/20 rounded-full blur-[120px] pointer-events-none" />
|
|
317
|
-
<div className="absolute bottom-[-20%] right-[-10%] w-[50%] h-[50%] bg-purple-600/20 rounded-full blur-[120px] pointer-events-none" />
|
|
318
|
-
|
|
319
|
-
<div className="absolute top-6 right-6 z-20">
|
|
320
|
-
<LanguageSwitcher direction="down" localOnly />
|
|
321
|
-
</div>
|
|
322
|
-
|
|
323
|
-
<div className="w-full max-w-md p-8 relative z-10 animate-fade-in-up" style={{ marginTop: '20px' }}>
|
|
324
|
-
<div className="text-center mb-10">
|
|
325
|
-
<div className="flex items-center justify-center gap-4 mb-6">
|
|
326
|
-
<SystemLogoMark className="w-12 h-12" fallbackShape="square" />
|
|
327
|
-
<h1 className="text-3xl font-extrabold text-white tracking-tight bg-clip-text text-transparent bg-gradient-to-r from-white to-gray-400">
|
|
328
|
-
{systemName}
|
|
329
|
-
</h1>
|
|
330
|
-
</div>
|
|
331
|
-
<h2 className="text-lg text-gray-400 mb-3 font-medium">{t('auth.login.title')}</h2>
|
|
332
|
-
<p className="text-gray-500 text-sm">
|
|
333
|
-
{t('auth.login.no_account')}{' '}
|
|
334
|
-
<Link
|
|
335
|
-
to="/register"
|
|
336
|
-
onClick={() => clearToasts()}
|
|
337
|
-
className="text-blue-400 hover:text-blue-300 font-medium transition-colors hover:underline"
|
|
338
|
-
>
|
|
339
|
-
{t('auth.login.create_account')}
|
|
340
|
-
</Link>
|
|
341
|
-
</p>
|
|
342
|
-
</div>
|
|
343
|
-
|
|
344
|
-
<div className="bg-[#1e1f20]/60 backdrop-blur-xl border border-gray-800 rounded-3xl px-8 pb-8 pt-7 shadow-2xl">
|
|
345
|
-
{!isRecoverOpen ? (
|
|
346
|
-
<form className="space-y-6" onSubmit={handleSubmit}>
|
|
347
|
-
<div className="space-y-4">
|
|
348
|
-
<CxInput
|
|
349
|
-
className="w-full"
|
|
350
|
-
required
|
|
351
|
-
prefix={<Phone className="h-5 w-5 shrink-0 text-gray-500" aria-hidden />}
|
|
352
|
-
placeholder={t('auth.login.phone_placeholder')}
|
|
353
|
-
value={phone}
|
|
354
|
-
onChange={(e) => setPhone(e.target.value)}
|
|
355
|
-
style={{ height: '54px' }}
|
|
356
|
-
/>
|
|
357
|
-
<CxInput
|
|
358
|
-
className="w-full"
|
|
359
|
-
type="password"
|
|
360
|
-
required
|
|
361
|
-
prefix={<Lock className="h-5 w-5 shrink-0 text-gray-500" aria-hidden />}
|
|
362
|
-
placeholder={t('auth.login.password_placeholder')}
|
|
363
|
-
value={password}
|
|
364
|
-
onChange={(e) => setPassword(e.target.value)}
|
|
365
|
-
style={{ height: '54px' }}
|
|
366
|
-
/>
|
|
367
|
-
</div>
|
|
368
|
-
|
|
369
|
-
<button
|
|
370
|
-
type="submit"
|
|
371
|
-
disabled={isLoading}
|
|
372
|
-
className="w-full relative flex items-center justify-center py-3.5 px-4 bg-gradient-to-r from-blue-600 to-purple-600 hover:from-blue-500 hover:to-purple-500 text-white font-semibold rounded-xl transition-all duration-200 shadow-lg shadow-blue-500/25 dark:shadow-none hover:shadow-blue-500/40 transform hover:-translate-y-0.5 disabled:opacity-50 disabled:cursor-not-allowed disabled:transform-none"
|
|
373
|
-
>
|
|
374
|
-
{isLoading ? (
|
|
375
|
-
<Loader2 className="animate-spin h-5 w-5" />
|
|
376
|
-
) : (
|
|
377
|
-
<span className="flex items-center gap-2">
|
|
378
|
-
{t('auth.login.submit')} <ArrowRight size={18} />
|
|
379
|
-
</span>
|
|
380
|
-
)}
|
|
381
|
-
</button>
|
|
382
|
-
|
|
383
|
-
<div className="text-center" style={{ marginTop: '12px' }}>
|
|
384
|
-
<button
|
|
385
|
-
type="button"
|
|
386
|
-
onClick={() => setIsRecoverOpen(true)}
|
|
387
|
-
className="text-sm text-blue-300 hover:text-blue-200 hover:underline"
|
|
388
|
-
>
|
|
389
|
-
{t('auth.recover.entry')}
|
|
390
|
-
</button>
|
|
391
|
-
</div>
|
|
392
|
-
{isAuthCodeVisible && (
|
|
393
|
-
<AuthCode ref={authRef} validImg={validImg} close={close} onReset={onReset} />
|
|
394
|
-
)}
|
|
395
|
-
</form>
|
|
396
|
-
) : (
|
|
397
|
-
<form className="space-y-5" onSubmit={submitRecoverPassword} autoComplete="new-password">
|
|
398
|
-
<div className="flex items-center justify-between">
|
|
399
|
-
<div className="text-white font-semibold">{t('auth.recover.title')}</div>
|
|
400
|
-
<button
|
|
401
|
-
type="button"
|
|
402
|
-
onClick={closeRecover}
|
|
403
|
-
className="text-sm text-gray-300 hover:text-white"
|
|
404
|
-
>
|
|
405
|
-
{t('auth.recover.back_to_login')}
|
|
406
|
-
</button>
|
|
407
|
-
</div>
|
|
408
|
-
|
|
409
|
-
<CxInput
|
|
410
|
-
className="w-full"
|
|
411
|
-
type="email"
|
|
412
|
-
required
|
|
413
|
-
autoComplete="off"
|
|
414
|
-
placeholder={t('auth.recover.email_placeholder')}
|
|
415
|
-
value={recoverEmail}
|
|
416
|
-
onChange={(e) => {
|
|
417
|
-
setRecoverEmail(e.target.value);
|
|
418
|
-
setRecoverEmailCode('');
|
|
419
|
-
}}
|
|
420
|
-
/>
|
|
421
|
-
|
|
422
|
-
<div className="flex items-center gap-2">
|
|
423
|
-
<button
|
|
424
|
-
type="button"
|
|
425
|
-
disabled={recoverSendingCode || recoverCooldownLoading || recoverCooldownSeconds > 0}
|
|
426
|
-
onClick={openRecoverSendCode}
|
|
427
|
-
className="shrink-0 px-4 py-2.5 border border-blue-500/60 text-blue-300 hover:text-white hover:bg-blue-500/20 rounded-xl transition-all disabled:opacity-50 disabled:cursor-not-allowed"
|
|
428
|
-
>
|
|
429
|
-
{recoverCooldownLoading || recoverSendingCode ? (
|
|
430
|
-
<span className="flex items-center gap-2">
|
|
431
|
-
<Loader2 className="animate-spin h-4 w-4" />
|
|
432
|
-
{t('common.loading')}
|
|
433
|
-
</span>
|
|
434
|
-
) : recoverCooldownSeconds > 0 ? (
|
|
435
|
-
t('auth.recover.send_code_countdown', { count: recoverCooldownSeconds })
|
|
436
|
-
) : (
|
|
437
|
-
t('auth.recover.send_code')
|
|
438
|
-
)}
|
|
439
|
-
</button>
|
|
440
|
-
<CxInput
|
|
441
|
-
className="min-w-0 flex-1"
|
|
442
|
-
autoComplete="off"
|
|
443
|
-
placeholder={t('auth.recover.email_code_placeholder')}
|
|
444
|
-
value={recoverEmailCode}
|
|
445
|
-
onChange={(e) => setRecoverEmailCode(e.target.value)}
|
|
446
|
-
/>
|
|
447
|
-
</div>
|
|
448
|
-
|
|
449
|
-
<CxInput
|
|
450
|
-
className="w-full"
|
|
451
|
-
type="password"
|
|
452
|
-
required
|
|
453
|
-
autoComplete="new-password"
|
|
454
|
-
placeholder={t('auth.recover.new_password_placeholder')}
|
|
455
|
-
value={recoverNewPassword}
|
|
456
|
-
onChange={(e) => setRecoverNewPassword(e.target.value)}
|
|
457
|
-
/>
|
|
458
|
-
<CxInput
|
|
459
|
-
className="w-full"
|
|
460
|
-
type="password"
|
|
461
|
-
required
|
|
462
|
-
autoComplete="new-password"
|
|
463
|
-
placeholder={t('auth.recover.confirm_password_placeholder')}
|
|
464
|
-
value={recoverConfirmPassword}
|
|
465
|
-
onChange={(e) => setRecoverConfirmPassword(e.target.value)}
|
|
466
|
-
/>
|
|
467
|
-
|
|
468
|
-
<button
|
|
469
|
-
type="submit"
|
|
470
|
-
disabled={recoverSubmitting}
|
|
471
|
-
className="w-full relative flex items-center justify-center py-3.5 px-4 bg-gradient-to-r from-blue-600 to-purple-600 hover:from-blue-500 hover:to-purple-500 text-white font-semibold rounded-xl transition-all duration-200 shadow-lg shadow-blue-500/25 dark:shadow-none hover:shadow-blue-500/40 transform hover:-translate-y-0.5 disabled:opacity-50 disabled:cursor-not-allowed disabled:transform-none"
|
|
472
|
-
>
|
|
473
|
-
{recoverSubmitting ? (
|
|
474
|
-
<Loader2 className="animate-spin h-5 w-5" />
|
|
475
|
-
) : (
|
|
476
|
-
<span className="flex items-center gap-2">
|
|
477
|
-
{t('auth.recover.submit')} <ArrowRight size={18} />
|
|
478
|
-
</span>
|
|
479
|
-
)}
|
|
480
|
-
</button>
|
|
481
|
-
|
|
482
|
-
{isRecoverAuthCodeVisible ? (
|
|
483
|
-
<AuthCode
|
|
484
|
-
validImg={handleRecoverSendEmailCode}
|
|
485
|
-
close={() => setIsRecoverAuthCodeVisible(false)}
|
|
486
|
-
onReset={() => {}}
|
|
487
|
-
/>
|
|
488
|
-
) : null}
|
|
489
|
-
</form>
|
|
490
|
-
)}
|
|
491
|
-
</div>
|
|
492
|
-
</div>
|
|
493
|
-
</div>
|
|
494
|
-
</ConfigProvider>
|
|
495
|
-
);
|
|
496
|
-
};
|
|
497
|
-
|
|
498
|
-
export default LoginPage;
|