Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
walk_daka_h5
Overview
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
穆启卓
walk_daka_h5
Commits
2c6d2448
Commit
2c6d2448
authored
Mar 29, 2019
by
穆启卓
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
ed5f5fe8
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
287 additions
and
209 deletions
+287
-209
index.html
public/index.html
+1
-1
Free.vue
src/components/Free.vue
+13
-13
HelloWorld.vue
src/components/HelloWorld.vue
+16
-6
api.js
src/components/axios/api.js
+25
-2
url.js
src/components/axios/url.js
+5
-1
main.js
src/main.js
+17
-2
router.js
src/router.js
+4
-0
ChallengeDetail.vue
src/views/ChallengeDetail.vue
+12
-8
Daka.vue
src/views/Daka.vue
+52
-52
HaveJoinedGame.vue
src/views/HaveJoinedGame.vue
+8
-0
PartakeChallenge.vue
src/views/PartakeChallenge.vue
+102
-2
SignUp.vue
src/views/SignUp.vue
+32
-122
No files found.
public/index.html
View file @
2c6d2448
...
...
@@ -4,7 +4,7 @@
<meta
charset=
"utf-8"
>
<meta
http-equiv=
"X-UA-Compatible"
content=
"IE=edge"
>
<meta
content=
"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;"
name=
"viewport"
/>
<title>
每天读书
打卡
</title>
<title>
步数
打卡
</title>
</head>
<body>
<noscript>
...
...
src/components/Free.vue
View file @
2c6d2448
...
...
@@ -309,19 +309,19 @@
joinFree
()
{
let
days
=
this
.
days
||
0
// this.queryPayImage();
dakaPay
(
days
,
1
).
then
(
response
=>
{
console
.
log
(
"报名状态"
,
response
);
if
(
response
.
code
==
1
)
{
this
.
showModal
(
"温馨提示"
,
response
.
msg
);
return
;
}
if
(
response
.
code
==
0
)
{
this
.
$emit
(
"close"
,
true
);
this
.
$emit
(
"success"
)
// localStorage.setItem("is_every", 0)
// location.replace("#/Success");
}
});
//
dakaPay(days, 1).then(response => {
//
console.log("报名状态", response);
//
if (response.code == 1) {
//
this.showModal("温馨提示", response.msg);
//
return;
//
}
//
if (response.code == 0) {
//
this.$emit("close", true);
//
this.$emit("success")
//
// localStorage.setItem("is_every", 0)
//
// location.replace("#/Success");
//
}
//
});
},
getPlatform
()
{
var
u
=
navigator
.
userAgent
,
...
...
src/components/HelloWorld.vue
View file @
2c6d2448
<
template
>
<div
class=
"hello"
>
</div>
<div
class=
"hello"
></div>
</
template
>
<
script
>
import
{
jssdk
,
shareContent
}
from
"@/components/axios/api"
;
import
{
jssdk
,
shareContent
,
select_user_signup
}
from
"@/components/axios/api"
;
export
default
{
name
:
"HelloWorld"
,
...
...
@@ -13,6 +12,7 @@
},
mounted
()
{
this
.
getConfig
();
this
.
checkUserJoin
();
},
methods
:
{
// 微信分参数
...
...
@@ -162,10 +162,19 @@
// this.getConfig();
// }
// }, 1000);
},
// 判断用户是否参加了比赛
checkUserJoin
()
{
select_user_signup
().
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
sessionStorage
.
setItem
(
'userHaveJoinGame'
,
String
(
res
.
data
.
daka_signup
));
}
else
{
sessionStorage
.
setItem
(
'userHaveJoinGame'
,
'false'
);
}
}).
catch
(
err
=>
{
sessionStorage
.
setItem
(
'userHaveJoinGame'
,
'false'
);
})
}
}
};
</
script
>
\ No newline at end of file
<
style
scoped
>
</
style
>
src/components/axios/api.js
View file @
2c6d2448
...
...
@@ -151,7 +151,7 @@ export function ocFollow() { //lookOption是你要调用接口的名字,issuer
}
// 报名支付
export
function
dakaPay
(
days
,
use_contract
)
{
export
function
dakaPay
(
grade
,
days
,
use_contract
)
{
let
now
=
new
Date
();
let
year
=
now
.
getFullYear
();
let
month
=
now
.
getMonth
()
+
1
;
...
...
@@ -173,7 +173,8 @@ export function dakaPay(days,use_contract) {
use_contract
:
use_contract
||
0
,
inviter_id
:
inviter
||
''
,
from_type
:
from_type
||
''
,
days
:
days
||
0
days
:
days
||
0
,
grade
:
grade
||
0
}
})
}
...
...
@@ -391,6 +392,28 @@ export function daka_index(grade) {
})
}
// 判断用户是否参与比赛
export
function
select_user_signup
()
{
return
fetch
({
url
:
api
.
select_user_signup
,
method
:
'GET'
,
params
:
{
}
})
}
// 比赛详情
export
function
daka_status_detail
(
week
,
grade
)
{
return
fetch
({
url
:
api
.
daka_status_detail
,
method
:
'GET'
,
params
:
{
week
:
week
,
grade
:
grade
}
})
}
//有新接口的时候像上面那样再来一次
// //修改昵称接口
...
...
src/components/axios/url.js
View file @
2c6d2448
...
...
@@ -45,7 +45,7 @@ export default {
ocFollowPath
:
`
${
api
}
/api/v1/oc_follow`
,
//10 报名支付 GET /api/v1/daka_pay
dakaPayPath
:
`
${
api
}
/api/v1/daka_pay`
,
//11 jssdk注入
GET /api/v1/daka_pay
//11 jssdk注入
jssdkPath
:
`
${
api
}
/api/v1/config/jssdk`
,
// 12 提现banner GET /api/v1/config/withdraw_banner
withdrawBannerPath
:
`
${
api
}
/api/v1/config/withdraw_banner`
,
...
...
@@ -83,4 +83,8 @@ export default {
withdraw_log
:
`
${
api
}
/api/v1/withdraw_log`
,
// 首页数据
daka_index
:
`
${
api
}
/api/v1/daka_index`
,
// 判断用户是否参与比赛
select_user_signup
:
`
${
api
}
/api/v1/select_user_signup`
,
// 比赛详情
daka_status_detail
:
`
${
api
}
/api/v1/daka_status/detail`
,
}
src/main.js
View file @
2c6d2448
...
...
@@ -60,9 +60,24 @@ router.beforeEach((to, from, next) => {
next
(
'/author'
)
// location.replace('#/author')
}
}
else
if
(
to
.
name
===
'MainPagePartakeChallenge'
||
to
.
name
===
'MainPageHaveJoinedGame'
)
{
// 处理tabbar去‘当前比赛’时,根据用户有没有参赛导向对应也页面
const
userHaveJoinGame
=
sessionStorage
.
getItem
(
'userHaveJoinGame'
);
if
(
userHaveJoinGame
===
'true'
)
{
if
(
to
.
name
===
'MainPageHaveJoinedGame'
)
{
next
();
}
else
{
next
()
// location.replace(`#${to.path}`)
next
({
name
:
'MainPageHaveJoinedGame'
});
}
}
else
{
if
(
to
.
name
===
'MainPagePartakeChallenge'
)
{
next
();
}
else
{
next
({
name
:
'MainPagePartakeChallenge'
});
}
}
}
else
{
next
();
}
})
...
...
src/router.js
View file @
2c6d2448
...
...
@@ -135,5 +135,9 @@ export default new Router({
},
]
},
{
path
:
"*"
,
redirect
:
"/MainPage/SignUp"
},
]
})
src/views/ChallengeDetail.vue
View file @
2c6d2448
<
template
>
<div
class=
"partake-challenge-page"
>
<Title
class=
"page-title"
title=
" "
v-on:goback=
"goback"
show_back=
"true"
></Title>
<div
class=
"game-rule-container"
>
<div
class=
"game-rule-container"
@
click=
"goOtherPage('Rule')"
>
<img
src=
"../images/ChallengeDetail/ic_que.png"
>
活动规则
</div>
<div
class=
"game-bonus-container"
>
<div
class=
"bonus-title"
>
本期累计奖励金(元)
</div>
<div
class=
"bonus-amount"
>
6.86
</div>
<div
class=
"bonus-amount"
>
{{
pageData
.
bet_bonus
}}
</div>
</div>
<div
class=
"game-title"
>
5000步七
日耐力赛
</div>
<div
class=
"game-time"
>
开赛时间:
3月11日 00:00-3月17日24:00
</div>
<div
class=
"game-title"
>
{{
pageData
.
target_step
}}
步三
日耐力赛
</div>
<div
class=
"game-time"
>
开赛时间:
{{
pageData
.
start_format
}}
—
{{
pageData
.
end_format
}}
</div>
<div
class=
"hr"
></div>
<div
class=
"game-info-container"
>
<div
class=
"game-info-section"
>
<div
class=
"section-item"
>
<div
class=
"item-value"
>
5636.26
</div>
<div
class=
"item-value"
>
{{
pageData
.
total_money
}}
</div>
<div
class=
"item-key"
>
总奖励金(元)
</div>
</div>
<div
class=
"section-item"
>
<div
class=
"item-value"
>
26.8%
</div>
<div
class=
"item-value"
>
{{
pageData
.
bet_rate
}}
</div>
<div
class=
"item-key"
>
收益率
</div>
</div>
</div>
<div
class=
"game-info-section"
>
<div
class=
"section-item"
>
<div
class=
"item-value"
>
70964
</div>
<div
class=
"item-value"
>
{{
pageData
.
people_cnt
}}
</div>
<div
class=
"item-key"
>
达标人数
</div>
</div>
<div
class=
"section-item"
>
<div
class=
"item-value"
>
111858
</div>
<div
class=
"item-value"
>
{{
pageData
.
total_signup
}}
</div>
<div
class=
"item-key"
>
参赛人数
</div>
</div>
</div>
...
...
@@ -47,6 +47,7 @@
},
data
()
{
return
{
pageData
:
JSON
.
parse
(
sessionStorage
.
getItem
(
'ChallengeDetailData'
))
}
},
created
()
{
...
...
@@ -55,6 +56,9 @@
goback
()
{
history
.
go
(
-
1
);
},
goOtherPage
(
pageName
)
{
this
.
$router
.
push
({
name
:
pageName
});
},
}
}
</
script
>
...
...
src/views/Daka.vue
View file @
2c6d2448
...
...
@@ -303,58 +303,58 @@
},
payToSign
()
{
let
days
=
this
.
userStatus
.
days
||
0
dakaPay
(
days
).
then
(
response
=>
{
this
.
current_date
=
new
Date
(
response
.
date
);
if
(
response
.
code
==
1
)
{
this
.
showModal
(
"温馨提示"
,
response
.
msg
);
return
;
}
let
result
=
response
.
data
;
console
.
log
(
"请求打卡支付数据"
,
result
);
if
(
result
)
{
WeixinJSBridge
.
invoke
(
"getBrandWCPayRequest"
,
{
appId
:
result
.
appId
,
//公众号名称,由商户传入
timeStamp
:
`
${
result
.
timeStamp
}
`
,
//时间戳,自1970年以来的秒数
nonceStr
:
result
.
nonceStr
,
//随机串
package
:
result
.
package
,
signType
:
result
.
signType
,
//微信签名方式:
paySign
:
result
.
paySign
//微信签名
},
// result,
res
=>
{
console
.
log
(
"支付调用结果"
,
res
);
if
(
res
.
err_msg
==
"get_brand_wcpay_request:ok"
)
{
// 使用以上方式判断前端返回,微信团队郑重提示:
//res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
// 支付成功后的回调函数
console
.
log
(
"支付成功"
);
this
.
showModal
(
"温馨提示"
,
"报名成功"
,
{
scb
:
()
=>
{
if
(
this
.
isFollow
==
1
)
{
this
.
$router
.
push
({
name
:
"Read"
})
}
else
{
this
.
$router
.
push
({
name
:
"Success"
})
}
}
});
// this.dateSelect(2);
// localStorage.setItem("is_every", 0)
// location.replace("#/Success");
}
if
(
res
.
err_msg
==
"get_brand_wcpay_request:fail"
)
{
this
.
togglePayFail
()
// this.showModal("温馨提示", "支付服务繁忙,请稍后重试");
}
if
(
res
.
err_msg
==
"get_brand_wcpay_request:cancel"
)
{
this
.
togglePayFail
()
console
.
log
(
"支付取消"
);
}
}
);
}
});
//
dakaPay(days).then(response => {
//
this.current_date = new Date(response.date);
//
if (response.code == 1) {
//
this.showModal("温馨提示", response.msg);
//
return;
//
}
//
let result = response.data;
//
console.log("请求打卡支付数据", result);
//
if (result) {
//
WeixinJSBridge.invoke(
//
"getBrandWCPayRequest",
//
{
//
appId: result.appId, //公众号名称,由商户传入
//
timeStamp: `${result.timeStamp}`, //时间戳,自1970年以来的秒数
//
nonceStr: result.nonceStr, //随机串
//
package: result.package,
//
signType: result.signType, //微信签名方式:
//
paySign: result.paySign //微信签名
//
},
//
// result,
//
res => {
//
console.log("支付调用结果", res);
//
if (res.err_msg == "get_brand_wcpay_request:ok") {
//
// 使用以上方式判断前端返回,微信团队郑重提示:
//
//res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
//
// 支付成功后的回调函数
//
console.log("支付成功");
//
this.showModal("温馨提示", "报名成功", {
//
scb: () => {
//
if (this.isFollow == 1) {
//
this.$router.push({name: "Read"})
//
} else {
//
this.$router.push({name: "Success"})
//
}
//
}
//
});
//
// this.dateSelect(2);
//
// localStorage.setItem("is_every", 0)
//
// location.replace("#/Success");
//
}
//
if (res.err_msg == "get_brand_wcpay_request:fail") {
//
this.togglePayFail()
//
// this.showModal("温馨提示", "支付服务繁忙,请稍后重试");
//
}
//
if (res.err_msg == "get_brand_wcpay_request:cancel") {
//
this.togglePayFail()
//
console.log("支付取消");
//
}
//
}
//
);
//
}
//
});
},
stopPop
(
e
)
{
e
.
stopPropagation
()
...
...
src/views/HaveJoinedGame.vue
View file @
2c6d2448
...
...
@@ -115,6 +115,7 @@
<
script
>
import
Title
from
"@/components/Title.vue"
;
import
{
daka_status_detail
}
from
"@/components/axios/api"
;
export
default
{
name
:
"HaveJoinedGame"
,
components
:
{
...
...
@@ -126,6 +127,7 @@
}
},
created
()
{
this
.
getPageData
();
},
methods
:
{
goback
()
{
...
...
@@ -136,6 +138,12 @@
},
currentPage
()
{
return
this
.
$router
.
history
.
current
.
name
;
},
getPageData
()
{
console
.
log
(
this
.
$route
)
daka_status_detail
().
then
(
res
=>
{
console
.
log
(
res
)
});
}
}
}
...
...
src/views/PartakeChallenge.vue
View file @
2c6d2448
...
...
@@ -47,20 +47,48 @@
<div
class=
"text1"
>
我同意
</div>
<div
class=
"text2"
@
click=
"goOtherPage('Rule')"
>
《步数打卡的挑战规则协议》
</div>
</div>
<div
class=
"partake-btn"
>
立即报名
</div>
<div
class=
"partake-btn"
@
click=
"payToSign()"
>
立即报名
</div>
</div>
<PayFailModal
v-if=
"isShowPayFail"
@
close=
"togglePayFail()"
></PayFailModal>
<div
class=
"modal"
v-if=
"modalShown"
>
<Modal
v-on:close=
"closeModal"
v-on:confirmModal=
"confirmModal"
v-bind:title=
"modalTitle"
v-bind:desc=
"modalDesc"
:option=
"modalOption"
></Modal>
</div>
<div
class=
"modal"
v-if=
"showFreeModal"
>
<Free
v-bind:page_type=
"1"
v-on:close=
"closeFree"
v-bind:v_data=
"contract_data"
@
showModal=
"showModal"
@
success=
"showSuccess"
:days=
"0"
></Free>
</div>
</div>
</
template
>
<
script
>
import
Title
from
"@/components/Title.vue"
;
import
PayFailModal
from
"@/components/PayFailModal.vue"
;
import
Free
from
"@/components/Free.vue"
;
import
Modal
from
"@/components/Modal.vue"
;
import
{
dakaPay
}
from
"@/components/axios/api"
;
export
default
{
name
:
"PartakeChallenge"
,
components
:
{
Title
Title
,
PayFailModal
,
Modal
,
Free
},
data
()
{
return
{
isShowPayFail
:
false
,
showFreeModal
:
false
,
modalTitle
:
""
,
modalDesc
:
""
,
modalShown
:
false
,
}
},
created
()
{
...
...
@@ -74,8 +102,80 @@
},
currentPage
()
{
return
this
.
$router
.
history
.
current
.
name
;
},
togglePayFail
()
{
this
.
isShowPayFail
=
!
this
.
isShowPayFail
},
payToSign
()
{
dakaPay
(
1
).
then
(
response
=>
{
if
(
response
.
code
==
1
)
{
this
.
showModal
(
"温馨提示"
,
response
.
msg
);
return
;
}
let
result
=
response
.
data
;
console
.
log
(
"请求打卡支付数据"
,
result
);
if
(
result
)
{
WeixinJSBridge
.
invoke
(
"getBrandWCPayRequest"
,
{
appId
:
result
.
appId
,
//公众号名称,由商户传入
timeStamp
:
result
.
timeStamp
,
//时间戳,自1970年以来的秒数
nonceStr
:
result
.
nonceStr
,
//随机串
package
:
result
.
package
,
signType
:
result
.
signType
,
//微信签名方式:
paySign
:
result
.
paySign
//微信签名
},
// result,
res
=>
{
console
.
log
(
"支付调用结果"
,
res
);
if
(
res
.
err_msg
==
"get_brand_wcpay_request:ok"
)
{
// 使用以上方式判断前端返回,微信团队郑重提示:
//res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
// 支付成功后的回调函数
console
.
log
(
"支付成功"
);
this
.
showSuccess
();
// this.dateSelect(2);
// localStorage.setItem("is_every", 0)
// location.replace("#/Success");
}
if
(
res
.
err_msg
==
"get_brand_wcpay_request:fail"
)
{
// this.showModal("温馨提示", "支付服务繁忙,请稍后重试");
this
.
togglePayFail
()
}
if
(
res
.
err_msg
==
"get_brand_wcpay_request:cancel"
)
{
// console.log("支付取消");
this
.
togglePayFail
()
}
}
);
}
});
},
showModal
(
title
,
desc
,
option
)
{
this
.
modalTitle
=
title
||
""
;
this
.
modalDesc
=
desc
||
""
;
this
.
modalOption
=
option
||
{}
this
.
modalShown
=
true
;
},
showSuccess
()
{
this
.
showModal
(
"温馨提示"
,
"报名成功"
,
{
scb
:
()
=>
{
sessionStorage
.
setItem
(
'userHaveJoinGame'
,
'true'
);
this
.
$router
.
push
({
name
:
"HaveJoinedGame"
});
}
});
},
closeFree
()
{
this
.
showFreeModal
=
false
;
},
closeModal
()
{
this
.
modalShown
=
false
;
},
confirmModal
(
scb
)
{
scb
&&
scb
()
this
.
modalShown
=
false
;
},
}
}
</
script
>
...
...
src/views/SignUp.vue
View file @
2c6d2448
<
template
>
<div
class=
"sign-up-page"
>
<!--
<PayFailModal
v-if=
"isShowPayFail"
@
close=
"togglePayFail"
></PayFailModal>
<div
class=
"modal"
v-if=
"modalShown"
>
<Modal
v-on:close=
"closeModal"
v-on:confirmModal=
"confirmModal"
v-bind:title=
"modalTitle"
v-bind:desc=
"modalDesc"
:option=
"modalOption"
></Modal>
</div>
<div
class=
"modal"
v-if=
"showFreeModal"
>
<Free
v-bind:page_type=
"1"
v-on:close=
"closeFree"
v-bind:v_data=
"contract_data"
@
showModal=
"showModal"
@
success=
"showSuccess"
:days=
"0"
></Free>
</div>
-->
<!-- 顶部步数级别选择 -->
<div
class=
"top-nav-level"
>
<div
:class=
"['level-item', choosedLevel===
0?'active':'']"
@
click=
"chooseGameLevel(0
)"
>
3000步赛
</div>
<div
:class=
"['level-item', choosedLevel===
1?'active':'']"
@
click=
"chooseGameLevel(1
)"
>
5000步赛
</div>
<div
:class=
"['level-item', choosedLevel===
2?'active':'']"
@
click=
"chooseGameLevel(2
)"
>
8000步赛
</div>
<div
:class=
"['level-item', choosedLevel===
1?'active':'']"
@
click=
"chooseGameLevel(1
)"
>
3000步赛
</div>
<div
:class=
"['level-item', choosedLevel===
2?'active':'']"
@
click=
"chooseGameLevel(2
)"
>
5000步赛
</div>
<div
:class=
"['level-item', choosedLevel===
3?'active':'']"
@
click=
"chooseGameLevel(3
)"
>
8000步赛
</div>
</div>
<!-- 左上角查看步数按钮 -->
<
img
class=
"view-steps-btn"
src=
"../images/SignUp/sy_bushu.png"
>
<
!--
<img
class=
"view-steps-btn"
src=
"../images/SignUp/sy_bushu.png"
>
--
>
<!-- 信息广播 -->
<NoticeBonus
class=
"notice-broadcast"
></NoticeBonus>
<!-- 挑战赛卡片 -->
...
...
@@ -32,7 +16,7 @@
<img
class=
"corner-marker"
src=
"../images/SignUp/home_tag_zmz.png"
v-if=
"item.status===1"
>
<img
class=
"corner-marker"
src=
"../images/SignUp/home_tag_yjs.png"
v-if=
"item.status===2"
>
<div
class=
"card-title"
>
3天健步挑战赛
</div>
<div
class=
"card-time"
><
{{
item
.
already_join
===
1
?
'已参赛'
:
'未参赛'
}}
{{
item
.
period_start
}}
——
{{
item
.
period_end
}}
>
</div>
<div
class=
"card-time"
><
{{
item
.
already_join
===
1
?
'已参赛'
:
'未参赛'
}}
{{
item
.
period_start
}}
—
{{
item
.
period_end
}}
>
</div>
<div
class=
"card-info"
>
<div
class=
"info-item"
v-if=
"item.status===0||item.status===2"
>
<div
class=
"item-title"
>
达标人数
</div>
...
...
@@ -47,22 +31,18 @@
<div
class=
"item-money"
>
{{
item
.
total_money
||
'0.00'
}}
</div>
</div>
</div>
<div
class=
"card-btn"
v-if=
"item.status===1"
@
click=
"goOtherPage('PartakeChallenge')"
>
<div
class=
"card-btn"
v-if=
"item.status===1
&&item.already_join===0
"
@
click=
"goOtherPage('PartakeChallenge')"
>
<div>
参与挑战
</div>
<div
class=
"card-btn-tip"
>
(每日目标
{{
item
.
target_step
}}
步)
</div>
</div>
<div
class=
"card-btn"
style=
"background:#32A1F6;"
v-else
@
click=
"goOtherPage('HaveJoinedGame')"
>
查看详情
</div>
<div
class=
"card-btn"
:style=
"item.status!==1?'background:#32A1F6;':''"
v-else
@
click=
"goWhereDetail(item)"
>
{{
item
.
status
===
1
?
'已报名'
:
'查看详情'
}}
</div>
</div>
</div>
</
template
>
<
script
>
import
NoticeBonus
from
"@/components/NoticeBonus.vue"
;
import
Free
from
"@/components/Free.vue"
;
import
Modal
from
"@/components/Modal.vue"
;
import
PayFailModal
from
"@/components/PayFailModal.vue"
;
import
{
dakaPay
,
track
,
userCards
,
daka_index
...
...
@@ -71,24 +51,16 @@
export
default
{
name
:
"SignUp"
,
components
:
{
NoticeBonus
,
Modal
,
Free
,
PayFailModal
NoticeBonus
},
data
()
{
return
{
contract_data
:
{},
showFreeModal
:
false
,
modalTitle
:
""
,
modalDesc
:
""
,
modalShown
:
false
,
current_date
:
{},
isShowPayFail
:
false
,
isFollow
:
false
,
gameList
:
[],
choosedLevel
:
0
choosedLevel
:
2
}
},
created
()
{
...
...
@@ -97,36 +69,40 @@
methods
:
{
chooseGameLevel
(
level
)
{
this
.
choosedLevel
=
level
;
this
.
getPageData
(
level
);
},
goOtherPage
(
pageName
)
{
this
.
$router
.
push
({
name
:
pageName
});
},
goWhereDetail
(
item
)
{
if
(
item
.
status
===
1
&&
item
.
already_join
===
1
)
{
// 已报名
this
.
$router
.
push
({
name
:
'HaveJoinedGame'
,
query
:
{
week
:
item
.
week
}
});
}
else
{
// 比赛中或者已结束
if
(
item
.
already_join
===
1
)
{
// 已报名
this
.
$router
.
push
({
name
:
'HaveJoinedGame'
,
query
:
{
week
:
item
.
week
}
});
}
else
{
// 未报名
sessionStorage
.
setItem
(
'ChallengeDetailData'
,
JSON
.
stringify
(
item
));
this
.
$router
.
push
({
name
:
'ChallengeDetail'
});
}
}
},
getPageData
(
grade
=
1
)
{
daka_index
(
grade
).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
this
.
gameList
=
res
.
data
;
console
.
log
(
this
.
gameList
)
}
})
},
togglePayFail
()
{
this
.
isShowPayFail
=
!
this
.
isShowPayFail
},
showSuccess
()
{
this
.
showModal
(
"温馨提示"
,
"报名成功"
,
{
scb
:
()
=>
{
if
(
this
.
isFollow
==
1
)
{
this
.
$router
.
push
({
name
:
"Read"
})
}
else
{
this
.
$router
.
push
({
name
:
"Success"
})
}
}
});
},
confirmModal
(
scb
)
{
scb
&&
scb
()
this
.
modalShown
=
false
;
},
showFree
(
e
)
{
e
.
stopPropagation
();
track
(
"free_contract_show"
);
...
...
@@ -159,72 +135,6 @@
this
.
showFreeModal
=
true
;
});
},
closeFree
()
{
this
.
showFreeModal
=
false
;
},
showModal
(
title
,
desc
,
option
)
{
this
.
modalTitle
=
title
||
""
;
this
.
modalDesc
=
desc
||
""
;
this
.
modalOption
=
option
||
{}
this
.
modalShown
=
true
;
},
closeModal
()
{
this
.
modalShown
=
false
;
},
payToSign
()
{
dakaPay
().
then
(
response
=>
{
this
.
current_date
=
new
Date
(
response
.
date
);
if
(
response
.
code
==
1
)
{
this
.
showModal
(
"温馨提示"
,
response
.
msg
);
return
;
}
let
result
=
response
.
data
;
console
.
log
(
"请求打卡支付数据"
,
result
);
if
(
result
)
{
WeixinJSBridge
.
invoke
(
"getBrandWCPayRequest"
,
{
appId
:
result
.
appId
,
//公众号名称,由商户传入
timeStamp
:
`
${
result
.
timeStamp
}
`
,
//时间戳,自1970年以来的秒数
nonceStr
:
result
.
nonceStr
,
//随机串
package
:
result
.
package
,
signType
:
result
.
signType
,
//微信签名方式:
paySign
:
result
.
paySign
//微信签名
},
// result,
res
=>
{
console
.
log
(
"支付调用结果"
,
res
);
if
(
res
.
err_msg
==
"get_brand_wcpay_request:ok"
)
{
// 使用以上方式判断前端返回,微信团队郑重提示:
//res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
// 支付成功后的回调函数
console
.
log
(
"支付成功"
);
this
.
showModal
(
"温馨提示"
,
"报名成功"
,
{
scb
:
()
=>
{
if
(
this
.
isFollow
==
1
)
{
this
.
$router
.
push
({
name
:
"Read"
})
}
else
{
this
.
$router
.
push
({
name
:
"Success"
})
}
}
});
// this.dateSelect(2);
// localStorage.setItem("is_every", 0)
// location.replace("#/Success");
}
if
(
res
.
err_msg
==
"get_brand_wcpay_request:fail"
)
{
// this.showModal("温馨提示", "支付服务繁忙,请稍后重试");
this
.
togglePayFail
()
}
if
(
res
.
err_msg
==
"get_brand_wcpay_request:cancel"
)
{
// console.log("支付取消");
this
.
togglePayFail
()
}
}
);
}
});
},
}
}
</
script
>
...
...
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