Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohobuy-node
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
1
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Plain Diff
Browse Files
Authored by
htoooth
8 years ago
Commit
758aec0a8bc9dd6a233a7967d69f1daa73acd341
2 parents
fe6aec75
850e8a46
Merge branch 'release/5.3.1' into feature/new-product-detail
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
52 additions
and
31 deletions
apps/product/models/favorite-brand-service.js
apps/product/views/action/product/detail.hbs
apps/product/views/partial/product/num.hbs
public/js/plugins/lazy-load.js
public/js/product/detail.page.js
public/js/product/detail/brand-fav.js
public/scss/product/_detail.css
apps/product/models/favorite-brand-service.js
View file @
758aec0
...
...
@@ -24,7 +24,7 @@ const getShopFavNumAsync = (sid) => {
return
{
code
:
200
,
data
:
{
count
:
_
.
get
(
result
,
'data.count'
)
count
:
_
.
get
(
result
,
'data
[0]
.count'
)
}
};
}
else
{
...
...
apps/product/views/action/product/detail.hbs
View file @
758aec0
...
...
@@ -473,11 +473,11 @@
<div
class=
"shoppingCar-nav"
>
<ul>
<li><a
href=
"#goodsMessage"
class=
"fixed option"
>
●
商品信息
</a></li>
<li><a
href=
"#sizeTitle"
class=
"option"
>
●
尺码信息
</a></li>
<li><a
href=
"#goodsTitle"
class=
"option"
>
●
商品详情
</a></li>
<li><a
href=
"#judgeTitle"
class=
"option comment"
>
●
商品评价
</a></li>
<li><a
href=
"#goodsAskTitle"
class=
"option consult"
>
●
商品咨询
</a></li>
<li><a
data-el=
"#goodsMessage"
href=
"javascript:;"
class=
"fixed option"
>
●
商品信息
</a></li>
<li><a
data-el=
"#sizeTitle"
href=
"javascript:;"
class=
"option"
>
●
尺码信息
</a></li>
<li><a
data-el=
"#goodsTitle"
href=
"javascript:;"
class=
"option"
>
●
商品详情
</a></li>
<li><a
data-el=
"#judgeTitle"
href=
"javascript:;"
class=
"option comment"
>
●
商品评价
</a></li>
<li><a
data-el=
"#goodsAskTitle"
href=
"javascript:;"
class=
"option consult"
>
●
商品咨询
</a></li>
</ul>
</div>
</div>
...
...
apps/product/views/partial/product/num.hbs
View file @
758aec0
...
...
@@ -9,7 +9,8 @@
</span>
<span
class=
"bundle
{{#
if_cond
bundle
.
type
"!="
2
}}
hide
{{/
if_cond
}}
"
>
{{
bundle
.
count
}}
件起购
{{
bundle
.
count
}}
件起购享
{{
bundle
.
discount
}}
折优惠
</span>
<span
class=
"few-sold hide"
>
...
...
public/js/plugins/lazy-load.js
View file @
758aec0
...
...
@@ -183,9 +183,10 @@ function dataLazyLoad(doc) {
this
.
fn
();
var
_this
=
this
;
Util
.
addEvent
(
window
,
"scroll"
,
$
.
throttle
(
500
,
true
,
_this
.
fn
));
Util
.
addEvent
(
window
,
"resize"
,
$
.
throttle
(
500
,
true
,
_this
.
fn
));
Util
.
addEvent
(
doc
.
body
,
"touchMove"
,
$
.
throttle
(
500
,
true
,
_this
.
fn
));
Util
.
addEvent
(
window
,
"scroll"
,
_this
.
fn
);
Util
.
addEvent
(
window
,
"resize"
,
_this
.
fn
);
Util
.
addEvent
(
doc
.
body
,
"touchMove"
,
_this
.
fn
);
return
this
;
}
};
}
...
...
public/js/product/detail.page.js
View file @
758aec0
...
...
@@ -1101,6 +1101,7 @@ function loadComment() {
commentPage
[
type
]
=
commentPage
[
type
]
||
1
;
loadingComments
=
true
;
return
$
.
ajax
({
type
:
'GET'
,
url
:
'/product/detail/comment'
,
...
...
@@ -1115,7 +1116,7 @@ function loadComment() {
// 购买评价
function
loadAllComments
(
type
,
nowPage
)
{
loadComments
(
type
,
nowPage
).
then
(
function
(
data
)
{
return
loadComments
(
type
,
nowPage
).
then
(
function
(
data
)
{
var
res
,
filter
,
$ul
,
totalnum
=
0
,
baseUrl
;
if
(
data
.
code
===
200
)
{
...
...
@@ -1203,7 +1204,7 @@ function loadComment() {
}
});
loadAllComments
(
currentType
);
return
loadAllComments
(
currentType
);
}
// 购买评价的相关事件
...
...
@@ -1265,7 +1266,7 @@ function loadConsult() {
loadingConsults
=
true
;
$
.
ajax
({
return
$
.
ajax
({
type
:
'GET'
,
url
:
'/product/detail/consult'
,
data
:
{
...
...
@@ -1426,7 +1427,7 @@ function loadConsult() {
});
});
loadConsults
(
1
);
return
loadConsults
(
1
);
}
window
.
fetchConsult
=
window
.
once
(
loadConsult
);
...
...
@@ -1465,7 +1466,7 @@ function initPageYas() {
// 店铺推荐
function
loadRecommend
()
{
$
.
ajax
({
return
$
.
ajax
({
type
:
'GET'
,
url
:
'/product/detail/recommend'
,
data
:
{
...
...
@@ -1769,6 +1770,19 @@ function loadReturn() {
window
.
fetchReturn
=
window
.
once
(
loadReturn
);
function
_scrollTo
(
$ele
)
{
var
top
=
0
;
if
(
$ele
)
{
top
=
$ele
.
offset
().
top
-
20
;
}
$
(
'html,body'
).
animate
({
scrollTop
:
top
},
500
);
}
// 首屏加载后,对比数据是否变化,如果变化,重新渲染,重新绑定事件
bindEvent
.
fire
();
...
...
@@ -1796,6 +1810,10 @@ bindEvent.fire();
favorite
.
statusFav
(
shopId
,
brandId
).
then
(
function
()
{
$
(
'#brand-favour'
).
addClass
(
'coled'
);
});
// 数据懒加载
var
dataLoad
=
dataLazyLoad
.
init
({
cls
:
'.datalazyload'
,
threshold
:
0
});
//eslint-disable-line
dataLoad
.
fn
&&
dataLoad
.
fn
();
}());
$
(
window
).
scroll
(
function
()
{
...
...
@@ -1840,6 +1858,8 @@ $(window).scroll(function() {
});
$
(
'.shoppingCar'
).
on
(
'click'
,
'.option'
,
function
(
e
)
{
e
.
stopPropagation
();
var
$this
=
$
(
this
);
if
(
$this
.
hasClass
(
'fixed'
))
{
...
...
@@ -1849,15 +1869,15 @@ $('.shoppingCar').on('click', '.option', function(e) {
$this
.
closest
(
'li'
).
siblings
().
find
(
'.option'
).
removeClass
(
'fixed'
);
$this
.
addClass
(
'fixed'
);
if
(
$this
.
hasClass
(
'comment'
))
{
window
.
fetchComment
();
window
.
fetchRecommend
();
}
else
if
(
$this
.
hasClass
(
'consult'
))
{
window
.
fetchConsult
();
window
.
fetchRecommend
();
if
(
$this
.
hasClass
(
'comment'
)
||
$this
.
hasClass
(
'consult'
))
{
$
.
when
(
window
.
fetchComment
(),
window
.
fetchConsult
(),
window
.
fetchRecommend
()).
always
(
function
()
{
_scrollTo
(
$
(
$this
.
data
(
'el'
)));
});
return
;
}
e
.
stopPropagation
(
);
_scrollTo
(
$
(
$this
.
data
(
'el'
))
);
});
$
(
'.shoppingCar-btn'
).
on
(
'click'
,
function
()
{
...
...
@@ -1873,9 +1893,8 @@ $('.shoppingCar-btn').on('click', function() {
}
var
$addToCart
=
$
(
'#add-to-cart'
);
var
sc
=
$
(
document
);
sc
.
scrollTop
(
200
);
_scrollTo
(
);
if
(
maxStock
===
-
1
)
{
$
(
'#sizes'
).
children
(
'.size-warn'
).
removeClass
(
'hide'
);
...
...
@@ -1911,5 +1930,4 @@ $(function() {
yasAtBottom
.
yasBottom
();
// 数据懒加载
dataLazyLoad
.
init
({
cls
:
'.datalazyload'
,
threshold
:
0
});
...
...
public/js/product/detail/brand-fav.js
View file @
758aec0
...
...
@@ -18,7 +18,7 @@ exports.addFav = function(sid, bid) {
if
(
sid
)
{
return
$
.
post
(
'/product/shop/togglecollect'
,
{
isFavorite
:
0
,
isFavorite
:
1
,
shopId
:
sid
}).
then
(
function
(
result
)
{
if
(
result
.
code
===
200
)
{
...
...
@@ -54,7 +54,7 @@ exports.cancelFav = function(sid, bid) {
if
(
sid
)
{
return
$
.
post
(
'/product/shop/togglecollect'
,
{
isFavorite
:
1
,
isFavorite
:
0
,
shopId
:
sid
}).
then
(
function
(
result
)
{
if
(
result
.
code
===
200
)
{
...
...
@@ -89,7 +89,7 @@ exports.statusFav = function(sid, bid) {
return
$
.
post
(
'/product/index/isFavoriteShop'
,
{
shopId
:
sid
}).
then
(
function
(
result
)
{
if
(
result
.
code
===
200
)
{
if
(
result
.
code
===
200
&&
result
.
data
)
{
return
$
.
Deferred
().
resolve
().
promise
();
//eslint-disable-line
}
else
{
return
$
.
Deferred
().
reject
().
promise
();
//eslint-disable-line
...
...
@@ -109,6 +109,6 @@ exports.statusFav = function(sid, bid) {
});
}
return
$
.
Deferred
().
reject
().
promise
();
return
$
.
Deferred
().
reject
().
promise
();
//eslint-disable-line
};
...
...
public/scss/product/_detail.css
View file @
758aec0
...
...
@@ -816,9 +816,10 @@
.share-row
{
margin-top
:
20px
;
height
:
16px
;
.title
{
line-height
:
16px
!important
;
}
}
...
...
Please
register
or
login
to post a comment