Commit 291d5d75 authored by Facius's avatar Facius

feat: 接口调试

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