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
linweijiong
jinfa-platform
Commits
e5952b4f
Commit
e5952b4f
authored
Aug 23, 2021
by
前端-钟卫鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:
parent
30769d21
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
25 deletions
+34
-25
addProducts.tsx
src/pages/commodity/products/addProducts.tsx
+8
-8
priceAttributeForm.tsx
...commodity/products/addProductsItem/priceAttributeForm.tsx
+7
-3
productDescFormDefault.tsx
...odity/products/addProductsItem/productDescFormDefault.tsx
+9
-10
index.tsx
...commodity/products/components/dragSortImageList/index.tsx
+10
-4
No files found.
src/pages/commodity/products/addProducts.tsx
View file @
e5952b4f
...
...
@@ -315,15 +315,15 @@ const AddProducts: React.FC<{}> = (props) => {
let
numberKeys
=
Object
.
keys
(
_params
).
map
(
_
=>
Number
(
_
)).
filter
(
Boolean
)
if
(
numberKeys
.
length
>
0
)
numberKeys
.
map
(
item
=>
delete
_params
[
item
])
PublicApi
.
postProductCommoditySaveOrUpdateCommodity
(
_params
).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
setIsEnableCheck
(
false
)
setReponseId
(
res
.
data
)
}
else
{
console
.
log
(
_params
,
'params'
)
//
PublicApi.postProductCommoditySaveOrUpdateCommodity(_params).then(res => {
//
if (res.code === 1000) {
//
setIsEnableCheck(false)
//
setReponseId(res.data)
//
} else {
setIsDisableSaveBtn
(
false
)
}
})
//
}
//
})
}).
then
(
e
=>
{
if
(
e
)
{
setIsDisableSaveBtn
(
false
)
...
...
src/pages/commodity/products/addProductsItem/priceAttributeForm.tsx
View file @
e5952b4f
...
...
@@ -815,7 +815,9 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
</
Form
.
Item
>
}
{
ladderPrice
?
<
Form
.
Item
ladderPrice
?
<
Form
.
Item
name=
"ladderRange"
label=
""
shouldUpdate=
{
true
}
...
...
@@ -905,7 +907,9 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
);
}
}
</
Form
.
List
>
</
Form
.
Item
>
:
<
Form
.
Item
</
Form
.
Item
>
:
<
Form
.
Item
label=
{
planPrice
===
3
?
"所需积分"
:
"单价"
}
name=
"uniquePrice"
rules=
{
[
...
...
@@ -920,7 +924,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
}
]
}
>
<
InputNumber
min=
{
0
}
style=
{
{
width
:
'100%'
}
}
placeholder=
{
planPrice
===
3
?
"请输入积分"
:
"请输入价格"
}
/>
<
InputNumber
min=
{
0
}
style=
{
{
width
:
'100%'
,
overflow
:
'visible'
}
}
placeholder=
{
planPrice
===
3
?
"请输入积分"
:
"请输入价格"
}
/>
</
Form
.
Item
>
}
</
Form
>
...
...
src/pages/commodity/products/addProductsItem/productDescFormDefault.tsx
View file @
e5952b4f
...
...
@@ -22,7 +22,6 @@ const schemaActions = createFormActions()
const
ProductDescFormDefualt
:
React
.
FC
<
{}
>
=
()
=>
{
const
[
fileImageList
,
setFileImageList
]
=
useState
<
any
>
([])
const
[
videoList
,
setVideoList
]
=
useState
<
any
>
([])
const
[
hyperlinkList
,
setHyperlinkList
]
=
useState
<
any
>
([])
const
flagRef
=
useRef
<
boolean
>
(
false
)
const
currentRef
=
useRef
<
any
>
({})
const
[
isLoading
,
setIsLoading
]
=
useState
<
boolean
>
(
false
)
// 上传的加载状态
...
...
@@ -58,6 +57,7 @@ const ProductDescFormDefualt: React.FC<{}> = () => {
},
[
selectCategoryId
])
useEffect
(()
=>
{
console
.
log
(
fileImageList
,
'fileImageList'
)
// 设置传输数据
setProductDescription
({
video
:
videoList
,
...
...
@@ -66,6 +66,7 @@ const ProductDescFormDefualt: React.FC<{}> = () => {
})
},
[
fileImageList
,
videoList
])
/** 拖拽后 改变数据位置 */
const
changePosition
=
useCallback
((
dragIndex
:
number
,
hoverIndex
:
number
)
=>
{
const
dragImage
=
fileImageList
[
dragIndex
]
setFileImageList
(
...
...
@@ -78,10 +79,6 @@ const ProductDescFormDefualt: React.FC<{}> = () => {
)
},
[
fileImageList
])
// useEffect(() => {
// console.log(hyperlinkList)
// }, [hyperlinkList])
const
uploadImgProps
=
{
name
:
'file'
,
action
:
'/api/file/file/upload'
,
...
...
@@ -165,9 +162,9 @@ const ProductDescFormDefualt: React.FC<{}> = () => {
}
const
handleAddHyperlink
=
(
idx
)
=>
{
console
.
log
(
'添加超链接'
)
currentRef
.
current
.
setVisible
(
true
)
schemaActions
.
setFieldValue
(
'idx'
,
idx
)
schemaActions
.
setFieldValue
(
'hyperlink'
,
fileImageList
[
idx
]?.
link
)
}
const
handleConfirm
=
()
=>
{
...
...
@@ -175,10 +172,12 @@ const ProductDescFormDefualt: React.FC<{}> = () => {
}
const
handleSubmit
=
async
(
value
)
=>
{
setHyperlinkList
(()
=>
{
let
url
=
[...
hyperlinkList
]
url
[
value
.
idx
]
=
value
.
hyperlink
return
url
console
.
log
(
value
)
const
{
idx
,
hyperlink
}
=
value
setFileImageList
(()
=>
{
let
list
=
[...
fileImageList
]
list
[
idx
][
'link'
]
=
hyperlink
return
list
})
currentRef
.
current
.
setVisible
(
false
)
}
...
...
src/pages/commodity/products/components/dragSortImageList/index.tsx
View file @
e5952b4f
...
...
@@ -13,7 +13,7 @@ interface RenderProps {
id
:
number
,
key
:
number
,
index
:
number
,
item
:
string
,
item
:
ImageItemProps
,
handleDelete
:
(
idx
:
number
)
=>
void
,
handleAddlink
:
(
idx
:
number
)
=>
void
,
changePosition
:
(
dragIdx
:
number
,
hoverIdx
:
number
)
=>
void
,
...
...
@@ -74,7 +74,7 @@ const ImageItem: React.FC<RenderProps> = (props) => {
drag
(
drop
(
ref
))
return
<
div
key=
{
index
}
className=
{
cx
(
styles
.
descriptBox
,
styles
.
mediaContentBox
)
}
ref=
{
ref
}
>
<
p
className=
{
styles
.
divImage
}
><
img
src=
{
item
}
/></
p
>
<
p
className=
{
styles
.
divImage
}
><
img
src=
{
item
[
'url'
]
}
/></
p
>
<
div
className=
{
styles
.
rightBtn
}
>
<
Tooltip
title=
"删除图片"
>
<
Button
size=
"small"
onClick=
{
()
=>
handleDelete
(
index
)
}
icon=
{
<
DeleteOutlined
/>
}
/>
...
...
@@ -89,8 +89,14 @@ const ImageItem: React.FC<RenderProps> = (props) => {
</
div
>
}
interface
ImageItemProps
{
url
:
string
,
linkType
:
number
,
link
:
string
,
}
interface
DragSortImageListProps
{
imageList
:
string
[],
imageList
:
ImageItemProps
[],
handleDelete
:
(
idx
:
number
)
=>
void
,
handleAddlink
:
(
idx
:
number
)
=>
void
,
changePosition
:
(
dragIdx
:
number
,
hoverIdx
:
number
)
=>
void
,
...
...
@@ -99,7 +105,7 @@ interface DragSortImageListProps {
const
DragSortImageList
:
React
.
FC
<
DragSortImageListProps
>
=
(
props
)
=>
{
const
{
imageList
,
handleDelete
,
handleAddlink
,
changePosition
}
=
props
const
renderImageList
=
(
item
,
index
)
=>
{
const
renderImageList
=
(
item
:
ImageItemProps
,
index
:
number
)
=>
{
return
<
ImageItem
id=
{
index
}
key=
{
index
}
...
...
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