Commit 1b6f110e authored by 前端-许佳敏's avatar 前端-许佳敏

Merge branch 'dev' into test

parents b8d71152 ff556a83
export default { export default {
'/api': { '/api': {
'target': 'http://10.0.0.25:8100/', 'target': 'http://10.0.0.10:8100/',
'changeOrigin': true, 'changeOrigin': true,
'pathRewrite': { '^/api': '' }, 'pathRewrite': { '^/api': '' },
} }
......
import React, { useState } from 'react'
import { Tag, Row } from 'antd'
import { useFormEffects, ISchemaFieldComponentProps } from '@formily/antd'
import { RiskCheck } from 'god'
const SliderValidate = (props: ISchemaFieldComponentProps) => {
const { value = [], mutators } = props
const xPoint = 80
const yPoint = 30
const imgUrl = 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1603280613858&di=b810f23b7c17affe6a2be8a28cecd857&imgtype=0&src=http%3A%2F%2Fa3.att.hudong.com%2F14%2F75%2F01300000164186121366756803686.jpg'
const componentProps = {
xPoint,
yPoint,
imgUrl
}
return (
<div>
<RiskCheck {...componentProps} imgWidth={300}/>
</div>
)
}
SliderValidate.defaultProps = {}
SliderValidate.isFieldComponent = true;
export default SliderValidate
\ No newline at end of file
...@@ -26,6 +26,7 @@ import { Checkbox, Radio } from '@formily/antd-components'; ...@@ -26,6 +26,7 @@ import { Checkbox, Radio } from '@formily/antd-components';
import DateSelect from './components/DateSelect'; import DateSelect from './components/DateSelect';
import VirtualChildren from './components/VirtualChildren'; import VirtualChildren from './components/VirtualChildren';
import SmilingFace from './components/SmilingFace'; import SmilingFace from './components/SmilingFace';
import SliderValidate from './components/SliderValidate';
import { useLinkComponentProps } from './linkages/linkComponentProps'; import { useLinkComponentProps } from './linkages/linkComponentProps';
import Loading from '../Loading'; import Loading from '../Loading';
...@@ -98,6 +99,7 @@ export const componentExport = { ...@@ -98,6 +99,7 @@ export const componentExport = {
DateSelect, DateSelect,
VirtualChildren, VirtualChildren,
SmilingFace, SmilingFace,
SliderValidate,
RadioGroup: Radio.Group RadioGroup: Radio.Group
} }
const NiceForm: React.FC<NiceFormProps> = props => { const NiceForm: React.FC<NiceFormProps> = props => {
......
...@@ -17,9 +17,10 @@ export const useAsyncSelect = async (name, service: () => Promise<any[]>, format ...@@ -17,9 +17,10 @@ export const useAsyncSelect = async (name, service: () => Promise<any[]>, format
}) })
linkage.loading(name) linkage.loading(name)
service().then(res => { service().then(res => {
let enums = []
if (format) { if (format) {
const [labelString, valueString] = format const [labelString, valueString] = format
res = res.map(v => ({ enums = res.map(v => ({
label: v[labelString], label: v[labelString],
value: v[valueString] value: v[valueString]
})) }))
...@@ -29,7 +30,7 @@ export const useAsyncSelect = async (name, service: () => Promise<any[]>, format ...@@ -29,7 +30,7 @@ export const useAsyncSelect = async (name, service: () => Promise<any[]>, format
}) })
linkage.loaded(name) linkage.loaded(name)
linkage.enum(name, res) linkage.enum(name, enums)
//请求结束可以dispatch一个自定义事件收尾,方便后续针对该事件做联动 //请求结束可以dispatch一个自定义事件收尾,方便后续针对该事件做联动
dispatch('requestAsyncSelect', { dispatch('requestAsyncSelect', {
name, name,
......
...@@ -12,12 +12,11 @@ export interface OrderHandReceivedModalProps { ...@@ -12,12 +12,11 @@ export interface OrderHandReceivedModalProps {
const OrderHandReceivedModal:React.FC<OrderHandReceivedModalProps> = ({currentRef}) => { const OrderHandReceivedModal:React.FC<OrderHandReceivedModalProps> = ({currentRef}) => {
const { formContext } = useContext(OrderDetailContext) const { data } = useContext(OrderDetailContext)
const [confirmVisible, setConfirmVisible] = useState(false) const [confirmVisible, setConfirmVisible] = useState(false)
const formData = formContext.data || {} const formData = data || {}
const { run, loading } = useHttpRequest(PublicApi.postOrderManualConfirmReceipt) const { run, loading } = useHttpRequest(PublicApi.postOrderManualConfirmReceipt)
const handleConfirm = async () => { const handleConfirm = async () => {
console.log('确认收货')
const { code } = await run({ const { code } = await run({
orderId: formData.id orderId: formData.id
}) })
......
...@@ -18,7 +18,7 @@ const ReadyReceiveOrderDetail: React.FC = () => { ...@@ -18,7 +18,7 @@ const ReadyReceiveOrderDetail: React.FC = () => {
const approvedRef = useRef<any>({}) const approvedRef = useRef<any>({})
// 是否是手工收货 // 是否是手工收货
const isHeadReceipt = formContext && formContext.data.interiorState === PurchaseOrderInsideWorkState.HAND_RECEIPT_ORDER const isHeadReceipt = formContext.data && formContext.data.interiorState === PurchaseOrderInsideWorkState.HAND_RECEIPT_ORDER
const handleClick = useCallback(() => { const handleClick = useCallback(() => {
if (isHeadReceipt) { if (isHeadReceipt) {
......
...@@ -16,7 +16,7 @@ const ReadyConfirmDelevedOrderDetail: React.FC = () => { ...@@ -16,7 +16,7 @@ const ReadyConfirmDelevedOrderDetail: React.FC = () => {
const { formContext, id, detailList } = useOrderDetail({type: 'saleOrder'}) const { formContext, id, detailList } = useOrderDetail({type: 'saleOrder'})
// 是否是手工发货 // 是否是手工发货
const isHandDeleved = formContext && formContext.data && formContext.data.purchaseOrderInteriorState === SaleOrderInsideWorkState.HAND_DELEVED_ORDER const isHandDeleved = formContext.data && formContext.data.purchaseOrderInteriorState === SaleOrderInsideWorkState.HAND_DELEVED_ORDER
// 所有发货单都是否已经发货了 // 所有发货单都是否已经发货了
const isShowBtn = formContext.data?.orderDeliveryDetailsResponses?.some(v => v.interiorState === DeliverySideState.ADD_LOGISTICS_ORDER) const isShowBtn = formContext.data?.orderDeliveryDetailsResponses?.some(v => v.interiorState === DeliverySideState.ADD_LOGISTICS_ORDER)
......
import React, { useState, Fragment } from 'react'; import React, { useState, Fragment } from 'react';
import cx from 'classnames'; import cx from 'classnames';
import { Row } from 'antd'; import { Row, Button } from 'antd';
import { Link, Helmet } from 'umi' import { Link, Helmet, history } from 'umi'
import { FormPage, RiskCheck } from 'god' import { FormPage, RiskCheck } from 'god'
import { IFormControllers, IFormButtonTypes } from 'god/dist/src/form-page' import { IFormControllers, IFormButtonTypes } from 'god/dist/src/form-page'
import './index.less' import './index.less'
...@@ -9,90 +9,25 @@ import NiceForm from '@/components/NiceForm'; ...@@ -9,90 +9,25 @@ import NiceForm from '@/components/NiceForm';
import { forgetPwdSchema } from './schema'; import { forgetPwdSchema } from './schema';
import { PATTERN_MAPS } from '@/constants/regExp'; import { PATTERN_MAPS } from '@/constants/regExp';
import { omit } from '@/utils'; import { omit } from '@/utils';
import { createFormActions } from '@formily/antd';
import { PublicApi } from '@/services/api';
const actions = createFormActions()
const GetBack: React.FC = () => { const GetBack: React.FC = () => {
const [validButton, setValidButton] = useState(true)
const finish = (value: any) => { const handleSubmit = async (value: any) => {
console.log(value, 'finish')
}
const handleSubmit = (value: any) => {
const { account } = value const { account } = value
const accountParams = PATTERN_MAPS.email.test(account) ? {email: account, ...omit(value, ['account'])} : { phone: account, ...omit(value, ['account']) } const isEmail = PATTERN_MAPS.email.test(account)
console.log(accountParams) const accountParams = isEmail ? {email: account, ...omit(value, ['account', 'confirmPassword'])} : { phone: account, ...omit(value, ['account', 'confirmPassword']) }
} const submitFn = isEmail ? PublicApi.postMemberRegisterResetEmail : PublicApi.postMemberRegisterResetSms
const getBcakForm: IFormControllers[] = [
{
type: 'Input',
name: 'phonemail',
span: 24,
inputProps: {
type: 'phonemail',
placeholder: '请输入您的邮箱/手机',
},
rules: [
{ required: true, message: '邮箱/手机为必填项!' }
]
},
// {
// span: 24,
// // @ts-ignore
// custom: () => <RiskCheck />
// },
{
type: 'Verification',
name: 'smsCode',
span: 24,
inputProps: {
} const { code } = await submitFn(accountParams)
}, if (code === 1000) {
{ history.replace('/user/login')
type: 'Input',
name: 'password',
span: 24,
inputProps: {
type: 'password',
placeholder: '设置你的密码',
},
rules: [
{ required: true, message: '密码为必填项!' },
{ pattern: /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[^]{8,20}$/, message: '密码长度8-20个字符,必须包含大小写字母和数字!' }
],
},
{
type: 'Input',
name: 'confirm',
span: 24,
dependencies: ['password'],
inputProps: {
type: 'password',
placeholder: '请再次输入密码',
},
rules: [
{ required: true, message: '请再次确认密码!' },
({ getFieldValue }) => ({
validator(rule, value) {
if (!value || getFieldValue('password') === value) {
return Promise.resolve();
}
return Promise.reject('两次的密码输入不一致!');
},
}),
]
},
]
const getBackButtons: IFormButtonTypes[] = [
{
text: '提交',
type: 'primary',
htmlType: 'submit',
block: true,
disabled: false,
} }
] }
const SubmitBtn = <Button type='primary' block htmlType='submit'>提交</Button>
return ( return (
<Fragment> <Fragment>
...@@ -105,6 +40,10 @@ const GetBack: React.FC = () => { ...@@ -105,6 +40,10 @@ const GetBack: React.FC = () => {
<NiceForm <NiceForm
schema={forgetPwdSchema} schema={forgetPwdSchema}
onSubmit={handleSubmit} onSubmit={handleSubmit}
actions={actions}
expressionScope={{
SubmitBtn
}}
effects={($, { setFieldState, getFieldState }) => { effects={($, { setFieldState, getFieldState }) => {
$('onFieldValueChange', '*(password,confirmPassword)').subscribe(fieldState => { $('onFieldValueChange', '*(password,confirmPassword)').subscribe(fieldState => {
const selfName = fieldState.name const selfName = fieldState.name
...@@ -128,6 +67,10 @@ const GetBack: React.FC = () => { ...@@ -128,6 +67,10 @@ const GetBack: React.FC = () => {
}) })
}} }}
/> />
<p className={'formBox'}>
<Link className='back' to={'/user/login'}>返回登录页</Link>
</p>
</div> </div>
</Row> </Row>
</Fragment> </Fragment>
......
...@@ -202,12 +202,19 @@ export const forgetPwdSchema: ISchema = { ...@@ -202,12 +202,19 @@ export const forgetPwdSchema: ISchema = {
size: 'large' size: 'large'
} }
}, },
SliderValidate: {
type: 'object',
"x-component": "SliderValidate"
},
smsCode: { smsCode: {
type: 'string', type: 'string',
"x-component": 'Phone', "x-component": 'Phone',
required: true,
"x-rules": [ "x-rules": [
{ {
required: true,
message: '请输入验证码'
},
{
pattern: PATTERN_MAPS.smsCode, pattern: PATTERN_MAPS.smsCode,
message: '请输入正确的6位验证码' message: '请输入正确的6位验证码'
} }
...@@ -229,6 +236,8 @@ export const forgetPwdSchema: ISchema = { ...@@ -229,6 +236,8 @@ export const forgetPwdSchema: ISchema = {
if (res.code === 1000) { if (res.code === 1000) {
callback() callback()
} }
}).finally(() => {
setLoading(false)
}) })
} }
...@@ -240,6 +249,8 @@ export const forgetPwdSchema: ISchema = { ...@@ -240,6 +249,8 @@ export const forgetPwdSchema: ISchema = {
if (res.code === 1000) { if (res.code === 1000) {
callback() callback()
} }
}).finally(() => {
setLoading(false)
}) })
} }
}) })
...@@ -282,9 +293,12 @@ export const forgetPwdSchema: ISchema = { ...@@ -282,9 +293,12 @@ export const forgetPwdSchema: ISchema = {
size: 'large', size: 'large',
} }
}, },
submit: { VirtualChildren: {
type: 'string', type: 'string',
"x-component": 'Submit' "x-component": 'VirtualChildren',
"x-component-props": {
children: "{{SubmitBtn}}"
}
} }
} }
} }
......
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