mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-27 01:23:55 +08:00
update:mqtt密钥复杂度校验
This commit is contained in:
@@ -97,7 +97,7 @@ export default {
|
||||
}).send()
|
||||
},
|
||||
// 修改
|
||||
updateParam(data, callback) {
|
||||
updateParam(data, callback, failCallback) {
|
||||
RequestService.sendRequest()
|
||||
.url(`${getServiceUrl()}/admin/params`)
|
||||
.method('PUT')
|
||||
@@ -106,6 +106,10 @@ export default {
|
||||
RequestService.clearRequestTime()
|
||||
callback(res)
|
||||
})
|
||||
.fail((err) => {
|
||||
RequestService.clearRequestTime()
|
||||
failCallback(err)
|
||||
})
|
||||
.networkFail((err) => {
|
||||
console.error('更新参数失败:', err)
|
||||
RequestService.reAjaxFun(() => {
|
||||
|
||||
@@ -1,51 +1,43 @@
|
||||
<template>
|
||||
<el-dialog :title="title"
|
||||
:visible.sync="visible"
|
||||
width="520px"
|
||||
class="param-dialog-wrapper"
|
||||
:append-to-body="true"
|
||||
:close-on-click-modal="false"
|
||||
:key="dialogKey"
|
||||
custom-class="custom-param-dialog"
|
||||
:show-close="false"
|
||||
>
|
||||
<el-dialog :title="title" :visible.sync="visible" width="520px" class="param-dialog-wrapper" :append-to-body="true"
|
||||
:close-on-click-modal="false" :key="dialogKey" custom-class="custom-param-dialog" :show-close="false">
|
||||
<div class="dialog-container">
|
||||
<div class="dialog-header">
|
||||
<h2 class="dialog-title">{{ title }}</h2>
|
||||
<button class="custom-close-btn" @click="cancel">
|
||||
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M13 1L1 13M1 1L13 13" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
|
||||
<path d="M13 1L1 13M1 1L13 13" stroke="currentColor" stroke-width="2" stroke-linecap="round" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<el-form :model="form" :rules="rules" ref="form" label-width="auto" label-position="left" class="param-form">
|
||||
<el-form-item :label="$t('paramDialog.paramCode')" prop="paramCode" class="form-item">
|
||||
<el-input v-model="form.paramCode" :placeholder="$t('paramDialog.paramCodePlaceholder')" class="custom-input"></el-input>
|
||||
<el-input v-model="form.paramCode" :placeholder="$t('paramDialog.paramCodePlaceholder')"
|
||||
class="custom-input"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item :label="$t('paramDialog.paramValue')" prop="paramValue" class="form-item">
|
||||
<el-input v-model="form.paramValue" :placeholder="$t('paramDialog.paramValuePlaceholder')" class="custom-input"></el-input>
|
||||
<el-input v-model="form.paramValue" :placeholder="$t('paramDialog.paramValuePlaceholder')"
|
||||
class="custom-input"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item :label="$t('paramDialog.valueType')" prop="valueType" class="form-item">
|
||||
<el-select v-model="form.valueType" :placeholder="$t('paramDialog.valueTypePlaceholder')" class="custom-select">
|
||||
<el-option v-for="item in valueTypeOptions" :key="item.value" :label="$t(`paramDialog.${item.value}Type`)" :value="item.value"/>
|
||||
<el-select v-model="form.valueType" :placeholder="$t('paramDialog.valueTypePlaceholder')"
|
||||
class="custom-select">
|
||||
<el-option v-for="item in valueTypeOptions" :key="item.value" :label="$t(`paramDialog.${item.value}Type`)"
|
||||
:value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item :label="$t('paramDialog.remark')" prop="remark" class="form-item remark-item">
|
||||
<el-input type="textarea" v-model="form.remark" :placeholder="$t('paramDialog.remarkPlaceholder')" :rows="3" class="custom-textarea"></el-input>
|
||||
<el-input type="textarea" v-model="form.remark" :placeholder="$t('paramDialog.remarkPlaceholder')" :rows="3"
|
||||
class="custom-textarea"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<div class="dialog-footer">
|
||||
<el-button
|
||||
type="primary"
|
||||
@click="submit"
|
||||
class="save-btn"
|
||||
:loading="saving"
|
||||
:disabled="saving">
|
||||
<el-button type="primary" @click="submit" class="save-btn" :loading="saving" :disabled="saving">
|
||||
{{ $t('paramDialog.save') }}
|
||||
</el-button>
|
||||
<el-button @click="cancel" class="cancel-btn">
|
||||
@@ -108,14 +100,17 @@ export default {
|
||||
if (valid) {
|
||||
this.saving = true; // 开始加载
|
||||
this.$emit('submit', this.form);
|
||||
|
||||
// 在父组件处理完成后,通过watch visible的变化来重置saving状态
|
||||
}
|
||||
});
|
||||
},
|
||||
cancel() {
|
||||
this.saving = false; // 取消时重置状态
|
||||
this.$emit('cancel');
|
||||
},
|
||||
|
||||
// 提供给父组件调用以重置saving状态
|
||||
resetSaving() {
|
||||
this.saving = false;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
||||
@@ -93,8 +93,8 @@
|
||||
</div>
|
||||
|
||||
<!-- 新增/编辑参数对话框 -->
|
||||
<param-dialog :title="dialogTitle" :visible.sync="dialogVisible" :form="paramForm" @submit="handleSubmit"
|
||||
@cancel="dialogVisible = false" />
|
||||
<param-dialog ref="paramDialog" :title="dialogTitle" :visible.sync="dialogVisible" :form="paramForm"
|
||||
@submit="handleSubmit" @cancel="dialogVisible = false" />
|
||||
<el-footer>
|
||||
<version-footer />
|
||||
</el-footer>
|
||||
@@ -224,18 +224,20 @@ export default {
|
||||
if (form.id) {
|
||||
// 更新参数
|
||||
Api.admin.updateParam(form, ({ data }) => {
|
||||
if (data.code === 0) {
|
||||
this.dialogVisible = false;
|
||||
this.fetchParams();
|
||||
this.$message.success({
|
||||
message: this.$t('paramManagement.updateSuccess'),
|
||||
showClose: true
|
||||
});
|
||||
} else {
|
||||
this.$message.error({
|
||||
message: data.msg || this.$t('paramManagement.updateFailed'),
|
||||
showClose: true
|
||||
});
|
||||
this.dialogVisible = false;
|
||||
this.fetchParams();
|
||||
this.$message.success({
|
||||
message: this.$t('paramManagement.updateSuccess'),
|
||||
showClose: true
|
||||
});
|
||||
}, ({ data }) => {
|
||||
this.$message.error({
|
||||
message: data.msg || this.$t('paramManagement.updateFailed'),
|
||||
showClose: true
|
||||
});
|
||||
// 调用ParamDialog的resetSaving方法重置保存状态
|
||||
if (this.$refs.paramDialog && typeof this.$refs.paramDialog.resetSaving === 'function') {
|
||||
this.$refs.paramDialog.resetSaving();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
@@ -253,6 +255,10 @@ export default {
|
||||
message: data.msg || this.$t('paramManagement.addFailed'),
|
||||
showClose: true
|
||||
});
|
||||
// 调用ParamDialog的resetSaving方法重置保存状态
|
||||
if (this.$refs.paramDialog && typeof this.$refs.paramDialog.resetSaving === 'function') {
|
||||
this.$refs.paramDialog.resetSaving();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user