mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-26 09:03:54 +08:00
update:格式化代码
This commit is contained in:
@@ -2,26 +2,26 @@
|
||||
<div class="welcome">
|
||||
<HeaderBar />
|
||||
|
||||
<div class="operation-bar">
|
||||
<h2 class="page-title">模型配置</h2>
|
||||
<div class="right-operations">
|
||||
<el-button plain size="small" @click="handleImport" style="background: #7b9de5; color: white;">
|
||||
<img loading="lazy" alt="" src="@/assets/model/inner_conf.png">
|
||||
导入配置
|
||||
</el-button>
|
||||
<el-button plain size="small" @click="handleExport" style="background: #71c9d1; color: white;">
|
||||
<img loading="lazy" alt="" src="@/assets/model/output_conf.png">
|
||||
导出配置
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="operation-bar">
|
||||
<h2 class="page-title">模型配置</h2>
|
||||
<div class="right-operations">
|
||||
<el-button plain size="small" @click="handleImport" style="background: #7b9de5; color: white;">
|
||||
<img loading="lazy" alt="" src="@/assets/model/inner_conf.png">
|
||||
导入配置
|
||||
</el-button>
|
||||
<el-button plain size="small" @click="handleExport" style="background: #71c9d1; color: white;">
|
||||
<img loading="lazy" alt="" src="@/assets/model/output_conf.png">
|
||||
导出配置
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 主体内容 -->
|
||||
<div class="main-wrapper">
|
||||
<div class="content-panel">
|
||||
<!-- 左侧导航 -->
|
||||
<el-menu :default-active="activeTab" class="nav-panel" @select="handleMenuSelect"
|
||||
style="background-size: cover; background-position: center;">
|
||||
style="background-size: cover; background-position: center;">
|
||||
<el-menu-item index="vad">
|
||||
<span class="menu-text">语言活动检测</span>
|
||||
</el-menu-item>
|
||||
@@ -46,14 +46,14 @@
|
||||
<div class="content-area">
|
||||
<div class="title-bar">
|
||||
<div class="title-wrapper">
|
||||
<h2 class="model-title">{{ modelTypeText }}</h2>
|
||||
<el-button type="primary" size="small" @click="addModel" class="add-btn">
|
||||
添加
|
||||
</el-button>
|
||||
<h2 class="model-title">{{ modelTypeText }}</h2>
|
||||
<el-button type="primary" size="small" @click="addModel" class="add-btn">
|
||||
添加
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="action-group">
|
||||
<div class="search-group">
|
||||
<el-input placeholder="请输入模型名称查询" v-model="search" size="small" class="search-input" clearable/>
|
||||
<el-input placeholder="请输入模型名称查询" v-model="search" size="small" class="search-input" clearable />
|
||||
<el-button type="primary" size="small" class="search-btn" @click="handleSearch">
|
||||
查询
|
||||
</el-button>
|
||||
@@ -61,7 +61,9 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-table ref="modelTable" style="width: 100%" :header-cell-style="{background: 'transparent'}" :data="modelList" class="data-table" header-row-class-name="table-header" :header-cell-class-name="headerCellClassName" @selection-change="handleSelectionChange">
|
||||
<el-table ref="modelTable" style="width: 100%" :header-cell-style="{ background: 'transparent' }"
|
||||
:data="modelList" class="data-table" header-row-class-name="table-header"
|
||||
:header-cell-class-name="headerCellClassName" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center"></el-table-column>
|
||||
<el-table-column label="模型名称" prop="modelName" align="center"></el-table-column>
|
||||
<el-table-column label="模型编码" prop="modelCode" align="center"></el-table-column>
|
||||
@@ -72,9 +74,8 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="是否启用" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-switch v-model="scope.row.isEnabled" class="custom-switch"
|
||||
:active-value="1" :inactive-value="0"
|
||||
:active-color="null" :inactive-color="null"/>
|
||||
<el-switch v-model="scope.row.isEnabled" class="custom-switch" :active-value="1" :inactive-value="0"
|
||||
:active-color="null" :inactive-color="null" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-if="activeTab === 'tts'" label="音色管理" align="center">
|
||||
@@ -98,7 +99,9 @@
|
||||
|
||||
<div class="table-footer">
|
||||
<div class="batch-actions">
|
||||
<el-button size="mini" @click="selectAll" style="width: 75px; background: #606ff3">{{ isAllSelected ? '取消全选' : '全选' }}</el-button>
|
||||
<el-button size="mini" @click="selectAll" style="width: 75px; background: #606ff3">{{ isAllSelected ?
|
||||
'取消全选' : '全选'
|
||||
}}</el-button>
|
||||
<el-button size="mini" type="danger" icon="el-icon-delete" @click="batchDelete">
|
||||
删除
|
||||
</el-button>
|
||||
@@ -107,7 +110,8 @@
|
||||
<button class="pagination-btn" :disabled="currentPage === 1" @click="goFirst">首页</button>
|
||||
<button class="pagination-btn" :disabled="currentPage === 1" @click="goPrev">上一页</button>
|
||||
|
||||
<button v-for="page in visiblePages" :key="page" class="pagination-btn" :class="{ active: page === currentPage }" @click="goToPage(page)">
|
||||
<button v-for="page in visiblePages" :key="page" class="pagination-btn"
|
||||
:class="{ active: page === currentPage }" @click="goToPage(page)">
|
||||
{{ page }}
|
||||
</button>
|
||||
|
||||
@@ -118,23 +122,24 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ModelEditDialog :modelType="activeTab" :visible.sync="editDialogVisible" :modelData="editModelData" @save="handleModelSave"/>
|
||||
<ModelEditDialog :modelType="activeTab" :visible.sync="editDialogVisible" :modelData="editModelData"
|
||||
@save="handleModelSave" />
|
||||
<TtsModel :visible.sync="ttsDialogVisible" />
|
||||
<AddModelDialog :modelType="activeTab" :visible.sync="addDialogVisible" @confirm="handleAddConfirm"/>
|
||||
<AddModelDialog :modelType="activeTab" :visible.sync="addDialogVisible" @confirm="handleAddConfirm" />
|
||||
</div>
|
||||
|
||||
<div class="copyright">
|
||||
©2025 xiaozhi-esp32-server
|
||||
</div>
|
||||
©2025 xiaozhi-esp32-server
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import ModelApi from "@/apis/module/model";
|
||||
import AddModelDialog from "@/components/AddModelDialog.vue";
|
||||
import HeaderBar from "@/components/HeaderBar.vue";
|
||||
import ModelEditDialog from "@/components/ModelEditDialog.vue";
|
||||
import TtsModel from "@/components/TtsModel.vue";
|
||||
import AddModelDialog from "@/components/AddModelDialog.vue";
|
||||
import ModelApi from "@/apis/module/model";
|
||||
|
||||
export default {
|
||||
components: { HeaderBar, ModelEditDialog, TtsModel, AddModelDialog },
|
||||
@@ -227,7 +232,7 @@ export default {
|
||||
this.activeTab,
|
||||
model.configJson?.provider || '',
|
||||
model.id,
|
||||
({data}) => resolve(data.code === 0)
|
||||
({ data }) => resolve(data.code === 0)
|
||||
)
|
||||
})
|
||||
)
|
||||
@@ -262,7 +267,7 @@ export default {
|
||||
this.activeTab,
|
||||
model.configJson?.provider || '', // 从configJson获取provider
|
||||
model.id,
|
||||
({data}) => {
|
||||
({ data }) => {
|
||||
if (data.code === 0) {
|
||||
this.$message.success('删除成功')
|
||||
this.loadData()
|
||||
@@ -316,7 +321,7 @@ export default {
|
||||
}
|
||||
};
|
||||
|
||||
ModelApi.addModel(params, ({data}) => {
|
||||
ModelApi.addModel(params, ({ data }) => {
|
||||
if (data.code === 0) {
|
||||
this.$message.success('新增成功');
|
||||
this.loadData();
|
||||
@@ -328,8 +333,8 @@ export default {
|
||||
|
||||
// 分页器
|
||||
goFirst() {
|
||||
this.currentPage = 1;
|
||||
this.loadData();
|
||||
this.currentPage = 1;
|
||||
this.loadData();
|
||||
},
|
||||
goPrev() {
|
||||
if (this.currentPage > 1) {
|
||||
@@ -357,7 +362,7 @@ export default {
|
||||
limit: this.pageSize
|
||||
};
|
||||
|
||||
ModelApi.getModelList(params, ({data}) => {
|
||||
ModelApi.getModelList(params, ({ data }) => {
|
||||
if (data.code === 0) {
|
||||
this.modelList = data.data.list;
|
||||
this.total = data.data.total;
|
||||
@@ -371,7 +376,7 @@ export default {
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
::v-deep .el-table tr{
|
||||
::v-deep .el-table tr {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
@@ -394,7 +399,7 @@ export default {
|
||||
min-height: 600px;
|
||||
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
|
||||
position: relative;
|
||||
background: rgba(237,242,255,0.5);
|
||||
background: rgba(237, 242, 255, 0.5);
|
||||
}
|
||||
|
||||
.operation-bar {
|
||||
@@ -430,12 +435,10 @@ export default {
|
||||
height: 100%;
|
||||
border-right: 1px solid #ebeef5;
|
||||
background:
|
||||
linear-gradient(
|
||||
120deg,
|
||||
linear-gradient(120deg,
|
||||
rgba(107, 140, 255, 0.3) 0%,
|
||||
rgba(169, 102, 255, 0.3) 25%,
|
||||
transparent 60%
|
||||
),
|
||||
transparent 60%),
|
||||
url("../assets/model/model.png") no-repeat center / cover;
|
||||
padding: 16px 0;
|
||||
flex-shrink: 0;
|
||||
@@ -620,7 +623,8 @@ export default {
|
||||
}
|
||||
|
||||
::v-deep .el-table .custom-selection-header .cell .el-checkbox__inner {
|
||||
display: none !important; /* 使表头复选框不可见 */
|
||||
display: none !important;
|
||||
/* 使表头复选框不可见 */
|
||||
}
|
||||
|
||||
::v-deep .el-table .custom-selection-header .cell::before {
|
||||
@@ -646,6 +650,7 @@ export default {
|
||||
}
|
||||
|
||||
::v-deep .data-table {
|
||||
|
||||
&.el-table::before,
|
||||
&.el-table::after,
|
||||
&.el-table__inner-wrapper::before {
|
||||
@@ -654,14 +659,14 @@ export default {
|
||||
}
|
||||
|
||||
::v-deep .data-table .el-table__header-wrapper {
|
||||
border-bottom: 1px solid rgb(224,227,237);
|
||||
border-bottom: 1px solid rgb(224, 227, 237);
|
||||
}
|
||||
|
||||
::v-deep .data-table .el-table__body td {
|
||||
border-bottom: 1px solid rgb(224,227,237) !important;
|
||||
border-bottom: 1px solid rgb(224, 227, 237) !important;
|
||||
}
|
||||
|
||||
.el-button img{
|
||||
.el-button img {
|
||||
height: 1em;
|
||||
vertical-align: middle;
|
||||
padding-right: 2px;
|
||||
@@ -689,7 +694,8 @@ export default {
|
||||
}
|
||||
|
||||
.voice-management-btn:hover {
|
||||
background: #8aa2e0; /* 悬停时颜色加深 */
|
||||
background: #8aa2e0;
|
||||
/* 悬停时颜色加深 */
|
||||
transform: scale(1.05);
|
||||
}
|
||||
|
||||
@@ -701,7 +707,8 @@ export default {
|
||||
padding-right: 15px !important;
|
||||
}
|
||||
|
||||
.edit-btn, .delete-btn {
|
||||
.edit-btn,
|
||||
.delete-btn {
|
||||
margin: 0 8px;
|
||||
color: #7079aa !important;
|
||||
}
|
||||
@@ -777,6 +784,4 @@ export default {
|
||||
margin-left: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user