Commit 7faaaa7a authored by Facius's avatar Facius

improvement: 绑卡

parent 08c6a60b
const UNI_APP = { const UNI_APP = {
apiUrl: 'http://192.168.0.204:8760', apiUrl: 'http://192.168.0.208:8760',
qn_base_url: 'https://qn-static.banshouhui.com/study/', qn_base_url: 'https://qn-static.banshouhui.com/study/',
qn_asset_url: 'http://deudn.c.pp.cc/', qn_asset_url: 'http://deudn.c.pp.cc/',
uCenterUrl: 'http://192.168.0.5:8093/',//'http://rest-u.yunya.com/' uCenterUrl: 'http://192.168.0.5:8093/', //'http://rest-u.yunya.com/'
argoDebugMode: 1, argoDebugMode: 1,
version: 'v1.0.0', version: 'v1.0.0',
} }
......
...@@ -78,6 +78,9 @@ let learnApiFun = function(vm) { ...@@ -78,6 +78,9 @@ let learnApiFun = function(vm) {
// 学员获取自己的题库 // 学员获取自己的题库
let getMyQuestionWarehouseList = async (params = {}) => let getMyQuestionWarehouseList = async (params = {}) =>
await vm.$u.get('/rest/question/query/getMyQuestionWarehouseList', params) await vm.$u.get('/rest/question/query/getMyQuestionWarehouseList', params)
let bindCard = async (params = {}) =>
await vm.$u.post('/rest/card/bind', params)
const learnApi = { const learnApi = {
getQuestion, getQuestion,
getQuestionTotal, getQuestionTotal,
...@@ -97,6 +100,7 @@ let learnApiFun = function(vm) { ...@@ -97,6 +100,7 @@ let learnApiFun = function(vm) {
queryExamRecord, queryExamRecord,
queryExamRecordOne, queryExamRecordOne,
getMyQuestionWarehouseList, getMyQuestionWarehouseList,
bindCard,
} }
return learnApi return learnApi
} }
......
...@@ -152,7 +152,9 @@ export default { ...@@ -152,7 +152,9 @@ export default {
this.detail.questionWarehouse && this.detail.questionWarehouse.cardId, this.detail.questionWarehouse && this.detail.questionWarehouse.cardId,
provinceName: this.provinceName, provinceName: this.provinceName,
experience: experience:
this.selected.state && !this.detail.questionWarehouse.cardId this.selected.state &&
(!this.detail.questionWarehouse ||
!this.detail.questionWarehouse.cardId)
? true ? true
: false, : false,
pass: this.$u.random(95, 99) + '%', pass: this.$u.random(95, 99) + '%',
......
...@@ -74,7 +74,7 @@ export default { ...@@ -74,7 +74,7 @@ export default {
} }
}, },
}, },
onLoad() {}, onLoad(e) {},
methods: { methods: {
handleClick() { handleClick() {
wx.scanCode({ wx.scanCode({
...@@ -83,7 +83,7 @@ export default { ...@@ -83,7 +83,7 @@ export default {
console.log(res) console.log(res)
if (res.result) { if (res.result) {
this.$u.route({ this.$u.route({
url: 'pages/learn/manualBinding', url: 'pages/learn/boundTest',
params: { params: {
code: res.result, code: res.result,
}, },
...@@ -93,7 +93,11 @@ export default { ...@@ -93,7 +93,11 @@ export default {
}) })
}, },
handleClickBuy() {}, handleClickBuy() {},
handleChange() {}, handleChange() {
this.$u.route({
url: 'pages/learn/manualBinding',
})
},
}, },
} }
</script> </script>
...@@ -132,7 +136,7 @@ export default { ...@@ -132,7 +136,7 @@ export default {
.first-line { .first-line {
display: flex; display: flex;
align-items: center; align-items: center;
margin-bottom: 56rpx; margin-bottom: 50rpx;
.blue-text { .blue-text {
color: #2953ff; color: #2953ff;
......
...@@ -9,27 +9,34 @@ ...@@ -9,27 +9,34 @@
title-bold title-bold
></u-navbar> ></u-navbar>
<view class="body-view"> <view class="body-view">
<image class="image-view" :src="successImage"></image> <!-- <image class="image-view" :src="successImage"></image> -->
<view class="content-view">学习卡已绑定成功</view> <view class="content-view">是否绑定该学习卡</view>
<view class="tip-view">可以前往首页进行答题或模拟考试学习</view> <view class="tip-view">学习卡完成绑定后,不支持解绑操作</view>
<view class="bottom-view"> <view class="bottom-view">
<u-button <u-button
:customStyle="buttonStyle" :customStyle="buttonStyle"
@click="handleClick" @click="handleClick"
type="primary" type="primary"
shape="circle" shape="circle"
:loading="loading"
> >
去首页 绑定
</u-button> </u-button>
</view> </view>
</view> </view>
<view>
<u-toast ref="uToast" />
</view>
</view> </view>
</template> </template>
<script> <script>
export default { export default {
data() { data() {
return {} return {
loading: false,
param: { cardNumber: '', cardSecret: '' },
}
}, },
computed: { computed: {
...@@ -41,9 +48,9 @@ export default { ...@@ -41,9 +48,9 @@ export default {
guize: '出题规则', guize: '出题规则',
} }
}, },
successImage() { // successImage() {
return process.uniEnv.qn_base_url + 'shenqingtijiaochenggong.png' // return process.uniEnv.qn_base_url + 'shenqingtijiaochenggong.png'
}, // },
buttonStyle() { buttonStyle() {
return { return {
height: '104rpx', height: '104rpx',
...@@ -55,12 +62,43 @@ export default { ...@@ -55,12 +62,43 @@ export default {
} }
}, },
}, },
onLoad() {}, onLoad(e) {
e = {}
e.code = '621001500006600c7m1dp8z2'
if (e && e.code) {
var code = e.code
this.param.cardNumber = code.slice(0, 15)
this.param.cardSecret = code.slice(15)
}
this.param.questionWarehouseId = this.questionWarehouseId
},
methods: { methods: {
handleClick() { handleClick() {
uni.switchTab({ // 获取题库列表
url: '/pages/index/index', this.loading = true
}) this.$u.api
.bindCard(this.param)
.then((res) => {
console.log('--------res--------', res)
uni.switchTab({
url: '/pages/index/index',
})
})
.catch((err) => {
this.loading = false
console.log(err)
this.$refs.uToast.show({
title: err.msg,
type: 'error',
})
})
},
setPageInfo(info) {
var pages = getCurrentPages()
if (pages.length >= 2) {
var page = pages[pages.length - 2]
page.info = info
}
}, },
}, },
} }
...@@ -84,13 +122,13 @@ export default { ...@@ -84,13 +122,13 @@ export default {
.body-view { .body-view {
height: 100%; height: 100%;
overflow: auto; overflow: auto;
padding-top: 100rpx; padding-top: 200rpx;
text-align: center; text-align: center;
.image-view { // .image-view {
margin-top: 100rpx; // margin-top: 100rpx;
width: 224rpx; // width: 224rpx;
height: 224rpx; // height: 224rpx;
} // }
.content-view { .content-view {
font-size: 40rpx; font-size: 40rpx;
color: #2953ff; color: #2953ff;
...@@ -99,7 +137,7 @@ export default { ...@@ -99,7 +137,7 @@ export default {
.tip-view { .tip-view {
font-size: 26rpx; font-size: 26rpx;
color: #9ea5bb; color: #9ea5bb;
margin-top: 10rpx; margin-top: 14rpx;
} }
.bottom-view { .bottom-view {
margin-top: 180rpx; margin-top: 180rpx;
......
...@@ -180,7 +180,7 @@ export default { ...@@ -180,7 +180,7 @@ export default {
] ]
}, },
}, },
onLoad() {}, onLoad(e) {},
methods: { methods: {
handleClick() { handleClick() {
this.$u.route({ this.$u.route({
...@@ -194,7 +194,7 @@ export default { ...@@ -194,7 +194,7 @@ export default {
openId: this.openId, openId: this.openId,
} }
uni.showLoading({ uni.showLoading({
title: '加载中' title: '加载中',
}) })
this.$u.api.payOrder(data).then((res) => { this.$u.api.payOrder(data).then((res) => {
uni.hideLoading() uni.hideLoading()
...@@ -228,7 +228,7 @@ export default { ...@@ -228,7 +228,7 @@ export default {
outTradeNo: no, outTradeNo: no,
} }
uni.showLoading({ uni.showLoading({
title: '支付中' title: '支付中',
}) })
this.$u.api.payQuery(params).then((res) => { this.$u.api.payQuery(params).then((res) => {
uni.hideLoading() uni.hideLoading()
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<view class="field-view"> <view class="field-view">
<input <input
type="number" type="number"
class="input-code" class="input-view"
:value="code" :value="code"
placeholder="请输入卡号" placeholder="请输入卡号"
:placeholder-style="placeplaceholderStyle" :placeholder-style="placeplaceholderStyle"
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
<view class="field-title">学习卡密码</view> <view class="field-title">学习卡密码</view>
<view class="field-view"> <view class="field-view">
<input <input
class="input-password" class="input-view"
password password
:value="password" :value="password"
placeholder="请输入密码" placeholder="请输入密码"
...@@ -54,6 +54,9 @@ ...@@ -54,6 +54,9 @@
> >
</view> </view>
</view> </view>
<view>
<u-toast ref="uToast" />
</view>
</view> </view>
</template> </template>
...@@ -95,7 +98,32 @@ export default { ...@@ -95,7 +98,32 @@ export default {
}, },
onLoad(e) {}, onLoad(e) {},
methods: { methods: {
handleClick() {}, handleClick() {
// 获取题库列表
this.loading = true
this.$u.api
.bindCard(this.param)
.then((res) => {
uni.switchTab({
url: '/pages/index/index',
})
})
.catch((err) => {
this.loading = false
console.log(err)
this.$refs.uToast.show({
title: err.msg,
type: 'error',
})
})
},
setPageInfo(info) {
var pages = getCurrentPages()
if (pages.length >= 2) {
var page = pages[pages.length - 2]
page.info = info
}
},
}, },
} }
</script> </script>
...@@ -146,6 +174,10 @@ export default { ...@@ -146,6 +174,10 @@ export default {
justify-content: center; justify-content: center;
border-right: 12rpx; border-right: 12rpx;
padding: 0 24rpx; padding: 0 24rpx;
.input-view {
width: 100%;
text-align: center;
}
} }
} }
......
...@@ -84,10 +84,10 @@ export default { ...@@ -84,10 +84,10 @@ export default {
}) })
}, },
// 获取题库列表 // 获取题库列表
async loadList() { loadList() {
this.loading = true this.loading = true
let param = {} let param = {}
let res = await this.$u.api this.$u.api
.getMyQuestionWarehouseList(param) .getMyQuestionWarehouseList(param)
.then((res) => { .then((res) => {
this.loading = false this.loading = false
......
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