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
7c700b89
Commit
7c700b89
authored
Dec 14, 2021
by
GuanHua
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'v2' of
http://10.0.0.22:3000/lingxi/lingxi-business-paltform
into v2
parents
30057b6e
887857e4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
14 deletions
+35
-14
addProducts.tsx
src/pages/commodity/products/addProducts.tsx
+27
-7
productImageForm.tsx
...s/commodity/products/addProductsItem/productImageForm.tsx
+8
-7
No files found.
src/pages/commodity/products/addProducts.tsx
View file @
7c700b89
...
...
@@ -265,17 +265,37 @@ const AddProducts: React.FC<{}> = (props) => {
_params
.
unitPriceAndPicList
=
productInfoByEdit
.
unitPriceAndPicList
_params
.
isAllAttributePic
=
productInfoByEdit
.
isAllAttributePic
// 没有点击图片单单修改了商品价格 取原有的图片和新的价格合成(编辑属性组合变更,不点击图片,直接报存)
if
(
clickTabIndex
.
indexOf
(
"4"
)
!==
-
1
)
{
_params
.
unitPriceAndPicList
=
priceAttributeParams
.
map
((
item
,
index
)
=>
{
return
{
id
:
item
.
id
,
// if (clickTabIndex.indexOf("4") !== -1) {
// _params.unitPriceAndPicList = priceAttributeParams.map((item, index) => {
// return {
// id: item.id,
// goods: { id: item.goodsId },
// attributeAndValueList: item.attributeAndValueList,
// unitPrice: item.unitPrice,
// priceRate: item.priceRate,
// commodityPic: productInfoByEdit.unitPriceAndPicList[index].commodityPic
// }
// })
// }
try
{
if
(
clickTabIndex
.
indexOf
(
"4"
)
!==
-
1
)
{
_params
.
unitPriceAndPicList
=
priceAttributeParams
.
map
((
item
,
index
)
=>
{
const
pic
=
productInfoByEdit
.
unitPriceAndPicList
[
index
]?.
commodityPic
if
(
!
pic
)
{
throw
new
Error
(
'请重新上传商品图片!'
)
}
return
{
id
:
item
.
id
,
goods
:
{
id
:
item
.
goodsId
},
attributeAndValueList
:
item
.
attributeAndValueList
,
unitPrice
:
item
.
unitPrice
,
priceRate
:
item
.
priceRate
,
commodityPic
:
productInfoByEdit
.
unitPriceAndPicList
[
index
].
commodityPic
}
})
commodityPic
:
pic
}
})
}
}
catch
(
e
)
{
return
e
}
}
}
...
...
src/pages/commodity/products/addProductsItem/productImageForm.tsx
View file @
7c700b89
...
...
@@ -29,6 +29,8 @@ const ProductImageForm: React.FC<{}> = (props) => {
// 选中的图片
const
uploadFileSelectRef
=
useRef
<
any
>
({})
const
editRowIndexRef
=
useRef
<
number
>
(
0
)
// 点击编辑的DOM ID
const
editImageIdRef
=
useRef
<
any
>
()
const
{
ProductStore
}
=
store
const
{
...
...
@@ -170,13 +172,11 @@ const ProductImageForm: React.FC<{}> = (props) => {
}
/** 编辑的时候 监听mousemove判断是否有选文件上传 */
const
addMonitor
=
()
=>
{
}
const
monitor
=
(
ele
)
=>
{
const
monitor
=
()
=>
{
document
.
removeEventListener
(
'mousemove'
,
monitor
);
if
(
ele
.
files
&&
ele
.
files
.
length
>
0
)
{
console
.
log
(
'您选择中文件:'
,
ele
.
files
)
console
.
log
(
editImageIdRef
.
current
?.
files
)
if
(
editImageIdRef
.
current
?.
files
&&
editImageIdRef
.
current
.
files
.
length
>
0
)
{
console
.
log
(
'您选择中文件:'
,
editImageIdRef
.
current
.
files
)
}
else
{
uploadFileSelectRef
.
current
=
{}
console
.
log
(
'您没有选择文件'
)
...
...
@@ -244,7 +244,8 @@ const ProductImageForm: React.FC<{}> = (props) => {
editRowIndexRef
.
current
=
index
// 触发图片上传
uploadEle
.
click
()
document
.
addEventListener
(
'mousemove'
,
()
=>
monitor
(
uploadEle
),
false
);
editImageIdRef
.
current
=
uploadEle
document
.
addEventListener
(
'mousemove'
,
monitor
,
false
);
}
return
(<
div
>
...
...
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