mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-28 04:59:52 +01:00
update: 设备生成主题、表情、字体入口调整
This commit is contained in:
parent
f11548fbc8
commit
e7244a8ba5
15 changed files with 96 additions and 50 deletions
|
|
@ -1,5 +1,6 @@
|
|||
module.exports = {
|
||||
plugins: {
|
||||
tailwindcss: {},
|
||||
autoprefixer: {}
|
||||
},
|
||||
}
|
||||
|
|
@ -77,7 +77,7 @@
|
|||
|
||||
<!-- 使用可复用的配置表单 -->
|
||||
<div v-if="showManualEdit" class="mt-4">
|
||||
<ConfigForm :config="customConfig" /></div>
|
||||
<ConfigForm :config="customConfig" @updateConfig="updateConfig" /></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -99,9 +99,9 @@
|
|||
</div>
|
||||
|
||||
<!-- 手动配置表单 -->
|
||||
<div class="border-2 border-gray-300 rounded-lg p-4">
|
||||
<div class="border border-gray-300 rounded-lg p-4">
|
||||
<h3 class="text-lg font-medium text-gray-900 mb-4">{{ $t('chipConfig.manualConfigTitle') }}</h3>
|
||||
<ConfigForm :config="customConfig" :show-required="true" />
|
||||
<ConfigForm :config="customConfig" :show-required="true" @updateConfig="updateConfig" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -127,6 +127,7 @@ const ConfigForm = {
|
|||
default: false
|
||||
}
|
||||
},
|
||||
emits: ["updateConfig"],
|
||||
render() {
|
||||
return h('div', { class: 'grid grid-cols-1 md:grid-cols-3 gap-4' }, [
|
||||
// 芯片型号选择
|
||||
|
|
@ -135,14 +136,18 @@ const ConfigForm = {
|
|||
this.$t('chipConfig.chipRequired') + ' ',
|
||||
this.showRequired ? h('span', { class: 'text-red-500' }, '*') : ''
|
||||
]),
|
||||
h('select', {
|
||||
class: 'w-full border border-gray-300 rounded-md px-3 py-2 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-primary-500',
|
||||
value: this.config.model,
|
||||
h('el-select', {
|
||||
class: 'w-full',
|
||||
props: {
|
||||
value: this.config.model,
|
||||
},
|
||||
on: {
|
||||
change: (e) => { this.config.model = e.target.value }
|
||||
change: (value) => {
|
||||
this.$emit('updateConfig', { model: value })
|
||||
}
|
||||
}
|
||||
}, this.$parent.CHIP_OPTIONS.map(option =>
|
||||
h('option', { attrs: { value: option.value }, key: option.value }, option.label)
|
||||
h('el-option', { attrs: { value: option.value, label: option.label }, key: option.value }, option.label)
|
||||
))
|
||||
]),
|
||||
|
||||
|
|
@ -152,19 +157,22 @@ const ConfigForm = {
|
|||
this.$t('chipConfig.widthRequired') + ' ',
|
||||
this.showRequired ? h('span', { class: 'text-red-500' }, '*') : ''
|
||||
]),
|
||||
h('input', {
|
||||
class: 'w-full border border-gray-300 rounded-md px-3 py-2 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-primary-500',
|
||||
h('el-input-number', {
|
||||
class: 'w-full',
|
||||
attrs: {
|
||||
type: 'number',
|
||||
min: 128,
|
||||
max: 800,
|
||||
placeholder: '320',
|
||||
},
|
||||
domProps: {
|
||||
props: {
|
||||
value: this.config.display.width,
|
||||
"controls-position": "right",
|
||||
},
|
||||
on: {
|
||||
input: (e) => { this.config.display.width = Number(e.target.value) }
|
||||
input: (value) => {
|
||||
this.$emit('updateConfig', { display: { ...this.config.display, width: value } })
|
||||
}
|
||||
}
|
||||
})
|
||||
]),
|
||||
|
|
@ -175,19 +183,22 @@ const ConfigForm = {
|
|||
this.$t('chipConfig.heightRequired') + ' ',
|
||||
this.showRequired ? h('span', { class: 'text-red-500' }, '*') : ''
|
||||
]),
|
||||
h('input', {
|
||||
class: 'w-full border border-gray-300 rounded-md px-3 py-2 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-primary-500',
|
||||
h('el-input-number', {
|
||||
class: 'w-full',
|
||||
attrs: {
|
||||
type: 'number',
|
||||
min: 128,
|
||||
max: 600,
|
||||
placeholder: '240',
|
||||
},
|
||||
domProps: {
|
||||
props: {
|
||||
value: this.config.display.height,
|
||||
"controls-position": "right",
|
||||
},
|
||||
on: {
|
||||
input: (e) => { this.config.display.height = Number(e.target.value) }
|
||||
input: (value) => {
|
||||
this.$emit('updateConfig', { display: { ...this.config.display, height: value } })
|
||||
}
|
||||
}
|
||||
})
|
||||
])
|
||||
|
|
@ -462,6 +473,10 @@ export default {
|
|||
return false
|
||||
}
|
||||
},
|
||||
// 更新自定义配置
|
||||
updateConfig(obj) {
|
||||
this.customConfig = { ...this.customConfig, ...obj };
|
||||
},
|
||||
|
||||
// 切换手动编辑
|
||||
toggleManualEdit() {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
</svg>
|
||||
</button>
|
||||
<!-- 烧录中提示 -->
|
||||
<div v-else class="text-sm text-orange-600 font-medium">
|
||||
<div v-else class="text-sm text-red-50 font-medium">
|
||||
{{ $t('generateModal.flashingInProgress') }}
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -150,8 +150,8 @@
|
|||
{{ $t('generateModal.downloadAssets') }}
|
||||
</span>
|
||||
</el-button>
|
||||
|
||||
<el-button
|
||||
<!-- 注释在线烧录设备功能 -->
|
||||
<!-- <el-button
|
||||
@click="startOnlineFlash"
|
||||
:disabled="!deviceOnline"
|
||||
class="w-full"
|
||||
|
|
@ -163,7 +163,7 @@
|
|||
</svg>
|
||||
{{ $t('generateModal.flashToDevice') }}
|
||||
</span>
|
||||
</el-button>
|
||||
</el-button> -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -186,21 +186,25 @@
|
|||
|
||||
<!-- 操作按钮 -->
|
||||
<div class="flex justify-between">
|
||||
<button
|
||||
<el-button
|
||||
@click="$emit('prev')"
|
||||
class="bg-gray-500 hover:bg-gray-600 text-white px-6 py-2 rounded-lg font-medium transition-colors"
|
||||
type="info"
|
||||
class="px-8 py-2"
|
||||
>
|
||||
{{ $t('generateSummary.previous') }}
|
||||
</button>
|
||||
<button
|
||||
</el-button>
|
||||
<el-button
|
||||
@click="$emit('generate')"
|
||||
class="bg-green-500 hover:bg-green-600 text-white px-8 py-2 rounded-lg font-medium transition-colors flex items-center"
|
||||
type="success"
|
||||
class="px-8 py-2"
|
||||
>
|
||||
<svg class="w-5 h-5 mr-2" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path fill-rule="evenodd" d="M3 17a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zm3.293-7.707a1 1 0 011.414 0L9 10.586V3a1 1 0 112 0v7.586l1.293-1.293a1 1 0 111.414 1.414l-3 3a1 1 0 01-1.414 0l-3-3a1 1 0 010-1.414z" clip-rule="evenodd"/>
|
||||
</svg>
|
||||
{{ $t('generateSummary.generate') }}
|
||||
</button>
|
||||
<div class="flex items-center">
|
||||
<svg class="w-5 h-5 mr-2" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path fill-rule="evenodd" d="M3 17a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zm3.293-7.707a1 1 0 011.414 0L9 10.586V3a1 1 0 112 0v7.586l1.293-1.293a1 1 0 111.414 1.414l-3 3a1 1 0 01-1.414 0l-3-3a1 1 0 010-1.414z" clip-rule="evenodd"/>
|
||||
</svg>
|
||||
{{ $t('generateSummary.generate') }}
|
||||
</div>
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -53,18 +53,18 @@
|
|||
|
||||
<!-- Navigation Buttons -->
|
||||
<div class="flex justify-between">
|
||||
<button
|
||||
<el-button
|
||||
@click="$emit('prev')"
|
||||
class="bg-gray-500 hover:bg-gray-600 text-white px-6 py-2 rounded-lg font-medium transition-colors"
|
||||
type="info"
|
||||
>
|
||||
{{ $t('themeDesign.previous') }}
|
||||
</button>
|
||||
<button
|
||||
</el-button>
|
||||
<el-button
|
||||
@click="handleNext"
|
||||
class="bg-primary-500 hover:bg-primary-600 text-white px-6 py-2 rounded-lg font-medium transition-colors"
|
||||
type="primary"
|
||||
>
|
||||
{{ $t('themeDesign.next') }}
|
||||
</button>
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
|
@ -75,21 +75,17 @@ import FontConfig from './tabs/FontConfig.vue'
|
|||
import EmojiConfig from './tabs/EmojiConfig.vue'
|
||||
import BackgroundConfig from './tabs/BackgroundConfig.vue'
|
||||
|
||||
// Icons (simple SVG components)
|
||||
// 麦克风图标
|
||||
const MicrophoneIcon = {
|
||||
render(h) { // 接收 h 函数(createElement)作为参数
|
||||
render(h) {
|
||||
return h('svg', {
|
||||
// SVG 基础属性(放在 attrs 中)
|
||||
attrs: {
|
||||
fill: 'none',
|
||||
stroke: 'currentColor',
|
||||
viewBox: '0 0 24 24'
|
||||
},
|
||||
// 样式类名(可选,也可在使用时传递)
|
||||
class: 'w-5 h-5'
|
||||
}, [
|
||||
// 子节点:path 标签
|
||||
h('path', {
|
||||
attrs: {
|
||||
'stroke-linecap': 'round',
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
<!-- 表情类型选择 -->
|
||||
<div class="space-y-4">
|
||||
<div class="flex flex-wrap gap-3">
|
||||
<div class="flex flex-wrap justify-center gap-3">
|
||||
<button
|
||||
@click="setEmojiType('none')"
|
||||
:class="[
|
||||
|
|
|
|||
|
|
@ -448,6 +448,7 @@ export default {
|
|||
'device.bindWithCode': '6-stelliger Bestätigungscode-Bindung',
|
||||
'device.manualAdd': 'Manuell hinzufügen',
|
||||
'device.unbind': 'Bindung aufheben',
|
||||
'device.deviceThemeGeneration': 'Gerätethema erstellen',
|
||||
'device.toolCall': 'Werkzeugaufruf',
|
||||
'device.selectAtLeastOne': 'Bitte wählen Sie mindestens einen Datensatz aus',
|
||||
'device.confirmBatchUnbind': 'Sind Sie sicher, dass Sie {count} ausgewählte Geräte entbinden möchten?',
|
||||
|
|
|
|||
|
|
@ -448,6 +448,7 @@ export default {
|
|||
'device.bindWithCode': '6-digit Verification Code Binding',
|
||||
'device.manualAdd': 'Manual Add',
|
||||
'device.unbind': 'Unbind',
|
||||
'device.deviceThemeGeneration': 'Device theme generation',
|
||||
'device.toolCall': 'Tool Call',
|
||||
'device.selectAtLeastOne': 'Please select at least one record',
|
||||
'device.confirmBatchUnbind': 'Are you sure you want to unbind {count} selected devices?',
|
||||
|
|
|
|||
|
|
@ -448,6 +448,7 @@ export default {
|
|||
'device.bindWithCode': 'Liên kết bằng mã xác minh 6 chữ số',
|
||||
'device.manualAdd': 'Thêm thủ công',
|
||||
'device.unbind': 'Hủy liên kết',
|
||||
'device.deviceThemeGeneration': 'Tạo chủ đề thiết bị',
|
||||
'device.toolCall': 'Gọi công cụ',
|
||||
'device.selectAtLeastOne': 'Vui lòng chọn ít nhất một bản ghi',
|
||||
'device.confirmBatchUnbind': 'Bạn có chắc chắn muốn hủy liên kết {count} thiết bị đã chọn?',
|
||||
|
|
|
|||
|
|
@ -448,6 +448,7 @@ export default {
|
|||
'device.bindWithCode': '6位验证码绑定',
|
||||
'device.manualAdd': '手动添加',
|
||||
'device.unbind': '解绑',
|
||||
'device.deviceThemeGeneration': '设备主题生成',
|
||||
'device.toolCall': '工具调用',
|
||||
'device.selectAtLeastOne': '请至少选择一条记录',
|
||||
'device.confirmBatchUnbind': '确认要解绑选中的 {count} 台设备吗?',
|
||||
|
|
|
|||
|
|
@ -448,6 +448,7 @@ export default {
|
|||
'device.bindWithCode': '6位驗證碼綁定',
|
||||
'device.manualAdd': '手動添加',
|
||||
'device.unbind': '解綁',
|
||||
'device.deviceThemeGeneration': '設備主題生成',
|
||||
'device.toolCall': '工具調用',
|
||||
'device.selectAtLeastOne': '請至少選擇一條記錄',
|
||||
'device.confirmBatchUnbind': '確認要解綁選中的 {count} 台設備嗎?',
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
}
|
||||
|
||||
.step-indicator.inactive {
|
||||
@apply bg-gray-200 text-gray-500;
|
||||
@apply bg-white text-gray-500;
|
||||
}
|
||||
|
||||
.tab-button {
|
||||
|
|
|
|||
|
|
@ -64,6 +64,9 @@
|
|||
<el-button size="mini" type="text" @click="handleUnbind(scope.row.device_id)">
|
||||
{{ $t('device.unbind') }}
|
||||
</el-button>
|
||||
<el-button v-if="canGenerate(scope.row)" size="mini" type="text" @click="handleGenertor">
|
||||
{{ $t('device.deviceThemeGeneration') }}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
|
@ -334,6 +337,9 @@ export default {
|
|||
});
|
||||
});
|
||||
},
|
||||
handleGenertor() {
|
||||
this.$router.push('/voice-box-custom')
|
||||
},
|
||||
goFirst() {
|
||||
this.currentPage = 1;
|
||||
},
|
||||
|
|
@ -467,6 +473,11 @@ export default {
|
|||
this.$message.error(msg || this.$t('message.error'))
|
||||
})
|
||||
},
|
||||
// 判断是否可以生成表情、主题、字体bin文件
|
||||
canGenerate(row) {
|
||||
const version = row.firmwareVersion.replace(/\./g, '');
|
||||
return Number(version) >= 200;
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
<template>
|
||||
<div class="min-h-screen bg-gray-50">
|
||||
<div class="min-h-screen voice-box">
|
||||
<HeaderBar />
|
||||
<!-- Header -->
|
||||
<header class="bg-white shadow-sm border-b">
|
||||
<!-- <header class="bg-white shadow-sm border-b">
|
||||
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-4">
|
||||
<div class="flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 sm:gap-0">
|
||||
<h1 class="text-2xl font-bold text-gray-900">{{ $t('header.title') }}</h1>
|
||||
|
|
@ -10,10 +11,10 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
</header> -->
|
||||
|
||||
<!-- Main Content -->
|
||||
<main class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
|
||||
<main class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 pt-8">
|
||||
<div>
|
||||
<!-- 配置状态提示(右下角浮动通知) -->
|
||||
<div
|
||||
|
|
@ -59,12 +60,12 @@
|
|||
</div>
|
||||
<span class="text-sm mt-2 text-gray-600">{{ step.titleKey }}</span>
|
||||
</div>
|
||||
<div v-if="index < steps.length - 1" class="w-16 h-0.5 bg-gray-300 mx-4"></div>
|
||||
<div v-if="index < steps.length - 1" class="w-16 h-0.5 bg-white mx-4"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Step Content -->
|
||||
<div class="bg-white rounded-lg shadow-sm border p-6">
|
||||
<div class="bg-white rounded-lg p-6">
|
||||
<ChipConfig
|
||||
v-if="currentStep === 0"
|
||||
v-model="config.chip"
|
||||
|
|
@ -106,6 +107,7 @@
|
|||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import HeaderBar from "@/components/HeaderBar.vue";
|
||||
import ChipConfig from '@/components/ChipConfig.vue'
|
||||
import DeviceStatus from '@/components/DeviceStatus.vue'
|
||||
|
||||
|
|
@ -119,6 +121,7 @@ import WebSocketTransfer from '@/utils/WebSocketTransfer.js'
|
|||
export default {
|
||||
name: "VoiceBoxCustom",
|
||||
components: {
|
||||
HeaderBar,
|
||||
ChipConfig,
|
||||
DeviceStatus,
|
||||
ThemeDesign,
|
||||
|
|
@ -620,4 +623,10 @@ export default {
|
|||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.voice-box {
|
||||
background: linear-gradient(to bottom right, #dce8ff, #e4eeff, #e6cbfd) center;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -19,6 +19,11 @@ module.exports = {
|
|||
500: '#3b82f6',
|
||||
600: '#2563eb',
|
||||
700: '#1d4ed8'
|
||||
},
|
||||
orange: {
|
||||
50: '#fff7ed',
|
||||
200: '#fed7aa',
|
||||
800: '#9a3412'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue