@liujitcn/kratos-taro-app-system 0.0.82 → 0.0.84
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/README.md +28 -0
- package/dist/module.mjs +0 -32
- package/package.json +4 -3
- package/src/{views/pages/my/my.scss → components/KratosMyPage.scss} +1 -0
- package/src/components/KratosMyPage.tsx +110 -0
- package/src/locales/en-US.json +0 -8
- package/src/locales/ja-JP.json +0 -8
- package/src/locales/zh-CN.json +0 -8
- package/src/locales/zh-TW.json +0 -8
- package/src/views/pages/my/components/MyExtensions.tsx +4 -0
- package/src/views/pages/my/my.tsx +6 -96
package/README.md
CHANGED
|
@@ -13,6 +13,34 @@
|
|
|
13
13
|
|
|
14
14
|
页面配置统一登记在 `src/pages.ts`,运行时映射位于 `src/index.ts`,构建期描述位于 `src/build.ts`。页面私有组件放在页面目录的 `components` 中,不会被 runner 扫描为路由。
|
|
15
15
|
|
|
16
|
+
## 个人中心扩展
|
|
17
|
+
|
|
18
|
+
公共组件 `KratosMyPage` 保留顶部标题与设置、个人信息和 AI 助手入口;AI 卡片继续由应用的 `aiEnabled` 配置控制显隐。React `children` 作为业务扩展区,位于这些固定内容之后,与它们共用滚动区域、主题和卡片间距。未传入内容时不增加容器或留白,业务卡片、数据请求和权限由项目模块维护。
|
|
19
|
+
|
|
20
|
+
公共组件与样式位于 `src/components/KratosMyPage.tsx` 和 `KratosMyPage.scss`。内置 [我的页面](src/views/pages/my/my.tsx) 已使用该组件,并挂载 [MyExtensions 空实现](src/views/pages/my/components/MyExtensions.tsx)。空实现返回 `null`,不显示占位卡片;项目可以按这个结构组织自己的业务内容。
|
|
21
|
+
|
|
22
|
+
在项目业务模块的 `src/views/pages/my/my.tsx` 复用公开组件入口:
|
|
23
|
+
|
|
24
|
+
```tsx
|
|
25
|
+
import KratosMyPage from '@liujitcn/kratos-taro-app-system/components/KratosMyPage'
|
|
26
|
+
import OrderSection from './components/OrderSection'
|
|
27
|
+
import ServiceSection from './components/ServiceSection'
|
|
28
|
+
|
|
29
|
+
/** MyPage 组合公共个人中心与项目业务卡片。 */
|
|
30
|
+
export default function MyPage() {
|
|
31
|
+
return (
|
|
32
|
+
<KratosMyPage>
|
|
33
|
+
<OrderSection />
|
|
34
|
+
<ServiceSection />
|
|
35
|
+
</KratosMyPage>
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
项目模块的 `pages` 声明 `'pages/my/my': { style: { navigationStyle: 'custom', navigationBarTitleText: '' } }`,`views` 声明 `PROFILE_HOME: 'pages/my/my'`,并在宿主 `module-manifest.ts` 中排在 system 模块之后。构建期 `buildModule.pages` 复用相同页面配置。使用相同的物理路由可以保留微信原生 tab 切换;页面 wrapper 和底部 tabBar 继续由 runner 生成,不在业务页面重复挂载。
|
|
41
|
+
|
|
42
|
+
扩展区可以直接放多个业务卡片,不需要复制公共页面或给顶部入口提供替换内容。需要登录态、用户资料或导航时,通过 core 的公开 store 与导航 API 获取。
|
|
43
|
+
|
|
16
44
|
## AI 助手
|
|
17
45
|
|
|
18
46
|
AI 页面支持会话创建与切换、历史会话搜索、消息加载、附件上传、复制、删除、再生成、工具提示和快捷入口。Provider 与模型通过 `AiModelService` 加载,知识库通过 `AiKnowledgeService` 加载并可多选,发送消息时携带所选知识库编号。H5 使用 Fetch SSE,微信小程序使用 chunked 请求,两端共用增量 SSE 解析器和相同事件契约。
|
package/dist/module.mjs
CHANGED
|
@@ -102,7 +102,6 @@ var zh_CN_default = {
|
|
|
102
102
|
"system.profile.account": "\u8D26\u53F7",
|
|
103
103
|
"system.profile.avatar_change": "\u70B9\u51FB\u4FEE\u6539\u5934\u50CF",
|
|
104
104
|
"system.profile.avatar_upload_failed": "\u4E0A\u4F20\u5934\u50CF\u5931\u8D25",
|
|
105
|
-
"system.profile.avatar_update": "\u66F4\u65B0\u5934\u50CF\u6635\u79F0",
|
|
106
105
|
"system.profile.gender": "\u6027\u522B",
|
|
107
106
|
"system.profile.email": "\u90AE\u7BB1",
|
|
108
107
|
"system.profile.email_placeholder": "\u8BF7\u8F93\u5165\u90AE\u7BB1",
|
|
@@ -151,27 +150,20 @@ var zh_CN_default = {
|
|
|
151
150
|
"system.settings.mfa_disable_factor_required": "\u8BF7\u8F93\u5165\u52A8\u6001\u53E3\u4EE4\u6216\u6062\u590D\u7801\u3002",
|
|
152
151
|
"system.settings.mfa_disable_action": "\u7981\u7528",
|
|
153
152
|
"system.settings.mfa_disable_success": "\u591A\u56E0\u7D20\u8BA4\u8BC1\u5DF2\u7981\u7528",
|
|
154
|
-
"system.settings.mfa_copy_uri": "\u590D\u5236\u7ED1\u5B9A\u5730\u5740",
|
|
155
|
-
"system.settings.mfa_copy_success": "\u590D\u5236\u6210\u529F",
|
|
156
153
|
"system.notification.title": "\u6D88\u606F",
|
|
157
154
|
"system.notification.sender.system": "\u7CFB\u7EDF",
|
|
158
|
-
"system.notification.description": "\u67E5\u770B\u7CFB\u7EDF\u901A\u77E5\u548C\u4E1A\u52A1\u6D88\u606F",
|
|
159
155
|
"system.notification.empty": "\u6682\u65E0\u6D88\u606F",
|
|
160
156
|
"system.notification.empty_inbox_hint": "\u65B0\u6D88\u606F\u5C06\u5728\u6B64\u663E\u793A",
|
|
161
157
|
"system.notification.empty_unread_hint": "\u5168\u90E8\u6D88\u606F\u5747\u5DF2\u8BFB\u5B8C",
|
|
162
158
|
"system.notification.empty_archived_hint": "\u5F52\u6863\u7684\u6D88\u606F\u5C06\u5728\u6B64\u663E\u793A",
|
|
163
|
-
"system.notification.action.view_all": "\u67E5\u770B\u5168\u90E8",
|
|
164
159
|
"system.notification.view.inbox": "\u5168\u90E8",
|
|
165
160
|
"system.notification.view.unread": "\u672A\u8BFB",
|
|
166
161
|
"system.notification.view.archived": "\u5DF2\u5F52\u6863",
|
|
167
|
-
"system.notification.category_filter": "\u5206\u7C7B ID",
|
|
168
162
|
"system.notification.mark_all_read": "\u5168\u90E8\u5DF2\u8BFB",
|
|
169
163
|
"system.notification.action.archive": "\u5F52\u6863",
|
|
170
164
|
"system.notification.action.restore": "\u6062\u590D",
|
|
171
165
|
"system.notification.action.delete": "\u5220\u9664",
|
|
172
|
-
"system.ai.model.provider_placeholder": "\u9009\u62E9\u4F9B\u5E94\u5546",
|
|
173
166
|
"system.ai.model.model_placeholder": "\u9009\u62E9\u6A21\u578B",
|
|
174
|
-
"system.ai.model.load_failed": "\u52A0\u8F7D\u4F9B\u5E94\u5546\u548C\u6A21\u578B\u5931\u8D25",
|
|
175
167
|
"system.ai.model.title": "\u9009\u62E9\u6A21\u578B",
|
|
176
168
|
"system.ai.model.provider_model_count": "{providers} \u4E2A\u4F9B\u5E94\u5546 \xB7 {models} \u4E2A\u6A21\u578B",
|
|
177
169
|
"system.ai.model.empty": "\u6682\u65E0\u53EF\u9009\u6A21\u578B",
|
|
@@ -257,7 +249,6 @@ var en_US_default = {
|
|
|
257
249
|
"system.profile.account": "Account",
|
|
258
250
|
"system.profile.avatar_change": "Tap to change avatar",
|
|
259
251
|
"system.profile.avatar_upload_failed": "Avatar upload failed",
|
|
260
|
-
"system.profile.avatar_update": "Update avatar and name",
|
|
261
252
|
"system.profile.gender": "Gender",
|
|
262
253
|
"system.profile.email": "Email",
|
|
263
254
|
"system.profile.email_placeholder": "Enter email",
|
|
@@ -306,27 +297,20 @@ var en_US_default = {
|
|
|
306
297
|
"system.settings.mfa_disable_factor_required": "Enter a TOTP code or recovery code.",
|
|
307
298
|
"system.settings.mfa_disable_action": "Disable",
|
|
308
299
|
"system.settings.mfa_disable_success": "Multi-factor authentication disabled",
|
|
309
|
-
"system.settings.mfa_copy_uri": "Copy binding address",
|
|
310
|
-
"system.settings.mfa_copy_success": "Copied",
|
|
311
300
|
"system.notification.title": "Messages",
|
|
312
301
|
"system.notification.sender.system": "System",
|
|
313
|
-
"system.notification.description": "View system notifications and business messages",
|
|
314
302
|
"system.notification.empty": "No messages",
|
|
315
303
|
"system.notification.empty_inbox_hint": "New messages will appear here",
|
|
316
304
|
"system.notification.empty_unread_hint": "You're all caught up",
|
|
317
305
|
"system.notification.empty_archived_hint": "Archived messages will appear here",
|
|
318
|
-
"system.notification.action.view_all": "View all",
|
|
319
306
|
"system.notification.view.inbox": "All",
|
|
320
307
|
"system.notification.view.unread": "Unread",
|
|
321
308
|
"system.notification.view.archived": "Archived",
|
|
322
|
-
"system.notification.category_filter": "Category ID",
|
|
323
309
|
"system.notification.mark_all_read": "Mark all read",
|
|
324
310
|
"system.notification.action.archive": "Archive",
|
|
325
311
|
"system.notification.action.restore": "Restore",
|
|
326
312
|
"system.notification.action.delete": "Delete",
|
|
327
|
-
"system.ai.model.provider_placeholder": "Select a provider",
|
|
328
313
|
"system.ai.model.model_placeholder": "Select a model",
|
|
329
|
-
"system.ai.model.load_failed": "Failed to load providers and models",
|
|
330
314
|
"system.ai.model.title": "Select Model",
|
|
331
315
|
"system.ai.model.provider_model_count": "{providers} providers \xB7 {models} models",
|
|
332
316
|
"system.ai.model.empty": "No models available",
|
|
@@ -412,7 +396,6 @@ var ja_JP_default = {
|
|
|
412
396
|
"system.profile.account": "\u30A2\u30AB\u30A6\u30F3\u30C8",
|
|
413
397
|
"system.profile.avatar_change": "\u30AF\u30EA\u30C3\u30AF\u3057\u3066\u30A2\u30D0\u30BF\u30FC\u3092\u5909\u66F4\u3057\u307E\u3059",
|
|
414
398
|
"system.profile.avatar_upload_failed": "\u30A2\u30D0\u30BF\u30FC\u306E\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u306B\u5931\u6557\u3057\u307E\u3057\u305F",
|
|
415
|
-
"system.profile.avatar_update": "\u30A2\u30D0\u30BF\u30FC\u306E\u30CB\u30C3\u30AF\u30CD\u30FC\u30E0\u3092\u66F4\u65B0",
|
|
416
399
|
"system.profile.gender": "\u6027\u5225",
|
|
417
400
|
"system.profile.email": "\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9",
|
|
418
401
|
"system.profile.email_placeholder": "\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044",
|
|
@@ -461,27 +444,20 @@ var ja_JP_default = {
|
|
|
461
444
|
"system.settings.mfa_disable_factor_required": "TOTP \u30B3\u30FC\u30C9\u307E\u305F\u306F\u30EA\u30AB\u30D0\u30EA\u30FC\u30B3\u30FC\u30C9\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
|
|
462
445
|
"system.settings.mfa_disable_action": "\u7121\u52B9\u306B\u3059\u308B",
|
|
463
446
|
"system.settings.mfa_disable_success": "\u591A\u8981\u7D20\u8A8D\u8A3C\u3092\u7121\u52B9\u306B\u3057\u307E\u3057\u305F",
|
|
464
|
-
"system.settings.mfa_copy_uri": "\u767B\u9332\u30A2\u30C9\u30EC\u30B9\u3092\u30B3\u30D4\u30FC",
|
|
465
|
-
"system.settings.mfa_copy_success": "\u30B3\u30D4\u30FC\u3057\u307E\u3057\u305F",
|
|
466
447
|
"system.notification.title": "\u30E1\u30C3\u30BB\u30FC\u30B8",
|
|
467
448
|
"system.notification.sender.system": "\u30B7\u30B9\u30C6\u30E0",
|
|
468
|
-
"system.notification.description": "\u30B7\u30B9\u30C6\u30E0\u901A\u77E5\u3068\u696D\u52D9\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u78BA\u8A8D",
|
|
469
449
|
"system.notification.empty": "\u30E1\u30C3\u30BB\u30FC\u30B8\u306F\u3042\u308A\u307E\u305B\u3093",
|
|
470
450
|
"system.notification.empty_inbox_hint": "\u65B0\u3057\u3044\u30E1\u30C3\u30BB\u30FC\u30B8\u306F\u3053\u3053\u306B\u8868\u793A\u3055\u308C\u307E\u3059",
|
|
471
451
|
"system.notification.empty_unread_hint": "\u3059\u3079\u3066\u306E\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u65E2\u8AAD\u306B\u3057\u307E\u3057\u305F",
|
|
472
452
|
"system.notification.empty_archived_hint": "\u30A2\u30FC\u30AB\u30A4\u30D6\u6E08\u307F\u306E\u30E1\u30C3\u30BB\u30FC\u30B8\u306F\u3053\u3053\u306B\u8868\u793A\u3055\u308C\u307E\u3059",
|
|
473
|
-
"system.notification.action.view_all": "\u3059\u3079\u3066\u8868\u793A",
|
|
474
453
|
"system.notification.view.inbox": "\u3059\u3079\u3066",
|
|
475
454
|
"system.notification.view.unread": "\u672A\u8AAD",
|
|
476
455
|
"system.notification.view.archived": "\u30A2\u30FC\u30AB\u30A4\u30D6\u6E08\u307F",
|
|
477
|
-
"system.notification.category_filter": "\u30AB\u30C6\u30B4\u30EAID",
|
|
478
456
|
"system.notification.mark_all_read": "\u3059\u3079\u3066\u65E2\u8AAD",
|
|
479
457
|
"system.notification.action.archive": "\u30A2\u30FC\u30AB\u30A4\u30D6",
|
|
480
458
|
"system.notification.action.restore": "\u5FA9\u5143",
|
|
481
459
|
"system.notification.action.delete": "\u524A\u9664",
|
|
482
|
-
"system.ai.model.provider_placeholder": "\u30D7\u30ED\u30D0\u30A4\u30C0\u30FC\u3092\u9078\u629E",
|
|
483
460
|
"system.ai.model.model_placeholder": "\u30E2\u30C7\u30EB\u3092\u9078\u629E",
|
|
484
|
-
"system.ai.model.load_failed": "\u30D7\u30ED\u30D0\u30A4\u30C0\u30FC\u3068\u30E2\u30C7\u30EB\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3067\u3057\u305F",
|
|
485
461
|
"system.ai.model.title": "\u30E2\u30C7\u30EB\u3092\u9078\u629E",
|
|
486
462
|
"system.ai.model.provider_model_count": "{providers} \u30D7\u30ED\u30D0\u30A4\u30C0\u30FC \xB7 {models} \u30E2\u30C7\u30EB",
|
|
487
463
|
"system.ai.model.empty": "\u9078\u629E\u53EF\u80FD\u306A\u30E2\u30C7\u30EB\u304C\u3042\u308A\u307E\u305B\u3093",
|
|
@@ -567,7 +543,6 @@ var zh_TW_default = {
|
|
|
567
543
|
"system.profile.account": "\u8CEC\u865F",
|
|
568
544
|
"system.profile.avatar_change": "\u9EDE\u9078\u4FEE\u6539\u982D\u50CF",
|
|
569
545
|
"system.profile.avatar_upload_failed": "\u4E0A\u50B3\u982D\u50CF\u5931\u6557",
|
|
570
|
-
"system.profile.avatar_update": "\u66F4\u65B0\u982D\u50CF\u66B1\u7A31",
|
|
571
546
|
"system.profile.gender": "\u6027\u5225",
|
|
572
547
|
"system.profile.email": "\u96FB\u5B50\u90F5\u4EF6",
|
|
573
548
|
"system.profile.email_placeholder": "\u8ACB\u8F38\u5165\u96FB\u5B50\u90F5\u4EF6",
|
|
@@ -616,27 +591,20 @@ var zh_TW_default = {
|
|
|
616
591
|
"system.settings.mfa_disable_factor_required": "\u8ACB\u8F38\u5165\u52D5\u614B\u5BC6\u78BC\u6216\u6062\u5FA9\u78BC\u3002",
|
|
617
592
|
"system.settings.mfa_disable_action": "\u505C\u7528",
|
|
618
593
|
"system.settings.mfa_disable_success": "\u591A\u56E0\u7D20\u8A8D\u8B49\u5DF2\u505C\u7528",
|
|
619
|
-
"system.settings.mfa_copy_uri": "\u8907\u88FD\u7D81\u5B9A\u5730\u5740",
|
|
620
|
-
"system.settings.mfa_copy_success": "\u8907\u88FD\u6210\u529F",
|
|
621
594
|
"system.notification.title": "\u6D88\u606F",
|
|
622
595
|
"system.notification.sender.system": "\u7CFB\u7D71",
|
|
623
|
-
"system.notification.description": "\u67E5\u770B\u7CFB\u7D71\u901A\u77E5\u548C\u696D\u52D9\u6D88\u606F",
|
|
624
596
|
"system.notification.empty": "\u66AB\u7121\u6D88\u606F",
|
|
625
597
|
"system.notification.empty_inbox_hint": "\u65B0\u8A0A\u606F\u5C07\u5728\u6B64\u986F\u793A",
|
|
626
598
|
"system.notification.empty_unread_hint": "\u5168\u90E8\u8A0A\u606F\u5747\u5DF2\u8B80\u5B8C",
|
|
627
599
|
"system.notification.empty_archived_hint": "\u5C01\u5B58\u7684\u8A0A\u606F\u5C07\u5728\u6B64\u986F\u793A",
|
|
628
|
-
"system.notification.action.view_all": "\u67E5\u770B\u5168\u90E8",
|
|
629
600
|
"system.notification.view.inbox": "\u5168\u90E8",
|
|
630
601
|
"system.notification.view.unread": "\u672A\u8B80",
|
|
631
602
|
"system.notification.view.archived": "\u5DF2\u6B78\u6A94",
|
|
632
|
-
"system.notification.category_filter": "\u5206\u985E ID",
|
|
633
603
|
"system.notification.mark_all_read": "\u5168\u90E8\u5DF2\u8B80",
|
|
634
604
|
"system.notification.action.archive": "\u6B78\u6A94",
|
|
635
605
|
"system.notification.action.restore": "\u6062\u5FA9",
|
|
636
606
|
"system.notification.action.delete": "\u522A\u9664",
|
|
637
|
-
"system.ai.model.provider_placeholder": "\u9078\u64C7\u4F9B\u61C9\u5546",
|
|
638
607
|
"system.ai.model.model_placeholder": "\u9078\u64C7\u6A21\u578B",
|
|
639
|
-
"system.ai.model.load_failed": "\u8F09\u5165\u4F9B\u61C9\u5546\u8207\u6A21\u578B\u5931\u6557",
|
|
640
608
|
"system.ai.model.title": "\u9078\u64C7\u6A21\u578B",
|
|
641
609
|
"system.ai.model.provider_model_count": "{providers} \u500B\u4F9B\u61C9\u5546 \xB7 {models} \u500B\u6A21\u578B",
|
|
642
610
|
"system.ai.model.empty": "\u66AB\u7121\u53EF\u9078\u6A21\u578B",
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "git@github.com:liujitcn/kratos-admin.git"
|
|
9
9
|
},
|
|
10
|
-
"version": "0.0.
|
|
10
|
+
"version": "0.0.84",
|
|
11
11
|
"type": "module",
|
|
12
12
|
"files": [
|
|
13
13
|
"dist",
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"./api/*": "./src/api/*",
|
|
30
30
|
"./rpc/*": "./src/rpc/*",
|
|
31
|
+
"./components/*": "./src/components/*.tsx",
|
|
31
32
|
"./views/*": "./src/views/*",
|
|
32
33
|
"./package.json": "./package.json"
|
|
33
34
|
},
|
|
@@ -38,8 +39,8 @@
|
|
|
38
39
|
"@tarojs/components": "4.2.1",
|
|
39
40
|
"@tarojs/taro": "4.2.1",
|
|
40
41
|
"react": "18.3.1",
|
|
41
|
-
"@liujitcn/kratos-taro-app-core": "^0.0.
|
|
42
|
-
"@liujitcn/kratos-taro-app-ui": "^0.0.
|
|
42
|
+
"@liujitcn/kratos-taro-app-core": "^0.0.84",
|
|
43
|
+
"@liujitcn/kratos-taro-app-ui": "^0.0.84"
|
|
43
44
|
},
|
|
44
45
|
"scripts": {
|
|
45
46
|
"build": "pnpm run build:entries && pnpm pack --pack-destination ../../../dist/npm",
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import type { CSSProperties, ReactNode } from 'react'
|
|
2
|
+
import { Image, ScrollView, View } from '@tarojs/components'
|
|
3
|
+
import defaultAvatar from '@liujitcn/kratos-taro-app-core/static/images/avatar.png'
|
|
4
|
+
import {
|
|
5
|
+
formatSrc,
|
|
6
|
+
getMpCapsuleRightGap,
|
|
7
|
+
navigateAppRoute,
|
|
8
|
+
navigateToLogin,
|
|
9
|
+
useI18n,
|
|
10
|
+
useSettingStore,
|
|
11
|
+
useThemeStore,
|
|
12
|
+
useUserStore,
|
|
13
|
+
} from '@liujitcn/kratos-taro-app-core'
|
|
14
|
+
import './KratosMyPage.scss'
|
|
15
|
+
|
|
16
|
+
/** KratosMyPageProps 个人中心的项目业务扩展属性。 */
|
|
17
|
+
export interface KratosMyPageProps {
|
|
18
|
+
/** 在个人信息和 AI 助手之后渲染的项目业务内容。 */
|
|
19
|
+
children?: ReactNode
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** KratosMyPage 保留公共个人中心入口,并在下方渲染项目业务内容。 */
|
|
23
|
+
export default function KratosMyPage({ children }: KratosMyPageProps) {
|
|
24
|
+
const { t } = useI18n()
|
|
25
|
+
const themeStore = useThemeStore()
|
|
26
|
+
const profile = useUserStore((state) => state.userInfo)
|
|
27
|
+
const isLoggedIn = useUserStore((state) => state.isAuthenticated())
|
|
28
|
+
const ensureAuthenticated = useUserStore((state) => state.ensureAuthenticated)
|
|
29
|
+
const aiEnabled = useSettingStore((state) => state.aiEnabled)
|
|
30
|
+
const avatarText = (profile?.nick_name || 'U').slice(0, 1)
|
|
31
|
+
/** MP-WEIXIN 原生胶囊按钮右侧避让宽度,写入 --mp-capsule-gap 供 .k-top 预留空间。 */
|
|
32
|
+
const capsuleGap = getMpCapsuleRightGap()
|
|
33
|
+
const topNavStyle = { '--mp-capsule-gap': `${capsuleGap}px` } as CSSProperties
|
|
34
|
+
/** 设计稿齿轮线稿,随主题取色的 data URI,替代 CSS 手绘图标。 */
|
|
35
|
+
const gearIcon = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(
|
|
36
|
+
`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="${
|
|
37
|
+
themeStore.theme === 'light' ? '#102232' : '#e9f4f6'
|
|
38
|
+
}" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.6 1.6 0 0 0 .3 1.8 2 2 0 1 1-2.8 2.8 1.6 1.6 0 0 0-2.7 1.1 2 2 0 1 1-4 0 1.6 1.6 0 0 0-2.6-1.1 2 2 0 1 1-2.8-2.8A1.6 1.6 0 0 0 3 13.9a2 2 0 1 1 0-4 1.6 1.6 0 0 0 1.5-2.7 2 2 0 1 1 2.8-2.8A1.6 1.6 0 0 0 10 4.6a2 2 0 1 1 4 0 1.6 1.6 0 0 0 2.7.6 2 2 0 1 1 2.8 2.8 1.6 1.6 0 0 0-.1 2.6a2.2 2.2 0 1 1 0 4.4Z"/></svg>`,
|
|
39
|
+
)}`
|
|
40
|
+
/** 个人卡账号行:登录展示账号,未登录提示去登录。 */
|
|
41
|
+
const accountText =
|
|
42
|
+
isLoggedIn && profile ? profile.user_name || profile.nick_name || '' : t('system.profile.login_prompt')
|
|
43
|
+
|
|
44
|
+
/** 打开需要登录的公共页面。 */
|
|
45
|
+
const openAuthenticatedPage = (route: string) => {
|
|
46
|
+
if (!ensureAuthenticated()) {
|
|
47
|
+
navigateToLogin()
|
|
48
|
+
return
|
|
49
|
+
}
|
|
50
|
+
navigateAppRoute(route)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<ScrollView
|
|
55
|
+
enableBackToTop
|
|
56
|
+
scrollY
|
|
57
|
+
className={`my-viewport${process.env.TARO_ENV === 'weapp' ? ' my-viewport--weapp' : ''} ${
|
|
58
|
+
themeStore.theme === 'light' ? 'theme-light' : 'theme-dark'
|
|
59
|
+
}`}
|
|
60
|
+
>
|
|
61
|
+
<View className='my-content'>
|
|
62
|
+
<View className='k-top' style={topNavStyle}>
|
|
63
|
+
<View className='k-top__title'>{t('core.navigation.my')}</View>
|
|
64
|
+
<View className='k-ic' onClick={() => openAuthenticatedPage('app/settings')}>
|
|
65
|
+
<Image className='my-gear' src={gearIcon} mode='aspectFit' />
|
|
66
|
+
</View>
|
|
67
|
+
</View>
|
|
68
|
+
|
|
69
|
+
<View className='my-stack'>
|
|
70
|
+
<View
|
|
71
|
+
className='k-glass k-glass--lit k-pfx my-profile'
|
|
72
|
+
onClick={() => navigateAppRoute('app/profile')}
|
|
73
|
+
>
|
|
74
|
+
<View className='my-pfx-main'>
|
|
75
|
+
{isLoggedIn && profile ? (
|
|
76
|
+
<Image
|
|
77
|
+
className='k-pfx__av'
|
|
78
|
+
src={profile.avatar ? formatSrc(profile.avatar) : defaultAvatar}
|
|
79
|
+
mode='aspectFill'
|
|
80
|
+
/>
|
|
81
|
+
) : (
|
|
82
|
+
<View className='k-pfx__av'>{avatarText}</View>
|
|
83
|
+
)}
|
|
84
|
+
<View className='my-pfx-meta'>
|
|
85
|
+
<View className='k-pfx__nm'>
|
|
86
|
+
{isLoggedIn && profile ? profile.nick_name : t('system.profile.not_logged_in')}
|
|
87
|
+
</View>
|
|
88
|
+
<View className='k-pfx__ac'>{accountText}</View>
|
|
89
|
+
</View>
|
|
90
|
+
</View>
|
|
91
|
+
<View className='k-pfx__ent'>{t('system.profile.title')} ›</View>
|
|
92
|
+
</View>
|
|
93
|
+
|
|
94
|
+
{aiEnabled ? (
|
|
95
|
+
<View className='k-aix' onClick={() => openAuthenticatedPage('app/ai')}>
|
|
96
|
+
<View className='k-aix__ic'>AI</View>
|
|
97
|
+
<View className='my-aix-copy'>
|
|
98
|
+
<View className='k-aix__t'>{t('system.settings.ai_title')}</View>
|
|
99
|
+
<View className='k-aix__d'>{t('system.settings.ai_description')}</View>
|
|
100
|
+
</View>
|
|
101
|
+
<View className='k-aix__b'>{t('system.settings.go_ask')}</View>
|
|
102
|
+
</View>
|
|
103
|
+
) : null}
|
|
104
|
+
|
|
105
|
+
{children}
|
|
106
|
+
</View>
|
|
107
|
+
</View>
|
|
108
|
+
</ScrollView>
|
|
109
|
+
)
|
|
110
|
+
}
|
package/src/locales/en-US.json
CHANGED
|
@@ -68,7 +68,6 @@
|
|
|
68
68
|
"system.profile.account": "Account",
|
|
69
69
|
"system.profile.avatar_change": "Tap to change avatar",
|
|
70
70
|
"system.profile.avatar_upload_failed": "Avatar upload failed",
|
|
71
|
-
"system.profile.avatar_update": "Update avatar and name",
|
|
72
71
|
"system.profile.gender": "Gender",
|
|
73
72
|
"system.profile.email": "Email",
|
|
74
73
|
"system.profile.email_placeholder": "Enter email",
|
|
@@ -117,27 +116,20 @@
|
|
|
117
116
|
"system.settings.mfa_disable_factor_required": "Enter a TOTP code or recovery code.",
|
|
118
117
|
"system.settings.mfa_disable_action": "Disable",
|
|
119
118
|
"system.settings.mfa_disable_success": "Multi-factor authentication disabled",
|
|
120
|
-
"system.settings.mfa_copy_uri": "Copy binding address",
|
|
121
|
-
"system.settings.mfa_copy_success": "Copied",
|
|
122
119
|
"system.notification.title": "Messages",
|
|
123
120
|
"system.notification.sender.system": "System",
|
|
124
|
-
"system.notification.description": "View system notifications and business messages",
|
|
125
121
|
"system.notification.empty": "No messages",
|
|
126
122
|
"system.notification.empty_inbox_hint": "New messages will appear here",
|
|
127
123
|
"system.notification.empty_unread_hint": "You're all caught up",
|
|
128
124
|
"system.notification.empty_archived_hint": "Archived messages will appear here",
|
|
129
|
-
"system.notification.action.view_all": "View all",
|
|
130
125
|
"system.notification.view.inbox": "All",
|
|
131
126
|
"system.notification.view.unread": "Unread",
|
|
132
127
|
"system.notification.view.archived": "Archived",
|
|
133
|
-
"system.notification.category_filter": "Category ID",
|
|
134
128
|
"system.notification.mark_all_read": "Mark all read",
|
|
135
129
|
"system.notification.action.archive": "Archive",
|
|
136
130
|
"system.notification.action.restore": "Restore",
|
|
137
131
|
"system.notification.action.delete": "Delete",
|
|
138
|
-
"system.ai.model.provider_placeholder": "Select a provider",
|
|
139
132
|
"system.ai.model.model_placeholder": "Select a model",
|
|
140
|
-
"system.ai.model.load_failed": "Failed to load providers and models",
|
|
141
133
|
"system.ai.model.title": "Select Model",
|
|
142
134
|
"system.ai.model.provider_model_count": "{providers} providers · {models} models",
|
|
143
135
|
"system.ai.model.empty": "No models available",
|
package/src/locales/ja-JP.json
CHANGED
|
@@ -68,7 +68,6 @@
|
|
|
68
68
|
"system.profile.account": "アカウント",
|
|
69
69
|
"system.profile.avatar_change": "クリックしてアバターを変更します",
|
|
70
70
|
"system.profile.avatar_upload_failed": "アバターのアップロードに失敗しました",
|
|
71
|
-
"system.profile.avatar_update": "アバターのニックネームを更新",
|
|
72
71
|
"system.profile.gender": "性別",
|
|
73
72
|
"system.profile.email": "メールアドレス",
|
|
74
73
|
"system.profile.email_placeholder": "メールアドレスを入力してください",
|
|
@@ -117,27 +116,20 @@
|
|
|
117
116
|
"system.settings.mfa_disable_factor_required": "TOTP コードまたはリカバリーコードを入力してください。",
|
|
118
117
|
"system.settings.mfa_disable_action": "無効にする",
|
|
119
118
|
"system.settings.mfa_disable_success": "多要素認証を無効にしました",
|
|
120
|
-
"system.settings.mfa_copy_uri": "登録アドレスをコピー",
|
|
121
|
-
"system.settings.mfa_copy_success": "コピーしました",
|
|
122
119
|
"system.notification.title": "メッセージ",
|
|
123
120
|
"system.notification.sender.system": "システム",
|
|
124
|
-
"system.notification.description": "システム通知と業務メッセージを確認",
|
|
125
121
|
"system.notification.empty": "メッセージはありません",
|
|
126
122
|
"system.notification.empty_inbox_hint": "新しいメッセージはここに表示されます",
|
|
127
123
|
"system.notification.empty_unread_hint": "すべてのメッセージを既読にしました",
|
|
128
124
|
"system.notification.empty_archived_hint": "アーカイブ済みのメッセージはここに表示されます",
|
|
129
|
-
"system.notification.action.view_all": "すべて表示",
|
|
130
125
|
"system.notification.view.inbox": "すべて",
|
|
131
126
|
"system.notification.view.unread": "未読",
|
|
132
127
|
"system.notification.view.archived": "アーカイブ済み",
|
|
133
|
-
"system.notification.category_filter": "カテゴリID",
|
|
134
128
|
"system.notification.mark_all_read": "すべて既読",
|
|
135
129
|
"system.notification.action.archive": "アーカイブ",
|
|
136
130
|
"system.notification.action.restore": "復元",
|
|
137
131
|
"system.notification.action.delete": "削除",
|
|
138
|
-
"system.ai.model.provider_placeholder": "プロバイダーを選択",
|
|
139
132
|
"system.ai.model.model_placeholder": "モデルを選択",
|
|
140
|
-
"system.ai.model.load_failed": "プロバイダーとモデルを読み込めませんでした",
|
|
141
133
|
"system.ai.model.title": "モデルを選択",
|
|
142
134
|
"system.ai.model.provider_model_count": "{providers} プロバイダー · {models} モデル",
|
|
143
135
|
"system.ai.model.empty": "選択可能なモデルがありません",
|
package/src/locales/zh-CN.json
CHANGED
|
@@ -68,7 +68,6 @@
|
|
|
68
68
|
"system.profile.account": "账号",
|
|
69
69
|
"system.profile.avatar_change": "点击修改头像",
|
|
70
70
|
"system.profile.avatar_upload_failed": "上传头像失败",
|
|
71
|
-
"system.profile.avatar_update": "更新头像昵称",
|
|
72
71
|
"system.profile.gender": "性别",
|
|
73
72
|
"system.profile.email": "邮箱",
|
|
74
73
|
"system.profile.email_placeholder": "请输入邮箱",
|
|
@@ -117,27 +116,20 @@
|
|
|
117
116
|
"system.settings.mfa_disable_factor_required": "请输入动态口令或恢复码。",
|
|
118
117
|
"system.settings.mfa_disable_action": "禁用",
|
|
119
118
|
"system.settings.mfa_disable_success": "多因素认证已禁用",
|
|
120
|
-
"system.settings.mfa_copy_uri": "复制绑定地址",
|
|
121
|
-
"system.settings.mfa_copy_success": "复制成功",
|
|
122
119
|
"system.notification.title": "消息",
|
|
123
120
|
"system.notification.sender.system": "系统",
|
|
124
|
-
"system.notification.description": "查看系统通知和业务消息",
|
|
125
121
|
"system.notification.empty": "暂无消息",
|
|
126
122
|
"system.notification.empty_inbox_hint": "新消息将在此显示",
|
|
127
123
|
"system.notification.empty_unread_hint": "全部消息均已读完",
|
|
128
124
|
"system.notification.empty_archived_hint": "归档的消息将在此显示",
|
|
129
|
-
"system.notification.action.view_all": "查看全部",
|
|
130
125
|
"system.notification.view.inbox": "全部",
|
|
131
126
|
"system.notification.view.unread": "未读",
|
|
132
127
|
"system.notification.view.archived": "已归档",
|
|
133
|
-
"system.notification.category_filter": "分类 ID",
|
|
134
128
|
"system.notification.mark_all_read": "全部已读",
|
|
135
129
|
"system.notification.action.archive": "归档",
|
|
136
130
|
"system.notification.action.restore": "恢复",
|
|
137
131
|
"system.notification.action.delete": "删除",
|
|
138
|
-
"system.ai.model.provider_placeholder": "选择供应商",
|
|
139
132
|
"system.ai.model.model_placeholder": "选择模型",
|
|
140
|
-
"system.ai.model.load_failed": "加载供应商和模型失败",
|
|
141
133
|
"system.ai.model.title": "选择模型",
|
|
142
134
|
"system.ai.model.provider_model_count": "{providers} 个供应商 · {models} 个模型",
|
|
143
135
|
"system.ai.model.empty": "暂无可选模型",
|
package/src/locales/zh-TW.json
CHANGED
|
@@ -68,7 +68,6 @@
|
|
|
68
68
|
"system.profile.account": "賬號",
|
|
69
69
|
"system.profile.avatar_change": "點選修改頭像",
|
|
70
70
|
"system.profile.avatar_upload_failed": "上傳頭像失敗",
|
|
71
|
-
"system.profile.avatar_update": "更新頭像暱稱",
|
|
72
71
|
"system.profile.gender": "性別",
|
|
73
72
|
"system.profile.email": "電子郵件",
|
|
74
73
|
"system.profile.email_placeholder": "請輸入電子郵件",
|
|
@@ -117,27 +116,20 @@
|
|
|
117
116
|
"system.settings.mfa_disable_factor_required": "請輸入動態密碼或恢復碼。",
|
|
118
117
|
"system.settings.mfa_disable_action": "停用",
|
|
119
118
|
"system.settings.mfa_disable_success": "多因素認證已停用",
|
|
120
|
-
"system.settings.mfa_copy_uri": "複製綁定地址",
|
|
121
|
-
"system.settings.mfa_copy_success": "複製成功",
|
|
122
119
|
"system.notification.title": "消息",
|
|
123
120
|
"system.notification.sender.system": "系統",
|
|
124
|
-
"system.notification.description": "查看系統通知和業務消息",
|
|
125
121
|
"system.notification.empty": "暫無消息",
|
|
126
122
|
"system.notification.empty_inbox_hint": "新訊息將在此顯示",
|
|
127
123
|
"system.notification.empty_unread_hint": "全部訊息均已讀完",
|
|
128
124
|
"system.notification.empty_archived_hint": "封存的訊息將在此顯示",
|
|
129
|
-
"system.notification.action.view_all": "查看全部",
|
|
130
125
|
"system.notification.view.inbox": "全部",
|
|
131
126
|
"system.notification.view.unread": "未讀",
|
|
132
127
|
"system.notification.view.archived": "已歸檔",
|
|
133
|
-
"system.notification.category_filter": "分類 ID",
|
|
134
128
|
"system.notification.mark_all_read": "全部已讀",
|
|
135
129
|
"system.notification.action.archive": "歸檔",
|
|
136
130
|
"system.notification.action.restore": "恢復",
|
|
137
131
|
"system.notification.action.delete": "刪除",
|
|
138
|
-
"system.ai.model.provider_placeholder": "選擇供應商",
|
|
139
132
|
"system.ai.model.model_placeholder": "選擇模型",
|
|
140
|
-
"system.ai.model.load_failed": "載入供應商與模型失敗",
|
|
141
133
|
"system.ai.model.title": "選擇模型",
|
|
142
134
|
"system.ai.model.provider_model_count": "{providers} 個供應商 · {models} 個模型",
|
|
143
135
|
"system.ai.model.empty": "暫無可選模型",
|
|
@@ -1,101 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import defaultAvatar from '@liujitcn/kratos-taro-app-core/static/images/avatar.png'
|
|
4
|
-
import {
|
|
5
|
-
formatSrc,
|
|
6
|
-
getMpCapsuleRightGap,
|
|
7
|
-
navigateAppRoute,
|
|
8
|
-
navigateToLogin,
|
|
9
|
-
useI18n,
|
|
10
|
-
useSettingStore,
|
|
11
|
-
useThemeStore,
|
|
12
|
-
useUserStore,
|
|
13
|
-
} from '@liujitcn/kratos-taro-app-core'
|
|
14
|
-
import './my.scss'
|
|
1
|
+
import KratosMyPage from '@liujitcn/kratos-taro-app-system/components/KratosMyPage'
|
|
2
|
+
import MyExtensions from './components/MyExtensions'
|
|
15
3
|
|
|
16
|
-
/**
|
|
4
|
+
/** MyPage 组合公共个人中心与项目业务扩展。 */
|
|
17
5
|
export default function MyPage() {
|
|
18
|
-
const { t } = useI18n()
|
|
19
|
-
const themeStore = useThemeStore()
|
|
20
|
-
const profile = useUserStore((state) => state.userInfo)
|
|
21
|
-
const isLoggedIn = useUserStore((state) => state.isAuthenticated())
|
|
22
|
-
const ensureAuthenticated = useUserStore((state) => state.ensureAuthenticated)
|
|
23
|
-
const aiEnabled = useSettingStore((state) => state.aiEnabled)
|
|
24
|
-
const avatarText = (profile?.nick_name || 'U').slice(0, 1)
|
|
25
|
-
/** MP-WEIXIN 原生胶囊按钮右侧避让宽度,写入 --mp-capsule-gap 供 .k-top 预留空间。 */
|
|
26
|
-
const capsuleGap = getMpCapsuleRightGap()
|
|
27
|
-
const topNavStyle = { '--mp-capsule-gap': `${capsuleGap}px` } as CSSProperties
|
|
28
|
-
/** 设计稿齿轮线稿,随主题取色的 data URI,替代 CSS 手绘图标。 */
|
|
29
|
-
const gearIcon = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(
|
|
30
|
-
`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="${
|
|
31
|
-
themeStore.theme === 'light' ? '#102232' : '#e9f4f6'
|
|
32
|
-
}" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.6 1.6 0 0 0 .3 1.8 2 2 0 1 1-2.8 2.8 1.6 1.6 0 0 0-2.7 1.1 2 2 0 1 1-4 0 1.6 1.6 0 0 0-2.6-1.1 2 2 0 1 1-2.8-2.8A1.6 1.6 0 0 0 3 13.9a2 2 0 1 1 0-4 1.6 1.6 0 0 0 1.5-2.7 2 2 0 1 1 2.8-2.8A1.6 1.6 0 0 0 10 4.6a2 2 0 1 1 4 0 1.6 1.6 0 0 0 2.7.6 2 2 0 1 1 2.8 2.8 1.6 1.6 0 0 0-.1 2.6a2.2 2.2 0 1 1 0 4.4Z"/></svg>`,
|
|
33
|
-
)}`
|
|
34
|
-
/** 个人卡账号行:登录展示账号,未登录提示去登录。 */
|
|
35
|
-
const accountText =
|
|
36
|
-
isLoggedIn && profile ? profile.user_name || profile.nick_name || '' : t('system.profile.login_prompt')
|
|
37
|
-
|
|
38
|
-
const openAuthenticatedPage = (route: string) => {
|
|
39
|
-
if (!ensureAuthenticated()) {
|
|
40
|
-
navigateToLogin()
|
|
41
|
-
return
|
|
42
|
-
}
|
|
43
|
-
navigateAppRoute(route)
|
|
44
|
-
}
|
|
45
|
-
|
|
46
6
|
return (
|
|
47
|
-
<
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
className={`my-viewport${process.env.TARO_ENV === 'weapp' ? ' my-viewport--weapp' : ''} ${
|
|
51
|
-
themeStore.theme === 'light' ? 'theme-light' : 'theme-dark'
|
|
52
|
-
}`}
|
|
53
|
-
>
|
|
54
|
-
<View className='my-content'>
|
|
55
|
-
<View className='k-top' style={topNavStyle}>
|
|
56
|
-
<View className='k-top__title'>{t('core.navigation.my')}</View>
|
|
57
|
-
<View className='k-ic' onClick={() => openAuthenticatedPage('app/settings')}>
|
|
58
|
-
<Image className='my-gear' src={gearIcon} mode='aspectFit' />
|
|
59
|
-
</View>
|
|
60
|
-
</View>
|
|
61
|
-
|
|
62
|
-
<View className='my-stack'>
|
|
63
|
-
<View
|
|
64
|
-
className='k-glass k-glass--lit k-pfx my-profile'
|
|
65
|
-
onClick={() => navigateAppRoute('app/profile')}
|
|
66
|
-
>
|
|
67
|
-
<View className='my-pfx-main'>
|
|
68
|
-
{isLoggedIn && profile ? (
|
|
69
|
-
<Image
|
|
70
|
-
className='k-pfx__av'
|
|
71
|
-
src={profile.avatar ? formatSrc(profile.avatar) : defaultAvatar}
|
|
72
|
-
mode='aspectFill'
|
|
73
|
-
/>
|
|
74
|
-
) : (
|
|
75
|
-
<View className='k-pfx__av'>{avatarText}</View>
|
|
76
|
-
)}
|
|
77
|
-
<View className='my-pfx-meta'>
|
|
78
|
-
<View className='k-pfx__nm'>
|
|
79
|
-
{isLoggedIn && profile ? profile.nick_name : t('system.profile.not_logged_in')}
|
|
80
|
-
</View>
|
|
81
|
-
<View className='k-pfx__ac'>{accountText}</View>
|
|
82
|
-
</View>
|
|
83
|
-
</View>
|
|
84
|
-
<View className='k-pfx__ent'>{t('system.profile.title')} ›</View>
|
|
85
|
-
</View>
|
|
86
|
-
|
|
87
|
-
{aiEnabled ? (
|
|
88
|
-
<View className='k-aix' onClick={() => openAuthenticatedPage('app/ai')}>
|
|
89
|
-
<View className='k-aix__ic'>AI</View>
|
|
90
|
-
<View className='my-aix-copy'>
|
|
91
|
-
<View className='k-aix__t'>{t('system.settings.ai_title')}</View>
|
|
92
|
-
<View className='k-aix__d'>{t('system.settings.ai_description')}</View>
|
|
93
|
-
</View>
|
|
94
|
-
<View className='k-aix__b'>{t('system.settings.go_ask')}</View>
|
|
95
|
-
</View>
|
|
96
|
-
) : null}
|
|
97
|
-
</View>
|
|
98
|
-
</View>
|
|
99
|
-
</ScrollView>
|
|
7
|
+
<KratosMyPage>
|
|
8
|
+
<MyExtensions />
|
|
9
|
+
</KratosMyPage>
|
|
100
10
|
)
|
|
101
11
|
}
|