Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
h5_activity
Project
Overview
Details
Activity
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
谭新宇
h5_activity
Commits
a8a89b73
Commit
a8a89b73
authored
Jul 18, 2019
by
txy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
'投票调整'
parent
aa9b496b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
182 additions
and
140 deletions
+182
-140
common.js
showPhotos/js/page/common.js
+152
-0
index.js
showPhotos/js/page/index.js
+16
-61
signup.js
showPhotos/js/page/signup.js
+1
-5
user.js
showPhotos/js/page/user.js
+13
-74
No files found.
showPhotos/js/page/common.js
View file @
a8a89b73
...
...
@@ -4,6 +4,9 @@ var activityCode = typeof rules !== 'undefined' ? rules.acActivity.code : '';
var
baseUrl
=
"https://space-api.check.icaremgt.com"
;
var
manageUrl
=
"http://api-admin-manage.check.icaremgt.com"
;
// 防止投票连点
var
gb_vote_loaded
=
false
if
(
typeof
data
!==
'undefined'
){
data
.
htmlJson
=
JSON
.
parse
(
data
.
htmlJson
);
}
...
...
@@ -246,4 +249,152 @@ function getActivityTitle() {
});
}
})
}
/* ***********************弹出框控制全部逻辑************************** */
// 投票
function
voteClickFn
(
params
,
successCallback
,
errorCallback
){
if
(
gb_vote_loaded
)
{
return
}
gb_vote_loaded
=
true
;
$
.
ajax
({
type
:
'PUT'
,
url
:
baseUrl
+
'/ACTIVITY/sz/vote/'
+
activityCode
,
data
:
params
,
headers
:
{
'x-token'
:
getToken
()
},
success
:
function
(
data
)
{
gb_vote_loaded
=
false
;
if
(
data
.
status
==
200
)
{
// 已报名-通过审核
if
(
user
.
reviewStatus
===
1
)
{
$
(
'#html-template-4 .struct span'
).
text
(
data
.
result
.
voteNumDay
)
$
(
'#html-template-4'
).
fadeIn
();
}
else
{
$
(
'#html-template-6 .struct span'
).
text
(
data
.
result
.
voteNumDay
)
$
(
'#html-template-6'
).
fadeIn
();
}
successCallback
&&
successCallback
(
data
);
}
else
if
(
data
.
status
==
201
)
{
// 已报名-通过审核
if
(
user
.
reviewStatus
===
1
)
{
$
(
'#html-template-5 .struct span'
).
text
(
rules
.
settings
.
szRule
.
voteNumDay
)
$
(
'#html-template-5'
).
fadeIn
();
}
else
{
$
(
'#html-template-7 .struct span'
).
text
(
rules
.
settings
.
szRule
.
voteNumDay
)
$
(
'#html-template-7'
).
fadeIn
();
}
errorCallback
&&
errorCallback
(
data
);
}
else
if
(
data
.
status
>=
400
)
{
// 异常处理
$
.
dialog
({
contentHtml
:
'<p style="text-align:center;">'
+
data
.
message
+
'</p>'
});
}
},
error
:
function
(
data
){
gb_vote_loaded
=
false
;
// 异常处理
$
.
dialog
({
contentHtml
:
'<p style="text-align:center;">'
+
data
.
responseJSON
.
message
+
'</p>'
});
}
})
}
// 参赛选手投票-有票
function
playerHasVoteDialogBind
(){
// 继续投票
$
(
'#html-template-4 .vote-btn-1'
).
off
(
"click"
).
on
(
'click'
,
function
(){
$
(
'#html-template-4'
).
fadeOut
();
});
// 我要拉票
$
(
'#html-template-4 .vote-btn-2'
).
off
(
"click"
).
on
(
'click'
,
function
(){
$
(
'#html-template-4'
).
hide
();
$
(
'#html-template-8'
).
fadeIn
();
});
// 关闭按钮
$
(
'#html-template-4 .modal-close'
).
off
(
"click"
).
on
(
'click'
,
function
(){
$
(
'#html-template-4'
).
fadeOut
();
});
}
// 参赛选手投票-无票
function
playerNoVoteDialogBind
(){
// 我要参赛
$
(
'#html-template-5 .vote-btn-1'
).
off
(
"click"
).
on
(
'click'
,
function
(){
$
(
'#html-template-5'
).
fadeOut
();
});
// 我要拉票
$
(
'#html-template-5 .vote-btn-2'
).
off
(
"click"
).
on
(
'click'
,
function
(){
$
(
'#html-template-5'
).
hide
();
$
(
'#html-template-8'
).
fadeIn
();
});
// 关闭按钮
$
(
'#html-template-5 .modal-close'
).
off
(
"click"
).
on
(
'click'
,
function
(){
$
(
'#html-template-5'
).
fadeOut
();
});
}
// 投票者-有票
function
visitorHasVoteDialogBind
(){
// 继续投票
$
(
'#html-template-6 .vote-btn-1'
).
off
(
"click"
).
on
(
'click'
,
function
(){
$
(
'#html-template-6'
).
fadeOut
();
});
// 我要拉票
$
(
'#html-template-6 .vote-btn-2'
).
off
(
"click"
).
on
(
'click'
,
function
(){
$
(
'#html-template-6'
).
hide
();
$
(
'#html-template-8'
).
fadeIn
();
});
// 关闭按钮
$
(
'#html-template-6 .modal-close'
).
off
(
"click"
).
on
(
'click'
,
function
(){
$
(
'#html-template-6'
).
fadeOut
();
});
}
// 投票者-无票
function
visitorNoVoteDialogBind
(){
// 我要参赛
$
(
'#html-template-7 .vote-btn-1'
).
off
(
"click"
).
on
(
'click'
,
function
(){
$
(
'#html-template-7'
).
fadeOut
();
});
// 我要拉票
$
(
'#html-template-7 .vote-btn-2'
).
off
(
"click"
).
on
(
'click'
,
function
(){
$
(
'#html-template-7'
).
hide
();
$
(
'#html-template-8'
).
fadeIn
();
});
// 关闭按钮
$
(
'#html-template-7 .modal-close'
).
off
(
"click"
).
on
(
'click'
,
function
(){
$
(
'#html-template-7'
).
fadeOut
();
});
}
// 拉票/活动秘籍
function
voteShateDialogBind
(){
// 关闭分享弹出框
$
(
"#html-template-8 .modal-close"
).
off
(
"click"
).
on
(
"click"
,
function
()
{
$
(
'#html-template-8'
).
fadeOut
()
});
}
// 所有投票弹出框按钮事件绑定
function
voteDialogBindFn
()
{
playerHasVoteDialogBind
();
playerNoVoteDialogBind
();
visitorHasVoteDialogBind
();
visitorNoVoteDialogBind
();
voteShateDialogBind
();
}
\ No newline at end of file
showPhotos/js/page/index.js
View file @
a8a89b73
...
...
@@ -24,6 +24,8 @@ $(function(){
}
else
{
$
(
"#act31528123692525"
).
click
();
}
voteDialogBindFn
();
});
// 元素点击事件绑定
...
...
@@ -119,19 +121,6 @@ function btnBindClick() {
});
});
// 继续投票
$
(
'#act21728433893489'
).
off
(
"click"
).
on
(
'click'
,
function
(){
$
(
'#html-template-4'
).
fadeOut
()
})
$
(
'#html-template-4 .modal-close'
).
off
(
"click"
).
on
(
'click'
,
function
(){
$
(
'#html-template-4'
).
fadeOut
()
})
// 我要拉票
$
(
'#act2172989331265,#act5161551593534'
).
off
(
'click'
).
on
(
'click'
,
function
(){
$
(
"#html-template-4"
).
hide
();
$
(
'#html-template-8'
).
fadeIn
();
})
// 查看排行
$
(
'#act5161526928645'
).
off
(
'click'
).
on
(
'click'
,
function
(){
$
(
'#html-template-5'
).
fadeOut
();
...
...
@@ -142,11 +131,6 @@ function btnBindClick() {
$
(
'#html-template-5'
).
fadeOut
()
})
// 关闭分享弹出框
$
(
"#html-template-8 .modal-close"
).
off
(
"click"
).
on
(
"click"
,
function
()
{
$
(
'#html-template-8'
).
fadeOut
()
});
// 排行榜
$
(
"#act2165045664554"
).
off
(
'click'
).
on
(
"click"
,
function
(){
var
_t
=
getToken
();
...
...
@@ -276,8 +260,20 @@ function getPlayerList(playerListData) {
$
(
'.vote-num'
,
item
).
text
(
playerListData
.
records
[
i
].
voteNum
+
'票'
);
// 投票点击事件
var
cloneItem
=
$
(
item
).
clone
();
cloneItem
.
find
(
'.act-btn'
).
attr
(
'id'
,
playerListData
.
records
[
i
].
id
).
on
(
'click'
,
voteClickFn
);
var
cloneItem
=
$
(
item
).
clone
();
cloneItem
.
find
(
'.act-btn'
).
attr
(
'id'
,
playerListData
.
records
[
i
].
id
).
on
(
'click'
,
function
(){
var
id
=
$
(
this
).
attr
(
'id'
);
var
_this
=
$
(
this
)
var
params
=
{
userId
:
id
}
// 投票
voteClickFn
(
params
,
function
(
data
){
// success
_this
.
parent
(
'.item-title'
).
prev
().
find
(
'.vote-num'
).
text
(
data
.
result
.
voteNum
+
'票'
)
});
});
// 参数选手点击事件
cloneItem
.
find
(
'.item-photo'
).
attr
(
'id'
,
playerListData
.
records
[
i
].
id
).
on
(
'click'
,
playPageFn
);
tempItem
.
append
(
cloneItem
);
...
...
@@ -345,47 +341,6 @@ function tabChange(){
}
}
// 投票按钮
function
voteClickFn
(){
var
id
=
$
(
this
).
attr
(
'id'
);
var
_this
=
$
(
this
)
var
params
=
{
userId
:
id
}
$
.
ajax
({
type
:
'PUT'
,
url
:
baseUrl
+
'/ACTIVITY/sz/vote/'
+
activityCode
,
data
:
params
,
headers
:
{
'x-token'
:
getToken
()
},
success
:
function
(
data
)
{
if
(
data
.
status
==
200
)
{
$
(
'#act1185354268270 span'
).
text
(
data
.
result
.
voteNumDay
)
$
(
'#html-template-4'
).
fadeIn
()
_this
.
parent
(
'.item-title'
).
prev
().
find
(
'.vote-num'
).
text
(
data
.
result
.
voteNum
+
'票'
)
}
else
if
(
data
.
status
==
201
)
{
$
(
'#act51626389412499 span'
).
text
(
rules
.
settings
.
szRule
.
voteNumDay
)
$
(
'#html-template-5'
).
fadeIn
()
}
else
if
(
data
.
status
>=
400
)
{
// 异常处理
$
.
dialog
({
contentHtml
:
'<p style="text-align:center;">'
+
data
.
message
+
'</p>'
});
}
},
error
:
function
(
data
){
// 异常处理
$
.
dialog
({
contentHtml
:
'<p style="text-align:center;">'
+
data
.
responseJSON
.
message
+
'</p>'
});
}
})
}
// 选手主页
function
playPageFn
()
{
var
id
=
$
(
this
).
attr
(
'id'
);
...
...
showPhotos/js/page/signup.js
View file @
a8a89b73
...
...
@@ -10,6 +10,7 @@ $(function () {
btnBindClick
();
// 绑定点击事件
$
(
'#act11739232574395'
).
attr
({
'readonly'
:
'readonly'
});
getOrgNameFn
();
voteDialogBindFn
();
})
// 元素点击事件绑定
...
...
@@ -51,11 +52,6 @@ function btnBindClick() {
transPage
(
'1'
,
activityCode
,
_t
);
});
// 分享弹框关闭
$
(
document
).
on
(
'click'
,
'#html-template-8 .modal-close'
,
function
()
{
$
(
'#html-template-8'
).
addClass
(
'global-none'
)
});
var
uploadFile
=
''
// 上传图片
$
(
"#uploadImage"
).
on
(
'change'
,
function
()
{
...
...
showPhotos/js/page/user.js
View file @
a8a89b73
var
gb_vote_loaded
=
false
// 加载html结构
loadHtmlJson
();
...
...
@@ -11,6 +10,7 @@ $(function(){
var
showTime
=
new
Date
(
rules
.
acActivity
.
endTime
).
getTime
()
-
new
Date
(
currentTime
).
getTime
()
userCountDown
(
showTime
/
1000
,
$
(
'#act31142119991744 span'
));
//倒计时
userTabInfo
();
voteDialogBindFn
();
});
// 微信鉴权
...
...
@@ -81,26 +81,6 @@ function btnBindClick() {
$
(
'#act31119351441050'
).
off
(
"click"
).
on
(
"click"
,
function
(){
$
(
'#html-template-8'
).
fadeIn
()
});
// 分享弹框关闭
$
(
document
).
on
(
'click'
,
'#html-template-8 .modal-close'
,
function
(){
$
(
'#html-template-8'
).
fadeOut
()
});
// 投票
$
(
'#act31119414834381'
).
off
(
"click"
).
on
(
"click"
,
function
(){
voteClickFn
()
});
// 我要拉票
$
(
'#act2172989331265'
).
off
(
"click"
).
on
(
"click"
,
function
(){
$
(
'#html-template-8'
).
fadeIn
()
});
// 继续投票
$
(
'#act21728433893489'
).
off
(
"click"
).
on
(
"click"
,
function
(){
voteClickFn
()
});
// 投票弹框关闭
$
(
document
).
on
(
'click'
,
'#html-template-4 .modal-close'
,
function
(){
$
(
'#html-template-4'
).
fadeOut
()
});
// 排行榜
$
(
"#act41612547506702"
).
off
(
'click'
).
on
(
"click"
,
function
(){
...
...
@@ -124,7 +104,18 @@ function btnBindClick() {
// 活动秘籍
$
(
"#act41613113951133"
).
off
(
"click"
).
on
(
"click"
,
function
(){
$
(
'#html-template-8'
).
fadeIn
()
$
(
'#html-template-8'
).
fadeIn
();
});
// 给用户投票
$
(
"#act31119414834381"
).
off
(
"click"
).
on
(
"click"
,
function
(){
var
_userId
=
getQueryString
(
"userId"
);
var
params
=
{
userId
:
_userId
}
voteClickFn
(
params
,
function
(
data
){
$
(
'#act3932189955 .userVoteNum span'
).
text
(
data
.
result
.
voteNum
);
});
});
}
// 倒计时
...
...
@@ -201,55 +192,3 @@ function userTabInfo() {
})
}
// 投票按钮
function
voteClickFn
(){
var
id
=
getQueryString
(
'userId'
)?
getQueryString
(
'userId'
):
user
.
id
;
var
_this
=
$
(
this
)
var
params
=
{
userId
:
id
}
if
(
gb_vote_loaded
)
{
return
}
gb_vote_loaded
=
true
$
.
ajax
({
type
:
'PUT'
,
url
:
baseUrl
+
'/ACTIVITY/sz/vote/'
+
activityCode
,
data
:
params
,
headers
:
{
'x-token'
:
getToken
()
},
success
:
function
(
data
)
{
gb_vote_loaded
=
false
if
(
data
.
status
==
200
)
{
$
(
'#act1185354268270 span'
).
text
(
data
.
result
.
voteNumDay
)
$
(
'#act3932189955 .user-info .inner-info'
).
find
(
'.userVoteNum span'
).
text
(
data
.
result
.
voteNum
)
if
(
user
.
status
)
{
$
(
'#html-template-4'
).
fadeIn
()
}
else
{
$
(
'#html-template-6'
).
fadeIn
()
}
}
else
if
(
data
.
status
==
201
)
{
$
(
'#act51626389412499 span'
).
text
(
rules
.
szRule
.
voteNumDay
)
// 模板参数中获取
if
(
user
.
status
)
{
$
(
'#html-template-5'
).
fadeIn
()
}
else
{
$
(
'#html-template-7'
).
fadeIn
()
}
}
else
if
(
data
.
status
>=
400
)
{
// 异常处理
$
.
dialog
({
contentHtml
:
'<p style="text-align:center;">'
+
data
.
message
+
'</p>'
});
}
},
error
:
function
(
data
)
{
gb_vote_loaded
=
false
// 异常处理
$
.
dialog
({
contentHtml
:
'<p style="text-align:center;">'
+
data
.
responseJSON
.
message
+
'</p>'
});
}
})
}
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