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
3bae45c0
Commit
3bae45c0
authored
Feb 02, 2021
by
李嘉林
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
瀑布流优化
parent
f373826a
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
60 additions
and
28 deletions
+60
-28
src/pages/home/index.vue
+10
-6
static/nativeComponents/GoodsList/index.js
+8
-8
static/nativeComponents/TimeLimitedDiscount/activityListItem/index.wxml
+1
-1
static/nativeComponents/TimeLimitedDiscount/activityListItem/index.wxss
+2
-1
static/nativeComponents/TimeLimitedDiscount/index.js
+1
-0
static/nativeComponents/module/WaterfallFlow/index.js
+31
-12
static/nativeComponents/module/WaterfallFlow/index.wxss
+7
-0
No files found.
src/pages/home/index.vue
View file @
3bae45c0
...
@@ -2,8 +2,8 @@
...
@@ -2,8 +2,8 @@
<div
class=
"domain"
>
<div
class=
"domain"
>
<!--
<view
class=
"ant-daipinglun"
>
1
</view>
-->
<!--
<view
class=
"ant-daipinglun"
>
1
</view>
-->
<!--
<goods-list
id=
"goodsList"
></goods-list>
-->
<!--
<goods-list
id=
"goodsList"
></goods-list>
-->
<
scroll-view
@
scroll=
"scrolls"
@
scrolltolower=
"scrolltolower"
style=
"height:100vh;"
scroll-y=
"true"
>
<
!--
<scroll-view
@
scroll=
"scrolls"
@
scrolltolower=
"scrolltolower"
style=
"height:100vh;overflow-y:auto;"
scroll-y=
"true"
>
--
>
<div
style=
"position:relative"
>
<div
style=
"position:relative
;
"
>
<ThemeDataPlant></ThemeDataPlant>
<ThemeDataPlant></ThemeDataPlant>
<div
v-for=
"(item,index) in pageData"
:key=
"index"
>
<div
v-for=
"(item,index) in pageData"
:key=
"index"
>
<div
v-if=
"item.componentCode=='banner'"
>
<div
v-if=
"item.componentCode=='banner'"
>
...
@@ -36,7 +36,6 @@
...
@@ -36,7 +36,6 @@
<div
v-if=
"item.componentCode == 'float-button'"
>
<div
v-if=
"item.componentCode == 'float-button'"
>
<float-button
:datas=
"item"
></float-button>
<float-button
:datas=
"item"
></float-button>
</div>
</div>
</div>
<div
v-if=
"item.componentCode == 'goods-search'"
>
<div
v-if=
"item.componentCode == 'goods-search'"
>
<goods-search
:datas=
"item"
></goods-search>
<goods-search
:datas=
"item"
></goods-search>
</div>
</div>
...
@@ -47,8 +46,9 @@
...
@@ -47,8 +46,9 @@
<pop-up
:datas=
"item"
></pop-up>
<pop-up
:datas=
"item"
></pop-up>
</div>
</div>
</div>
</div>
</div>
<bottomCont></bottomCont>
<bottomCont></bottomCont>
<
/scroll-view
>
<
!--
</scroll-view>
--
>
<!--
<image
<!--
<image
src=
"http://cdn.mayi888.com/public/jpg/33ff0efc-96b5-4044-a65a-07799dfe98e1.jpg?x-oss-process=image/resize,limit_1,w_750"
src=
"http://cdn.mayi888.com/public/jpg/33ff0efc-96b5-4044-a65a-07799dfe98e1.jpg?x-oss-process=image/resize,limit_1,w_750"
></image>
></image>
...
@@ -105,7 +105,7 @@ export default {
...
@@ -105,7 +105,7 @@ export default {
let
logoUrl
=
app
.
DFSImg
(
res
.
data
.
data
.
logoUrl
,
500
,
400
,
0
);
let
logoUrl
=
app
.
DFSImg
(
res
.
data
.
data
.
logoUrl
,
500
,
400
,
0
);
resolve
({
resolve
({
title
:
shopName
,
title
:
shopName
,
path
:
"
page
/home/main"
,
path
:
"
/pages
/home/main"
,
imageUrl
:
logoUrl
,
imageUrl
:
logoUrl
,
success
:
function
(
res
)
{
success
:
function
(
res
)
{
console
.
log
(
"成功"
,
res
);
console
.
log
(
"成功"
,
res
);
...
@@ -151,6 +151,9 @@ export default {
...
@@ -151,6 +151,9 @@ export default {
},
},
onShow
()
{
onShow
()
{
setTabBarActive
.
bind
(
this
)(
checkTabbarPage
(
'/'
));
setTabBarActive
.
bind
(
this
)(
checkTabbarPage
(
'/'
));
this
.
$mp
.
page
.
onPageScroll
=
(
el
)
=>
{
this
.
scrolls
(
el
);
};
},
},
methods
:
{
methods
:
{
init
(
pageList
)
{
init
(
pageList
)
{
...
@@ -161,8 +164,9 @@ export default {
...
@@ -161,8 +164,9 @@ export default {
console
.
log
(
"36"
,
this
.
pageData
);
console
.
log
(
"36"
,
this
.
pageData
);
},
},
scrolls
(
el
){
scrolls
(
el
){
console
.
log
(
'scroll'
)
if
(
this
.
$mp
.
page
.
selectComponent
(
".goodsListItem"
)){
this
.
$mp
.
page
.
selectComponent
(
".goodsListItem"
).
getScroll
(
el
);
this
.
$mp
.
page
.
selectComponent
(
".goodsListItem"
).
getScroll
(
el
);
}
},
},
scrolltolower
(){
scrolltolower
(){
console
.
log
(
"scrolltolower"
)
console
.
log
(
"scrolltolower"
)
...
...
static/nativeComponents/GoodsList/index.js
View file @
3bae45c0
...
@@ -26,12 +26,14 @@ const componentOptions = {
...
@@ -26,12 +26,14 @@ const componentOptions = {
// 组件生命周期
// 组件生命周期
lifetimes
:
{
lifetimes
:
{
created
()
{},
created
()
{},
ready
()
{},
ready
()
{
this
.
init
();
},
moved
()
{},
moved
()
{},
detached
()
{}
detached
()
{}
},
},
attached
()
{
attached
()
{
this
.
init
();
},
},
definitionFilter
()
{},
definitionFilter
()
{},
// 页面生命周期
// 页面生命周期
...
@@ -220,8 +222,8 @@ const componentOptions = {
...
@@ -220,8 +222,8 @@ const componentOptions = {
)
)
:
[];
:
[];
item
.
shopLogoUrl
=
DFSImg
(
item
.
shopLogoUrl
);
item
.
shopLogoUrl
=
DFSImg
(
item
.
shopLogoUrl
);
item
.
coverImage
=
DFSImg
(
item
.
coverImage
,
100
,
100
,
0
);
item
.
coverImage
=
DFSImg
(
item
.
coverImage
,
400
,
400
,
1
);
item
.
productImgUrl
=
DFSImg
(
item
.
productImgUrl
,
100
,
100
,
0
);
item
.
productImgUrl
=
DFSImg
(
item
.
productImgUrl
,
400
,
400
,
1
);
item
.
minPrice
=
Number
(
item
.
minPrice
).
toFixed
(
2
);
item
.
minPrice
=
Number
(
item
.
minPrice
).
toFixed
(
2
);
item
.
qty
=
Number
(
item
.
qty
);
item
.
qty
=
Number
(
item
.
qty
);
item
.
saleQty
=
Number
(
item
.
saleQty
);
item
.
saleQty
=
Number
(
item
.
saleQty
);
...
@@ -242,22 +244,20 @@ const componentOptions = {
...
@@ -242,22 +244,20 @@ const componentOptions = {
item
.
getSaleTime
=
this
.
getSaleTime
(
item
.
saleTime
);
item
.
getSaleTime
=
this
.
getSaleTime
(
item
.
saleTime
);
}
}
});
});
setTimeout
(()
=>
{
this
.
setData
({
this
.
setData
({
"datas.componentData.goodsList"
:
goodsList
"datas.componentData.goodsList"
:
goodsList
});
});
if
(
type
==
1
)
{
if
(
type
==
1
)
{
// 初始化
// 初始化
if
(
this
.
selectComponent
(
"#waterfallFlow"
))
{
if
(
this
.
selectComponent
(
"#waterfallFlow"
))
{
this
.
selectComponent
(
"#waterfallFlow"
).
initList
(
);
this
.
selectComponent
(
"#waterfallFlow"
).
initList
(
goodsList
);
}
}
}
else
{
}
else
{
// 滚动加载
// 滚动加载
if
(
this
.
selectComponent
(
"#waterfallFlow"
))
{
if
(
this
.
selectComponent
(
"#waterfallFlow"
))
{
this
.
selectComponent
(
"#waterfallFlow"
).
reLoadPro
(
);
this
.
selectComponent
(
"#waterfallFlow"
).
reLoadPro
(
goodsList
);
}
}
}
}
},
0
);
},
},
getSaleTime
(
val
)
{
getSaleTime
(
val
)
{
return
new
Date
(
val
.
replace
(
/-/g
,
"/"
)).
getTime
()
-
new
Date
().
getTime
();
return
new
Date
(
val
.
replace
(
/-/g
,
"/"
)).
getTime
()
-
new
Date
().
getTime
();
...
...
static/nativeComponents/TimeLimitedDiscount/activityListItem/index.wxml
View file @
3bae45c0
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
{{datas.singleItemActivityName}}
{{datas.singleItemActivityName}}
</view>
</view>
<view class="cover">
<view class="cover">
<image
mode="center"
src="{{datas.singleItemActivityCoverImage}}"></image>
<image src="{{datas.singleItemActivityCoverImage}}"></image>
</view>
</view>
<view class="countDown flex" wx:if="{{countDownShow}}">
<view class="countDown flex" wx:if="{{countDownShow}}">
<van-count-down
<van-count-down
...
...
static/nativeComponents/TimeLimitedDiscount/activityListItem/index.wxss
View file @
3bae45c0
.activityListItem {
.activityListItem {
margin-bottom: 20rpx;
padding: 20rpx 0;
padding: 20rpx 0;
background: #fff;
background: #fff;
border-radius: 8rpx;
border-radius: 8rpx;
...
@@ -7,6 +6,7 @@
...
@@ -7,6 +6,7 @@
-moz-border-radius: 8rpx;
-moz-border-radius: 8rpx;
-ms-border-radius: 8rpx;
-ms-border-radius: 8rpx;
-o-border-radius: 8rpx;
-o-border-radius: 8rpx;
margin-bottom: 20rpx;
}
}
.title {
.title {
padding: 8rpx 20rpx;
padding: 8rpx 20rpx;
...
@@ -23,6 +23,7 @@
...
@@ -23,6 +23,7 @@
}
}
.cover image {
.cover image {
width: 100%;
width: 100%;
height: 100%;
}
}
.countDown {
.countDown {
padding: 4rpx 10rpx;
padding: 4rpx 10rpx;
...
...
static/nativeComponents/TimeLimitedDiscount/index.js
View file @
3bae45c0
...
@@ -210,6 +210,7 @@ const componentOptions = {
...
@@ -210,6 +210,7 @@ const componentOptions = {
item
.
endTimeTimeStamp
=
new
Date
(
item
.
endTime
.
replace
(
/-/g
,
"/"
)).
getTime
()
-
new
Date
().
getTime
();
item
.
endTimeTimeStamp
=
new
Date
(
item
.
endTime
.
replace
(
/-/g
,
"/"
)).
getTime
()
-
new
Date
().
getTime
();
item
.
singleItemActivityCoverImage
=
DFSImg
(
item
.
singleItemActivityCoverImage
);
item
.
singleItemActivityCoverImage
=
DFSImg
(
item
.
singleItemActivityCoverImage
);
item
.
isStart
=
new
Date
(
item
.
startTime
.
replace
(
/-/g
,
"/"
)).
getTime
()
>
new
Date
().
getTime
()
?
true
:
false
;
item
.
isStart
=
new
Date
(
item
.
startTime
.
replace
(
/-/g
,
"/"
)).
getTime
()
>
new
Date
().
getTime
()
?
true
:
false
;
console
.
log
(
item
.
isEnd
,
'-----------------------213'
);
})
})
this
.
setData
({
"datas.componentData.actList"
:
list
});
this
.
setData
({
"datas.componentData.actList"
:
list
});
if
(
hideNum
==
actList
.
length
)
{
if
(
hideNum
==
actList
.
length
)
{
...
...
static/nativeComponents/module/WaterfallFlow/index.js
View file @
3bae45c0
...
@@ -54,23 +54,41 @@ Component({
...
@@ -54,23 +54,41 @@ Component({
contentList
:
[],
contentList
:
[],
inj
:
0
,
inj
:
0
,
clientHeight
:
0
,
//窗口高度
clientHeight
:
0
,
//窗口高度
goodsNum
:
0
,
goodsNum
:
0
,
},
},
methods
:
{
methods
:
{
// 初始化数组
// 初始化数组
initList
()
{
initList
(
goodsList
)
{
// 初始化容器
// 初始化容器
let
{
contentList
,
waterfallDeviationHeight
}
=
this
.
data
;
let
{
contentList
,
waterfallDeviationHeight
}
=
this
.
data
;
contentList
[
0
]
=
[];
contentList
[
0
]
=
[];
contentList
[
1
]
=
[];
contentList
[
1
]
=
[];
waterfallDeviationHeight
=
[
0
,
0
];
waterfallDeviationHeight
=
[
0
,
0
];
this
.
setData
({
contentList
,
waterfallDeviationHeight
});
this
.
setData
({
contentList
,
waterfallDeviationHeight
});
console
.
log
(
this
.
data
.
note
,
"-------------------185"
);
this
.
reLoadPro
(
goodsList
);
this
.
reLoadPro
();
},
async
reLoadPro
(
goodsList
)
{
console
.
log
(
goodsList
,
'----------------------75'
)
// this.setHeight(this.data.goodsNum);
this
.
setHeight1
(
this
.
data
.
goodsNum
,
goodsList
);
this
.
setData
({
goodsNum
:
goodsList
.
length
>
0
?
goodsList
.
length
+
1
:
0
});
},
},
async
reLoadPro
()
{
setHeight1
(
i
,
goodsList
)
{
this
.
setHeight
(
this
.
data
.
goodsNum
);
let
itemList
=
goodsList
.
splice
(
i
,
goodsList
.
length
);
this
.
setData
({
goodsNum
:
this
.
data
.
note
.
length
>
0
?
this
.
data
.
note
.
length
+
1
:
0
});
let
{
contentList
}
=
this
.
data
;
itemList
.
forEach
((
item
,
index
)
=>
{
if
(
index
%
2
==
0
)
{
contentList
[
0
].
push
(
item
);
console
.
log
(
item
.
productName
,
"--------位置--左"
);
}
else
{
contentList
[
1
].
push
(
item
);
console
.
log
(
item
.
productName
,
"--------位置--右"
);
}
});
this
.
setData
({
contentList
});
},
},
setHeight
(
i
)
{
setHeight
(
i
)
{
let
_this
=
this
;
let
_this
=
this
;
...
@@ -147,12 +165,13 @@ Component({
...
@@ -147,12 +165,13 @@ Component({
.
select
(
"#waterfallFlow"
)
.
select
(
"#waterfallFlow"
)
.
boundingClientRect
(
function
(
res
)
{
.
boundingClientRect
(
function
(
res
)
{
if
(
res
)
{
if
(
res
)
{
console
.
log
(
el
,
"-------------118"
);
let
scrollTop
=
parseInt
(
el
.
scrollTop
);
console
.
log
(
res
,
"---------------35"
);
let
scrollTop
=
parseInt
(
el
.
target
.
scrollTop
);
let
domHeight
=
parseInt
(
res
.
height
);
let
domHeight
=
parseInt
(
res
.
height
);
// 窗口高度+滚动高度等于 = 元素整体高度 -(预留一段距离加载) 触发父组件查询接口
// 窗口高度+滚动高度等于 = 元素整体高度 -(预留一段距离加载) 触发父组件查询接口
if
(
scrollTop
+
_this
.
data
.
clientHeight
>=
domHeight
-
150
&&
finished
==
false
)
{
if
(
scrollTop
+
_this
.
data
.
clientHeight
>=
domHeight
-
150
&&
finished
==
false
)
{
_this
.
triggerEvent
(
"onLoad"
);
_this
.
triggerEvent
(
"onLoad"
);
}
}
}
}
...
...
static/nativeComponents/module/WaterfallFlow/index.wxss
View file @
3bae45c0
...
@@ -17,3 +17,9 @@ image {
...
@@ -17,3 +17,9 @@ image {
.container-item:nth-child(2n + 2) {
.container-item:nth-child(2n + 2) {
padding-left: var(--proGap);
padding-left: var(--proGap);
}
}
.loadBottom{
text-align: center;
color: #999;
font-size: 24rpx;
margin-top: 10rpx;
}
\ No newline at end of file
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