Commit ea7fe076 authored by 前端-李俊鑫's avatar 前端-李俊鑫

fix: 自营商城配置问题修复

parent 0448815e
/*
* @Author: XieZhiXiong
* @Date: 2021-05-11 10:46:57
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-05-18 15:47:20
* @LastEditors: Crayon
* @LastEditTime: 2021-10-14 09:56:42
* @Description: 申请单基础信息
*/
import React, { CSSProperties } from 'react';
......
......@@ -3,7 +3,7 @@ import { Image, Button, Form, Spin, Row, Col, Switch, Space, Input, Empty } from
import { FormOutlined } from '@ant-design/icons';
import { PublicApi } from '@/services/api';
import { MALL_ENV, MALL_PROPERTY, ENV_COLOR, ENV_BG_COLOR } from './constant'
import { validatorByte } from '@/utils/regExp';
import { validatorByte, validatorAllTrim } from '@/utils/regExp';
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import UploadImage from '@/components/UploadImage'
import styles from './index.less'
......@@ -48,6 +48,7 @@ const OwnMallConfigure = () => {
PublicApi.postManageActivityShopRuleUpdate({ id, ...values }).then(res => {
if (res.code === 1000) {
getMallList()
showEdit({ id }, false)
}
}).finally(() => {
setSaveLoading(false)
......@@ -134,7 +135,8 @@ const OwnMallConfigure = () => {
name='name'
rules={[
{ required: true, message: '请填写商城名称' },
{ validator: (r, v, c) => validatorByte(r, v, c, 40) }
{ validator: (r, v, c) => validatorByte(r, v, c, 40) },
{ validator: (r, v, c) => validatorAllTrim(v, c, '商城名称') },
]}
>
<Input/>
......
......@@ -68,3 +68,24 @@ export const validatorByte = (rule, value, callback, maxByte: number) => {
callback(err)
}
}
/**
* 校验内容是否为纯空格
* @param value 表单输入的值
* @param callback
* @param name 字段名称
*/
export const validatorAllTrim = (value, callback, name = '') => {
try {
if(value){
if(value.trim().length === 0)
throw new Error(`${name}不可为空`);
else
callback()
} else {
callback()
}
} catch (err) {
callback(err)
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment