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
0de878e9
Commit
0de878e9
authored
Oct 12, 2021
by
Xuguangxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
'增加trycache'
parent
af0ee5be
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
43 deletions
+47
-43
smallPic.vue
src/views/goodsDetail/smallPic.vue
+47
-43
No files found.
src/views/goodsDetail/smallPic.vue
View file @
0de878e9
...
...
@@ -213,52 +213,56 @@ export default {
},
async
init
(
detailParam
)
{
const
[
res
]
=
await
goods
.
detailInfo
(
detailParam
);
firstGroupShare
(
{
...
this
.
$route
.
query
,
skuName
:
res
.
goodsName
,
skuImg
:
res
.
thumbImageUrl
},
2
);
if
(
res
.
groupBuyInfo
.
groupId
)
{
// localStorage.set('groupBuyGroupId', res.groupBuyInfo.groupId || ''); // 设置groupBuyGroupId,用于下单
this
.
groupId
=
+
res
.
groupBuyInfo
.
groupId
||
''
;
}
if
(
res
.
saleCount
&&
res
.
activitySkuTotalCount
)
{
const
percentage
=
(
+
res
.
activitySkuTotalCount
-
+
res
.
saleCount
)
/
+
res
.
activitySkuTotalCount
;
if
(
isNaN
(
percentage
))
{
this
.
stockPercentage
=
0
;
}
else
{
this
.
stockPercentage
=
Math
.
floor
(
percentage
)
>=
1
?
100
:
Math
.
floor
(
percentage
*
100
);
}
console
.
log
(
this
.
stockPercentage
);
}
this
.
imgList
=
res
.
imageUrl
||
[];
this
.
detailInfo
=
res
;
this
.
setStartStatus
(
res
);
try
{
this
.
detailInfo
.
contentDetailUrl
=
this
.
detailInfo
.
contentDetailUrl
.
replace
(
'
http://
'
,
'
https://
'
firstGroupShare
(
{
...
this
.
$route
.
query
,
skuName
:
res
.
goodsName
,
skuImg
:
res
.
thumbImageUrl
},
2
);
const
detailImages
=
await
goods
.
getDetailPic
(
this
.
detailInfo
.
contentDetailUrl
);
console
.
log
(
detailImages
);
// 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
||
''
;
}
if
(
res
.
saleCount
&&
res
.
activitySkuTotalCount
)
{
const
percentage
=
(
+
res
.
activitySkuTotalCount
-
+
res
.
saleCount
)
/
+
res
.
activitySkuTotalCount
;
if
(
isNaN
(
percentage
))
{
this
.
stockPercentage
=
0
;
}
else
{
this
.
stockPercentage
=
Math
.
floor
(
percentage
)
>=
1
?
100
:
Math
.
floor
(
percentage
*
100
);
}
console
.
log
(
this
.
stockPercentage
);
}
this
.
imgList
=
res
.
imageUrl
||
[];
this
.
detailInfo
=
res
;
this
.
setStartStatus
(
res
);
try
{
this
.
detailInfo
.
contentDetailUrl
=
this
.
detailInfo
.
contentDetailUrl
.
replace
(
'
http://
'
,
'
https://
'
);
const
detailImages
=
await
goods
.
getDetailPic
(
this
.
detailInfo
.
contentDetailUrl
);
console
.
log
(
detailImages
);
// 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
.
detailImgList
=
srcArr
;
}
catch
(
error
)
{
console
.
error
(
error
);
}
catch
(
e
)
{
console
.
log
(
e
);
}
},
setStartStatus
(
data
)
{
...
...
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