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
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
<
template
>
<
template
>
<view>
<view
class=
"bound-test"
>
<u-button
type=
"primary"
@
click=
"payOrder"
>
微信支付测试
</u-button>
<u-navbar
back-icon-color=
"#FFFFFF"
background=
"transparent"
title=
" "
titleColor=
"#FFFFFF"
:border-bottom=
"false"
title-bold
></u-navbar>
<image
class=
"background-image"
:src=
"zhutuImage"
></image>
<view
class=
"head-view"
>
<view
class=
"head-tip"
>
8年题库沉淀,省时省力考高分
</view>
<view
class=
"content-text"
>
{{
info
.
title
}}
</view>
</view>
<view
class=
"body-view"
>
<view
class=
"title-view"
>
{{
info
.
title
}}
</view>
<view
class=
"message-view"
>
8年题库沉淀,省时省力考高分
</view>
<view
class=
"tip-view"
>
• 有效期90天,自购买或者绑卡后答题激活为起始日期
</view
>
<view
class=
"price-view"
>
<view
class=
"left-view"
>
<view
class=
"discount-view"
>
¥
<text
class=
"count-text"
>
{{
info
.
discount
}}
</text
>
元/套
</view>
<view
class=
"money-view"
><text
class=
"money-text"
>
¥
{{
info
.
money
}}
元/套
</text
><view
class=
"line-view"
></view>
</view>
</view>
<u-button
:customStyle=
"buyButtonStyle"
@
click=
"handleClickBuy"
type=
"primary"
>
立即购买
</u-button>
</view>
<view
class=
"detail-view"
>
<image
class=
"title-image"
:src=
"tikuxinxiImage"
></image>
<view
class=
"question-bank-view"
>
<view
class=
"outline-view "
>
本题库共
<text
class=
"count"
>
{{
info
.
total
}}
</text>
道教研组精编考题,专业老师会根据各地政策不断更新优化题库
</view
>
<view
class=
"items-view"
>
<view
v-for=
"(item, index) in subItems"
:key=
"index"
class=
"sub-content-item"
>
<view
class=
"sub-image"
>
<image
class=
"image"
:src=
"item.icon"
></image>
</view>
<view>
{{
item
.
title
}}
</view>
<view
class=
"value-view"
>
{{
item
.
value
}}
道
</view>
</view>
</view>
</view>
<image
class=
"title-image"
:src=
"shiherenqunImage"
></image>
<view
class=
"crowd-view"
>
<view
class=
"outline-view "
>
课程适合以下3类人群
</view>
<image
v-for=
"(item, index) in images"
:src=
"item"
:key=
"index"
class=
"crowd-image"
></image>
</view>
</view>
</view>
<view
class=
"bottom-view"
>
<u-button
:customStyle=
"buttonStyle"
@
click=
"handleClick"
type=
"primary"
shape=
"circle"
>
持卡用户绑定
</u-button>
</view>
</view>
</view>
</
template
>
</
template
>
<
script
>
<
script
>
import
md5
from
'@/common/md5.js'
export
default
{
export
default
{
components
:
{},
data
()
{
data
()
{
return
{
return
{
lists
:
[
info
:
{
{
title
:
'高处安装、维护、拆除作业人员题库'
,
questionWarehouseId
:
1
,
money
:
80.0
,
amount
:
0.01
,
discount
:
30.0
,
count
:
1
,
singleChoice
:
128
,
},
multipleChoice
:
322
,
],
trueOrFalse
:
526
,
total
:
986
,
},
}
}
},
},
methods
:
{
payOrder
()
{
computed
:
{
const
data
=
{
detail01Image
()
{
instrtutionId
:
1
,
return
process
.
uniEnv
.
qn_base_url
+
'detail01.png'
orders
:
JSON
.
stringify
(
this
.
lists
),
},
openId
:
this
.
openId
,
detail02Image
()
{
return
process
.
uniEnv
.
qn_base_url
+
'detail02.png'
},
detail03Image
()
{
return
process
.
uniEnv
.
qn_base_url
+
'detail03.png'
},
shiherenqunImage
()
{
return
process
.
uniEnv
.
qn_base_url
+
'shiherenqun.png'
},
tikuxinxiImage
()
{
return
process
.
uniEnv
.
qn_base_url
+
'tikuxinxi.png'
},
danxuanImage
()
{
return
process
.
uniEnv
.
qn_base_url
+
'danxuan.png'
},
duoxuanImage
()
{
return
process
.
uniEnv
.
qn_base_url
+
'duoxuan.png'
},
panduanmage
()
{
return
process
.
uniEnv
.
qn_base_url
+
'panduan.png'
},
zhutuImage
()
{
return
process
.
uniEnv
.
qn_base_url
+
'zhutu.png'
},
images
()
{
return
[
this
.
detail01Image
,
this
.
detail02Image
,
this
.
detail03Image
]
},
buttonStyle
()
{
return
{
height
:
'104rpx'
,
backgroundColor
:
'#2953FF'
,
color
:
'#FFFFFF'
,
fontSize
:
'32rpx'
,
fontWeight
:
'bold'
,
}
}
this
.
$u
.
api
.
payOrder
(
data
).
then
((
res
)
=>
{
this
.
pay
(
res
)
})
},
},
pay
(
data
)
{
buyButtonStyle
()
{
const
timeStamp
=
String
(
Date
.
now
())
return
{
const
paySign
=
md5
width
:
'160rpx'
,
.
hexMD5
(
height
:
'64rpx'
,
`appId=wxd1d6eede324b0465&nonceStr=
${
data
.
nonce_str
}
&package=prepay_id=
${
data
.
prepay_id
}
&signType=MD5&timeStamp=
${
timeStamp
}
&key=weixiuhui20151a2b3c4d5e6f7g8h9ij`
backgroundColor
:
'#2953FF'
,
)
color
:
'#FFFFFF'
,
.
toUpperCase
()
fontSize
:
'26rpx'
,
borderRadius
:
'12rpx'
,
uni
.
requestPayment
({
}
provider
:
'wxpay'
,
},
timeStamp
:
timeStamp
,
subItems
()
{
nonceStr
:
data
.
nonce_str
,
return
[
package
:
`prepay_id=
${
data
.
prepay_id
}
`
,
{
signType
:
'MD5'
,
title
:
'单选题'
,
paySign
:
paySign
,
value
:
'128'
,
success
:
(
res
)
=>
{
icon
:
this
.
danxuanImage
,
console
.
log
(
'success:'
+
JSON
.
stringify
(
res
))
this
.
checkPayStatus
(
data
.
out_trade_no
)
},
},
fail
:
(
err
)
=>
{
{
console
.
log
(
'fail:'
+
JSON
.
stringify
(
err
))
title
:
'判断题'
,
if
(
err
.
errMsg
===
'requestPayment:fail cancel'
)
{
value
:
'526'
,
this
.
$u
.
toast
(
'取消支付'
)
icon
:
this
.
panduanmage
,
}
else
{
this
.
checkPayStatus
(
data
.
out_trade_no
)
}
},
},
{
title
:
'多选题'
,
value
:
'322'
,
icon
:
this
.
duoxuanImage
,
},
]
},
},
onLoad
()
{},
methods
:
{
handleClick
()
{
uni
.
switchTab
({
url
:
'/pages/index/index'
,
})
})
},
},
checkPayStatus
(
no
)
{
handleClickBuy
()
{},
const
params
=
{
},
outTradeNo
:
no
}
</
script
>
<
style
lang=
"scss"
scoped
>
::-webkit-scrollbar
{
width
:
0
;
height
:
0
;
color
:
transparent
;
display
:
none
;
}
.bound-test
{
display
:
flex
;
flex-direction
:
column
;
height
:
100vh
;
position
:
relative
;
.background-image
{
position
:
absolute
;
width
:
100%
;
height
:
520rpx
;
z-index
:
-1
;
}
.head-view
{
padding
:
20rpx
180rpx
60rpx
30rpx
;
.head-tip
{
color
:
#ffffff
;
font-size
:
26rpx
;
margin-bottom
:
10rpx
;
}
.content-text
{
font-size
:
48rpx
;
font-weight
:
bold
;
color
:
#ffffff
;
}
}
.body-view
{
border-radius
:
24rpx
24rpx
0
0
;
background-color
:
#ffffff
;
height
:
100%
;
overflow
:
auto
;
.title-view
{
color
:
#191c27
;
font-size
:
36rpx
;
font-weight
:
bold
;
padding
:
30rpx
30rpx
0
30rpx
;
}
.message-view
{
color
:
#9ea5bb
;
font-size
:
26rpx
;
margin
:
16rpx
24rpx
30rpx
24rpx
;
}
.tip-view
{
background-color
:
rgba
(
41
,
83
,
255
,
0
.1
);
color
:
#2953ff
;
font-size
:
26rpx
;
border-radius
:
4rpx
;
height
:
56rpx
;
line-height
:
56rpx
;
padding-left
:
14rpx
;
margin
:
0
24rpx
;
}
.price-view
{
display
:
flex
;
justify-content
:
space-between
;
align-items
:
center
;
margin
:
40rpx
24rpx
50rpx
34rpx
;
.left-view
{
display
:
flex
;
align-items
:
flex-end
;
.discount-view
{
font-size
:
24rpx
;
color
:
#fa5a49
;
font-weight
:
bold
;
.count-text
{
font-size
:
60rpx
;
}
}
.money-view
{
position
:
relative
;
.money-text
{
font-size
:
24rpx
;
color
:
#5a6073
;
font-weight
:
bold
;
}
.line-view
{
position
:
absolute
;
height
:
2rpx
;
background-color
:
#5a6073
;
top
:
22rpx
;
width
:
100%
;
}
}
}
}
.detail-view
{
background-color
:
#f7f9fc
;
border-radius
:
24rpx
24rpx
0
0
;
text-align
:
center
;
padding
:
56rpx
30rpx
;
.title-image
{
width
:
416rpx
;
height
:
72rpx
;
}
}
this
.
$u
.
api
.
payQuery
(
params
).
then
(
res
=>
{
.question-bank-view
{
if
(
res
.
trade_state
===
'SUCCESS'
)
{
margin
:
56rpx
0
80rpx
0
;
this
.
$u
.
toast
(
'支付成功'
)
background-color
:
#ffffff
;
}
else
if
(
res
.
trade_state
===
'NOTPAY'
)
{
border-radius
:
24rpx
;
this
.
$u
.
toast
(
'请稍后核实订单状态,不要重复发起支付'
)
padding
:
56rpx
30rpx
;
}
else
if
(
res
.
trade_state
===
'PAYERROR'
)
{
.outline-view
{
this
.
$u
.
toast
(
'支付失败'
)
color
:
#5a6073
;
}
else
{
font-size
:
28rpx
;
this
.
$u
.
toast
(
res
.
trade_state_desc
)
margin-bottom
:
58rpx
;
.count
{
color
:
#2953ff
;
}
}
}
})
.items-view
{
display
:
flex
;
justify-content
:
space-between
;
align-items
:
center
;
.sub-content-item
{
color
:
#5a6073
;
font-size
:
26rpx
;
display
:
flex
;
justify-content
:
space-between
;
flex-direction
:
column
;
align-items
:
center
;
background-color
:
rgba
(
41
,
83
,
255
,
0
.1
);
width
:
180rpx
;
height
:
240rpx
;
border-radius
:
12rpx
;
padding
:
40rpx
0
;
.sub-image
{
margin-bottom
:
20rpx
;
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
.image
{
width
:
64rpx
;
height
:
64rpx
;
}
}
.value-view
{
font-size
:
32rpx
;
font-weight
:
bold
;
color
:
#2953ff
;
margin-top
:
10rpx
;
}
}
}
}
.crowd-view
{
margin-top
:
56rpx
;
background-color
:
#ffffff
;
border-radius
:
24rpx
;
padding
:
56rpx
30rpx
;
.outline-view
{
font-size
:
28rpx
;
color
:
#5a6073
;
margin-bottom
:
32rpx
;
}
.crowd-image
{
width
:
622rpx
;
height
:
120rpx
;
margin-top
:
24rpx
;
}
}
}
}
},
}
.bottom-view
{
padding
:
36rpx
24rpx
44rpx
24rpx
;
}
}
}
</
script
>
</
style
>
<
style
lang=
"scss"
scoped
></
style
>
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