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
lijing
8 years ago
Commit
e427aa2f6496e0862f5197141ab53b76e15a2919
1 parent
d15d60e5
增加中奖记录
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
125 additions
and
2 deletions
apps/activity/controllers/raffle.js
apps/activity/models/raffle.js
apps/activity/router.js
apps/activity/views/action/raffle/activity.hbs
public/js/activity/raffle.page.js
public/scss/activity/raffle/promotion.page.css
apps/activity/controllers/raffle.js
View file @
e427aa2
...
...
@@ -71,6 +71,21 @@ exports.getOrders = (req, res, next) => {
};
/**
* 获取中奖记录
* @param req
* @param res
* @param next
*/
exports
.
getRecord
=
(
req
,
res
,
next
)
=>
{
raffleModel
.
getRecord
({
pageCount
:
req
.
query
.
pageCount
,
pageId
:
req
.
query
.
pageId
,
}).
then
(
result
=>
{
res
.
json
(
result
);
}).
catch
(
next
);
};
/**
* 入口页
* @param req
* @param res
...
...
apps/activity/models/raffle.js
View file @
e427aa2
...
...
@@ -470,12 +470,27 @@ const bind = (params) => {
},
{
code
:
200
});
};
/**
* 获取中奖记录
* @returns {*}
* @private
* @param params
*/
const
getRecord
=
(
params
)
=>
{
return
service
.
get
(
'/activity/lottery/getLotteryPrizeInfo'
,
{
lotteryId
:
20
,
pageId
:
params
.
pageId
,
pageCount
:
params
.
pageCount
},
{
code
:
200
});
};
module
.
exports
=
{
order
,
getOrders
,
activity
,
lucky
,
bind
bind
,
getRecord
};
...
...
apps/activity/router.js
View file @
e427aa2
...
...
@@ -83,6 +83,7 @@ router.get('/market/v2', market.v2); // 市场推广活动å‡çº§ç‰ˆï¼Œè‡ªå®šä¹‰ä
router
.
get
(
'/raffle/activity'
,
raffle
.
activity
);
// 微信免单抽奖活动
router
.
get
(
'/raffle/orders'
,
auth
,
raffle
.
order
);
// 微信免单抽奖活动订单列表
router
.
get
(
'/raffle/getOrders'
,
raffle
.
getOrders
);
// 微信免单抽奖活动获取订单列表数据
router
.
get
(
'/raffle/getRecord'
,
raffle
.
getRecord
);
// 微信免单抽奖活动获取中奖记录
router
.
get
(
'/raffle/enter'
,
raffle
.
enter
);
// 微信免单抽奖活动入口页
router
.
post
(
'/raffle/lucky'
,
raffle
.
lucky
);
// 微信免单抽奖按钮
router
.
get
(
'/raffle/bind'
,
raffle
.
bind
);
// 送有货币
...
...
apps/activity/views/action/raffle/activity.hbs
View file @
e427aa2
...
...
@@ -12,6 +12,12 @@
<li>
{{
name
}}
:
{{
remark
}}
</li>
{{/
prizes
}}
</ul>
<div
class=
"record"
>
<p>
获奖名单:
</p>
<div
class=
"record-c"
>
<div
class=
"record-list"
></div>
</div>
</div>
<a
class=
"btn"
href=
"./orders"
></a>
<div
class=
"account"
>
{{#
mobile
}}
您已绑定账号:
{{
.
}}{{/
mobile
}}
</div>
<div
class=
"rule-c"
>
...
...
public/js/activity/raffle.page.js
View file @
e427aa2
...
...
@@ -35,7 +35,8 @@ var orderHammer,
reasonSwiper
;
var
userId
=
''
,
orderCode
=
''
;
orderCode
=
''
,
pageId
=
0
;
var
orderContent
=
require
(
'activity/raffle/order-content.hbs'
);
...
...
@@ -401,6 +402,69 @@ $(function() {
$
(
slides
[
activeIndex
]).
css
(
'transform'
,
''
);
}
});
// 中奖记录
if
(
$
(
'.record'
).
length
>
0
)
{
var
pageCount
=
6
;
recordInit
();
goScroll
();
}
// 初始化
function
recordInit
()
{
var
recordResult
=
getRecord
();
var
$recordList
=
recordResult
.
data
.
lotteryPrize
;
var
$recordSpan
=
''
;
for
(
var
i
=
0
;
i
<
$recordList
.
length
;
i
++
)
{
$recordSpan
=
$recordSpan
+
'<span>'
+
$recordList
[
i
].
userName
+
'中了'
+
$recordList
[
i
].
prizeName
+
':'
+
$recordList
[
i
].
prizeRemark
+
'; </span>'
;
}
$
(
'.record-list'
).
append
(
$recordSpan
);
}
// 获取中奖记录
function
getRecord
()
{
pageId
++
;
var
recordResult
=
''
;
$
.
ajax
({
type
:
'GET'
,
url
:
'/activity/raffle/getRecord'
,
data
:
{
pageId
:
pageId
,
pageCount
:
pageCount
},
async
:
false
,
success
:
function
(
res
)
{
if
(
res
.
code
===
200
)
{
if
(
res
.
data
.
lotteryPrize
.
length
<
pageCount
)
{
pageId
=
0
;
}
recordResult
=
res
;
}
else
{
tip
.
show
(
'网络断开了~~'
);
}
},
error
:
function
(
res
)
{
tip
.
show
(
'网络断开了~~'
);
}
});
return
recordResult
;
}
// 滚动
function
goScroll
()
{
var
$firstSpan
=
$
(
'.record-list span:first'
);
var
$recordList
=
$
(
'.record-list'
);
$recordList
.
animate
({
marginLeft
:
'-'
+
$firstSpan
.
width
()
+
'px'
},
10000
,
'linear'
,
function
()
{
$firstSpan
.
remove
();
$recordList
.
css
(
'margin-left'
,
'0'
);
if
(
$recordList
.
find
(
'span'
).
length
<
5
)
{
recordInit
();
}
goScroll
();
}
);
}
});
$reaMask
.
find
(
'.box-cmp'
).
on
(
'touchend'
,
function
(
e
)
{
...
...
public/scss/activity/raffle/promotion.page.css
View file @
e427aa2
...
...
@@ -7,6 +7,28 @@
background-size
:
100%
auto
;
background-repeat
:
no-repeat
;
.record
{
color
:
#fff
;
font-size
:
25px
;
margin-top
:
30px
;
p
{
text-align
:
center
;
}
.record-c
{
width
:
600px
;
margin
:
0
auto
;
overflow
:
hidden
;
height
:
40px
;
line-height
:
40px
;
}
.record-list
{
width
:
2000px
;
}
}
.logo
{
width
:
263px
;
height
:
53px
;
...
...
Please
register
or
login
to post a comment