Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
SURPRISED
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
华国豪
SURPRISED
Commits
cde87b7b
Commit
cde87b7b
authored
Nov 15, 2019
by
华国豪
🙄
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://gitlab.oytour.com/huaguohao/surprised
parents
9229e081
90e8345c
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
361 additions
and
161 deletions
+361
-161
GT_activities.html
html/GT_activities.html
+329
-140
jquery.dataStatistics.js
js/jquery.dataStatistics.js
+32
-21
No files found.
html/GT_activities.html
View file @
cde87b7b
This diff is collapsed.
Click to expand it.
js/jquery.dataStatistics.js
View file @
cde87b7b
...
...
@@ -9,6 +9,9 @@ $.fn.dataStatistics = function(options) {
platform
:
'app'
,
count
:
0
,
login
:
true
,
activityStartDate
:
0
,
activityEndDate
:
0
,
nowDate
:
0
},
options
||
{});
var
ths
=
this
;
//解决this指向问题
...
...
@@ -60,6 +63,7 @@ $.fn.dataStatistics = function(options) {
var
difference
=
0
;
//执行次数
var
nownumber
=
options
.
min
;
//优惠券数量
var
Activityendtime
=
''
;
//活动结束时间
let
nodisplay
=
false
;
function
run
(
diff
)
{
if
(
diff
)
{
difference
=
diff
...
...
@@ -71,7 +75,6 @@ $.fn.dataStatistics = function(options) {
clearInterval
(
timer2
);
//优惠券用完 清楚定时器
// $(".received_img").attr("src", "");
$
(
'.img_bg_M'
).
css
(
"background-image"
,
"url(../images/MJ_200@3x.png)"
);
$
(
'.img_bg_p1'
).
css
(
"color"
,
"#CCCCCC"
);
...
...
@@ -80,10 +83,13 @@ $.fn.dataStatistics = function(options) {
$
(
'.img_btn p'
).
html
(
'活动结束'
)
$
(
'.box_content_t'
).
hide
()
$
(
'.img_btn'
).
css
(
"background-image"
,
"url(../images/nobuy_btn.png)"
);
$
(
'.dataStatistics'
).
css
(
'display'
,
"none"
);
$
(
'.deta_replace'
).
css
(
'display'
,
"flex"
);
$
(
'#notice'
).
css
(
'display'
,
"block"
);
$
(
'.notice_img'
).
css
(
'display'
,
"block"
);
if
(
nodisplay
==
true
){
//显示活动预告
$
(
'.dataStatistics'
).
css
(
'display'
,
"none"
);
$
(
'.deta_replace'
).
css
(
'display'
,
"flex"
);
$
(
'#notice'
).
css
(
'display'
,
"block"
);
$
(
'.notice_img'
).
css
(
'display'
,
"block"
);
}
// layer.msg('优惠券被抢光了!')
}
...
...
@@ -139,17 +145,16 @@ $.fn.dataStatistics = function(options) {
var
timer2
=
setInterval
(()
=>
{
$
.
ajax
({
type
:
"POST"
,
url
:
`
${
getApiUrl
().
urlJava
}
api/appActivity/get
UserPurchaseTime
`
,
url
:
`
${
getApiUrl
().
urlJava
}
api/appActivity/get
CurrentActivity
`
,
contentType
:
"application/json"
,
data
:
getJavaData
({}),
data
:
getJavaData
({
couponId
:
options
.
couponId
}),
async
:
false
,
success
:
function
(
res
)
{
if
(
res
.
resultCode
===
1
)
{
nodisplay
=
true
if
(
nownumber
>
0
)
{
let
num
=
nownumber
-
res
.
data
.
repertory
;
// 算出动画执行的次数
nownumber
=
res
.
data
.
repertory
;
// 算出现在的数字
// let num = 10 ; // 算出动画执行的次数
// // nownumber = 900; // 算出现在的数字
if
(
num
>
0
)
{
if
(
num
>
5
){
...
...
@@ -160,11 +165,13 @@ $.fn.dataStatistics = function(options) {
min
:
nownumber
,
len
:
4
,
add
:
true
,
price
:
res
.
data
.
redemptionP
rice
,
couponId
:
res
.
data
.
couponId
,
price
:
options
.
p
rice
,
couponId
:
options
.
couponId
,
platform
:
options
.
platform
,
login
:
options
.
login
,
count
:
res
.
data
.
count
,
//判断是否可以抢购 0为不可以
count
:
options
.
count
,
//判断是否可以抢购 0为不可以
activityStartDate
:
options
.
activityStartDate
,
activityEndDate
:
options
.
activityEndDate
,
});
//刚进入页面不执行动画
}
else
{
...
...
@@ -178,23 +185,26 @@ $.fn.dataStatistics = function(options) {
min
:
nownumber
,
len
:
4
,
add
:
true
,
price
:
res
.
data
.
redemptionP
rice
,
couponId
:
res
.
data
.
couponId
,
price
:
options
.
p
rice
,
couponId
:
options
.
couponId
,
platform
:
options
.
platform
,
login
:
options
.
login
,
count
:
res
.
data
.
count
,
//判断是否可以抢购 0为不可以
count
:
options
.
count
,
//判断是否可以抢购 0为不可以
activityStartDate
:
options
.
activityStartDate
,
activityEndDate
:
options
.
activityEndDate
,
});
//刚进入页面不执行动画
}
if
(
nownumber
==
0
)
{
Activityendtime
=
res
.
data
.
expirationDate
.
replace
(
'T'
,
' '
).
replace
(
/-/g
,
'/'
);
}
options
.
count
=
res
.
data
.
count
;
let
activityStartDate
=
new
Date
(
res
.
data
.
activityStartDate
.
replace
(
'T'
,
' '
).
replace
(
/-/g
,
'/'
)).
getTime
()
;
let
activityEndDate
=
new
Date
(
res
.
data
.
activityEndDate
.
replace
(
'T'
,
' '
).
replace
(
/-/g
,
'/'
)).
getTime
()
;
//
options.count = res.data.count;
let
activityStartDate
=
options
.
activityStartDate
;
let
activityEndDate
=
options
.
activityEndDate
;
let
nowDate
=
new
Date
(
res
.
data
.
currentTime
.
replace
(
'T'
,
' '
).
replace
(
/-/g
,
'/'
)).
getTime
();
//服务器时间
let
nowDate
=
new
Date
(
res
.
data
.
currentTime
.
replace
(
/-/g
,
'/'
)).
getTime
();
//服务器时间
// let nowDate = options.nowDate; //服务器时间
if
(
activityStartDate
>=
nowDate
)
{
//活动还没开始
clearInterval
(
timer2
);
...
...
@@ -215,7 +225,7 @@ $.fn.dataStatistics = function(options) {
clearInterval
(
timer2
);
//活动结束 清楚定时器
}
else
{
if
(
nownumber
>
0
)
{
if
(
res
.
data
.
count
!=
0
)
{
if
(
options
.
count
!=
0
)
{
// $(".received_img").attr("src", "");
$
(
'.img_btn p'
).
html
(
'立即抢购'
)
}
else
{
...
...
@@ -239,7 +249,6 @@ $.fn.dataStatistics = function(options) {
$
(
'.notice_img'
).
css
(
'display'
,
"block"
);
}
}
}
else
{
...
...
@@ -283,6 +292,8 @@ $.fn.dataStatistics = function(options) {
}
if
(
options
.
platform
==
'app'
)
{
window
.
postMessage
(
JSON
.
stringify
(
data
));
}
else
if
(
options
.
platform
==
'H5'
){
window
.
location
.
href
=
'https://activity.oytour.com/html/downloadApp.html'
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment