Commit e81d45d1 authored by Damon's avatar Damon

feat: 考试成绩

parent f207c805
...@@ -55,6 +55,15 @@ let learnApiFun = function(vm) { ...@@ -55,6 +55,15 @@ let learnApiFun = function(vm) {
let applyExam = async (params = {}) => let applyExam = async (params = {}) =>
await vm.$u.get(`/rest/question/applyExam/${params.questionWarehouseId}/${params.paperId}`, params) await vm.$u.get(`/rest/question/applyExam/${params.questionWarehouseId}/${params.paperId}`, params)
let submitExamRecord = async (params = {}) =>
await vm.$u.post('/rest/question/submit/examRecord', params)
let queryExamRecord = async (params = {}) =>
await vm.$u.post('/rest/question/queryExamRecord', params)
let queryExamRecordOne = async (params = {}) =>
await vm.$u.get(`/rest/question/queryExamRecord/${params.id}`, params)
const learnApi = { const learnApi = {
getQuestion, getQuestion,
getQuestionTotal, getQuestionTotal,
...@@ -68,7 +77,10 @@ let learnApiFun = function(vm) { ...@@ -68,7 +77,10 @@ let learnApiFun = function(vm) {
removeCollection, removeCollection,
removeError, removeError,
getExamPaper, getExamPaper,
applyExam applyExam,
submitExamRecord,
queryExamRecord,
queryExamRecordOne
} }
return learnApi return learnApi
} }
......
...@@ -124,8 +124,6 @@ ...@@ -124,8 +124,6 @@
</dailyPop> </dailyPop>
</view> </view>
<!-- 体验资格结束 -->
<experience-end-pop :visible.sync="experienceEnd" />
</view> </view>
</template> </template>
...@@ -134,7 +132,6 @@ import swiperLimitedLoad from '@/components/swiper-limited-load/index.vue' ...@@ -134,7 +132,6 @@ import swiperLimitedLoad from '@/components/swiper-limited-load/index.vue'
import answerOperationTips from '@/components/answer-operation-tips/index.vue' import answerOperationTips from '@/components/answer-operation-tips/index.vue'
import answerCompletePop from '@/components/answer-complete-pop/index.vue' import answerCompletePop from '@/components/answer-complete-pop/index.vue'
import dailyPop from '@/components/daily-pop/index.vue' import dailyPop from '@/components/daily-pop/index.vue'
import experienceEndPop from '@/components/experience-end-pop/index.vue'
import Utils from './utils.js' import Utils from './utils.js'
const NO_PREV_PAGE = -1 const NO_PREV_PAGE = -1
...@@ -146,7 +143,6 @@ export default { ...@@ -146,7 +143,6 @@ export default {
answerOperationTips, answerOperationTips,
answerCompletePop, answerCompletePop,
dailyPop, dailyPop,
experienceEndPop
}, },
data() { data() {
return { return {
...@@ -155,8 +151,6 @@ export default { ...@@ -155,8 +151,6 @@ export default {
type: 1, type: 1,
// 1 答题模式 2 学习模式 // 1 答题模式 2 学习模式
model: 1, model: 1,
// 体验资格
experienceEnd: false,
// 每日一练 // 每日一练
daily: { daily: {
status: false, status: false,
...@@ -297,16 +291,10 @@ export default { ...@@ -297,16 +291,10 @@ export default {
} }
if (current == NO_NEXT_PAGE) { if (current == NO_NEXT_PAGE) {
if (this.type === 2) { return uni.showToast({
this.$u.route({ title: '已经是最后一题了',
url: 'pages/learn/source', icon: 'none',
}) })
} else {
return uni.showToast({
title: '已经是最后一题了',
icon: 'none',
})
}
} }
} }
...@@ -456,10 +444,24 @@ export default { ...@@ -456,10 +444,24 @@ export default {
}, },
// 考试成绩弹框确认 // 考试成绩弹框确认
submit() { submit() {
// 提前交卷 const data = {
this.$u.route({ id: this.recordId,
type: 'redirect', point: this.complete.result[2]
url: '/pages/learn/score', }
uni.showLoading({
title: '正在计算考试成绩'
})
this.$u.api.submitExamRecord(data).then(res => {
uni.hideLoading()
if (res) { // 交卷
this.$u.route({
type: 'redirect',
url: '/pages/learn/score',
params: {
id: this.recordId
}
})
}
}) })
}, },
// 考试成绩弹框取消 // 考试成绩弹框取消
...@@ -482,14 +484,14 @@ export default { ...@@ -482,14 +484,14 @@ export default {
const info = this.list.find(v => v.index === this.currentIndex) const info = this.list.find(v => v.index === this.currentIndex)
const action = status ? 'removeCollection' : 'joinCollection' const action = status ? 'removeCollection' : 'joinCollection'
this.$u.api[action]({questionId: info.id}).then(res => { this.$u.api[action]({questionId: info.id}).then(res => {
info.collectionFlag = !status if(res) info.collectionFlag = !status
}) })
}, },
// 移除 // 移除
remove() { remove() {
const info = this.list.find(v => v.index === this.currentIndex) const info = this.list.find(v => v.index === this.currentIndex)
this.$u.api.removeError({questionId: info.id}).then(res => { this.$u.api.removeError({questionId: info.id}).then(res => {
this.current = this.currentIndex + 1 if(res) this.current = this.currentIndex + 1
}) })
}, },
// 以下方法用于初始化数据 // 以下方法用于初始化数据
......
...@@ -103,19 +103,21 @@ export default { ...@@ -103,19 +103,21 @@ export default {
paperId: this.info.id paperId: this.info.id
} }
uni.showLoading({ uni.showLoading({
title: '加载中' title: '载入试题中'
}) })
this.$u.api.applyExam(params).then(res => { this.$u.api.applyExam(params).then(res => {
uni.hideLoading() uni.hideLoading()
this.$u.route({ if (res) {
url: '/pages/learn/answer', this.$u.route({
params: { url: '/pages/learn/answer',
recordId: res.id, params: {
source: 3, recordId: res.id,
passPoint: this.info.passPoint, source: 3,
totalPoint: this.info.totalPoint passPoint: this.info.passPoint,
} totalPoint: this.info.totalPoint
}) }
})
}
}) })
}, },
}, },
......
...@@ -40,17 +40,12 @@ ...@@ -40,17 +40,12 @@
<image class="image" :src="info.image || defaultImage"> </image <image class="image" :src="info.image || defaultImage"> </image
></view> ></view>
<view>{{ info.name }}</view> <view>{{ info.name }}</view>
<view class="time-view">{{ <view class="time-view">{{ info.time }}</view>
$u.timeFormat(
info.time || new Date().getTime(),
'yyyy.mm.dd hh:MM:ss'
)
}}</view>
</view> </view>
<view class="detail-view"> <view class="detail-view">
<view class="name-view">{{ info.category }}</view> <view class="name-view">{{ info.category }}</view>
<view class="type-view">{{ info.type }}</view> <view class="type-view">{{ info.type }}</view>
<image class="qrcode-image" :src="qrcodeImage"></image> <image class="qrcode-image" :src="info.institutionLogo"></image>
</view> </view>
</view> </view>
<view class="bottom-view"> <view class="bottom-view">
...@@ -67,6 +62,7 @@ ...@@ -67,6 +62,7 @@
<u-button <u-button
:customStyle="buttonStyle" :customStyle="buttonStyle"
@click="handleClick" @click="handleClick"
open-type="share"
type="primary" type="primary"
hover-class="none" hover-class="none"
> >
...@@ -126,9 +122,7 @@ export default { ...@@ -126,9 +122,7 @@ export default {
backImage() { backImage() {
return this.isPass ? this.hegechengjiImage : this.buhegechengjiImage return this.isPass ? this.hegechengjiImage : this.buhegechengjiImage
}, },
qrcodeImage() {
return process.uniEnv.qn_base_url + 'buhegechengji.png'
},
hegechengjiImage() { hegechengjiImage() {
return process.uniEnv.qn_base_url + 'hegechengji.png' return process.uniEnv.qn_base_url + 'hegechengji.png'
}, },
...@@ -160,19 +154,47 @@ export default { ...@@ -160,19 +154,47 @@ export default {
return this.$u.random(random[0], random[1]) return this.$u.random(random[0], random[1])
}, },
}, },
onLoad() { onLoad(e) {
this.info = { if (!e) {
name: '我就是昵称', this.$u.route({
image: '', url: 'pages/index/index',
score: 74, type: 'tab'
time: 1626402760689, })
category: '高处安装、维护、拆除作业人员',
type: '模拟考试',
} }
this.init(e?.id)
}, },
methods: { methods: {
handleClick() {}, init(id) {
handleClickRecord() {}, uni.showLoading({
title: '加载中'
})
this.$u.api.queryExamRecordOne({id: id}).then(res => {
uni.hideLoading()
if (res) {
const echoMap = res.echoMap
this.info = {
institutionLogo: echoMap?.institutionId?.wxQrcodePath || process.uniEnv.qn_base_url + 'applets.jpg',
name: echoMap.studentId.nickname,
image: echoMap.studentId.avatarPath,
score: res.point,
time: res.endDatetime,
category: echoMap.questionWarehouseId.title,
type: '模拟考试'
}
}
})
},
handleClick() {
},
handleClickRecord() {
this.$u.route({
type: 'push',
url: '/pages/learn/answer',
params: {
source: 5
}
})
},
}, },
} }
</script> </script>
......
...@@ -7,7 +7,7 @@ const router = createRouter({ ...@@ -7,7 +7,7 @@ const router = createRouter({
}) })
// 检测登录白名单,无需登录也可访问的页面 // 检测登录白名单,无需登录也可访问的页面
const whiteList = ['index', 'cert', 'mine', 'login'] const whiteList = ['index', 'cert', 'mine', 'login', 'learnScore']
// 全局路由前置守卫 // 全局路由前置守卫
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
......
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