Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mayi-mp-shop
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
程默
mayi-mp-shop
Commits
bd5ce047
Commit
bd5ce047
authored
May 19, 2023
by
HouTiZhuo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
轮播滑动开发
parent
7a8fba9e
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
75 additions
and
2 deletions
+75
-2
static/nativeComponents/GoodsList/GoodsItem/index.js
+7
-0
static/nativeComponents/GoodsList/GoodsItem/index.wxml
+2
-2
static/nativeComponents/GoodsList/GoodsItem/index.wxss
+8
-0
static/nativeComponents/GoodsList/index.js
+22
-0
static/nativeComponents/GoodsList/index.wxml
+20
-0
static/nativeComponents/GoodsList/index.wxss
+16
-0
No files found.
static/nativeComponents/GoodsList/GoodsItem/index.js
View file @
bd5ce047
...
@@ -29,6 +29,7 @@ const componentOptions = {
...
@@ -29,6 +29,7 @@ const componentOptions = {
isBeginSecKill
:
false
,
// 是否开始秒杀
isBeginSecKill
:
false
,
// 是否开始秒杀
isLessTenHour
:
false
,
// 秒杀活动小于 10 小时
isLessTenHour
:
false
,
// 秒杀活动小于 10 小时
currentSecKillInfo
:
{},
// 当前秒杀信息
currentSecKillInfo
:
{},
// 当前秒杀信息
priceTextStyle
:
'flex-start'
},
},
// 数据监听器
// 数据监听器
observers
:
{
observers
:
{
...
@@ -60,6 +61,12 @@ const componentOptions = {
...
@@ -60,6 +61,12 @@ const componentOptions = {
imgFillType
imgFillType
})
})
log
.
info
(
'datas'
);
log
.
info
(
'datas'
);
const
textStyle
=
{
'left'
:
'flex-start'
,
'center'
:
'center'
,
'right'
:
'flex-end'
};
this
.
setData
({
priceTextStyle
:
textStyle
[
this
.
data
.
datas
.
componentData
[
'priceTextAlign'
]]
})
},
},
// 获取当前秒杀信息
// 获取当前秒杀信息
getSecKillInfo
(
val
)
{
getSecKillInfo
(
val
)
{
...
...
static/nativeComponents/GoodsList/GoodsItem/index.wxml
View file @
bd5ce047
...
@@ -117,7 +117,7 @@
...
@@ -117,7 +117,7 @@
<view class="itemNo" wx:if="{{datas.componentData['itemNo']}}">{{items.productCode}}</view>
<view class="itemNo" wx:if="{{datas.componentData['itemNo']}}">{{items.productCode}}</view>
<view class="info-top flex">
<view class="info-top flex">
<view
<view
class="
name
"
class="
{{datas.componentData.style === 'swipe' ? 'line-clamp1' : 'name'}}
"
wx:if="{{datas.componentData['nameShow']}}"
wx:if="{{datas.componentData['nameShow']}}"
style="color:{{datas.componentData['nameColor']}};font-weight:{{datas.componentData['nameFontWeight']}};font-size:{{datas.componentData['nameFontSize']}}em;"
style="color:{{datas.componentData['nameColor']}};font-weight:{{datas.componentData['nameFontWeight']}};font-size:{{datas.componentData['nameFontSize']}}em;"
>
>
...
@@ -158,7 +158,7 @@
...
@@ -158,7 +158,7 @@
<!-- 底部 -->
<!-- 底部 -->
<view class="bottom" wx:if="{{datas.componentData['goodsType'] !=1}}">
<view class="bottom" wx:if="{{datas.componentData['goodsType'] !=1}}">
<!-- 价格 -->
<!-- 价格 -->
<view class="priceItem flex" style="flex-wrap:{{items && items.secondKillActivityInfoGoodsList ? 'wrap' : 'nowrap'}}">
<view class="priceItem flex" style="flex-wrap:{{items && items.secondKillActivityInfoGoodsList ? 'wrap' : 'nowrap'}}
;justify-content:{{priceTextStyle}}
">
<!-- 秒杀展示 -->
<!-- 秒杀展示 -->
<block wx:if="{{items && items.secondKillActivityInfoGoodsList}}">
<block wx:if="{{items && items.secondKillActivityInfoGoodsList}}">
<view class="flex" style="margin: 12rpx 0 6rpx;align-items: center;width: 100%;">
<view class="flex" style="margin: 12rpx 0 6rpx;align-items: center;width: 100%;">
...
...
static/nativeComponents/GoodsList/GoodsItem/index.wxss
View file @
bd5ce047
...
@@ -418,3 +418,10 @@ margin-right: 8rpx;
...
@@ -418,3 +418,10 @@ margin-right: 8rpx;
font-weight: 600;
font-weight: 600;
margin-top: 12rpx;
margin-top: 12rpx;
}
}
.line-clamp1 {
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
}
\ No newline at end of file
static/nativeComponents/GoodsList/index.js
View file @
bd5ce047
...
@@ -68,6 +68,8 @@ const componentOptions = {
...
@@ -68,6 +68,8 @@ const componentOptions = {
randomNumber
:
""
,
randomNumber
:
""
,
selectScreen
:
false
,
// 筛选选中状态
selectScreen
:
false
,
// 筛选选中状态
clientHeight
:
0
,
//窗口高度
clientHeight
:
0
,
//窗口高度
swipeInfo
:
[],
currentSwiperIndex
:
0
},
},
// 数据监听器
// 数据监听器
observers
:
{},
observers
:
{},
...
@@ -233,6 +235,26 @@ const componentOptions = {
...
@@ -233,6 +235,26 @@ const componentOptions = {
this
.
getInterList
(
2
);
this
.
getInterList
(
2
);
}
}
}
}
this
.
getSwipeLen
();
},
handleSwipeChange
(
e
)
{
this
.
setData
({
currentSwiperIndex
:
e
.
detail
.
current
})
},
getSwipeLen
()
{
const
goodsListLen
=
this
.
data
.
datas
.
componentData
.
goodsList
.
length
||
0
;
const
len
=
Math
.
ceil
((
goodsListLen
/
this
.
data
.
datas
.
componentData
.
columnNum
));
const
result
=
[];
for
(
let
i
=
0
;
i
<
len
;
i
++
)
{
const
itemLen
=
this
.
getSwipeItemLen
(
i
);
result
.
push
(
itemLen
)
}
this
.
setData
({
swipeInfo
:
result
});
},
getSwipeItemLen
(
index
)
{
const
goodsListLen
=
this
.
data
.
datas
.
componentData
.
goodsList
.
length
||
0
;
const
columnNum
=
this
.
data
.
datas
.
componentData
.
columnNum
;
const
total
=
(
index
+
1
)
*
columnNum
;
return
total
>
goodsListLen
?
goodsListLen
-
(
index
*
columnNum
)
:
columnNum
},
},
getProductList
(
code
,
type
)
{
getProductList
(
code
,
type
)
{
let
{
goodsSort
,
attributeValueList
}
=
this
.
data
.
datas
.
componentData
;
let
{
goodsSort
,
attributeValueList
}
=
this
.
data
.
datas
.
componentData
;
...
...
static/nativeComponents/GoodsList/index.wxml
View file @
bd5ce047
...
@@ -149,6 +149,26 @@
...
@@ -149,6 +149,26 @@
<view class="goods-heap-Item" wx:if="{{datas.componentData.style==='heap'}}">
<view class="goods-heap-Item" wx:if="{{datas.componentData.style==='heap'}}">
<heap-item datas="{{datas}}"></heap-item>
<heap-item datas="{{datas}}"></heap-item>
</view>
</view>
<view wx:if="{{datas.componentData.style === 'swipe'}}">
<swiper bindchange="handleSwipeChange">
<block wx:for="{{swipeInfo}}">
<swiper-item style="display: grid;gap:{{datas.componentData.proGap*2}}rpx;grid-template-columns:repeat({{datas.componentData.columnNum}}, 1fr)">
<view wx:for="{{item}}" wx:for-index="indey">
<goods-item
datas="{{datas}}"
items="{{datas.componentData.goodsList[index * datas.componentData.columnNum + indey]}}"
indexs="{{index}}"
></goods-item>
</view>
</swiper-item>
</block>
</swiper>
<view class="flex custom-indicator">
<block wx:for="{{swipeInfo}}">
<view class="custom-indicator__item {{currentSwiperIndex === index && 'custom-indicator__active'}}"></view>
</block>
</view>
</view>
<view class="noGoods" wx:if="{{datas.componentData.goodsList.length == 0 && datas.componentData.filterComponentsFlag && !loading && datas.componentData.style != 'rowList'}}">
<view class="noGoods" wx:if="{{datas.componentData.goodsList.length == 0 && datas.componentData.filterComponentsFlag && !loading && datas.componentData.style != 'rowList'}}">
<image mode="widthFix" src="https://cdn.mayi888.com/static/img/empty-goods.png"></image>
<image mode="widthFix" src="https://cdn.mayi888.com/static/img/empty-goods.png"></image>
没有找到商品
没有找到商品
...
...
static/nativeComponents/GoodsList/index.wxss
View file @
bd5ce047
...
@@ -208,3 +208,19 @@ image{
...
@@ -208,3 +208,19 @@ image{
font-size: 28rpx;
font-size: 28rpx;
margin-top: 10rpx;
margin-top: 10rpx;
}
}
.custom-indicator {
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
}
.custom-indicator .custom-indicator__item {
width: 32rpx;
border: 2rpx solid rgba(0, 0, 0, 0.1);
}
.custom-indicator .custom-indicator__active {
border: 2rpx solid #C72A30;
}
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