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
Email Patches
Plain Diff
Browse Files
Authored by
陈轩
8 years ago
Commit
ac68eef56236709d1bcb80db3d95b2b2aa88468b
1 parent
6fe0aa69
秒杀列表 页面初始化数据接口分离
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
17 deletions
apps/product/controllers/seckill.js
apps/product/router.js
public/js/product/seckill.page.js
apps/product/controllers/seckill.js
View file @
ac68eef
...
...
@@ -12,6 +12,11 @@ const mRoot = '../models';
const
headerModel
=
require
(
'../../../doraemon/models/header'
);
const
seckillModel
=
require
(
`
$
{
mRoot
}
/seckill`
)
;
let
headerData
=
headerModel
.
setNav
({
navTitle
:
'秒杀活动'
,
navBtn
:
true
,
});
/**
* [时间缺0补0]
*/
...
...
@@ -105,23 +110,21 @@ function fetchProductList(activityInfo, uid) {
/**
* [秒杀列表页面]
*/
const
index
=
(
req
,
res
,
next
)
=>
{
let
focusTime
=
Number
.
parseInt
(
req
.
query
.
time
,
10
)
||
0
;
let
headerData
=
headerModel
.
setNav
({
navTitle
:
'秒杀活动'
,
navBtn
:
true
,
const
index
=
(
req
,
res
)
=>
{
return
res
.
render
(
'seckill'
,
{
title
:
'秒杀活动'
,
pageHeader
:
headerData
,
pageStyle
:
'seckill-page'
,
pageFooter
:
true
,
width750
:
true
,
});
};
if
(
!
req
.
xhr
)
{
return
res
.
render
(
'seckill'
,
{
title
:
'秒杀活动'
,
pageHeader
:
headerData
,
pageStyle
:
'seckill-page'
,
pageFooter
:
true
,
width750
:
true
,
});
}
/**
* [秒杀列表 页面 初始数据]
*/
const
indexData
=
(
req
,
res
,
next
)
=>
{
let
focusTime
=
Number
.
parseInt
(
req
.
query
.
time
,
10
)
||
0
;
let
result
=
{};
let
uid
=
req
.
yoho
.
isApp
&&
req
.
query
.
uid
;
...
...
@@ -227,6 +230,7 @@ const index = (req, res, next) => {
res
.
json
(
result
);
});
});
};
/**
...
...
@@ -332,6 +336,7 @@ const checkAppVer = function(okVersion) {
module
.
exports
=
{
index
,
indexData
,
getProductList
,
remind
,
checkAppVer
...
...
apps/product/router.js
View file @
ac68eef
...
...
@@ -95,6 +95,7 @@ router.get('/recommend-for-you/cart', recommendForYou.cart);
router
.
get
(
'/seckill'
,
seckill
.
checkAppVer
(
'5.1.0'
),
seckill
.
index
);
// 秒杀列表页
router
.
get
(
'/seckill/list'
,
seckill
.
indexData
);
router
.
post
(
'/seckill/remind'
,
seckill
.
remind
);
// only app; 秒杀提醒
router
.
get
(
'/seckill/get-product-list'
,
seckill
.
getProductList
);
// 秒杀列表根据活动id获取商品列表
...
...
public/js/product/seckill.page.js
View file @
ac68eef
...
...
@@ -394,11 +394,16 @@ seckillObj = {
pageLoad
:
function
(
callback
)
{
var
self
=
this
;
var
$xhr
;
var
data
=
{};
loading
.
show
();
window
.
queryString
.
time
&&
(
data
.
time
=
window
.
queryString
.
time
);
yoho
.
isApp
&&
(
data
.
uid
=
window
.
queryString
.
uid
);
$xhr
=
$
.
ajax
({
url
:
location
.
href
,
cache
:
false
url
:
'/product/seckill/list'
,
data
:
data
})
.
done
(
function
(
result
)
{
self
.
$container
.
replaceWith
(
...
...
Please
register
or
login
to post a comment