Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHOBUYPC
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
2
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
xuqi
9 years ago
Commit
00fe20ba21bb07a6bf8a7f1e367ea4d322785901
1 parent
c851ca6d
latest walk with jsonp.Review by:@xuqi
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
76 additions
and
54 deletions
template/www.yohobuy.com/partials/product/latest-walk.phtml
web-static/js/product/latest-walk.js
web-static/js/product/list.js
yohobuy/www.yohobuy.com/application/modules/Product/controllers/Index1.php
template/www.yohobuy.com/partials/product/latest-walk.phtml
View file @
00fe20b
{
{#if
latestWalk
}
}
<input
id=
"latest-walk-count"
type=
"hidden"
value=
"{{latestWalk}}"
>
<div
class=
"latest-walk"
>
<h
2
>最近浏览的商品</h
2
>
<div
class=
"goods clearfix"
>
{
{#
latestWalk
}
}
<div
class=
"good"
>
<a
href=
"{{href}}"
>
<img
class=
"lazy"
data-original=
"{{img}}"
>
</a>
<a
class=
"name"
href=
"{{href}}"
>
{
{name
}
}</a>
<p
class=
"price"
>
{
{#if
salePrice
}
}
<span
class=
"market-price"
>¥
{
{marketPrice
}
}</span>
{
{/if
}
}
<span
class=
"sale-price"
>¥
{
{salePrice
}
}</span>
</p>
</div>
{
{/
latestWalk
}
}
</div>
<div
id=
"latest-walk-goods"
class=
"goods clearfix"
></div>
</div>
<script
id=
"latest-walk-tpl"
type=
"text/html"
>
\
{
{#
latestWalk
}
}
<div
class=
"good"
>
<a
href=
"\{{href}}"
>
<img
class=
"lazy"
data-original=
"\{{img}}"
>
</a>
<a
class=
"name"
href=
"\{{href}}"
>\
{
{name
}
}</a>
<p
class=
"price"
>
<span
class=
"market-price"
>\
{
{marketPrice
}
}</span>
<span
class=
"sale-price"
>\
{
{salePrice
}
}</span>
</p>
</div>
\
{
{/
latestWalk
}
}
</script>
{
{/if
}
}
\ No newline at end of file
...
...
web-static/js/product/latest-walk.js
0 → 100644
View file @
00fe20b
/**
* 最近浏览取接口渲染模板
* @author: xuqi<qi.xu@yoho.cn>
8 @date: 2016/1/20
*/
var
$
=
require
(
'yoho.jquery'
);
var
Handlebars
=
require
(
'yoho.handlebars'
);
var
lazyLoad
=
require
(
'yoho.lazyload'
);
var
$latestWalkCount
=
$
(
'#latest-walk-count'
);
(
function
()
{
var
tpl
;
if
(
$latestWalkCount
.
lenght
<
0
)
{
return
;
}
tpl
=
Handlebars
.
compile
(
$
(
'#latest-walk-tpl'
).
html
());
$
.
ajax
({
url
:
'http://itemapi.yohobuy.com/item/item/recentreview'
,
dataType
:
'jsonp'
,
data
:
{
limit
:
$latestWalkCount
.
val
()
},
success
:
function
(
data
)
{
var
latestWalk
=
[],
res
,
i
,
cur
;
if
(
data
.
code
===
200
)
{
res
=
data
.
data
;
for
(
i
=
0
;
i
<
res
.
length
;
i
++
)
{
cur
=
res
[
i
];
latestWalk
.
push
({
href
:
cur
.
url
,
img
:
cur
.
pic_url
,
name
:
cur
.
product_name
,
salePrice
:
cur
.
price
,
marketPrice
:
cur
.
market_price
});
}
if
(
latestWalk
.
length
>
0
)
{
$
(
'#latest-walk-goods'
).
html
(
tpl
({
latestWalk
:
latestWalk
}));
lazyLoad
(
$
(
'#latest-walk-goods .lazy'
));
}
}
}
});
}());
\ No newline at end of file
...
...
web-static/js/product/list.js
View file @
00fe20b
...
...
@@ -8,4 +8,6 @@ require('./filter');
require
(
'./sort-pager'
);
require
(
'./latest-walk'
);
require
(
'./product'
);
\ No newline at end of file
...
...
yohobuy/www.yohobuy.com/application/modules/Product/controllers/Index1.php
View file @
00fe20b
...
...
@@ -958,44 +958,7 @@ class Index1Controller extends AbstractAction
),
'totalCount'
=>
'2259'
,
'pager'
=>
'<a href="" class="cur"><span>1</span></a><a href=""><span>2</span></a><a href="" title="下一页">下一页<span class="iconfont">></span></a>'
,
'latestWalk'
=>
array
(
array
(
'img'
=>
'http://img11.static.yhbimg.com/goodsimg/2015/08/24/11/018fd5cbe604b37ea35336257fcbff8114.jpg?imageMogr2/thumbnail/195x260/extent/195x260/background/d2hpdGU=/position/center/quality/90'
,
'name'
=>
'Life·After Life 牛角扣夹棉连帽大衣(M51款)【吴亦凡亲身试着】'
,
'marketPrice'
=>
'939'
,
'salePrice'
=>
'679'
),
array
(
'img'
=>
'http://img10.static.yhbimg.com/goodsimg/2014/11/05/08/0110a09053658b079265a553ee20a5779d.jpg?imageMogr2/thumbnail/195x260/extent/195x260/background/d2hpdGU=/position/center/quality/90'
,
'name'
=>
'th:字母撞色毛衣'
,
'marketPrice'
=>
'698'
,
'salePrice'
=>
'209'
),
array
(
'img'
=>
'http://img10.static.yhbimg.com/goodsimg/2014/11/05/08/0110a09053658b079265a553ee20a5779d.jpg?imageMogr2/thumbnail/195x260/extent/195x260/background/d2hpdGU=/position/center/quality/90'
,
'name'
=>
'th:字母撞色毛衣'
,
'marketPrice'
=>
'698'
,
'salePrice'
=>
'209'
),
array
(
'img'
=>
'http://img10.static.yhbimg.com/goodsimg/2014/11/05/08/0110a09053658b079265a553ee20a5779d.jpg?imageMogr2/thumbnail/195x260/extent/195x260/background/d2hpdGU=/position/center/quality/90'
,
'name'
=>
'th:字母撞色毛衣'
,
'marketPrice'
=>
'698'
,
'salePrice'
=>
'209'
),
array
(
'img'
=>
'http://img10.static.yhbimg.com/goodsimg/2014/11/05/08/0110a09053658b079265a553ee20a5779d.jpg?imageMogr2/thumbnail/195x260/extent/195x260/background/d2hpdGU=/position/center/quality/90'
,
'name'
=>
'th:字母撞色毛衣'
,
'marketPrice'
=>
'698'
,
'salePrice'
=>
'209'
),
array
(
'img'
=>
'http://img10.static.yhbimg.com/goodsimg/2014/11/05/08/0110a09053658b079265a553ee20a5779d.jpg?imageMogr2/thumbnail/195x260/extent/195x260/background/d2hpdGU=/position/center/quality/90'
,
'name'
=>
'th:字母撞色毛衣'
,
'marketPrice'
=>
'698'
,
'salePrice'
=>
'209'
)
)
'latestWalk'
=>
6
)
);
$this
->
_view
->
display
(
'list'
,
$data
);
...
...
Please
register
or
login
to post a comment