Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-platform
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
shenshaokai
jinfa-platform
Commits
2d627562
Commit
2d627562
authored
Jul 16, 2021
by
XieZhiXiong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: 抽离公共schema、effects
parent
3ce7325d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
169 additions
and
0 deletions
+169
-0
index.tsx
.../transaction/purchaserEvaluation/common/effects/index.tsx
+13
-0
useBusinessEffects.tsx
...purchaserEvaluation/common/effects/useBusinessEffects.tsx
+48
-0
evaluateSchema.tsx
...ion/purchaserEvaluation/common/schemas/evaluateSchema.tsx
+108
-0
No files found.
src/pages/transaction/purchaserEvaluation/common/effects/index.tsx
0 → 100644
View file @
2d627562
/*
* @Author: XieZhiXiong
* @Date: 2021-07-16 17:13:23
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-07-16 17:13:24
* @Description:
*/
import
{
useBusinessEffects
}
from
'./useBusinessEffects'
;
export
const
createEffects
=
(
context
,
actions
)
=>
{
useBusinessEffects
(
context
,
actions
);
};
\ No newline at end of file
src/pages/transaction/purchaserEvaluation/common/effects/useBusinessEffects.tsx
0 → 100644
View file @
2d627562
/*
* @Author: XieZhiXiong
* @Date: 2021-07-16 17:13:39
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-07-16 17:14:46
* @Description:
*/
import
{
FormEffectHooks
,
FormPath
}
from
'@formily/antd'
;
const
{
onFieldInputChange$
,
onFieldValueChange$
,
}
=
FormEffectHooks
;
export
const
useBusinessEffects
=
(
context
,
actions
)
=>
{
const
{
setFieldState
,
}
=
actions
;
// 评论图片限制 4 张
onFieldInputChange$
(
'comments.*.picture'
).
subscribe
(
fieldState
=>
{
const
{
name
,
value
}
=
fieldState
;
setFieldState
(
FormPath
.
transform
(
name
,
/
\d
/
,
$1
=>
{
return
`comments.
${
$1
}
.picture`
}),
state
=>
{
// 禁用掉 或者 editable 设置成 false,删除按钮也会禁用掉的
// 所以目前先用过 rules 去限制最多可上传多少张
// state.props['x-component-props'].disabled = value.length >= 4;
}
);
});
// 评分联动
onFieldInputChange$
(
'comments.*.star'
).
subscribe
(
fieldState
=>
{
const
{
name
,
value
}
=
fieldState
;
setFieldState
(
FormPath
.
transform
(
name
,
/
\d
/
,
$1
=>
{
return
`comments.
${
$1
}
.smile`
}),
state
=>
{
state
.
value
=
value
;
}
);
});
}
\ No newline at end of file
src/pages/transaction/purchaserEvaluation/common/schemas/evaluateSchema.tsx
0 → 100644
View file @
2d627562
/*
* @Author: XieZhiXiong
* @Date: 2021-07-16 16:53:17
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-07-16 16:57:12
* @Description: 评价 schema
*/
import
{
ISchema
}
from
'@formily/antd'
;
import
{
UPLOAD_TYPE
}
from
'@/constants'
;
export
const
evaluateSchema
:
ISchema
=
{
type
:
'object'
,
properties
:
{
comments
:
{
type
:
'array'
,
'x-component'
:
'EvaluationList'
,
default
:
[],
items
:
{
type
:
'object'
,
properties
:
{
LEFT_RIGHT
:
{
type
:
'object'
,
'x-component'
:
'LeftRightLayout'
,
'x-component-props'
:
{
rightProps
:
{
span
:
2
,
offset
:
4
,
},
},
properties
:
{
MEGA_LADYOUT
:
{
type
:
'object'
,
'x-component'
:
'Mega-Layout'
,
'x-component-props'
:
{
labelCol
:
6
,
labelAlign
:
'left'
,
position
:
'left'
,
},
properties
:
{
star
:
{
title
:
'满意程度'
,
required
:
true
,
'x-component'
:
'Rating'
,
'x-component-props'
:
{
allowHalf
:
false
,
allowClear
:
false
,
},
'x-rules'
:
[
{
required
:
true
,
message
:
'请选择满意程度'
,
},
],
},
comment
:
{
type
:
'string'
,
title
:
'评价'
,
required
:
true
,
'x-component'
:
'TextArea'
,
'x-component-props'
:
{
rows
:
4
,
},
'x-rules'
:
{
max
:
200
,
},
},
picture
:
{
type
:
'string'
,
title
:
'图片'
,
'x-component'
:
'FixUpload'
,
'x-component-props'
:
{
listType
:
'card'
,
action
:
'/api/file/file/upload/prefix'
,
data
:
{
fileType
:
UPLOAD_TYPE
,
prefix
:
''
,
},
beforeUpload
:
'{{beforeUpload}}'
,
accept
:
'.png, .jpg, .jpeg'
,
},
'x-rules'
:
[
{
max
:
4
,
message
:
'最多可上传4张图片'
,
},
],
'x-mega-props'
:
{
addonAfter
:
'{{UploadTip}}'
,
},
},
},
},
smile
:
{
type
:
'object'
,
default
:
5
,
'x-component'
:
'SmilingFace'
,
'x-component-props'
:
{
position
:
'right'
,
},
},
},
},
},
},
},
},
};
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment