Commit c814ffbb authored by Damon's avatar Damon

Merge branch 'dev-v1.0.0' of git.banshouhui.com:wuzhenzhe/study into dev-v1.0.0

parents 701804be 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
} }
}, },
{ {
...@@ -124,6 +127,16 @@ ...@@ -124,6 +127,16 @@
"enablePullDownRefresh": false, "enablePullDownRefresh": false,
"disableScroll": true "disableScroll": true
} }
},
{
"path": "boundTest",
"name": "learnBoundTest",
"style": {
"navigationBarTitleText": "绑定试题",
"navigationStyle": "custom",
"enablePullDownRefresh": false,
"disableScroll": true
}
} }
] ]
}, },
......
<template>
<view class="bound-test">
<u-navbar
back-icon-color="#191C27"
background="transparent"
title="绑定试题"
titleColor="#191C27"
:border-bottom="false"
title-bold
></u-navbar>
<view class="body-view">
<image class="image-view" :src="successImage"></image>
<view class="content-view">学习卡已绑定成功</view>
<view class="tip-view">可以前往首页进行答题或模拟考试学习</view>
<view class="bottom-view">
<u-button
:customStyle="buttonStyle"
@click="handleClick"
type="primary"
shape="circle"
>
去首页
</u-button>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {}
},
computed: {
labels() {
return {
kemu: '考试科目',
tishu: '考试题数',
biaozhun: '合格标准',
guize: '出题规则',
}
},
successImage() {
return process.uniEnv.qn_base_url + 'shenqingtijiaochenggong.png'
},
buttonStyle() {
return {
height: '104rpx',
width: '400rpx',
backgroundColor: '#2953FF',
color: '#FFFFFF',
fontSize: '32rpx',
fontWeight: 'bold',
}
},
},
onLoad() {},
methods: {
handleClick() {
uni.switchTab({
url: '/pages/index/index',
})
},
},
}
</script>
<style lang="scss" scoped>
::-webkit-scrollbar {
width: 0;
height: 0;
color: transparent;
display: none;
}
.bound-test {
display: flex;
flex-direction: column;
background-image: linear-gradient(to top, #f7f9fc 0%, #e9f3ff 50%);
background-color: #f7f9fc;
background-size: 100% 520rpx;
background-repeat: no-repeat;
height: 100vh;
.body-view {
height: 100%;
overflow: auto;
padding-top: 100rpx;
text-align: center;
.image-view {
margin-top: 100rpx;
width: 224rpx;
height: 224rpx;
}
.content-view {
font-size: 40rpx;
color: #2953ff;
font-weight: bold;
}
.tip-view {
font-size: 26rpx;
color: #9ea5bb;
margin-top: 10rpx;
}
.bottom-view {
margin-top: 180rpx;
}
}
}
</style>
<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>
<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>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment