Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
J
jd-vx-app
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
Administrator
jd-vx-app
Commits
8284d2f9
Commit
8284d2f9
authored
Jan 09, 2023
by
肖健
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
首页商品轮播
parent
7c1670d7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
14 deletions
+33
-14
home-new.vue
pages/home-new.vue
+33
-14
No files found.
pages/home-new.vue
View file @
8284d2f9
...
...
@@ -18,9 +18,9 @@
</view>
<view
class=
"banner"
>
<view
:class=
"indexCommodityList.length ==
2 ? 'banner-bg' : 'banner-bg banner-bg-1'"
v-if=
"indexCommodityList && indexCommodityList.length
<
=
2
"
>
<view
:class=
"indexCommodityList.length ==
1 ? 'banner-bg' : 'banner-bg banner-bg-1'"
v-if=
"indexCommodityList && indexCommodityList.length == 1
"
>
<image
src=
"http://jdnc-oss.uzosp.com/2022/12/28/b1679b5da1b84fa1827039fe4fadd91c.png"
></image>
<view
class=
"item"
style=
"margin-right: 15rpx;"
@
click=
"goJdShop(item)"
v-for=
"(item, i) in indexCommodityList"
:key=
"i"
>
<view
class=
"item"
style=
"margin-right: 15rpx;"
@
click=
"goJdShop(item)"
v-for=
"(item, i) in indexCommodityList
[0]
"
:key=
"i"
>
<image
:src=
"item.mainImgUrl"
></image>
<view
class=
"banner-btn-bg"
>
<view
class=
"banner-btn"
>
...
...
@@ -31,19 +31,25 @@
</view>
</view>
<view
v-else
>
<view
scroll-x=
"true"
class=
"banner-bg"
>
<view
class=
"banner-bg"
>
<image
src=
"http://jdnc-oss.uzosp.com/2022/12/28/b1679b5da1b84fa1827039fe4fadd91c.png"
></image>
<scroll-view
:scroll-x=
"true"
:enable-flex=
"true"
:show-scrollbar=
"false"
:scroll-with-animation=
"true"
style=
"width:100%;white-space: nowrap;"
>
<view
class=
"item"
style=
"display: inline-flex;margin-right: 15rpx;"
@
click=
"goJdShop(item)"
v-for=
"(item, i) in indexCommodityList"
:key=
"i"
>
<image
:src=
"item.mainImgUrl"
></image>
<view
class=
"banner-btn-bg"
>
<view
class=
"banner-btn"
>
<image
src=
"../static/index/ban-btn.png"
></image>
<text>
立即购买
</text>
</view>
</view>
</view>
</scroll-view>
<swiper
:indicator-dots=
"true"
:autoplay=
"true"
indicator-color =
"rgba(255, 255, 255, 0.35)"
indicator-active-color=
"#FEE83A"
style=
"height: 430rpx;width:100%"
>
<swiper-item
v-for=
"(item, i) in indexCommodityList"
:key=
"i"
>
<u-grid
align=
"left"
:col=
"2"
>
<u-grid-item
v-for=
"(t, tj) in indexCommodityList[i]"
:key=
"tj"
@
click=
"goJdShop(t)"
>
<view
class=
"item"
style=
"display: inline-flex;"
>
<image
:src=
"t.mainImgUrl"
></image>
<view
class=
"banner-btn-bg"
>
<view
class=
"banner-btn"
>
<image
src=
"../static/index/ban-btn.png"
></image>
<text>
立即购买
</text>
</view>
</view>
</view>
</u-grid-item>
</u-grid>
</swiper-item>
</swiper>
</view>
</view>
...
...
@@ -333,6 +339,19 @@
}).
then
(
res
=>
{
if
(
res
&&
res
.
length
>
0
)
{
this
.
indexCommodityList
=
res
let
resultArr
=
[]
let
indexSize
=
Math
.
ceil
(
res
/
2
)
let
startIdx
=
0
res
.
forEach
(
function
(
value
,
index
)
{
if
(
index
%
2
==
0
)
{
resultArr
[
startIdx
]
=
[]
resultArr
[
startIdx
].
push
(
value
)
}
else
{
resultArr
[
startIdx
].
push
(
value
)
startIdx
++
}
});
this
.
indexCommodityList
=
resultArr
}
else
{
this
.
indexCommodityList
=
[]
}
...
...
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