@liujitcn/kratos-uni-app-system 0.0.19 → 0.0.21
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/index.mjs +1460 -7
- package/package.json +2 -2
- package/src/api/base/ai_message.ts +8 -5
- package/src/index.ts +18 -0
- package/src/locales/README.md +15 -0
- package/src/locales/en-US.json +91 -0
- package/src/locales/es-ES.json +91 -0
- package/src/locales/fr-FR.json +91 -0
- package/src/locales/ja-JP.json +91 -0
- package/src/locales/ko-KR.json +91 -0
- package/src/locales/zh-CN.json +91 -0
- package/src/locales/zh-TW.json +91 -0
- package/src/pages.ts +4 -4
- package/src/views/pages/my/my.vue +9 -7
- package/src/views/pagesMember/ai/components/SessionDrawer.vue +10 -6
- package/src/views/pagesMember/ai/components/WelcomePanel.vue +11 -7
- package/src/views/pagesMember/ai/index.vue +85 -66
- package/src/views/pagesMember/profile/profile.vue +22 -15
- package/src/views/pagesMember/settings/settings.vue +53 -6
|
@@ -3,9 +3,32 @@ import { useUserStore } from '@liujitcn/kratos-uni-app-core/stores'
|
|
|
3
3
|
import { onLoad } from '@dcloudio/uni-app'
|
|
4
4
|
import { ref } from 'vue'
|
|
5
5
|
import { navigateToLogin } from '@liujitcn/kratos-uni-app-core/utils/navigation'
|
|
6
|
+
import { getLanguageOptions, useI18n, type SupportedLocale } from '@liujitcn/kratos-uni-app-core'
|
|
7
|
+
import { computed, watch } from 'vue'
|
|
6
8
|
|
|
7
9
|
const userStore = useUserStore()
|
|
10
|
+
const { locale, setLocale, t } = useI18n()
|
|
8
11
|
const logoutLoading = ref(false)
|
|
12
|
+
const localeOptions = computed(() => getLanguageOptions())
|
|
13
|
+
const localeLabels = computed(() => localeOptions.value.map((item) => item.language_name))
|
|
14
|
+
const localeIndex = computed(() =>
|
|
15
|
+
Math.max(
|
|
16
|
+
0,
|
|
17
|
+
localeOptions.value.findIndex((item) => item.language_code === locale.value),
|
|
18
|
+
),
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
watch(locale, () => void uni.setNavigationBarTitle({ title: t('system.settings.title') }), {
|
|
22
|
+
immediate: true,
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
/** 处理语言选择并刷新动态本地化数据。 */
|
|
26
|
+
const onLocaleChange = (event: { detail: { value: string | number } }) => {
|
|
27
|
+
const nextLocale = localeOptions.value[Number(event.detail.value)]?.language_code as
|
|
28
|
+
| SupportedLocale
|
|
29
|
+
| undefined
|
|
30
|
+
if (nextLocale) void setLocale(nextLocale)
|
|
31
|
+
}
|
|
9
32
|
|
|
10
33
|
// #ifndef MP-WEIXIN
|
|
11
34
|
// 非微信小程序端未登录时没有可用设置项,直接引导登录以避免显示空白页面。
|
|
@@ -23,7 +46,7 @@ const onLogout = () => {
|
|
|
23
46
|
}
|
|
24
47
|
// 模态弹窗
|
|
25
48
|
uni.showModal({
|
|
26
|
-
content: '
|
|
49
|
+
content: t('system.settings.logoutConfirm'),
|
|
27
50
|
confirmColor: '#27BA9B',
|
|
28
51
|
success: async (res) => {
|
|
29
52
|
if (!res.confirm) {
|
|
@@ -38,7 +61,7 @@ const onLogout = () => {
|
|
|
38
61
|
} catch (error) {
|
|
39
62
|
await uni.showToast({
|
|
40
63
|
icon: 'none',
|
|
41
|
-
title: '
|
|
64
|
+
title: t('system.settings.logoutFailed'),
|
|
42
65
|
})
|
|
43
66
|
} finally {
|
|
44
67
|
logoutLoading.value = false
|
|
@@ -53,14 +76,28 @@ const onLogout = () => {
|
|
|
53
76
|
<!-- #ifdef MP-WEIXIN -->
|
|
54
77
|
<!-- 列表2 -->
|
|
55
78
|
<view class="list">
|
|
56
|
-
<button hover-class="none" class="item arrow" open-type="openSetting"
|
|
57
|
-
|
|
58
|
-
|
|
79
|
+
<button hover-class="none" class="item arrow" open-type="openSetting">
|
|
80
|
+
{{ t('system.settings.authorization') }}
|
|
81
|
+
</button>
|
|
82
|
+
<button hover-class="none" class="item arrow" open-type="feedback">
|
|
83
|
+
{{ t('system.settings.feedback') }}
|
|
84
|
+
</button>
|
|
85
|
+
<button hover-class="none" class="item arrow" open-type="contact">
|
|
86
|
+
{{ t('system.settings.contact') }}
|
|
87
|
+
</button>
|
|
59
88
|
</view>
|
|
60
89
|
<!-- #endif -->
|
|
90
|
+
<view class="list">
|
|
91
|
+
<picker :range="localeLabels" :value="localeIndex" @change="onLocaleChange">
|
|
92
|
+
<view class="item arrow locale-item">
|
|
93
|
+
<text>{{ t('common.field.language') }}</text>
|
|
94
|
+
<text class="locale-value">{{ localeLabels[localeIndex] }}</text>
|
|
95
|
+
</view>
|
|
96
|
+
</picker>
|
|
97
|
+
</view>
|
|
61
98
|
<!-- 操作按钮 -->
|
|
62
99
|
<view class="action" v-if="userStore.isAuthenticated()">
|
|
63
|
-
<view @tap="onLogout" class="button"
|
|
100
|
+
<view @tap="onLogout" class="button">{{ t('common.action.logout') }}</view>
|
|
64
101
|
</view>
|
|
65
102
|
</view>
|
|
66
103
|
</template>
|
|
@@ -113,6 +150,16 @@ page {
|
|
|
113
150
|
}
|
|
114
151
|
}
|
|
115
152
|
|
|
153
|
+
.locale-item {
|
|
154
|
+
display: flex;
|
|
155
|
+
justify-content: space-between;
|
|
156
|
+
padding-right: 42rpx;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.locale-value {
|
|
160
|
+
color: #888;
|
|
161
|
+
}
|
|
162
|
+
|
|
116
163
|
/* 操作按钮 */
|
|
117
164
|
.action {
|
|
118
165
|
text-align: center;
|