@liujitcn/kratos-uni-app-system 0.0.84 → 0.0.86
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/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.86",
|
|
11
11
|
"type": "module",
|
|
12
12
|
"files": [
|
|
13
13
|
"dist",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@dcloudio/uni-app": "3.0.0-5010520260709002",
|
|
37
37
|
"@dcloudio/uni-ui": "^1.4.28",
|
|
38
38
|
"vue": "^3.4.21",
|
|
39
|
-
"@liujitcn/kratos-uni-app-core": "^0.0.
|
|
39
|
+
"@liujitcn/kratos-uni-app-core": "^0.0.86"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"esbuild": "^0.20.2",
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { useSettingStore, useThemeStore, useUserStore } from '@liujitcn/kratos-uni-app-core/stores'
|
|
3
3
|
import { computed } from 'vue'
|
|
4
|
-
import { formatSrc
|
|
4
|
+
import { formatSrc } from '@liujitcn/kratos-uni-app-core/utils/index'
|
|
5
5
|
import { navigateToLogin } from '@liujitcn/kratos-uni-app-core/utils/navigation'
|
|
6
6
|
import { navigateAppRoute } from '@liujitcn/kratos-uni-app-core'
|
|
7
|
+
import KratosNavBar from '@liujitcn/kratos-uni-app-core/components/KratosNavBar.vue'
|
|
7
8
|
import defaultAvatar from '@liujitcn/kratos-uni-app-core/static/images/avatar.png'
|
|
8
9
|
import { useI18n } from '@liujitcn/kratos-uni-app-core'
|
|
9
10
|
|
|
@@ -22,19 +23,9 @@ const { t } = useI18n()
|
|
|
22
23
|
const isLoggedIn = computed(() => userStore.isAuthenticated())
|
|
23
24
|
const profile = computed(() => userStore.userInfo)
|
|
24
25
|
|
|
25
|
-
/** MP-WEIXIN 原生胶囊按钮右侧避让宽度,写入 --mp-capsule-gap 供 .k-top 预留空间。 */
|
|
26
|
-
const capsuleGap = getMpCapsuleRightGap()
|
|
27
|
-
|
|
28
26
|
/** 昵称或占位账号首字符,用于渐变头像兜底。 */
|
|
29
27
|
const avatarText = computed(() => (profile.value?.nick_name || 'U').slice(0, 1))
|
|
30
28
|
|
|
31
|
-
/** 设计稿齿轮线稿,随主题取色的 data URI,替代 CSS 手绘图标。 */
|
|
32
|
-
const gearIcon = computed(() => {
|
|
33
|
-
const color = themeStore.theme === 'light' ? '#102232' : '#e9f4f6'
|
|
34
|
-
const svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="${color}" 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>`
|
|
35
|
-
return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svg)}`
|
|
36
|
-
})
|
|
37
|
-
|
|
38
29
|
/** 个人卡账号行:登录展示账号,未登录提示去登录。 */
|
|
39
30
|
const accountText = computed(() => {
|
|
40
31
|
if (isLoggedIn.value && profile.value) {
|
|
@@ -68,13 +59,15 @@ const navigateToProfile = () => navigateAppRoute('app/profile')
|
|
|
68
59
|
<template>
|
|
69
60
|
<scroll-view enable-back-to-top class="my-viewport" scroll-y :class="themeStore.themeClass">
|
|
70
61
|
<view class="my-content">
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
62
|
+
<KratosNavBar
|
|
63
|
+
:title="t('core.navigation.my')"
|
|
64
|
+
variant="tab"
|
|
65
|
+
:action="{
|
|
66
|
+
icon: 'settings',
|
|
67
|
+
label: t('core.settings.title'),
|
|
68
|
+
onClick: navigateToSettings,
|
|
69
|
+
}"
|
|
70
|
+
/>
|
|
78
71
|
|
|
79
72
|
<view class="my-stack">
|
|
80
73
|
<!-- 个人资料 -->
|
|
@@ -122,24 +115,13 @@ const navigateToProfile = () => navigateAppRoute('app/profile')
|
|
|
122
115
|
}
|
|
123
116
|
|
|
124
117
|
.my-content {
|
|
125
|
-
padding:
|
|
126
|
-
|
|
127
|
-
/* #ifdef MP-WEIXIN */
|
|
128
|
-
/* k-top 在小程序端自带 44px 状态栏高度的导航带,页面不再额外让出顶部空间 */
|
|
129
|
-
padding-top: 0;
|
|
130
|
-
/* #endif */
|
|
118
|
+
padding: 0 20rpx calc(40rpx + env(safe-area-inset-bottom));
|
|
131
119
|
}
|
|
132
120
|
|
|
133
121
|
.my-stack {
|
|
134
122
|
display: flex;
|
|
135
123
|
flex-direction: column;
|
|
136
124
|
gap: 24rpx;
|
|
137
|
-
margin-top: 16rpx;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
.my-gear {
|
|
141
|
-
width: 34rpx;
|
|
142
|
-
height: 34rpx;
|
|
143
125
|
}
|
|
144
126
|
|
|
145
127
|
/* k-pfx 仅定义 flex 排布,卡片内边距交由页面控制 */
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
import KratosNavBar from '@liujitcn/kratos-uni-app-core/components/KratosNavBar.vue'
|
|
2
3
|
import { onLoad } from '@dcloudio/uni-app'
|
|
3
4
|
import { computed, nextTick, onBeforeUnmount, ref, watch } from 'vue'
|
|
4
5
|
import {
|
|
@@ -22,7 +23,7 @@ import { isAuthExpiredError } from '@liujitcn/kratos-uni-app-core/utils/http'
|
|
|
22
23
|
import Composer from './components/Composer.vue'
|
|
23
24
|
import SessionDrawer from './components/SessionDrawer.vue'
|
|
24
25
|
import WelcomePanel from './components/WelcomePanel.vue'
|
|
25
|
-
import {
|
|
26
|
+
import { useI18n } from '@liujitcn/kratos-uni-app-core'
|
|
26
27
|
import { useThemeStore } from '@liujitcn/kratos-uni-app-core/stores'
|
|
27
28
|
import {
|
|
28
29
|
type AiStreamEvent,
|
|
@@ -74,9 +75,6 @@ const MAX_ATTACHMENT_COUNT = 6
|
|
|
74
75
|
const STARTER_PROMPT_PAGE_SIZE = 4
|
|
75
76
|
const { locale, t } = useI18n()
|
|
76
77
|
const themeStore = useThemeStore()
|
|
77
|
-
/** 导航图标随主题取色,uni-icons 的 color 属性不接受 CSS 变量。 */
|
|
78
|
-
const navIconColor = computed(() => (themeStore.theme === 'light' ? '#102232' : '#e9f4f6'))
|
|
79
|
-
|
|
80
78
|
const windowInfo = uni.getWindowInfo()
|
|
81
79
|
let safeAreaTop =
|
|
82
80
|
windowInfo.safeArea?.top || windowInfo.statusBarHeight || windowInfo.safeAreaInsets?.top || 0
|
|
@@ -362,15 +360,6 @@ const handleMessageAction = (item: ChatMessageItem) => {
|
|
|
362
360
|
})
|
|
363
361
|
}
|
|
364
362
|
|
|
365
|
-
const navigateBack = () => {
|
|
366
|
-
const pages = getCurrentPages()
|
|
367
|
-
if (pages.length > 1) {
|
|
368
|
-
uni.navigateBack()
|
|
369
|
-
return
|
|
370
|
-
}
|
|
371
|
-
navigateAppRoute('app/home')
|
|
372
|
-
}
|
|
373
|
-
|
|
374
363
|
const handleSend = async () => {
|
|
375
364
|
if (isSubmitDisabled.value) {
|
|
376
365
|
return
|
|
@@ -1277,20 +1266,11 @@ function showError(error: unknown, fallback: string) {
|
|
|
1277
1266
|
|
|
1278
1267
|
<template>
|
|
1279
1268
|
<view class="ai-page" :class="themeStore.themeClass">
|
|
1280
|
-
<view class="ai-navbar
|
|
1281
|
-
<
|
|
1282
|
-
|
|
1283
|
-
:
|
|
1284
|
-
|
|
1285
|
-
></view>
|
|
1286
|
-
<view class="k-page-nav__title">{{ t('system.ai.chat_title') }}</view>
|
|
1287
|
-
<view
|
|
1288
|
-
class="k-page-nav__side k-ic"
|
|
1289
|
-
:aria-label="t('system.ai.history')"
|
|
1290
|
-
@tap="toggleSessionDrawer"
|
|
1291
|
-
>
|
|
1292
|
-
<uni-icons type="bars" size="22" :color="navIconColor" />
|
|
1293
|
-
</view>
|
|
1269
|
+
<view class="ai-navbar">
|
|
1270
|
+
<KratosNavBar
|
|
1271
|
+
:title="t('system.ai.chat_title')"
|
|
1272
|
+
:action="{ icon: 'history', label: t('system.ai.history'), onClick: toggleSessionDrawer }"
|
|
1273
|
+
/>
|
|
1294
1274
|
</view>
|
|
1295
1275
|
|
|
1296
1276
|
<scroll-view
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
import KratosNavBar from '@liujitcn/kratos-uni-app-core/components/KratosNavBar.vue'
|
|
2
3
|
import { onLoad } from '@dcloudio/uni-app'
|
|
3
4
|
import { ref } from 'vue'
|
|
4
5
|
import { navigateAppView, t } from '@liujitcn/kratos-uni-app-core'
|
|
5
6
|
import { useThemeStore } from '@liujitcn/kratos-uni-app-core/stores'
|
|
6
|
-
import { homeTabPage } from '@liujitcn/kratos-uni-app-core/utils/navigation'
|
|
7
7
|
import { defNotificationService } from '../../../api/base/v1/notification'
|
|
8
8
|
import type { Notification } from '../../../rpc/base/v1/notification'
|
|
9
9
|
import { MessageActionType, MessageContentFormat } from '../../../rpc/base/v1/notification'
|
|
@@ -52,20 +52,11 @@ function openAction() {
|
|
|
52
52
|
}
|
|
53
53
|
navigateAppView(detail.value.action_target, params)
|
|
54
54
|
}
|
|
55
|
-
|
|
56
|
-
/** 返回消息列表,页面栈为空时回到首页。 */
|
|
57
|
-
function onBack() {
|
|
58
|
-
uni.navigateBack({ fail: () => uni.reLaunch({ url: homeTabPage }) })
|
|
59
|
-
}
|
|
60
55
|
</script>
|
|
61
56
|
|
|
62
57
|
<template>
|
|
63
58
|
<view class="detail-page" :class="themeStore.themeClass">
|
|
64
|
-
<
|
|
65
|
-
<view class="k-page-nav__back" :aria-label="t('common.action.back')" @tap="onBack"></view>
|
|
66
|
-
<view class="k-page-nav__title">{{ t('system.notification.title') }}</view>
|
|
67
|
-
<view class="k-page-nav__side" aria-hidden="true"></view>
|
|
68
|
-
</view>
|
|
59
|
+
<KratosNavBar :title="t('system.notification.title')" />
|
|
69
60
|
<template v-if="detail">
|
|
70
61
|
<text class="detail-title">{{ detail.title }}</text>
|
|
71
62
|
<view class="detail-meta">
|
|
@@ -104,7 +95,7 @@ function onBack() {
|
|
|
104
95
|
.detail-page {
|
|
105
96
|
box-sizing: border-box;
|
|
106
97
|
min-height: 100vh;
|
|
107
|
-
padding:
|
|
98
|
+
padding: 0 30rpx calc(96rpx + env(safe-area-inset-bottom));
|
|
108
99
|
background: var(--kratos-bg-gradient);
|
|
109
100
|
color: var(--kratos-color-text);
|
|
110
101
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
import KratosEmpty from '@liujitcn/kratos-uni-app-core/components/KratosEmpty.vue'
|
|
3
|
+
import KratosNavBar from '@liujitcn/kratos-uni-app-core/components/KratosNavBar.vue'
|
|
2
4
|
import { onShow } from '@dcloudio/uni-app'
|
|
3
5
|
import { computed, ref } from 'vue'
|
|
4
|
-
import {
|
|
6
|
+
import { navigateAppView, t } from '@liujitcn/kratos-uni-app-core'
|
|
5
7
|
import { useThemeStore } from '@liujitcn/kratos-uni-app-core/stores'
|
|
6
|
-
import { getMpCapsuleRightGap } from '@liujitcn/kratos-uni-app-core/utils/index'
|
|
7
8
|
import { defNotificationService } from '../../../api/base/v1/notification'
|
|
8
9
|
import type { Notification, NotificationCategory } from '../../../rpc/base/v1/notification'
|
|
9
10
|
import { NotificationView } from '../../../rpc/base/v1/notification'
|
|
@@ -11,8 +12,6 @@ import { notificationUnreadTotal, refreshNotificationSummary } from '../../../no
|
|
|
11
12
|
import { resolveMessageCategoryIcon } from './icons'
|
|
12
13
|
|
|
13
14
|
const themeStore = useThemeStore()
|
|
14
|
-
/** MP-WEIXIN 原生胶囊按钮右侧避让宽度,写入 --mp-capsule-gap 供 .k-top 预留空间。 */
|
|
15
|
-
const capsuleGap = getMpCapsuleRightGap()
|
|
16
15
|
const items = ref<Notification[]>([])
|
|
17
16
|
const loading = ref(false)
|
|
18
17
|
const cursorId = ref(0)
|
|
@@ -128,22 +127,19 @@ const emptyHintKey = computed(() => {
|
|
|
128
127
|
|
|
129
128
|
<template>
|
|
130
129
|
<view class="message-page" :class="themeStore.themeClass">
|
|
131
|
-
<
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
{{ t('system.notification.mark_all_read') }}
|
|
145
|
-
</view>
|
|
146
|
-
</view>
|
|
130
|
+
<KratosNavBar
|
|
131
|
+
:title="t('system.notification.title')"
|
|
132
|
+
variant="tab"
|
|
133
|
+
:action="
|
|
134
|
+
selectedView !== NotificationView.NOTIFICATION_VIEW_ARCHIVED && notificationUnreadTotal > 0
|
|
135
|
+
? {
|
|
136
|
+
display: 'text',
|
|
137
|
+
label: t('system.notification.mark_all_read'),
|
|
138
|
+
onClick: markAllRead,
|
|
139
|
+
}
|
|
140
|
+
: undefined
|
|
141
|
+
"
|
|
142
|
+
/>
|
|
147
143
|
<view class="k-chips">
|
|
148
144
|
<view class="k-ch" :class="{ 'k-ch--pri': categoryId === undefined }" @tap="changeCategory()">
|
|
149
145
|
{{ t('system.notification.view.inbox') }}
|
|
@@ -247,50 +243,10 @@ const emptyHintKey = computed(() => {
|
|
|
247
243
|
.message-page {
|
|
248
244
|
box-sizing: border-box;
|
|
249
245
|
min-height: 100vh;
|
|
250
|
-
padding:
|
|
246
|
+
padding: 0 20rpx calc(200rpx + env(safe-area-inset-bottom));
|
|
251
247
|
background: var(--kratos-bg-gradient);
|
|
252
248
|
color: var(--kratos-color-text);
|
|
253
249
|
}
|
|
254
|
-
/* #ifdef MP-WEIXIN */
|
|
255
|
-
.message-page {
|
|
256
|
-
/* k-top 在小程序端自带 44px 状态栏高度的导航带,页面不再额外让出顶部空间 */
|
|
257
|
-
padding-top: 0;
|
|
258
|
-
}
|
|
259
|
-
/* #endif */
|
|
260
|
-
.message-header {
|
|
261
|
-
/* 标题绝对居中后头部不再依赖流内内容撑高,保证标题行与筛选行留出间距 */
|
|
262
|
-
min-height: 76rpx;
|
|
263
|
-
padding: 20rpx 4rpx 24rpx;
|
|
264
|
-
}
|
|
265
|
-
/* 标题排版与 k-page-nav__title/k-top__title 同规格,绝对居中后文字与红点同行排布 */
|
|
266
|
-
.message-header__title {
|
|
267
|
-
position: absolute;
|
|
268
|
-
left: 50%;
|
|
269
|
-
display: flex;
|
|
270
|
-
align-items: center;
|
|
271
|
-
min-width: 0;
|
|
272
|
-
max-width: calc(100% - 190rpx);
|
|
273
|
-
overflow: hidden;
|
|
274
|
-
font-size: 32rpx;
|
|
275
|
-
font-weight: 700;
|
|
276
|
-
color: var(--kratos-color-text);
|
|
277
|
-
transform: translateX(-50%);
|
|
278
|
-
white-space: nowrap;
|
|
279
|
-
}
|
|
280
|
-
.message-header__text {
|
|
281
|
-
min-width: 0;
|
|
282
|
-
overflow: hidden;
|
|
283
|
-
text-overflow: ellipsis;
|
|
284
|
-
}
|
|
285
|
-
.message-unread-dot {
|
|
286
|
-
flex-shrink: 0;
|
|
287
|
-
width: 12rpx;
|
|
288
|
-
height: 12rpx;
|
|
289
|
-
margin-left: 12rpx;
|
|
290
|
-
border-radius: 50%;
|
|
291
|
-
background: var(--kratos-color-danger);
|
|
292
|
-
box-shadow: 0 0 16rpx var(--kratos-color-danger);
|
|
293
|
-
}
|
|
294
250
|
.message-tabs {
|
|
295
251
|
display: flex;
|
|
296
252
|
margin-top: 4rpx;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
import KratosNavBar from '@liujitcn/kratos-uni-app-core/components/KratosNavBar.vue'
|
|
2
3
|
import { defAuthService } from '@liujitcn/kratos-uni-app-core/api/system/app/v1/auth'
|
|
3
4
|
import { useThemeStore, useUserStore } from '@liujitcn/kratos-uni-app-core/stores'
|
|
4
5
|
import type { UserProfileForm } from '@liujitcn/kratos-uni-app-core/rpc/system/app/v1/auth'
|
|
@@ -17,9 +18,6 @@ const userStore = useUserStore()
|
|
|
17
18
|
const themeStore = useThemeStore()
|
|
18
19
|
const { t } = useI18n()
|
|
19
20
|
|
|
20
|
-
/** 返回上一页。 */
|
|
21
|
-
const onBack = () => uni.navigateBack()
|
|
22
|
-
|
|
23
21
|
const imgMaxSize = ref(1024 * 1024)
|
|
24
22
|
const submitting = ref(false)
|
|
25
23
|
let navigateBackTimer: ReturnType<typeof setTimeout> | undefined
|
|
@@ -251,11 +249,7 @@ const onSubmit = async () => {
|
|
|
251
249
|
<view class="profile-viewport" :class="themeStore.themeClass">
|
|
252
250
|
<view class="profile-content">
|
|
253
251
|
<!-- 导航栏:统一子页头(单一返回 + 标题) -->
|
|
254
|
-
<
|
|
255
|
-
<view class="k-page-nav__back" :aria-label="t('common.action.back')" @tap="onBack"></view>
|
|
256
|
-
<view class="k-page-nav__title">{{ t('system.profile.title') }}</view>
|
|
257
|
-
<view class="k-page-nav__side" aria-hidden="true"></view>
|
|
258
|
-
</view>
|
|
252
|
+
<KratosNavBar :title="t('system.profile.title')" />
|
|
259
253
|
|
|
260
254
|
<!-- 头像卡:点击更换头像 -->
|
|
261
255
|
<view class="k-glass k-glass--lit k-pfx profile-id" @tap="onAvatarChange">
|
|
@@ -367,7 +361,7 @@ const onSubmit = async () => {
|
|
|
367
361
|
background: var(--kratos-bg-gradient);
|
|
368
362
|
}
|
|
369
363
|
|
|
370
|
-
/*
|
|
364
|
+
/* 导航组件统一处理顶部空间,页面只维护内容的水平与底部留白。 */
|
|
371
365
|
.profile-content {
|
|
372
366
|
padding: 0 32rpx calc(40rpx + env(safe-area-inset-bottom));
|
|
373
367
|
}
|