Commit e81d45d1 authored by Damon's avatar Damon

feat: 考试成绩

parent f207c805
......@@ -55,6 +55,15 @@ let learnApiFun = function(vm) {
let applyExam = async (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 = {
getQuestion,
getQuestionTotal,
......@@ -68,7 +77,10 @@ let learnApiFun = function(vm) {
removeCollection,
removeError,
getExamPaper,
applyExam
applyExam,
submitExamRecord,
queryExamRecord,
queryExamRecordOne
}
return learnApi
}
......
......@@ -124,8 +124,6 @@
</dailyPop>
</view>
<!-- 体验资格结束 -->
<experience-end-pop :visible.sync="experienceEnd" />
</view>
</template>
......@@ -134,7 +132,6 @@ import swiperLimitedLoad from '@/components/swiper-limited-load/index.vue'
import answerOperationTips from '@/components/answer-operation-tips/index.vue'
import answerCompletePop from '@/components/answer-complete-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'
const NO_PREV_PAGE = -1
......@@ -146,7 +143,6 @@ export default {
answerOperationTips,
answerCompletePop,
dailyPop,
experienceEndPop
},
data() {
return {
......@@ -155,8 +151,6 @@ export default {
type: 1,
// 1 答题模式 2 学习模式
model: 1,
// 体验资格
experienceEnd: false,
// 每日一练
daily: {
status: false,
......@@ -297,16 +291,10 @@ export default {
}
if (current == NO_NEXT_PAGE) {
if (this.type === 2) {
this.$u.route({
url: 'pages/learn/source',
})
} else {
return uni.showToast({
title: '已经是最后一题了',
icon: 'none',
})
}
return uni.showToast({
title: '已经是最后一题了',
icon: 'none',
})
}
}
......@@ -456,10 +444,24 @@ export default {
},
// 考试成绩弹框确认
submit() {
// 提前交卷
this.$u.route({
type: 'redirect',
url: '/pages/learn/score',
const data = {
id: this.recordId,
point: this.complete.result[2]
}
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 {
const info = this.list.find(v => v.index === this.currentIndex)
const action = status ? 'removeCollection' : 'joinCollection'
this.$u.api[action]({questionId: info.id}).then(res => {
info.collectionFlag = !status
if(res) info.collectionFlag = !status
})
},
// 移除
remove() {
const info = this.list.find(v => v.index === this.currentIndex)
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 {
paperId: this.info.id
}
uni.showLoading({
title: '加载中'
title: '载入试题中'
})
this.$u.api.applyExam(params).then(res => {
uni.hideLoading()
this.$u.route({
url: '/pages/learn/answer',
params: {
recordId: res.id,
source: 3,
passPoint: this.info.passPoint,
totalPoint: this.info.totalPoint
}
})
if (res) {
this.$u.route({
url: '/pages/learn/answer',
params: {
recordId: res.id,
source: 3,
passPoint: this.info.passPoint,
totalPoint: this.info.totalPoint
}
})
}
})
},
},
......
......@@ -40,17 +40,12 @@
<image class="image" :src="info.image || defaultImage"> </image
></view>
<view>{{ info.name }}</view>
<view class="time-view">{{
$u.timeFormat(
info.time || new Date().getTime(),
'yyyy.mm.dd hh:MM:ss'
)
}}</view>
<view class="time-view">{{ info.time }}</view>
</view>
<view class="detail-view">
<view class="name-view">{{ info.category }}</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 class="bottom-view">
......@@ -67,6 +62,7 @@
<u-button
:customStyle="buttonStyle"
@click="handleClick"
open-type="share"
type="primary"
hover-class="none"
>
......@@ -126,9 +122,7 @@ export default {
backImage() {
return this.isPass ? this.hegechengjiImage : this.buhegechengjiImage
},
qrcodeImage() {
return process.uniEnv.qn_base_url + 'buhegechengji.png'
},
hegechengjiImage() {
return process.uniEnv.qn_base_url + 'hegechengji.png'
},
......@@ -160,19 +154,47 @@ export default {
return this.$u.random(random[0], random[1])
},
},
onLoad() {
this.info = {
name: '我就是昵称',
image: '',
score: 74,
time: 1626402760689,
category: '高处安装、维护、拆除作业人员',
type: '模拟考试',
onLoad(e) {
if (!e) {
this.$u.route({
url: 'pages/index/index',
type: 'tab'
})
}
this.init(e?.id)
},
methods: {
handleClick() {},
handleClickRecord() {},
init(id) {
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>
......
......@@ -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) => {
......
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