Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohobuywap-node
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Plain Diff
Browse Files
Authored by
ccbikai(👎🏻🍜)
8 years ago
Commit
a3cd93fe0bf3f49afa5928b801a6432a05727953
2 parents
3bb5eae9
97c4bc2c
Merge branch 'grey'
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
43 additions
and
61 deletions
apps/guang/controllers/plusstar.js
apps/guang/models/plusstar.js
apps/guang/views/action/plusstar/resources-goodsList.hbs
package.json
public/js/guang/plusstar-index.page.js
apps/guang/controllers/plusstar.js
View file @
a3cd93f
...
...
@@ -85,10 +85,7 @@ exports.resourcesGoodsList = (req, res, next) => {
let
param
=
{};
param
=
{
productSkn
:
productSkn
.
split
(
','
),
yh_channel
:
req
.
body
.
yh_channel
,
page
:
req
.
body
.
page
,
limit
:
req
.
body
.
limit
productSkn
:
productSkn
.
split
(
','
)
};
plusstarModel
.
getProductBatch
(
param
,
{
...
...
apps/guang/models/plusstar.js
View file @
a3cd93f
...
...
@@ -49,10 +49,7 @@ const getProductBatch = (param, options) => {
param
.
productSkn
=
_
.
isArray
(
param
.
productSkn
)
?
param
.
productSkn
:
[
param
.
productSkn
];
return
api
.
get
(
''
,
{
method
:
'h5.product.batch'
,
productSkn
:
param
.
productSkn
.
join
(
','
),
yh_channel
:
param
.
yh_channel
,
page
:
param
.
page
,
limit
:
param
.
limit
productSkn
:
param
.
productSkn
.
join
(
','
)
}).
then
(
result
=>
{
let
data
=
{};
...
...
@@ -178,7 +175,7 @@ const getResourcesData = (params, options) => {
let
preferSkns
=
result
[
1
]
&&
result
[
1
].
data
||
[];
if
(
result
[
0
]
&&
result
[
0
].
goods
&&
result
[
0
].
goods
.
productSkns
)
{
result
[
0
].
goods
.
productSkns
=
_
.
uniq
(
Object
.
assign
(
skns
,
preferSkns
));
result
[
0
].
goods
.
productSkns
=
_
.
uniq
(
skns
.
concat
(
preferSkns
));
}
return
result
[
0
];
...
...
apps/guang/views/action/plusstar/resources-goodsList.hbs
View file @
a3cd93f
{{#if
result
.
product_list
}}
<input
type=
'hidden'
value=
'
{{
result
.
page_total
}}
'
class=
'page-total'
/>
{{/if}}
{{#
each
result
.
product_list
}}
{{>
common
/
goods
}}
{{/
each
}}
\ No newline at end of file
...
...
package.json
View file @
a3cd93f
{
"name"
:
"m-yohobuy-node"
,
"version"
:
"5.1.
0
"
,
"version"
:
"5.1.
1
"
,
"private"
:
true
,
"description"
:
"A New Yohobuy Project With Express"
,
"repository"
:
{
...
...
public/js/guang/plusstar-index.page.js
View file @
a3cd93f
...
...
@@ -37,17 +37,15 @@ plusstar = {
$tabUlDom
=
$
(
'.plusstar-page .tab-nav ul'
);
// 重置tab code位置
if
(
window
.
localStorage
)
{
$tabUlDom
.
find
(
'li'
).
each
(
function
()
{
localStorage
.
setItem
(
$
(
this
).
data
(
'code'
),
0
);
});
}
$tabUlDom
.
find
(
'li'
).
css
({
width
:
100
/
$tabUlDom
.
find
(
'li'
).
length
+
'%'
});
$tabUlDom
.
find
(
'li'
).
each
(
function
()
{
// 重新进入滑动位置清除
window
.
setCookie
(
$
(
this
).
data
(
'code'
),
0
);
});
// 事情委托机制
$tabUlDom
.
bind
(
'click'
,
function
(
event
)
{
$liDom
=
$
(
event
.
target
).
closest
(
'li'
);
...
...
@@ -65,16 +63,16 @@ plusstar = {
if
(
window
.
_yas
&&
window
.
_yas
.
sendCustomInfo
)
{
window
.
_yas
.
sendCustomInfo
({
op
:
'YB_FASHION_TAB_C'
,
param
:
JSON
.
stringify
(
$
.
extend
(
speckParamApp
,
{
param
:
JSON
.
stringify
(
$
.
extend
({
TAB_ID
:
$liDom
.
index
()
+
1
}))
}
,
speckParamApp
))
},
true
);
window
.
_yas
.
sendCustomInfo
({
op
:
'YB_FASHION_HOME_L'
,
param
:
JSON
.
stringify
(
$
.
extend
(
speckParamApp
,
{
param
:
JSON
.
stringify
(
$
.
extend
({
TAB_ID
:
that
.
ParentLiDom
.
index
()
+
1
}))
}
,
speckParamApp
))
},
true
);
}
});
...
...
@@ -87,10 +85,10 @@ plusstar = {
}
$tabUlDom
.
find
(
'li'
).
removeClass
(
'focus'
);
$liDom
.
addClass
(
'focus'
);
that
.
ParentLiDom
=
$liDom
;
// 保留当前tab先中的对象
that
.
tabNav
(
$liDom
.
data
(
'code'
));
// ent -- 默认选中
that
.
ParentLiDom
=
$liDom
;
// 保留当前tab先中的对象
setTimeout
(
function
()
{
that
.
_yas
();
},
1000
);
...
...
@@ -111,28 +109,28 @@ plusstar = {
// 商品单击埋点
$dom
=
$
(
event
.
target
).
closest
(
'.good-info'
);
index
=
$dom
.
index
()
+
1
;
window
.
givePoint
(
$
.
extend
(
speckParamApp
,
{
window
.
givePoint
(
$
.
extend
({
REC_POSE
:
RECPOSE
,
PRD_ID
:
$dom
.
data
(
'good-id'
),
ORDER_CODE
:
''
,
PRD_NUM
:
index
%
that
.
common
.
pagesize
===
0
?
that
.
common
.
pagesize
:
index
%
that
.
common
.
pagesize
,
ACTION_ID
:
1
,
page_num
:
Math
.
ceil
(
index
/
that
.
common
.
pagesize
)
}));
}
,
speckParamApp
));
}
else
if
(
$
(
event
.
target
).
closest
(
'.banner-top'
).
length
>
0
)
{
// 头部banner楼层埋点
$dom
=
$
(
event
.
target
).
closest
(
'li'
);
index
=
$dom
.
index
()
+
1
;
window
.
_yas
.
sendCustomInfo
({
op
:
'YB_FASHION_FLR_C'
,
param
:
JSON
.
stringify
(
$
.
extend
(
speckParamApp
,
{
param
:
JSON
.
stringify
(
$
.
extend
({
TAB_ID
:
that
.
ParentLiDom
.
index
()
+
1
,
F_ID
:
$dom
.
closest
(
'ul'
).
data
(
'id'
),
F_NAME
:
'焦点图'
,
F_URL
:
$dom
.
find
(
'a'
).
attr
(
'href'
),
F_INDEX
:
1
,
I_INDEX
:
index
%
2
+
1
// banner,li是双倍的
}))
}
,
speckParamApp
))
},
true
);
}
else
if
(
$
(
event
.
target
).
closest
(
'.speck-title-image a'
).
length
>
0
)
{
// 各楼层埋点
...
...
@@ -141,14 +139,14 @@ plusstar = {
window
.
_yas
.
sendCustomInfo
({
op
:
'YB_FASHION_FLR_C'
,
param
:
JSON
.
stringify
(
$
.
extend
(
speckParamApp
,
{
param
:
JSON
.
stringify
(
$
.
extend
({
TAB_ID
:
that
.
ParentLiDom
.
index
()
+
1
,
F_ID
:
$dom
.
data
(
'fid'
),
F_NAME
:
$dom
.
data
(
'name'
),
F_URL
:
$domA
.
attr
(
'href'
),
F_INDEX
:
$dom
.
index
()
+
1
,
I_INDEX
:
$domA
.
hasClass
(
'more'
)
?
0
:
(
$domA
.
index
()
+
1
)
}))
}
,
speckParamApp
))
},
true
);
}
});
...
...
@@ -156,9 +154,9 @@ plusstar = {
// 潮流优选首页加载时
window
.
_yas
.
sendCustomInfo
({
op
:
'YB_FASHION_HOME_L'
,
param
:
JSON
.
stringify
(
$
.
extend
(
speckParamApp
,
{
param
:
JSON
.
stringify
(
$
.
extend
({
TAB_ID
:
that
.
ParentLiDom
.
index
()
+
1
}))
}
,
speckParamApp
))
},
true
);
},
tabNav
:
function
(
code
)
{
...
...
@@ -166,14 +164,16 @@ plusstar = {
this
.
common
.
codeDefault
=
code
;
// 记住最后一次的tab code
this
.
common
.
page
=
1
;
// 商品列表从第一页开始
searching
=
false
;
searching
=
false
;
//初始化翻页
$
.
ajax
({
type
:
'GET'
,
url
:
'/guang/plusstar/resources-template'
,
data
:
{
code
:
code
,
app_version
:
isApp
uid
:
window
.
queryString
.
uid
,
app_version
:
isApp
,
yh_channel
:
that
.
ParentLiDom
.
index
()
+
1
},
dataType
:
'html'
,
success
:
function
(
data
)
{
...
...
@@ -186,20 +186,19 @@ plusstar = {
return
true
;
}
// 记录切换tab位置
$
(
document
).
scrollTop
(
window
.
cookie
(
code
)
||
0
);
that
.
resInit
();
$
(
'.plusstar-resources'
).
find
(
'img.lazy'
).
lazyload
();
// 设置滚动条的位置
if
(
window
.
localStorage
)
{
$
(
document
).
scrollTop
(
localStorage
.
getItem
(
code
)
||
0
);
}
productSkns
=
$
(
data
).
find
(
'.product-skns'
).
val
();
if
(
productSkns
)
{
that
.
common
.
productSkns
=
productSkns
.
split
(
','
);
}
that
.
common
.
pageTotal
=
Math
.
ceil
(
that
.
common
.
productSkns
.
length
/
that
.
common
.
pagesize
);
},
error
:
function
()
{
tip
.
show
(
'网络断开连接了~'
);
...
...
@@ -226,9 +225,8 @@ plusstar = {
skn
=
[];
if
(
searching
)
{
return
true
;
return
;
}
searching
=
true
;
if
(
that
.
common
.
page
>
that
.
common
.
pageTotal
)
{
...
...
@@ -236,44 +234,38 @@ plusstar = {
}
loading
.
showLoadingMask
();
skn
=
that
.
common
.
productSkns
.
slice
((
that
.
common
.
page
-
1
)
*
that
.
common
.
pagesize
,
that
.
common
.
page
*
that
.
common
.
pagesize
);
$
.
ajax
({
type
:
'POST'
,
url
:
'/guang/plusstar/resources-goodsList'
,
timeout
:
5000
,
data
:
{
productSkn
:
that
.
common
.
productSkns
.
join
(
','
),
app_version
:
isApp
,
limit
:
that
.
common
.
pagesize
,
page
:
that
.
common
.
page
,
yh_channel
:
that
.
ParentLiDom
.
index
()
+
1
productSkn
:
skn
.
join
(
','
),
app_version
:
isApp
},
dataType
:
'html'
,
success
:
function
(
data
)
{
skn
=
[];
searching
=
false
;
loading
.
hideLoadingMask
();
searching
=
false
;
that
.
common
.
page
++
;
if
(
data
===
''
)
{
return
true
;
}
if
(
that
.
common
.
page
<=
1
)
{
that
.
common
.
pageTotal
=
$
(
data
).
siblings
(
'.page-total'
).
val
();
}
$
.
each
(
$
(
data
).
siblings
(
'.good-info'
),
function
()
{
skn
.
push
(
$
(
this
).
data
(
'good-id'
));
});
window
.
givePoint
(
$
.
extend
(
speckParamApp
,
{
window
.
givePoint
(
$
.
extend
({
REC_POSE
:
RECPOSE
,
PRD_ID
:
skn
.
join
(
','
),
ORDER_CODE
:
''
,
PRD_NUM
:
that
.
common
.
pagesize
,
ACTION_ID
:
0
,
page_num
:
that
.
common
.
page
++
}));
page_num
:
that
.
common
.
page
-
1
},
speckParamApp
));
$
(
'.plusstar-resources .goods'
).
append
(
data
);
...
...
@@ -292,15 +284,14 @@ plusstar = {
scrollFn
=
debounce
(
function
()
{
scrollTop
=
$
(
document
).
scrollTop
();
// 保留滑动位置,产品要求
window
.
setCookie
(
plusstar
.
common
.
codeDefault
,
$
(
this
).
scrollTop
());
// 当scroll到最后一列商品的高度后继续请求下一页数据
if
(
400
+
scrollTop
>=
$
(
document
).
height
()
-
windowHeight
)
{
plusstar
.
goodsList
();
}
if
(
window
.
localStorage
)
{
localStorage
.
setItem
(
plusstar
.
common
.
codeDefault
,
$
(
this
).
scrollTop
());
}
},
200
);
$
(
function
()
{
...
...
Please
register
or
login
to post a comment