Commit 3d294a13 authored by Facius's avatar Facius

improvement: 首页刷新

parent 56908c89
...@@ -86,7 +86,9 @@ let learnApiFun = function(vm) { ...@@ -86,7 +86,9 @@ let learnApiFun = function(vm) {
`/rest/question/searchQuestion/${params.questionWarehouseId}`, `/rest/question/searchQuestion/${params.questionWarehouseId}`,
params params
) )
// 检查是否具有体验资格
let checkGetQuestion = async (questionWarehouseId) =>
await vm.$u.get('/rest/question/checkGetQuestion/' + questionWarehouseId)
const learnApi = { const learnApi = {
getQuestion, getQuestion,
getQuestionTotal, getQuestionTotal,
...@@ -108,6 +110,7 @@ let learnApiFun = function(vm) { ...@@ -108,6 +110,7 @@ let learnApiFun = function(vm) {
getMyQuestionWarehouseList, getMyQuestionWarehouseList,
bindCard, bindCard,
searchQuestion, searchQuestion,
checkGetQuestion,
} }
return learnApi return learnApi
} }
......
...@@ -113,6 +113,7 @@ export default { ...@@ -113,6 +113,7 @@ export default {
data: {}, data: {},
relationId: 0, // 绑卡用 relationId: 0, // 绑卡用
loading: false, loading: false,
canExperience: false, // 体验资格
} }
}, },
computed: { computed: {
...@@ -166,12 +167,7 @@ export default { ...@@ -166,12 +167,7 @@ export default {
cardId: cardId:
this.detail.questionWarehouse && this.detail.questionWarehouse.cardId, this.detail.questionWarehouse && this.detail.questionWarehouse.cardId,
provinceName: this.provinceName, provinceName: this.provinceName,
experience: experience: this.canExperience,
this.selected.state &&
(!this.detail.questionWarehouse ||
!this.detail.questionWarehouse.cardId)
? true
: false,
pass: this.$u.random(95, 99) + '%', pass: this.$u.random(95, 99) + '%',
days: this.detail.totalDayCount || 0, days: this.detail.totalDayCount || 0,
today: this.detail.todayCount || 0, today: this.detail.todayCount || 0,
...@@ -250,7 +246,7 @@ export default { ...@@ -250,7 +246,7 @@ export default {
}, },
}, },
onLoad() { onLoad() {
this.initData() this.getProvinceList()
}, },
onShow() { onShow() {
let pages = getCurrentPages() let pages = getCurrentPages()
...@@ -261,11 +257,8 @@ export default { ...@@ -261,11 +257,8 @@ export default {
page.info = null page.info = null
this.visible = info.state this.visible = info.state
this.queryMyQuestionWarehouseDetail(this.selected.id) this.queryMyQuestionWarehouseDetail(this.selected.id)
} } else {
let refresh = page.refresh this.queryMyQuestionWarehouseDetail(this.info.id || 0)
if (refresh) {
page.refresh = null
this.queryMyQuestionWarehouseDetail(this.info.id)
} }
}, },
methods: { methods: {
...@@ -273,6 +266,21 @@ export default { ...@@ -273,6 +266,21 @@ export default {
this.getProvinceList() this.getProvinceList()
this.queryMyQuestionWarehouseDetail('0') this.queryMyQuestionWarehouseDetail('0')
}, },
// 检查是否具有体验资格
checkGetQuestion(id) {
this.$u.api
.checkGetQuestion(id)
.then((res) => {
console.log('-------checkGet---------------Question----------', res)
this.canExperience = res <= 0
console.log(this.canExperience)
})
.catch((err) => {
console.log('----------------', err)
console.log(err)
})
},
// 题库详情 // 题库详情
queryQuestionWarehouseById(id) { queryQuestionWarehouseById(id) {
this.$u.api this.$u.api
...@@ -305,6 +313,10 @@ export default { ...@@ -305,6 +313,10 @@ export default {
this.queryQuestionWarehouseById( this.queryQuestionWarehouseById(
res.questionWarehouse.questionWarehouseId res.questionWarehouse.questionWarehouseId
) )
if (res.questionWarehouse.questionWarehouseId) {
this.checkGetQuestion(res.questionWarehouse.questionWarehouseId)
}
}) })
.catch((err) => { .catch((err) => {
this.loading = false this.loading = false
...@@ -325,7 +337,7 @@ export default { ...@@ -325,7 +337,7 @@ export default {
// ... // ...
} else if (this.info.id) { } else if (this.info.id) {
if (this.info.experience) { if (this.info.experience) {
this.selected.state = false // this.selected.state = false
// this.$u.vuex('experience', false) // this.$u.vuex('experience', false)
// 体验 // 体验
// 1.顺序答题 2.随机练习 3.模拟考试 4.收藏答题 5.错题答题 6.专项练习-单选 7.专项练习-多选 8.专项练习-判断 9.专项练习-答案是 // 1.顺序答题 2.随机练习 3.模拟考试 4.收藏答题 5.错题答题 6.专项练习-单选 7.专项练习-多选 8.专项练习-判断 9.专项练习-答案是
...@@ -387,7 +399,7 @@ export default { ...@@ -387,7 +399,7 @@ export default {
} }
}, },
handleClickExperience() { handleClickExperience() {
this.selected.state = false // this.selected.state = false
// this.$u.vuex('experience', false) // this.$u.vuex('experience', false)
// 体验 // 体验
// 1.顺序答题 2.随机练习 3.模拟考试 4.收藏答题 5.错题答题 6.专项练习-单选 7.专项练习-多选 8.专项练习-判断 9.专项练习-答案是 // 1.顺序答题 2.随机练习 3.模拟考试 4.收藏答题 5.错题答题 6.专项练习-单选 7.专项练习-多选 8.专项练习-判断 9.专项练习-答案是
......
...@@ -166,6 +166,9 @@ export default { ...@@ -166,6 +166,9 @@ export default {
uni.hideLoading() uni.hideLoading()
if (res.trade_state === 'SUCCESS') { if (res.trade_state === 'SUCCESS') {
this.$u.toast('支付成功') this.$u.toast('支付成功')
uni.switchTab({
url: '/pages/index/index',
})
} else if (res.trade_state === 'NOTPAY') { } else if (res.trade_state === 'NOTPAY') {
this.$u.toast('请稍后核实订单状态,不要重复发起支付') this.$u.toast('请稍后核实订单状态,不要重复发起支付')
} else if (res.trade_state === 'PAYERROR') { } else if (res.trade_state === 'PAYERROR') {
......
...@@ -253,6 +253,9 @@ export default { ...@@ -253,6 +253,9 @@ export default {
uni.hideLoading() uni.hideLoading()
if (res.trade_state === 'SUCCESS') { if (res.trade_state === 'SUCCESS') {
this.$u.toast('支付成功') this.$u.toast('支付成功')
uni.switchTab({
url: '/pages/index/index',
})
} else if (res.trade_state === 'NOTPAY') { } else if (res.trade_state === 'NOTPAY') {
this.$u.toast('请稍后核实订单状态,不要重复发起支付') this.$u.toast('请稍后核实订单状态,不要重复发起支付')
} else if (res.trade_state === 'PAYERROR') { } else if (res.trade_state === 'PAYERROR') {
......
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