Commit c5abad0a authored by Facius's avatar Facius

feat: 接口调试

parent 809fd407
;(function() {
let NODE_ENV = 'dev' // dev:开发环境 | test:测试环境 | prod:生产环境
let NODE_ENV = 'test' // dev:开发环境 | test:测试环境 | prod:生产环境
let ENV_VAR = null
let VERSION = 'v1.3.0'
if (process.env.NODE_ENV === 'development') {
......
......@@ -108,8 +108,7 @@ let learnApiFun = function(vm) {
// 获取进行中的考试记录
let inProgress = async (params = {}) =>
await vm.$u.get(
'/rest/question/exam/inProgress',
params
'/rest/question/exam/inProgress/' + params.questionWarehouseId
)
// 考试暂存
......@@ -128,6 +127,10 @@ let learnApiFun = function(vm) {
let receiveAward = async (params = {}) =>
await vm.$u.post('/rest/reward/receive/award', params)
// 获取问卷回答状态
let answerStatus = async (params = {}) =>
await vm.$u.get('/rest/survey/answer/status', params)
const learnApi = {
getQuestion,
getQuestionTotal,
......@@ -156,7 +159,8 @@ let learnApiFun = function(vm) {
examSuspend,
examCancel,
submitSurvey,
receiveAward
receiveAward,
answerStatus
}
return learnApi
}
......
......@@ -10,8 +10,7 @@
return {
list: [{
image: process.uniEnv.qn_base_url + 'wenjuandatiguagngao.jpg',
title: '昨夜星辰昨夜风,画楼西畔桂堂东',
id: 0
id: 1
}
],
}
......
......@@ -56,6 +56,7 @@ export default {
data() {
return {
loading: false,
surveyId: 1,
list: [
{
title: '您通过什么渠道了解到模考大师?',
......@@ -183,7 +184,7 @@ export default {
}
let params = {
options: options,
surveyId: 1,
surveyId: 1, // 问卷id,暂时写死
surveyName: "调查小问卷"
}
let trackParams = {
......
......@@ -89,7 +89,7 @@ export default {
methods: {
handleClickCell(questionData, cardData) {
this.selectedData = questionData
this.cardData = cardData
this.cardData = cardData || {}
},
handleClick() {
if (!this.selected) return
......@@ -98,7 +98,8 @@ export default {
let params = {
questionWarehouseId: this.selectedData.id,
cardId: this.cardData.id,
sourse: 'SURVEY' // 问卷调查
sourse: 'SURVEY', // 问卷调查
bizId: 1,// bizId 问卷id,暂时写死
}
let trackParams = {
openId: this.openId,
......
......@@ -147,7 +147,8 @@ export default {
showOrgId: false, // 显示机构id
tipTop: 410,
tipTop0: 50,
havingExamination: false // 有进行中的考试
havingExamination: false, // 有进行中的考试
questionnaireStatus: 10,
}
},
computed: {
......@@ -278,15 +279,16 @@ export default {
return `width:570rpx;margin-top:${this.tipTop0}rpx`
},
showAdvertisement() {
return this.selected.id > 0 && (this.filledQuestionnaire || this.notQuestionnaire) || true
return this.selected.id > 0 && (this.filledQuestionnaire || this.notQuestionnaire)
},
// 0-未参与问卷, 1-已参与未领取奖品, 2-已参与已领取奖品, 10-已参与无奖品问卷
// 已参与调查未领取奖励
filledQuestionnaire() {
return this.questionnaireStatus == '已答卷未领取'
return this.questionnaireStatus == 1
},
// 未参与调查
notQuestionnaire() {
return this.questionnaireStatus == '未答卷'
return this.questionnaireStatus == 0
}
},
watch: {
......@@ -330,7 +332,6 @@ export default {
this.queryMyQuestionWarehouseDetail(this.info.id || 0)
}
this.chagefinishCount()
this.getInProgress()
}
},
onUnload() {},
......@@ -361,6 +362,11 @@ export default {
this.data = res || { questionWarehouse: {} }
if (!this.data.questionWarehouse) this.data.questionWarehouse = {}
this.selected = this.data.questionWarehouse
// 是否有继续答题
this.getInProgress()
// 是否显示广告:调查问卷
this.answerStatus()
})
.catch((err) => {
this.loading = false
......@@ -670,18 +676,13 @@ export default {
this.$u.route({
url: 'pages/advertisement/' + path,
params: {
advertisementId: id,
surveyId: id,
},
})
},
getInProgress() {
let trackParams = {
openId: this.openId,
nickname: this.userInfo.nickName,
}
getApp().track("handPaper", trackParams)
this.$u.api
.inProgress()
.inProgress({questionWarehouseId: this.selected.id})
.then((res) => {
let data = res && res.pop() || {}
this.havingExamination = data.id || false
......@@ -689,6 +690,17 @@ export default {
.catch((err) => {
console.log(err)
})
},
answerStatus() {
// surveyId 问卷id,暂时写死
this.$u.api
.answerStatus({surveyId: 1})
.then((res) => {
this.questionnaireStatus = res
})
.catch((err) => {
console.log(err)
})
}
},
}
......
......@@ -252,7 +252,7 @@ export default {
if (e?.passPoint) this.passPoint = parseInt(e.passPoint) // 合格分数
if (e?.totalPoint) this.totalPoint = parseInt(e.totalPoint) // 考试总分/总条数
if (e?.duration) this.timestamp = parseInt(e.duration) * 60 // 考试时间
debugger
switch (this.source) {
case 1:
case 2:
......@@ -340,6 +340,9 @@ debugger
if (this.source === 3 && res.inProcessQuestionIndex && Number(res.inProcessQuestionIndex) > 0) {
this.timestamp = res.remainderSecond
index = Number(res.inProcessQuestionIndex)
if (index > 0) {
this.continueToast()
}
} else if (this.source === 1) {
index = this.lastIndex[this.questionWarehouseId] || 0
}
......@@ -505,10 +508,7 @@ debugger
item.result = status
item.errShow = this.type === 2 ? true : status === 'fail'
item.userAnswer = userAnswer
if (this.currentIndex + 1 < this.total) {
const nextItem = this.list.find((v) => v.index === this.currentIndex + 1)
item.inProcessQuestionId = nextItem && nextItem.id
}
// 保存答案
if (this.model === 1) this.saveAnswer(item)
......@@ -571,7 +571,7 @@ debugger
},
// 保存答案
saveAnswer(info) {
const params = {
const params = {list:[{
answer: info.userAnswer,
answerRight: info.result === 'pass',
questionId: info.id,
......@@ -579,16 +579,22 @@ debugger
questionWarehouseId: this.questionWarehouseId,
recordId: this.recordId,
source: this.source,
}]}
if (this.source === 3) {
params.remainderSecond = this.$refs.uCountDown.seconds
if (this.currentIndex + 1 < this.total) {
const nextItem = this.list.find((v) => v.index === this.currentIndex + 1)
params.inProcessQuestionId = nextItem && nextItem.id
}
}
let time = this.$refs.uCountDown.seconds
let trackParams = {
openId: this.openId,
nickname: this.userInfo.nickName,
...params,
remainderSecond: time,
}
getApp().track("submitAnswers", trackParams)
this.$u.api.answer({list: [params], remainderSecond: time}).then((res) => {
this.$u.api.answer(params).then((res) => {
if (this.source === 2) {
// 每日一练
if (this.daily.status && res === 10) this.dailyComplete()
......
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