Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
study
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
Damon
study
Commits
ea133e80
Commit
ea133e80
authored
Jul 19, 2021
by
Facius
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 题库详情页面
parent
305eebad
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
425 additions
and
62 deletions
+425
-62
pages.json
src/pages.json
+4
-1
detail copy.vue
src/pages/learn/detail copy.vue
+81
-0
detail.vue
src/pages/learn/detail.vue
+340
-61
No files found.
src/pages.json
View file @
ea133e80
...
@@ -62,7 +62,10 @@
...
@@ -62,7 +62,10 @@
"path"
:
"detail"
,
"path"
:
"detail"
,
"name"
:
"learnDetail"
,
"name"
:
"learnDetail"
,
"style"
:
{
"style"
:
{
"navigationBarTitleText"
:
"题库详情"
"navigationBarTitleText"
:
""
,
//
题库详情
"navigationStyle"
:
"custom"
,
"enablePullDownRefresh"
:
false
,
"disableScroll"
:
true
}
}
},
},
{
{
...
...
src/pages/learn/detail copy.vue
0 → 100644
View file @
ea133e80
<
template
>
<view>
<u-button
type=
"primary"
@
click=
"payOrder"
>
微信支付测试
</u-button>
</view>
</
template
>
<
script
>
import
md5
from
'@/common/md5.js'
export
default
{
components
:
{},
data
()
{
return
{
lists
:
[
{
questionWarehouseId
:
1
,
amount
:
0.01
,
count
:
1
,
},
],
}
},
methods
:
{
payOrder
()
{
const
data
=
{
instrtutionId
:
1
,
orders
:
JSON
.
stringify
(
this
.
lists
),
openId
:
this
.
openId
,
}
this
.
$u
.
api
.
payOrder
(
data
).
then
((
res
)
=>
{
this
.
pay
(
res
)
})
},
pay
(
data
)
{
const
timeStamp
=
String
(
Date
.
now
())
const
paySign
=
md5
.
hexMD5
(
`appId=wxd1d6eede324b0465&nonceStr=
${
data
.
nonce_str
}
&package=prepay_id=
${
data
.
prepay_id
}
&signType=MD5&timeStamp=
${
timeStamp
}
&key=weixiuhui20151a2b3c4d5e6f7g8h9ij`
)
.
toUpperCase
()
uni
.
requestPayment
({
provider
:
'wxpay'
,
timeStamp
:
timeStamp
,
nonceStr
:
data
.
nonce_str
,
package
:
`prepay_id=
${
data
.
prepay_id
}
`
,
signType
:
'MD5'
,
paySign
:
paySign
,
success
:
(
res
)
=>
{
console
.
log
(
'success:'
+
JSON
.
stringify
(
res
))
this
.
checkPayStatus
(
data
.
out_trade_no
)
},
fail
:
(
err
)
=>
{
console
.
log
(
'fail:'
+
JSON
.
stringify
(
err
))
if
(
err
.
errMsg
===
'requestPayment:fail cancel'
)
{
this
.
$u
.
toast
(
'取消支付'
)
}
else
{
this
.
checkPayStatus
(
data
.
out_trade_no
)
}
},
})
},
checkPayStatus
(
no
)
{
const
params
=
{
outTradeNo
:
no
}
this
.
$u
.
api
.
payQuery
(
params
).
then
(
res
=>
{
if
(
res
.
trade_state
===
'SUCCESS'
)
{
this
.
$u
.
toast
(
'支付成功'
)
}
else
if
(
res
.
trade_state
===
'NOTPAY'
)
{
this
.
$u
.
toast
(
'请稍后核实订单状态,不要重复发起支付'
)
}
else
if
(
res
.
trade_state
===
'PAYERROR'
)
{
this
.
$u
.
toast
(
'支付失败'
)
}
else
{
this
.
$u
.
toast
(
res
.
trade_state_desc
)
}
})
}
},
}
</
script
>
<
style
lang=
"scss"
scoped
></
style
>
src/pages/learn/detail.vue
View file @
ea133e80
This diff is collapsed.
Click to expand it.
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