updata:智控台页面添加语言切换,支持中英繁。

This commit is contained in:
rainv123
2025-09-11 17:10:50 +08:00
parent a9b0775469
commit 98a1483032
41 changed files with 3800 additions and 1061 deletions
+30 -18
View File
@@ -14,36 +14,37 @@
</div>
</div>
<div class="device-name">
语言模型{{ device.llmModelName }}
{{ $t('home.languageModel') }}{{ device.llmModelName }}
</div>
<div class="device-name">
音色模型{{ device.ttsModelName }} ({{ device.ttsVoiceName }})
{{ $t('home.voiceModel') }}{{ device.ttsModelName }} ({{ device.ttsVoiceName }})
</div>
<div style="display: flex;gap: 10px;align-items: center;">
<div class="settings-btn" @click="handleConfigure">
配置角色
<div :class="['settings-btn', {'settings-btn-en': isEnglish}]" @click="handleConfigure">
{{ $t('home.configureRole') }}
</div>
<div class="settings-btn" @click="handleVoicePrint">
声纹识别
<div :class="['settings-btn', {'settings-btn-en': isEnglish}]" @click="handleVoicePrint">
{{ $t('home.voiceprintRecognition') }}
</div>
<div class="settings-btn" @click="handleDeviceManage">
设备管理({{ device.deviceCount }})
<div :class="['settings-btn', {'settings-btn-en': isEnglish}]" @click="handleDeviceManage">
{{ $t('home.deviceManagement') }}({{ device.deviceCount }})
</div>
<div class="settings-btn" @click="handleChatHistory"
:class="{ 'disabled-btn': device.memModelId === 'Memory_nomem' }">
<el-tooltip v-if="device.memModelId === 'Memory_nomem'" content="请先在“配置角色”界面开启记忆" placement="top">
<span>聊天记录</span>
<div :class="['settings-btn', {'settings-btn-en': isEnglish, 'disabled-btn': device.memModelId === 'Memory_nomem'}]" @click="handleChatHistory">
<el-tooltip v-if="device.memModelId === 'Memory_nomem'" :content="$t('home.enableMemory')" placement="top">
<span>{{ $t('home.chatHistory') }}</span>
</el-tooltip>
<span v-else>聊天记录</span>
<span v-else>{{ $t('home.chatHistory') }}</span>
</div>
</div>
<div class="version-info">
<div>最近对话{{ formattedLastConnectedTime }}</div>
<div>{{ $t('home.lastConversation') }}{{ formattedLastConnectedTime }}</div>
</div>
</div>
</template>
<script>
import i18n from '@/i18n';
export default {
name: 'DeviceItem',
props: {
@@ -54,23 +55,27 @@ export default {
},
computed: {
formattedLastConnectedTime() {
if (!this.device.lastConnectedAt) return '暂未对话';
if (!this.device.lastConnectedAt) return this.$t('home.noConversation');
const lastTime = new Date(this.device.lastConnectedAt);
const now = new Date();
const diffMinutes = Math.floor((now - lastTime) / (1000 * 60));
if (diffMinutes <= 1) {
return '刚刚';
return this.$t('home.justNow');
} else if (diffMinutes < 60) {
return `${diffMinutes}分钟前`;
return this.$t('home.minutesAgo', { minutes: diffMinutes });
} else if (diffMinutes < 24 * 60) {
const hours = Math.floor(diffMinutes / 60);
const minutes = diffMinutes % 60;
return `${hours}小时${minutes > 0 ? minutes + '分钟' : ''}`;
return this.$t('home.hoursAgo', { hours, minutes });
} else {
return this.device.lastConnectedAt;
}
},
// 判断是否为英文
isEnglish() {
return i18n.locale === 'en';
}
},
methods: {
@@ -125,6 +130,13 @@ export default {
border-radius: 14px;
}
.settings-btn.settings-btn-en {
font-size: 11px;
height: 39px;
min-width: 65px;
padding: 0 16px;
}
.version-info {
display: flex;
justify-content: space-between;