Commit afd989c3 authored by Facius's avatar Facius

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

parents cec01ecd 7744dd92
......@@ -110,12 +110,12 @@ export default {
immediate: true
},
model(newVal, oldVal){
if (newVal === 2) this.autoAnswer()
this.changeModel(newVal)
}
},
methods: {
init (defaulaIndex) {
let list = this.list
let list = JSON.parse(JSON.stringify(this.list))
if (list == null || list.length == 0) {
return
}
......@@ -181,21 +181,29 @@ export default {
// 记录滑过来的位置,此值对于下一次滑动的计算很重要
this.swiperIndex = current
if (this.model === 2) {
this.autoAnswer()
this.changeModel()
}
},
autoAnswer() {
this.$set(this.swiperList[this.swiperIndex], 'errShow', true)
this.$set(this.swiperList[this.swiperIndex], 'submitStatus', true)
const info = this.swiperList[this.swiperIndex]
const lists = info.answerList.map(v => {
if (info.rightKey.includes(v.sort)) {
v.checked = true
v.confirm = true
}
return v
})
this.$emit("answerChange", 'pass', lists)
// 切换模式
changeModel(model) {
let info = JSON.parse(JSON.stringify(this.swiperList[this.swiperIndex]))
if (model === 1) {
const item = this.list.find(v => v.index === info.index)
this.$set(this.swiperList, this.swiperIndex, item)
} else {
// 学习模式,显示答案
info.errShow = true
info.answerList.forEach(v => {
if (info.rightKey.includes(v.sort)) {
v.checked = true
v.confirm = true
} else {
v.checked = false
v.confirm = false
}
})
this.$set(this.swiperList, this.swiperIndex, info)
}
},
/**
* 获取初始化的swiperList
......
......@@ -225,6 +225,7 @@ export default {
this.init()
},
methods: {
// 初始化数据
init() {
const params = {
questionWarehouseId: this.questionWarehouseId,
......@@ -251,6 +252,7 @@ export default {
this.refresh(index)
})
},
// 切换
swiperChange(e) {
let current = e.current
this.currentIndex = current
......
......@@ -193,7 +193,11 @@ export default {
orders: JSON.stringify(this.lists),
openId: this.openId,
}
uni.showLoading({
title: '加载中'
})
this.$u.api.payOrder(data).then((res) => {
uni.hideLoading()
this.pay(res)
})
},
......@@ -223,7 +227,11 @@ export default {
const params = {
outTradeNo: no,
}
uni.showLoading({
title: '支付中'
})
this.$u.api.payQuery(params).then((res) => {
uni.hideLoading()
if (res.trade_state === 'SUCCESS') {
this.$u.toast('支付成功')
} else if (res.trade_state === 'NOTPAY') {
......
......@@ -104,7 +104,11 @@ function request({ currentPage, size, onSuccess, onFailed }, vm) {
source: vm.source
}
}
uni.showLoading({
title: '加载中'
})
vm.$u.api.getQuestion(params).then(res => {
uni.hideLoading()
const list = res.records
let data = {}
data.total = res.total
......
......@@ -37,7 +37,11 @@ export default {
avatar: userInfo.avatarUrl,
nickname: userInfo.nickName,
}
uni.showLoading({
title: '加载中'
})
this.$u.api.loginWechatAuth(data).then((res) => {
uni.hideLoading()
this.$u.vuex('vuex_token', res.token)
this.$u.vuex('openId', res.openId)
this.$u.vuex('userInfo', userInfo)
......
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