Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
group-buy-ui
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
ui
group-buy-ui
Commits
ca3ee43a
Commit
ca3ee43a
authored
Sep 25, 2021
by
Xuguangxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
a5c99714
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
57 deletions
+66
-57
sharePic.vue
src/components/sharePic.vue
+6
-1
index.vue
src/views/goodsDetail/index.vue
+60
-56
No files found.
src/components/sharePic.vue
View file @
ca3ee43a
...
...
@@ -44,7 +44,7 @@
</div>
</div>
<div
v-for=
"num in maxCount -
1 -
avatorList.length"
v-for=
"num in maxCount - avatorList.length"
:key=
"`placeholder$
{num}`"
class="item placeholder"
/>
...
...
@@ -117,6 +117,11 @@ export default {
this
.
maxCount
=
openGroupCnt
>=
6
?
6
:
openGroupCnt
;
this
.
openGroupCnt
=
openGroupCnt
;
this
.
avatorList
=
peoplePhotoList
.
slice
(
0
,
openGroupCnt
);
this
.
$nextTick
(()
=>
{
if
(
this
.
avatorList
.
length
===
0
)
{
this
.
maxCount
-=
1
;
}
});
},
async
createAndUploadPic
(
sharePicData
)
{
this
.
sharePicData
=
sharePicData
;
...
...
src/views/goodsDetail/index.vue
View file @
ca3ee43a
...
...
@@ -418,67 +418,71 @@ export default {
},
async
init
(
detailParam
)
{
const
[
res
]
=
await
goods
.
detailInfo
(
detailParam
);
if
(
res
.
groupBuyInfo
.
groupId
)
{
localStorage
.
set
(
'
groupBuyGroupId
'
,
res
.
groupBuyInfo
.
groupId
||
''
);
// 设置groupBuyGroupId,用于下单
this
.
groupId
=
+
res
.
groupBuyInfo
.
groupId
||
0
;
}
if
(
res
.
groupBuyInfo
?.
joinGroup
)
{
const
query
=
{
...
this
.
$route
.
query
};
return
this
.
$router
.
replace
({
name
:
'
groupBuySkuInfoSmallPic
'
,
query
});
}
this
.
imgList
=
res
.
imageUrl
||
[];
this
.
detailInfo
=
res
;
this
.
setStartStatus
(
res
);
this
.
showPage
=
true
;
try
{
const
detailImages
=
await
goods
.
getDetailPic
(
this
.
detailInfo
.
contentDetailUrl
);
// const imgReg = new RegExp('(?
<=
src
=
"
).[^
"
]
*
'
,
'
g
'
);
// this.detailImgList = (detailImages ||
''
).match(imgReg);
let imgReg = /<img.*?(?:>|
\
/>)/gi;
// eslint-disable-next-line no-useless-escape
let srcReg = /src=[
\'
"]?([^
\'
"]*)[
\'
"]?/i;
let arr = (detailImages ||
''
).match(imgReg);
let srcArr = [];
for (let i = 0; i < arr.length; i++) {
let src = arr[i].match(srcReg)[1].replace(
'
http
:
//', 'https://');
srcArr
.
push
(
src
);
if
(
res
.
groupBuyInfo
?.
groupId
)
{
localStorage
.
set
(
'
groupBuyGroupId
'
,
res
.
groupBuyInfo
.
groupId
||
''
);
// 设置groupBuyGroupId,用于下单
this
.
groupId
=
+
res
.
groupBuyInfo
.
groupId
||
0
;
}
this
.
detailImgList
=
srcArr
;
}
catch
(
error
)
{
console
.
error
(
error
);
}
this
.
selectedGoods
.
skuId
=
this
.
detailInfo
.
skuNo
;
if
(
res
.
activitySkuTotalCount
===
0
)
{
this
.
detailInfo
.
limitCount
=
1
;
this
.
detailInfo
.
activityLimitCount
=
0
;
this
.
$dialog
({
message
:
'
哎呀,活动太火爆,该商品已经卖光,换一个商品试试吧!
'
,
title
:
''
,
showCancelButton
:
false
,
confirmButtonText
:
'
查看其他商品
'
,
onConfirm
:
()
=>
{
this
.
$router
.
push
({
name
:
'
groupBuyList
'
});
if
(
res
.
groupBuyInfo
?.
joinGroup
)
{
const
query
=
{
...
this
.
$route
.
query
};
return
this
.
$router
.
replace
({
name
:
'
groupBuySkuInfoSmallPic
'
,
query
});
}
this
.
imgList
=
res
.
imageUrl
||
[];
this
.
detailInfo
=
res
;
this
.
setStartStatus
(
res
);
this
.
showPage
=
true
;
try
{
const
detailImages
=
await
goods
.
getDetailPic
(
this
.
detailInfo
.
contentDetailUrl
);
// const imgReg = new RegExp('(?
<=
src
=
"
).[^
"
]
*
'
,
'
g
'
);
// this.detailImgList = (detailImages ||
''
).match(imgReg);
let imgReg = /<img.*?(?:>|
\
/>)/gi;
// eslint-disable-next-line no-useless-escape
let srcReg = /src=[
\'
"]?([^
\'
"]*)[
\'
"]?/i;
let arr = (detailImages ||
''
).match(imgReg);
let srcArr = [];
for (let i = 0; i < arr.length; i++) {
let src = arr[i].match(srcReg)[1].replace(
'
http
:
//', 'https://');
srcArr
.
push
(
src
);
}
this
.
detailImgList
=
srcArr
;
}
catch
(
error
)
{
console
.
error
(
error
);
}
this
.
selectedGoods
.
skuId
=
this
.
detailInfo
.
skuNo
;
if
(
res
.
activitySkuTotalCount
===
0
)
{
this
.
detailInfo
.
limitCount
=
1
;
this
.
detailInfo
.
activityLimitCount
=
0
;
this
.
$dialog
({
message
:
'
哎呀,活动太火爆,该商品已经卖光,换一个商品试试吧!
'
,
title
:
''
,
showCancelButton
:
false
,
confirmButtonText
:
'
查看其他商品
'
,
onConfirm
:
()
=>
{
this
.
$router
.
push
({
name
:
'
groupBuyList
'
});
}
});
}
this
.
selectedAddress
=
res
.
receiverInfo
||
{};
this
.
specList
=
res
.
skuAtts
||
[];
let
li
=
[];
this
.
specList
.
forEach
(
item
=>
{
item
.
attsValues
.
forEach
(
i
=>
{
i
.
attsCode
=
item
.
attsCode
;
if
(
i
.
isSelected
)
{
this
.
specSelected
.
push
(
i
);
}
});
li
=
li
.
concat
(
item
.
attsValues
);
});
this
.
specChildList
=
li
;
// // 收货地址
// this.getAddr();
//选择的商品规格
this
.
getSelectedSkuNo
(
this
.
specSelected
);
}
catch
(
e
)
{
this
.
$toast
(
'
获取商品详情失败
'
);
}
this
.
selectedAddress
=
res
.
receiverInfo
||
{};
this
.
specList
=
res
.
skuAtts
||
[];
let
li
=
[];
this
.
specList
.
forEach
(
item
=>
{
item
.
attsValues
.
forEach
(
i
=>
{
i
.
attsCode
=
item
.
attsCode
;
if
(
i
.
isSelected
)
{
this
.
specSelected
.
push
(
i
);
}
});
li
=
li
.
concat
(
item
.
attsValues
);
});
this
.
specChildList
=
li
;
// // 收货地址
// this.getAddr();
//选择的商品规格
this
.
getSelectedSkuNo
(
this
.
specSelected
);
},
async
getAddr
()
{
if
(
!
this
.
hasLogin
)
{
...
...
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