Commit 67677612 authored by Bill's avatar Bill

Merge branch 'dev' of 10.0.0.22:lingxi/lingxi-business-system into dev

parents f04b5e03 9887a74a
......@@ -17,8 +17,11 @@ const demoFetch = require('../../demo').fetchConfig
const isDemo = true
const SITE_ID = Number(process.env.SITE_ID)
const BACK_GATEWAY = process.env.BACK_GATEWAY
const remoteUrl = process.argv[2] || 'http://10.0.0.25:8100'
const remoteUrl = BACK_GATEWAY || process.argv[2] || 'http://10.0.0.25:8100'
console.log(`\n当前访问的后端url是${remoteUrl}!!!!!!`)
if (!SITE_ID) {
console.log('\n构建失败!!!!!!')
......
......@@ -7,6 +7,7 @@ import {ColumnType} from 'antd/lib/table/interface';
import ReutrnEle from '@/components/ReturnEle';
import { PublicApi } from '@/services/api';
import { usePageStatus } from '@/hooks/usePageStatus';
import { validatorByte } from '@/utils/regExp';
const { Option } = Select;
......@@ -173,6 +174,9 @@ const AddAtttribute: React.FC<{}> = () => {
required: true,
message: '输入属性组名!',
},
{
validator: (r, v, c) => validatorByte(r, v, c, 20)
}
]}
>
<Input placeholder="输入属性组名" disabled={pageStatus === 2} />
......@@ -195,6 +199,9 @@ const AddAtttribute: React.FC<{}> = () => {
required: true,
message: '输入属性名称!',
},
{
validator: (r, v, c) => validatorByte(r, v, c, 20)
}
]}
>
<Input placeholder="输入属性名称" disabled={pageStatus === 2} />
......
......@@ -28,7 +28,13 @@ export const classSchema: ISchema = {
required: true,
"x-component-props": {
placeholder: '请输入品类名称'
}
},
"x-rules": [
{
limitByte: true,
maxByte: 16
}
]
},
type: {
type: 'number',
......
......@@ -7,6 +7,7 @@ import { history } from 'umi';
import ReutrnEle from '@/components/ReturnEle';
import { PublicApi } from '@/services/api';
import { GetManageAreaAllResponse } from '@/services/PassApi';
import { validatorByte } from '@/utils/regExp';
const layout = {
labelCol: {
......@@ -158,6 +159,9 @@ const AddPropertyValue: React.FC<{}> = () => {
required: true,
message: '输入属性值名称!',
},
{
validator: (r, v, c) => validatorByte(r, v, c, 12)
}
]}
>
<Input placeholder="输入属性值名称" disabled={isSee} />
......
......@@ -42,3 +42,28 @@ export const checkRegExp = (str:string, type:string) => {
return true;
}
}
/**
* 区别校验 汉字 和 字符 长度
* @param rule
* @param value 表单输入的值
* @param callback
* @param maxByte:number 最大字符数
*/
export const validatorByte = (rule, value, callback, maxByte: number) => {
try {
if(value){
let str = value
str = str.replace(/[\u4e00-\u9fa5]/g, 'OO')
if(str.length > maxByte)
throw new Error(`最多输入${maxByte}个字符,${Math.floor(maxByte / 2)}个汉字`);
else
callback()
} else {
callback()
}
} catch (err) {
callback(err)
}
}
\ No newline at end of file
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