Commit aa618423 authored by 前端-钟卫鹏's avatar 前端-钟卫鹏
parents 3e410bcf 6b32c63c
This diff is collapsed.
...@@ -116,7 +116,18 @@ const LogisticsRoute = { ...@@ -116,7 +116,18 @@ const LogisticsRoute = {
name: 'orderResultDeatil', name: 'orderResultDeatil',
component: '@/pages/logistics/components/orderSearchDetail', component: '@/pages/logistics/components/orderSearchDetail',
hideInMenu: true hideInMenu: true
} },
{
path: '/memberCenter/logisticsAbility/logisticsResult/toOrderComfirmList',
name: 'toOrderComfirmList',
component: '@/pages/logistics/logisticsResult/toOrderComfirmList',
},
{//待确认详情处理
path: '/memberCenter/logisticsAbility/logisticsResult/toOrderComfirmDeatil',
name: 'orderResultDeatil',
component: '@/pages/logistics/components/orderSearchDetail',
hideInMenu: true
},
] ]
} }
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
"scripts": { "scripts": {
"api": "god-ytt", "api": "god-ytt",
"scripts:build": "node scripts/run", "scripts:build": "node scripts/run",
"start:dev":"umi dev",
"start:analyze": "ANALYZE=1 umi dev", "start:analyze": "ANALYZE=1 umi dev",
"clean": "rimraf node_modules", "clean": "rimraf node_modules",
"start": "yarn scripts:build && umi dev", "start": "yarn scripts:build && umi dev",
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: LeeJiancong * @Author: LeeJiancong
* @Date: 2020-07-13 14:08:50 * @Date: 2020-07-13 14:08:50
* @LastEditors: LeeJiancong * @LastEditors: LeeJiancong
* @LastEditTime: 2020-07-23 14:02:07 * @LastEditTime: 2020-07-27 11:29:16
*/ */
export default { export default {
...@@ -83,5 +83,6 @@ export default { ...@@ -83,5 +83,6 @@ export default {
'menu.logisticsAbility.logisticsResult': '物流单处理', 'menu.logisticsAbility.logisticsResult': '物流单处理',
'menu.logisticsAbility.logisticsResult.orderResultSearchList': '物流单查询', 'menu.logisticsAbility.logisticsResult.orderResultSearchList': '物流单查询',
'menu.logisticsAbility.logisticsResult.orderResultDeatil': '物流单详情' 'menu.logisticsAbility.logisticsResult.orderResultDeatil': '物流单详情',
'menu.logisticsAbility.logisticsResult.toOrderComfirmList': '待确认物流单',
}; };
\ No newline at end of file
import React, { Component, useState, useEffect } from 'react';
import { Modal, Button, Form } from 'antd'
import {
SchemaForm, SchemaMarkupField as Field,
createFormActions,
FormEffectHooks
} from '@formily/antd'
import { Input, Radio, FormMegaLayout } from '@formily/antd-components'
import { values } from 'mobx';
export interface Params {
dialogVisible: boolean,
onCancel: Function,
dontReceive?: boolean //默认展示
}
const actions = createFormActions()
const {onFieldChange$} = FormEffectHooks
const comfirmDialog: React.FC<Params> = (props) => {
console.log(props.dialogVisible)
const handleCancel = () => {
}
const handletOk = (values:any) => {
console.log(values)
actions.submit()
props.onCancel()
}
useEffect(() => {
return () => {
}
}, [])
const useFormEffects = () => {
const { setFieldState } = createFormActions()
onFieldChange$('radio').subscribe(({value}) => {
setFieldState('remarkOption',state => {
if(value == 1){
state.visible = false
}else{
state.visible = true
}
})
})
}
return (
<>
<Modal
title='单据确认'
width={800}
visible={props.dialogVisible}
onOk={handletOk}
onCancel={() => props.onCancel()}
destroyOnClose
afterClose={() => actions.reset()}
okText='确定'
cancelText='取消'
>
<SchemaForm components={{
Input, Radio: Radio.Group, TextArea: Input.TextArea
}}
actions={actions}
effects={() => useFormEffects()}
onSubmit={(values) => handletOk(values)
}
>
<Field
enum={
[
{ label: '接受物流单', value:1 },
{ label: '不接受物流单', value:2 }
]}
name='radio'
required
x-component="Radio"
/>
{props.dontReceive &&
<FormMegaLayout name='remarkOption' label='不接受原因' full required wrapperWidth={570} labelCol={2} labelAlign="top">
<Field
name="remark"
x-component="TextArea"
required
x-component-props={{
placeholder: '在此输入你的内容,最多60个汉字'
}}
x-rules={value => {
if (value.length > 60) {
return {
type: 'warning',
message: '原因最多60个汉字'
}
}
}
}
/>
</FormMegaLayout>
}
</SchemaForm>
</Modal>
</>
)
}
comfirmDialog.defaultProps = {
dontReceive: true
}
export default comfirmDialog
\ No newline at end of file
...@@ -4,6 +4,8 @@ import { PageHeaderWrapper } from '@ant-design/pro-layout' ...@@ -4,6 +4,8 @@ import { PageHeaderWrapper } from '@ant-design/pro-layout'
import { EyeOutlined, ClockCircleOutlined, UpOutlined, DownOutlined, StopOutlined, CheckSquareOutlined } from '@ant-design/icons' import { EyeOutlined, ClockCircleOutlined, UpOutlined, DownOutlined, StopOutlined, CheckSquareOutlined } from '@ant-design/icons'
import { StandardTable } from 'god' import { StandardTable } from 'god'
import { ColumnType } from 'antd/lib/table/interface' import { ColumnType } from 'antd/lib/table/interface'
import ConfirmModal from './confirmModal'
import {history} from 'umi'
import style from './index.less' import style from './index.less'
const { Step } = Steps const { Step } = Steps
const data = [ const data = [
...@@ -20,6 +22,8 @@ const data = [ ...@@ -20,6 +22,8 @@ const data = [
const detailInfo: React.FC<{}> = () => { const detailInfo: React.FC<{}> = () => {
const ref = useRef({}) const ref = useRef({})
let [isextraOption, setIsextraOption] = useState(false)
let [visible, setvisible] = useState(false)
const [detailData, setDetailData] = useState<any>({ const [detailData, setDetailData] = useState<any>({
step: { step: {
current: 0, current: 0,
...@@ -168,13 +172,15 @@ const detailInfo: React.FC<{}> = () => { ...@@ -168,13 +172,15 @@ const detailInfo: React.FC<{}> = () => {
}, },
]; ];
//在这做逻辑判断 判断路由 是由哪个页面进来的 //在这做逻辑判断 判断路由 是由哪个页面进来的
// useEffect(() => { useEffect(() => {
// effect let pathname = history.location.pathname
// return () => { if(pathname === '/memberCenter/logisticsAbility/logisticsResult/toOrderComfirmDeatil'){
// cleanup setIsextraOption(true)
// } }
// }, [])
// 模拟请求 return () => {
}
}, [])
const fetchData = (params: any) => { const fetchData = (params: any) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const queryResult = data.find(v => v.key === params.keywords); const queryResult = data.find(v => v.key === params.keywords);
...@@ -203,12 +209,13 @@ const detailInfo: React.FC<{}> = () => { ...@@ -203,12 +209,13 @@ const detailInfo: React.FC<{}> = () => {
</> </>
} }
extra={ extra={
isextraOption &&
<> <>
<Button> <Button onClick={() => setvisible(true)}>
<StopOutlined /> <StopOutlined />
不接受物流单 不接受物流单
</Button> </Button>
<Button className={style['saveBtn']}> <Button onClick={() => setvisible(true)} className={style['saveBtn']}>
<CheckSquareOutlined /> <CheckSquareOutlined />
接受物流单 接受物流单
</Button> </Button>
...@@ -409,6 +416,10 @@ const detailInfo: React.FC<{}> = () => { ...@@ -409,6 +416,10 @@ const detailInfo: React.FC<{}> = () => {
</Col> </Col>
</Row> </Row>
<ConfirmModal
dialogVisible={visible}
onCancel={() => setvisible(false)}
/>
</PageHeaderWrapper> </PageHeaderWrapper>
) )
......
...@@ -122,8 +122,13 @@ const orderSearchList: React.FC<listProps> = (props) => { ...@@ -122,8 +122,13 @@ const orderSearchList: React.FC<listProps> = (props) => {
TimeRange: '' TimeRange: ''
}) })
const handleSee = () => { const handleSee = () => {
props.type === '1'? history.push(`/memberCenter/logisticsAbility/logisticsSubmit/orderSubmitDeatil`): if(props.type === '1'){
history.push('/memberCenter/logisticsAbility/logisticsResult/orderResultDeatil') history.push(`/memberCenter/logisticsAbility/logisticsSubmit/orderSubmitDeatil`)
}else if(props.type === '2'){
history.push('/memberCenter/logisticsAbility/logisticsResult/orderResultDeatil')
}else {
history.push(' /memberCenter/logisticsAbility/logisticsResult/toOrderComfirmDeatil')
}
} }
const columns: ColumnType<any>[] = [ const columns: ColumnType<any>[] = [
{ {
......
/* /*
* @Date: 2020-07-13 15:01:40 * @Date: 2020-07-13 15:01:40
* @LastEditors: LeeJiancong * @LastEditors: LeeJiancong
* @LastEditTime: 2020-07-24 17:54:55 * @LastEditTime: 2020-07-27 11:38:38
*/ */
import React, { ReactNode, useRef } from 'react' import React, { ReactNode, useRef } from 'react'
...@@ -191,6 +191,7 @@ const Company: React.FC<{}> = () => { ...@@ -191,6 +191,7 @@ const Company: React.FC<{}> = () => {
<PageHeaderWrapper> <PageHeaderWrapper>
<Card> <Card>
<StandardTable <StandardTable
tableProps={{rowKey:'id'}}
columns={columns} columns={columns}
currentRef={ref} currentRef={ref}
fetchTableData={(params: any) => fetchData(params)} fetchTableData={(params: any) => fetchData(params)}
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: LeeJiancong * @Author: LeeJiancong
* @Date: 2020-07-15 10:31:55 * @Date: 2020-07-15 10:31:55
* @LastEditors: LeeJiancong * @LastEditors: LeeJiancong
* @LastEditTime: 2020-07-24 20:10:56 * @LastEditTime: 2020-07-27 19:11:21
*/ */
import React, { Component, useState, useEffect } from 'react'; import React, { Component, useState, useEffect } from 'react';
import ReactDOM from 'react-dom' import ReactDOM from 'react-dom'
...@@ -84,7 +84,7 @@ const dropdownRender = () => { ...@@ -84,7 +84,7 @@ const dropdownRender = () => {
const diaLogForm: React.FC<ListProps> = (props) => { const diaLogForm: React.FC<ListProps> = (props) => {
const [provinceList, setProvinceList] = useState([]) const [provinceList, setProvinceList] = useState([])
const [state, setState] = useState({ editable: true }) const [editable, setEditable] = useState<boolean>(true)
const [headerTitle, setHeaderTitle] = useState('') const [headerTitle, setHeaderTitle] = useState('')
const [select, setSelect] = useState<countryItem>({ const [select, setSelect] = useState<countryItem>({
key: 'cn', key: 'cn',
...@@ -118,6 +118,9 @@ const diaLogForm: React.FC<ListProps> = (props) => { ...@@ -118,6 +118,9 @@ const diaLogForm: React.FC<ListProps> = (props) => {
let _title = history.location.query.isSee ? '查看': let _title = history.location.query.isSee ? '查看':
Number(id) === 0? '新建':'编辑' Number(id) === 0? '新建':'编辑'
if( history.location.query.isSee){
setEditable(false)
}
// console.log(id,typeof id,history.location.query.isSee,typeof history.location.query.isSee) // console.log(id,typeof id,history.location.query.isSee,typeof history.location.query.isSee)
setHeaderTitle(`${_title}运费模板`) setHeaderTitle(`${_title}运费模板`)
PublicApi.getWarehouseAreaByPcodeAll({ pcode: '100000' }).then(res => { PublicApi.getWarehouseAreaByPcodeAll({ pcode: '100000' }).then(res => {
...@@ -181,6 +184,7 @@ const diaLogForm: React.FC<ListProps> = (props) => { ...@@ -181,6 +184,7 @@ const diaLogForm: React.FC<ListProps> = (props) => {
backIcon={<ReutrnEle description="返回" />} backIcon={<ReutrnEle description="返回" />}
title={headerTitle} title={headerTitle}
extra={ extra={
editable &&
<Button type="primary" onClick={() => actions.submit()}> 保存</Button> <Button type="primary" onClick={() => actions.submit()}> 保存</Button>
//外层调用form API //外层调用form API
} }
...@@ -188,7 +192,7 @@ const diaLogForm: React.FC<ListProps> = (props) => { ...@@ -188,7 +192,7 @@ const diaLogForm: React.FC<ListProps> = (props) => {
<Card> <Card>
<Row > <Row >
<Col span={24}> <Col span={24}>
<SchemaForm editable={state.editable} <SchemaForm editable={editable}
actions={actions}//要传递 actions={actions}//要传递
initialValues={{ initialValues={{
// provic: '广东省', // provic: '广东省',
......
This diff is collapsed.
This diff is collapsed.
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
color : #6B778C; color : #6B778C;
&:nth-last-of-type(1) { &:nth-last-of-type(1) {
flex : 2.5; flex : 3;
padding-right: 20px; padding-right: 20px;
box-sizing : border-box; box-sizing : border-box;
color : #172B4D; color : #172B4D;
...@@ -201,10 +201,4 @@ ...@@ -201,10 +201,4 @@
color : #fff; color : #fff;
background : @main-color; background : @main-color;
margin-left: 10px; margin-left: 10px;
}
.count{
font-weight: 500;
color: #172B4D;
font-size: 24px;
} }
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -6,13 +6,22 @@ ...@@ -6,13 +6,22 @@
} }
} }
.select { .subRow {
width : 160px; width: 100%;
margin : 0 0 16px 16px;
text-align: left; .subCol {
width : 100%;
text-align: right;
&:nth-of-type(1) { .select {
margin-left: 0; width : 160px;
margin : 0 0 16px 16px;
text-align: left;
&:nth-of-type(1) {
margin-left: 0;
}
}
} }
} }
...@@ -109,4 +118,4 @@ ...@@ -109,4 +118,4 @@
font-size : 14px; font-size : 14px;
font-family : SimSun, sans-serif; font-family : SimSun, sans-serif;
line-height : 1; line-height : 1;
} }
\ No newline at end of file
This diff is collapsed.
import React, { ReactNode, useState, useRef, useEffect } from 'react'; import React, { ReactNode, useState, useRef, useEffect } from 'react';
import { history } from 'umi'; import { history } from 'umi';
import { Row, Col, Tooltip, Button, Popconfirm, Card, Input } from 'antd'; import { Row, Col, Tooltip, Button, Popconfirm, Card, Input } from 'antd';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { import {
PlayCircleOutlined, PlayCircleOutlined,
PauseCircleOutlined, PauseCircleOutlined,
...@@ -189,13 +188,13 @@ const memberLevel: React.FC<[]> = () => { ...@@ -189,13 +188,13 @@ const memberLevel: React.FC<[]> = () => {
// 模拟请求 // 模拟请求
const fetchData = (params: any) => { const fetchData = (params: any) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
PublicApi.postMemberManageLevelPage({ PublicApi.getMemberManageLevelPage({
levelTag: '', cond: '',
memberLevelTypeEnum: '', current: params.current,
roleName: '', pageSize: params.pageSize,
current: params.page, }).then(res => {
pageSize: params.rows, resolve(res.data);
}).then(res => {}); });
}); });
}; };
...@@ -223,48 +222,44 @@ const memberLevel: React.FC<[]> = () => { ...@@ -223,48 +222,44 @@ const memberLevel: React.FC<[]> = () => {
const handleReset = () => {}; const handleReset = () => {};
const handleSet = (record: any) => { const handleSet = (record: any) => {
history.push('/memberCenter/memberAbility/manage/level/addEquity'); history.push('/memberAbility/manage/level/addEquity');
}; };
return ( return (
<PageHeaderWrapper> <Card>
<Card> <StandardTable
<StandardTable tableProps={{ rowKey: 'id' }}
columns={columns} columns={columns}
currentRef={ref} currentRef={ref}
fetchTableData={(params: any) => fetchData(params)} fetchTableData={(params: any) => fetchData(params)}
controlRender={ controlRender={
<Row> <Row>
<Col className={style.col} span={12} offset={12}> <Col className={style.col} span={12} offset={12}>
<Tooltip <Tooltip
trigger={['focus']} trigger={['focus']}
placement="top" placement="top"
title={ title={
<span> <span>
输入ID、会员等级、会员角色名称&nbsp;&nbsp;进行搜索 输入ID、会员等级、会员角色名称&nbsp;&nbsp;进行搜索
</span> </span>
} }
> >
<Input.Search <Input.Search
style={{ width: '232px' }} style={{ width: '232px' }}
value={keywords} value={keywords}
placeholder="搜索" placeholder="搜索"
onChange={e => setKeywords(e.target.value)} onChange={e => setKeywords(e.target.value)}
onSearch={() => handleSearch} onSearch={() => handleSearch}
/> />
</Tooltip> </Tooltip>
<Button <Button className={style.resetBtn} onClick={() => handleReset()}>
className={style.resetBtn} 重置
onClick={() => handleReset()} </Button>
> </Col>
重置 </Row>
</Button> }
</Col> />
</Row> </Card>
}
/>
</Card>
</PageHeaderWrapper>
); );
}; };
......
This diff is collapsed.
import React, { useState, useRef, ReactNode } from 'react' import React, { useState, useRef, ReactNode } from 'react';
import { history } from 'umi' import { history } from 'umi';
import { Card, Input, Button } from 'antd' import { Card, Input, Button } from 'antd';
import { PageHeaderWrapper } from '@ant-design/pro-layout' import { ContainerOutlined } from '@ant-design/icons';
import { ContainerOutlined } from '@ant-design/icons' import { StandardTable } from 'god';
import { StandardTable } from 'god' import { ColumnType } from 'antd/lib/table/interface';
import { ColumnType } from 'antd/lib/table/interface' import {
import { IFormFilter, IButtonFilter } from 'god/dist/src/standard-table/TableController' IFormFilter,
import './index.less' IButtonFilter,
} from 'god/dist/src/standard-table/TableController';
import './index.less';
import { PublicApi } from '@/services/api';
const data = [ const data = [
{ {
...@@ -15,7 +18,7 @@ const data = [ ...@@ -15,7 +18,7 @@ const data = [
rule: 1, rule: 1,
explain: '完成交易订单后,按照交易订单金额的百分比记入获取的升级分值', explain: '完成交易订单后,按照交易订单金额的百分比记入获取的升级分值',
type: '商户会员', type: '商户会员',
score: '' score: '',
}, },
{ {
key: '2', key: '2',
...@@ -23,7 +26,7 @@ const data = [ ...@@ -23,7 +26,7 @@ const data = [
rule: 1, rule: 1,
explain: '完成交易订单后,按照交易订单金额的百分比记入获取的升级分值', explain: '完成交易订单后,按照交易订单金额的百分比记入获取的升级分值',
type: '渠道会员', type: '渠道会员',
score: '' score: '',
}, },
{ {
key: '3', key: '3',
...@@ -31,7 +34,7 @@ const data = [ ...@@ -31,7 +34,7 @@ const data = [
rule: 2, rule: 2,
explain: '完成交易订单后,按照交易订单金额的百分比记入获取的升级分值', explain: '完成交易订单后,按照交易订单金额的百分比记入获取的升级分值',
type: '商户会员', type: '商户会员',
score: '' score: '',
}, },
{ {
key: '4', key: '4',
...@@ -39,12 +42,12 @@ const data = [ ...@@ -39,12 +42,12 @@ const data = [
rule: 3, rule: 3,
explain: '完成交易订单后,按照交易订单金额的百分比记入获取的升级分值', explain: '完成交易订单后,按照交易订单金额的百分比记入获取的升级分值',
type: '商户会员', type: '商户会员',
score: '' score: '',
}, },
] ];
const memberUpgradeRule: React.FC<[]> = () => { const memberUpgradeRule: React.FC<[]> = () => {
const ref = useRef({}) const ref = useRef({});
const columns: ColumnType<any>[] = [ const columns: ColumnType<any>[] = [
{ {
...@@ -58,7 +61,11 @@ const memberUpgradeRule: React.FC<[]> = () => { ...@@ -58,7 +61,11 @@ const memberUpgradeRule: React.FC<[]> = () => {
dataIndex: 'rule', dataIndex: 'rule',
align: 'center', align: 'center',
key: 'rule', key: 'rule',
render: (text: any, record: any) => <span>{record.rule === 1 ? '交易' : record.rule === 2 ? '评价' : '登录'}</span> render: (text: any, record: any) => (
<span>
{record.rule === 1 ? '交易' : record.rule === 2 ? '评价' : '登录'}
</span>
),
}, },
{ {
title: '升级规则说明', title: '升级规则说明',
...@@ -78,43 +85,41 @@ const memberUpgradeRule: React.FC<[]> = () => { ...@@ -78,43 +85,41 @@ const memberUpgradeRule: React.FC<[]> = () => {
align: 'center', align: 'center',
key: 'score', key: 'score',
render: (text: any, record: any) => { render: (text: any, record: any) => {
let component: ReactNode = null let component: ReactNode = null;
component = ( component =
record.rule === 1 ? <Input addonAfter="%" defaultValue={record.score} /> : <Input defaultValue={record.score} /> record.rule === 1 ? (
) <Input addonAfter="%" defaultValue={record.score} />
return component ) : (
} <Input defaultValue={record.score} />
} );
return component;
},
},
]; ];
// 模拟请求 // 模拟请求
const fetchData = (params: any) => { const fetchData = (params: any) => {
console.log(params);
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// getUpgradeRuleList(params).then(res => { PublicApi.getMemberManageLevelRulePage({
// }) current: params.current,
const queryResult = data.find(v => v.key === params.keywords) pageSize: params.pageSize,
setTimeout(() => { }).then(res => {
resolve({ resolve(res.data);
code: 200, });
message: '', });
data: queryResult ? [queryResult] : data };
})
}, 1000)
})
}
return ( return (
<PageHeaderWrapper extra={[<Button className='saveBtn' icon={<ContainerOutlined />}>保存</Button>]}> <Card>
<Card> <StandardTable
<StandardTable tableProps={{ rowKey: 'id' }}
columns={columns} columns={columns}
currentRef={ref} currentRef={ref}
fetchTableData={(params: any) => fetchData(params)} /> fetchTableData={(params: any) => fetchData(params)}
</Card> />
</PageHeaderWrapper> </Card>
) );
} };
export default memberUpgradeRule export default memberUpgradeRule;
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
/**
* @param str:string 需要校验的字符串
* @param type:string 需要校验的类型
*/
export const checkRegExp = (str:string, type:string) => {
switch (type) {
case 'phone': //手机号码
return /^1[3|4|5|6|7|8|9][0-9]{9}$/.test(str);
case 'tel': //座机
return /^(0\d{2,3}-\d{7,8})(-\d{1,4})?$/.test(str);
case 'card': //身份证
return /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(str);
case 'pwd': //密码以字母开头,长度在6~18之间,只能包含字母、数字和下划线
return /^[a-zA-Z]\w{5,17}$/.test(str)
case 'postal': //邮政编码
return /[1-9]\d{5}(?!\d)/.test(str);
case 'QQ': //QQ号
return /^[1-9][0-9]{4,9}$/.test(str);
case 'email': //邮箱
return /^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/.test(str);
case 'money': //金额(小数点2位)
return /^\d*(?:\.\d{0,2})?$/.test(str);
case 'URL': //网址
return /(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/.test(str)
case 'IP': //IP
return /((?:(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d?\\d))/.test(str);
case 'date': //日期时间
return /^(\d{4})\-(\d{2})\-(\d{2}) (\d{2})(?:\:\d{2}|:(\d{2}):(\d{2}))$/.test(str) || /^(\d{4})\-(\d{2})\-(\d{2})$/.test(str)
case 'number': //数字
return /^[0-9]$/.test(str);
case 'english': //英文
return /^[a-zA-Z]+$/.test(str);
case 'chinese': //中文
return /^[\\u4E00-\\u9FA5]+$/.test(str);
case 'lower': //小写
return /^[a-z]+$/.test(str);
case 'upper': //大写
return /^[A-Z]+$/.test(str);
case 'HTML': //HTML标记
return /<("[^"]*"|'[^']*'|[^'">])*>/.test(str);
default:
return true;
}
}
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