mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-26 04:39:53 +01:00
* 统一管理后台弹框更舒展 把 CustomDialog 默认宽度从 600 加到 720,正文给到至少 360 的高度, 默认弹框就不再显得局促。参数编辑弹框也跟着加宽。智能体历史版 本那条列表、对比和恢复预览都给到至少 420 的最小高度,避免内容 少时框太矮看起来小气。其他像添加智能体、绑定设备这些原本就合适 的弹框没动。 * 弹框外观统一收口 原本几个弹框长得参差不齐:标题字号、按钮文案、留白高度各管各的。这次把新建智能体、新建设备、改模型、改参数这几个弹框接到同一个底座上,按钮统一成「确定」「取消」,输入框字号高度对齐,遮罩背景加了模糊,弹框太高就内部滚动,四个弹框看起来一个模子 * 修复弹框关掉后再点不开 之前几个弹框改用新底座的时候,关闭那一路少了一段转发:父页面用双向绑定来收弹框关闭的信号,子页面应该再把关闭事件抛上去告诉父页面。这一段被删了,下次再点添加按钮时父页面那边状态没复位,弹框就拉不开来。现在把这段补回去。 * 弹框宽度和高度统一收口 同一批弹框的尺寸还是各管各的:模型配置里改参数那个是跟着窗口大小按比例伸缩,历史提示词的源编辑弹框是 900 像素,参数管理里又是 720 像素,智能体变更详情那个上下还留了一大块空白。这次收到同一个共用底子上:宽度都对齐到 720 像素,弹框默认上下贴齐屏幕边、内容多时中间滚动,变更详情那个高度撑到接近屏幕顶到底。 * 管理后台弹框按大小分类统一外观 管理后台里的弹框按大小分成两类来收口。占整页的大弹框(历史版本、变更详情、模型修改、模型参数修正等)撑满整个浏览器高度,下面不再留白;小弹框(添加智能体、添加设备、知识库、字典、角色模板等)改成对齐屏幕正中,不再顶在屏幕上沿。修改模型那条弹框也加宽到 960,左右留白加大到 40,跟历史版本对齐,看起来更舒展。 * 大弹框上下留白收口到十像素并按三档统一宽度 大弹框上下各留十像素让边框和圆角清晰可见。宽度按用途分三档:表单 960、含代码 1080、表格 80% 加宽度上限。供应器、上下文供应器、音色克隆都改 960;TTS 从 90% 改 80%;角色模板从 1200 改 1080;缓存查看从 70% 改 80%。新增模板的大文本框改成自适应高度。 * 弹框样式与文案收口处理 AddDeviceDialog 确认后关闭弹框;CustomDialog 去掉 :global 与紧邻选择器,合并 el-dialog__body 样式块;删除未使用的 --dialog-form/--dialog-code;AddWisdomBodyDialog 的 cancel/handleClose 委托到同一个实现;多语言文案同步去冒号与双点。 * 弹框遮罩样式移到全局作用域 scoped 块里的 ::v-deep .v-modal 打不到 body 层的遮罩,改在 global.scss 用全局选择器。 * 弹框 wrapper 居中样式移到全局作用域 scoped 块里的 ::v-deep .el-dialog__wrapper 同样打不到 element-ui 自渲染的 wrapper,跟 .v-modal 一起挪到 global.scss。 * 弹框提交状态异常收口 设备激活码错误路径不再卡 loading;Provider 与固件弹框补 loading 兜底。 * 弹框视觉异常收口 首页删除确认弹框 wrapper 居中;历史版本弹框去掉内层多余滚动条。 * 设备 API 链式返回修复 bindDevice 等方法补上 return,让 .fail() 兜底回调能正常注册到请求对象上。 * 设备 API 错误回调参数补全 device.js 六个方法加 failCallback 参数;user.js login 网络重试补 failCallback;AddDeviceDialog 改四参数签名。 * 设备状态 API 失败回调引用修复 getDeviceStatus 的 .fail() 块把函数体内 callback(res) 改成与签名一致的 if (failCallback) failCallback(err),避免业务错误时抛 ReferenceError。
271 lines
5.5 KiB
Vue
271 lines
5.5 KiB
Vue
<template>
|
|
<el-dialog
|
|
:title="title"
|
|
:visible.sync="dialogVisible"
|
|
:width="width"
|
|
:close-on-click-modal="closeOnClickModal"
|
|
:close-on-press-escape="closeOnPressEscape"
|
|
:show-close="showClose"
|
|
:destroy-on-close="destroyOnClose"
|
|
:custom-class="dialogCustomClass"
|
|
class="custom-dialog"
|
|
@close="handleClose"
|
|
@open="handleOpen"
|
|
>
|
|
<template slot="title">
|
|
<slot name="title">
|
|
<div class="dialog-title">
|
|
<img src="@/assets/knowledge-base/level.png" class="title-icon" />
|
|
<span>{{ title }}</span>
|
|
</div>
|
|
</slot>
|
|
</template>
|
|
<slot></slot>
|
|
<template slot="footer">
|
|
<div v-if="footer" class="dialog-footer">
|
|
<CustomButton @click="handleCancel">{{ cancelText }}</CustomButton>
|
|
<CustomButton :loading="confirmLoading" type="confirm" @click="handleConfirm">
|
|
<span class="confirm-inner">
|
|
<img src="@/assets/knowledge-base/star.png" class="confirm-icon" />
|
|
{{ confirmText }}
|
|
</span>
|
|
</CustomButton>
|
|
</div>
|
|
</template>
|
|
</el-dialog>
|
|
</template>
|
|
|
|
<script>
|
|
import CustomButton from './CustomButton.vue';
|
|
export default {
|
|
name: "CustomDialog",
|
|
props: {
|
|
title: {
|
|
type: String,
|
|
default: ""
|
|
},
|
|
visible: {
|
|
type: Boolean,
|
|
default: false
|
|
},
|
|
confirmLoading: {
|
|
type: Boolean,
|
|
default: false
|
|
},
|
|
width: {
|
|
type: String,
|
|
default: "720px"
|
|
},
|
|
footer: {
|
|
type: Boolean,
|
|
default: true
|
|
},
|
|
closeOnClickModal: {
|
|
type: Boolean,
|
|
default: false
|
|
},
|
|
closeOnPressEscape: {
|
|
type: Boolean,
|
|
default: true
|
|
},
|
|
showClose: {
|
|
type: Boolean,
|
|
default: true
|
|
},
|
|
destroyOnClose: {
|
|
type: Boolean,
|
|
default: true
|
|
},
|
|
customClass: {
|
|
type: String,
|
|
default: ""
|
|
},
|
|
size: {
|
|
type: String,
|
|
default: "small",
|
|
validator: (val) => ["small", "large"].includes(val),
|
|
},
|
|
cancelText: {
|
|
type: String,
|
|
default: "取消"
|
|
},
|
|
confirmText: {
|
|
type: String,
|
|
default: "确认保存"
|
|
}
|
|
},
|
|
data() {
|
|
return {
|
|
dialogVisible: this.visible
|
|
};
|
|
},
|
|
computed: {
|
|
dialogCustomClass() {
|
|
const classes = ["custom-dialog"];
|
|
if (this.customClass) classes.push(this.customClass);
|
|
if (this.size === "large") classes.push("custom-dialog--large");
|
|
if (String(this.width).includes("%")) classes.push("custom-dialog--fluid");
|
|
return classes.join(" ");
|
|
},
|
|
},
|
|
components: {
|
|
CustomButton
|
|
},
|
|
watch: {
|
|
visible(val) {
|
|
this.dialogVisible = val;
|
|
}
|
|
},
|
|
methods: {
|
|
handleClose() {
|
|
this.dialogVisible = false;
|
|
this.$emit("update:visible", false);
|
|
this.$emit("close");
|
|
},
|
|
handleOpen() {
|
|
this.$emit("open");
|
|
},
|
|
handleCancel() {
|
|
this.dialogVisible = false;
|
|
this.$emit("update:visible", false);
|
|
this.$emit("cancel");
|
|
},
|
|
handleConfirm() {
|
|
this.$emit("confirm");
|
|
}
|
|
}
|
|
};
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
/* 大档与小档通过 .custom-dialog--large 区分 */
|
|
::v-deep .el-dialog.custom-dialog {
|
|
border-radius: 10px;
|
|
overflow: hidden;
|
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|
margin: 5vh auto !important;
|
|
display: flex;
|
|
flex-direction: column;
|
|
max-height: calc(100vh - 10vh);
|
|
}
|
|
|
|
::v-deep .el-dialog__body {
|
|
max-height: calc(100vh - 220px);
|
|
overflow-y: auto;
|
|
padding: 20px;
|
|
}
|
|
|
|
/* .v-modal 样式由 global.scss 全局定义 */
|
|
::v-deep .el-dialog__header {
|
|
padding: 16px 20px 12px;
|
|
background: linear-gradient(135deg, #e2eeff, #edeafe);
|
|
text-align: left;
|
|
}
|
|
|
|
::v-deep .el-dialog__title {
|
|
font-size: 16px;
|
|
font-weight: 500;
|
|
color: #1a1a1a;
|
|
}
|
|
|
|
::v-deep .dialog-title {
|
|
font-size: 18px;
|
|
display: inline-flex;
|
|
align-items: center;
|
|
> span {
|
|
line-height: 18px;
|
|
font-weight: 500;
|
|
}
|
|
}
|
|
|
|
::v-deep .title-icon {
|
|
width: 24px;
|
|
height: 24px;
|
|
margin-right: 8px;
|
|
}
|
|
|
|
::v-deep .el-dialog__headerbtn {
|
|
top: 12px;
|
|
right: 16px;
|
|
width: 32px;
|
|
height: 32px;
|
|
border: none;
|
|
border-radius: 50%;
|
|
background: #fff;
|
|
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
|
|
.el-dialog__close {
|
|
font-size: 18px;
|
|
color: #666;
|
|
position: static;
|
|
transform: none;
|
|
}
|
|
|
|
&:hover {
|
|
background: #fff;
|
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
|
|
|
|
.el-dialog__close {
|
|
color: #333;
|
|
}
|
|
}
|
|
}
|
|
|
|
::v-deep .el-dialog__footer {
|
|
padding: 12px 20px 16px;
|
|
}
|
|
|
|
::v-deep .dialog-footer {
|
|
display: flex;
|
|
justify-content: flex-end;
|
|
|
|
.el-button {
|
|
padding: 10px 20px;
|
|
display: flex;
|
|
align-items: center;
|
|
}
|
|
|
|
.el-button--primary {
|
|
background: linear-gradient(to right, #4a7cfd, #8154fc);
|
|
border: none;
|
|
|
|
&:hover,
|
|
&:focus {
|
|
background: linear-gradient(to right, #4a7cfd, #8154fc);
|
|
opacity: 0.85;
|
|
}
|
|
}
|
|
|
|
.confirm-inner {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
}
|
|
|
|
.confirm-icon {
|
|
width: 16px;
|
|
height: 16px;
|
|
margin-right: 4px;
|
|
}
|
|
}
|
|
|
|
/* 大档:上下各留 10px 让边框和圆角可见 */
|
|
::v-deep .el-dialog.custom-dialog.custom-dialog--large {
|
|
margin: 10px auto !important;
|
|
height: calc(100vh - 20px);
|
|
max-height: calc(100vh - 20px);
|
|
border-radius: 10px;
|
|
}
|
|
|
|
::v-deep .el-dialog.custom-dialog.custom-dialog--large.custom-dialog--fluid {
|
|
max-width: var(--dialog-table-max);
|
|
}
|
|
|
|
::v-deep .el-dialog.custom-dialog--large .el-dialog__body {
|
|
max-height: calc(100vh - 20px - 110px);
|
|
flex: 1;
|
|
min-height: 0;
|
|
}
|
|
</style>
|