Commit 291d5d75 authored by Facius's avatar Facius

feat: 接口调试

parent ab9d55c4
;(function() { ;(function() {
let NODE_ENV = 'prod' // dev:开发环境 | test:测试环境 | prod:生产环境 let NODE_ENV = 'dev' // dev:开发环境 | test:测试环境 | prod:生产环境
let ENV_VAR = null let ENV_VAR = null
let VERSION = 'v1.3.0' let VERSION = 'v1.3.0'
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
......
...@@ -6,10 +6,10 @@ let learnApiFun = function(vm) { ...@@ -6,10 +6,10 @@ let learnApiFun = function(vm) {
await vm.$u.post('/rest/question/query/getQuestion', params) await vm.$u.post('/rest/question/query/getQuestion', params)
let getQuestionTotal = async (params = {}) => let getQuestionTotal = async (params = {}) =>
await vm.$u.post('/rest/question/query/getQuestionTotal', params) await vm.$u.post('/rest/V2/question/query/getQuestionTotal', params)
let answer = async (params = {}) => let answer = async (params = {}) =>
await vm.$u.post('/rest/question/save/answer', params) await vm.$u.post('/rest/V2/question/save/answer', params)
// 获取科目 // 获取科目
let subjectList = async (params = {}) => let subjectList = async (params = {}) =>
await vm.$u.get('/rest/question/query/subjectList', params) await vm.$u.get('/rest/question/query/subjectList', params)
...@@ -104,6 +104,22 @@ let learnApiFun = function(vm) { ...@@ -104,6 +104,22 @@ let learnApiFun = function(vm) {
'/rest/question/query/studyRecord/' + questionWarehouseId, '/rest/question/query/studyRecord/' + questionWarehouseId,
params params
) )
// 获取进行中的考试记录
let inProgress = async (params = {}) =>
await vm.$u.get(
'/rest/question/exam/inProgress',
params
)
// 考试暂存
let examSuspend = async (params = {}) =>
await vm.$u.post(`/rest/question/exam/suspend/${params.id}`, params)
// 重新考试,即取消本次记录
let examCancel = async (params = {}) =>
await vm.$u.post(`/rest/question/exam/cancel/${params.id}`, params)
const learnApi = { const learnApi = {
getQuestion, getQuestion,
getQuestionTotal, getQuestionTotal,
...@@ -128,6 +144,9 @@ let learnApiFun = function(vm) { ...@@ -128,6 +144,9 @@ let learnApiFun = function(vm) {
checkGetQuestion, checkGetQuestion,
everyTaskList, everyTaskList,
studyRecord, studyRecord,
inProgress,
examSuspend,
examCancel
} }
return learnApi return learnApi
} }
......
...@@ -6,6 +6,9 @@ ...@@ -6,6 +6,9 @@
mode="center" mode="center"
width="654rpx" width="654rpx"
:mask-close-able="false" :mask-close-able="false"
closeable
close-icon-size="32"
@close="handleClose"
> >
<image <image
:src="tanchuangdingbuImage" :src="tanchuangdingbuImage"
...@@ -129,6 +132,9 @@ export default { ...@@ -129,6 +132,9 @@ export default {
this.changeVisibleValue(false) this.changeVisibleValue(false)
this.$emit('click', this.type) this.$emit('click', this.type)
}, },
handleClose() {
this.changeVisibleValue(false)
}
}, },
} }
</script> </script>
......
...@@ -106,12 +106,12 @@ ...@@ -106,12 +106,12 @@
</view> </view>
<MaskTip <MaskTip
:show.sync="showMask" :show.sync="showMask"
imageName="mengcegn-xuanti.png" imageName="dianjitishi1.png"
:imageStyle="imageStyle0" :imageStyle="imageStyle0"
/> />
<MaskTip <MaskTip
:show.sync="showCountTip" :show.sync="showCountTip"
imageName="mengceng2.png" imageName="dianjitishi4.png"
:imageStyle="imageStyle" :imageStyle="imageStyle"
/> />
</view> </view>
...@@ -147,6 +147,7 @@ export default { ...@@ -147,6 +147,7 @@ export default {
showOrgId: false, // 显示机构id showOrgId: false, // 显示机构id
tipTop: 410, tipTop: 410,
tipTop0: 50, tipTop0: 50,
havingExamination: false // 有进行中的考试
} }
}, },
computed: { computed: {
...@@ -187,10 +188,6 @@ export default { ...@@ -187,10 +188,6 @@ export default {
}, },
] ]
}, },
// 有进行中的考试
havingExamination() {
return false
},
examText() { examText() {
return this.info.cardId ? '/' + this.info.totalExam : '题库进阶练习' return this.info.cardId ? '/' + this.info.totalExam : '题库进阶练习'
}, },
...@@ -294,7 +291,7 @@ export default { ...@@ -294,7 +291,7 @@ export default {
query query
.select('.subject-statistics') .select('.subject-statistics')
.boundingClientRect((data) => { .boundingClientRect((data) => {
this.tipTop = data?.top * 2 + 100 this.tipTop = data?.top * 2 + 72
this.showCountTip = true this.showCountTip = true
}) })
.exec() .exec()
...@@ -325,6 +322,7 @@ export default { ...@@ -325,6 +322,7 @@ export default {
this.queryMyQuestionWarehouseDetail(this.info.id || 0) this.queryMyQuestionWarehouseDetail(this.info.id || 0)
} }
this.chagefinishCount() this.chagefinishCount()
this.getInProgress()
} }
}, },
onUnload() {}, onUnload() {},
...@@ -353,6 +351,7 @@ export default { ...@@ -353,6 +351,7 @@ export default {
.then((res) => { .then((res) => {
this.loading = false this.loading = false
this.data = res || { questionWarehouse: {} } this.data = res || { questionWarehouse: {} }
if (!this.data.questionWarehouse) this.data.questionWarehouse = {}
this.selected = this.data.questionWarehouse this.selected = this.data.questionWarehouse
}) })
.catch((err) => { .catch((err) => {
...@@ -539,36 +538,12 @@ export default { ...@@ -539,36 +538,12 @@ export default {
}, },
// 继续考试 // 继续考试
handleContinue() { handleContinue() {
const params = { this.$u.route({
questionWarehouseId: this.questionWarehouseId, url: '/pages/learn/answer',
paperId: this.info.id, params: {
} recordId: this.havingExamination,
uni.showLoading({ source: 3,
title: '载入试题中', },
})
// 埋点-去模拟考试
let trackParams = {
openId: this.openId,
nickname: this.userInfo.nickName,
...params,
}
getApp().track('applyExam-beginAnswerPage', trackParams)
// 不用调这个获取id的
this.$u.api.applyExam(params).then((res) => {
uni.hideLoading()
if (res) {
this.$u.route({
url: '/pages/learn/answer',
params: {
recordId: res.id,
source: 3,
passPoint: this.info.passPoint,
totalPoint: this.info.totalPoint,
duration: this.info.durationNumber,
},
})
}
}) })
}, },
handleClick(path, params) { handleClick(path, params) {
...@@ -684,6 +659,21 @@ export default { ...@@ -684,6 +659,21 @@ export default {
advertisementId: id, advertisementId: id,
}, },
}) })
},
getInProgress() {
let trackParams = {
openId: this.openId,
nickname: this.userInfo.nickName,
}
getApp().track("handPaper", trackParams)
this.$u.api
.inProgress()
.then((res) => {
// this.havingExamination = res && res.pop().id || false
})
.catch((err) => {
console.log(err)
})
} }
}, },
} }
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
bg-color="" bg-color=""
@end="timeEnd" @end="timeEnd"
@change="timeChange" @change="timeChange"
ref="uCountDown"
></u-count-down ></u-count-down
></view> ></view>
</view> </view>
...@@ -317,12 +318,13 @@ export default { ...@@ -317,12 +318,13 @@ export default {
this.$u.api.getQuestionTotal(params).then((res) => { this.$u.api.getQuestionTotal(params).then((res) => {
// 列表总长度,一定要在第一次请求列表数据前明确该值 // 列表总长度,一定要在第一次请求列表数据前明确该值
// 否则无法知道下一页是否还有数据 // 否则无法知道下一页是否还有数据
let total = parseInt(res) || 0 let total = parseInt(res.questionTotal) || 0
// if (total > 0) { // if (total > 0) {
// 考试 // 考试
if (this.type === 2) { if (this.type === 2) {
this.pageSize = this.totalPoint this.pageSize = this.totalPoint
total = this.totalPoint total = this.totalPoint
this.timestamp = res.remainderSecond
} }
this.total = total this.total = total
...@@ -370,7 +372,7 @@ export default { ...@@ -370,7 +372,7 @@ export default {
customBack() { customBack() {
getApp().track("back") getApp().track("back")
if (this.source === 3) { if (this.source === 3) {
// 如果已答题,点击返回提示交卷 // 如果已答题,点击返回提示暂停弹窗
const count = this.list.reduce((accumulator, currentValue) => { const count = this.list.reduce((accumulator, currentValue) => {
if (currentValue.submitStatus) accumulator++ if (currentValue.submitStatus) accumulator++
return accumulator return accumulator
...@@ -564,13 +566,15 @@ export default { ...@@ -564,13 +566,15 @@ export default {
recordId: this.recordId, recordId: this.recordId,
source: this.source, source: this.source,
} }
let time = this.$refs.uCountDown.seconds
let trackParams = { let trackParams = {
openId: this.openId, openId: this.openId,
nickname: this.userInfo.nickName, nickname: this.userInfo.nickName,
...params ...params,
remainderSecond: time,
} }
getApp().track("submitAnswers", trackParams) getApp().track("submitAnswers", trackParams)
this.$u.api.answer([params]).then((res) => { this.$u.api.answer({list: [params], remainderSecond: time}).then((res) => {
if (this.source === 2) { if (this.source === 2) {
// 每日一练 // 每日一练
if (this.daily.status && res === 10) this.dailyComplete() if (this.daily.status && res === 10) this.dailyComplete()
...@@ -599,50 +603,58 @@ export default { ...@@ -599,50 +603,58 @@ export default {
type: 'primary', type: 'primary',
}) })
}, },
// 点击了暂停弹窗的暂停 // 点击了暂停弹窗的保存并退出
handleClickPause() { handleClickPause() {
const params = { const data = {
answer: info.userAnswer, id: this.recordId,
answerRight: info.result === 'pass', remainderSecond: this.$refs.uCountDown.seconds,
questionId: info.id,
questionWarehouseId: this.questionWarehouseId,
recordId: this.recordId,
source: this.source,
} }
// 埋点-暂停答题
let trackParams = { let trackParams = {
openId: this.openId, openId: this.openId,
nickname: this.userInfo.nickName, nickname: this.userInfo.nickName,
...params ...data
} }
getApp().track("examSuspend", trackParams)
getApp().track('getUserQuestionWareHouse-questionnaire', trackParams)
this.$u.api this.$u.api
.getUserQuestionWareHouse() .examSuspend(data)
.then((res) => { .then((res) => {
this.$u.route({ this.$u.route({
type: 'back', type: 'back',
})
})
.catch((err) => {
this.$u.route({
type: 'back',
})
console.log(err)
}) })
})
.catch((err) => {
console.log(err)
})
}, },
// 点击了暂停弹窗的重新开始 // 点击了暂停弹窗的重新开始
handleClickRestart() { handleClickRestart() {
this.$u.route({ const data = {
url: '/pages/learn/answer', id: this.recordId,
type: 'redirectTo', }
params: { uni.showLoading({
recordId: this.recordId, title: '重新加载',
source: this.source, })
passPoint: this.passPoint, let trackParams = {
totalPoint: this.totalPoint, openId: this.openId,
}, nickname: this.userInfo.nickName,
...data
}
getApp().track("examCancel", trackParams)
this.$u.api.examCancel(data).then((res) => {
uni.hideLoading()
if (res) {
// 交卷
this.$u.route({
url: '/pages/learn/answer',
type: 'redirectTo',
params: {
recordId: this.recordId,
source: this.source,
passPoint: this.passPoint,
totalPoint: this.totalPoint,
},
})
}
}) })
}, },
// 考试成绩弹框确认 // 考试成绩弹框确认
......
...@@ -135,6 +135,7 @@ export default { ...@@ -135,6 +135,7 @@ export default {
if (res) { if (res) {
this.$u.route({ this.$u.route({
url: '/pages/learn/answer', url: '/pages/learn/answer',
type: 'redirectTo',
params: { params: {
recordId: res.id, recordId: res.id,
source: 3, source: 3,
......
...@@ -83,13 +83,13 @@ ...@@ -83,13 +83,13 @@
</view> </view>
<MaskTip <MaskTip
:show.sync="show" :show.sync="show"
imageName="mengceng-goumai.png" imageName="dianjitishi3.png"
:imageStyle="imageStyle" :imageStyle="imageStyle"
/> />
<MaskTip <MaskTip
:show.sync="show1" :show.sync="show1"
@click="showTip" @click="showTip"
imageName="mengceng-bangding.png" imageName="dianjitishi2.png"
:imageStyle="imageStyle1" :imageStyle="imageStyle1"
/> />
</view> </view>
......
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