feat: 修改重复提示

pull/192/head
zhengkunwang223 2 years ago committed by zhengkunwang223
parent 8d560e8668
commit 0d22ae6dc3

@ -96,7 +96,7 @@ func (w WebsiteService) GetWebsites() ([]response.WebsiteDTO, error) {
func (w WebsiteService) CreateWebsite(ctx context.Context, create request.WebsiteCreate) error { func (w WebsiteService) CreateWebsite(ctx context.Context, create request.WebsiteCreate) error {
if exist, _ := websiteRepo.GetBy(websiteRepo.WithDomain(create.PrimaryDomain)); len(exist) > 0 { if exist, _ := websiteRepo.GetBy(websiteRepo.WithDomain(create.PrimaryDomain)); len(exist) > 0 {
return buserr.New(constant.ErrNameIsExist) return buserr.New(constant.ErrDomainIsExist)
} }
if exist, _ := websiteRepo.GetBy(websiteRepo.WithAlias(create.Alias)); len(exist) > 0 { if exist, _ := websiteRepo.GetBy(websiteRepo.WithAlias(create.Alias)); len(exist) > 0 {
return buserr.New(constant.ErrAliasIsExist) return buserr.New(constant.ErrAliasIsExist)

@ -6,12 +6,12 @@
<el-switch v-model="form.enable" @change="updateEnable"></el-switch> <el-switch v-model="form.enable" @change="updateEnable"></el-switch>
</el-form-item> </el-form-item>
<el-form-item prop="cycle" :label="$t('website.cycle')"> <el-form-item prop="cycle" :label="$t('website.cycle')">
<el-input v-model.number="form.cycle" type="number"> <el-input v-model="form.cycle" type="number">
<template #append>{{ $t('website.seconds') }}</template> <template #append>{{ $t('website.seconds') }}</template>
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item prop="frequency" :label="$t('website.frequency')"> <el-form-item prop="frequency" :label="$t('website.frequency')">
<el-input v-model.number="form.frequency" type="number"> <el-input v-model="form.frequency" type="number">
<template #append>{{ $t('website.count') }}</template> <template #append>{{ $t('website.count') }}</template>
</el-input> </el-input>
</el-form-item> </el-form-item>
@ -35,7 +35,7 @@
import { Website } from '@/api/interface/website'; import { Website } from '@/api/interface/website';
import { SaveFileContent } from '@/api/modules/files'; import { SaveFileContent } from '@/api/modules/files';
import { GetWafConfig, UpdateWafEnable } from '@/api/modules/website'; import { GetWafConfig, UpdateWafEnable } from '@/api/modules/website';
import { Rules } from '@/global/form-rules'; import { checkNumberRange, Rules } from '@/global/form-rules';
import i18n from '@/lang'; import i18n from '@/lang';
import { MsgSuccess } from '@/utils/message'; import { MsgSuccess } from '@/utils/message';
import { FormInstance } from 'element-plus'; import { FormInstance } from 'element-plus';
@ -73,8 +73,8 @@ let fileUpdate = reactive({
content: '', content: '',
}); });
let rules = ref({ let rules = ref({
cycle: [Rules.requiredInput], cycle: [Rules.requiredInput, checkNumberRange(1, 9999999)],
frequency: [Rules.requiredInput], frequency: [Rules.requiredInput, checkNumberRange(1, 9999999)],
}); });
const wafForm = ref<FormInstance>(); const wafForm = ref<FormInstance>();

Loading…
Cancel
Save