Commit c757c1f2 authored by Damon's avatar Damon

feat: 考试

parent de960bd0
...@@ -32,6 +32,12 @@ let learnApiFun = function(vm) { ...@@ -32,6 +32,12 @@ let learnApiFun = function(vm) {
let removeError = async (params = {}) => let removeError = async (params = {}) =>
await vm.$u.get('/rest/question/remove/error/'+params.questionId, params) await vm.$u.get('/rest/question/remove/error/'+params.questionId, params)
let getExamPaper = async (params = {}) =>
await vm.$u.get('/rest/question/getExamPaper/'+params.questionWarehouseId, params)
let applyExam = async (params = {}) =>
await vm.$u.get(`/rest/question/applyExam/${params.questionWarehouseId}/${params.paperId}`, params)
const learnApi = { const learnApi = {
getQuestion, getQuestion,
getQuestionTotal, getQuestionTotal,
...@@ -41,7 +47,9 @@ let learnApiFun = function(vm) { ...@@ -41,7 +47,9 @@ let learnApiFun = function(vm) {
getProvinceList, getProvinceList,
joinCollection, joinCollection,
removeCollection, removeCollection,
removeError removeError,
getExamPaper,
applyExam
} }
return learnApi return learnApi
} }
......
...@@ -181,15 +181,16 @@ export default { ...@@ -181,15 +181,16 @@ export default {
swiperDuration: '0', swiperDuration: '0',
// 分页数据 // 分页数据
currentPage: 1, currentPage: 1,
pageSize: 10, pageSize: 100,
total: 0, total: 0,
requesting: false, requesting: false,
// 科目ID
questionWarehouseId: null,
// 1.顺序答题 2.随机练习 3.模拟考试 4.收藏答题 5.错题答题 6.专项练习-单选 7.专项练习-多选 8.专项练习-判断 9.专项练习-答案是 // 1.顺序答题 2.随机练习 3.模拟考试 4.收藏答题 5.错题答题 6.专项练习-单选 7.专项练习-多选 8.专项练习-判断 9.专项练习-答案是
source: 0, source: 0,
recordId: 0, recordId: 0,
currentItem: {} // 合格分数
passPoint: 60,
// 考试题数
totalPoint: 100,
} }
}, },
computed: { computed: {
...@@ -218,9 +219,10 @@ export default { ...@@ -218,9 +219,10 @@ export default {
} }
}, },
onLoad(e) { onLoad(e) {
this.questionWarehouseId = parseInt(e?.questionWarehouseId) || '1414854649273384960'
if (e?.source) this.source = parseInt(e.source) if (e?.source) this.source = parseInt(e.source)
if (e?.recordId) this.recordId = parseInt(e.recordId) if (e?.recordId) this.recordId = e.recordId
if (e?.passPoint) this.passPoint = parseInt(e.passPoint)
if (e?.totalPoint) this.totalPoint = parseInt(e.totalPoint)
switch (this.source) { switch (this.source) {
case 1: case 1:
case 2: case 2:
...@@ -260,8 +262,8 @@ export default { ...@@ -260,8 +262,8 @@ export default {
let total = parseInt(res) || 0 let total = parseInt(res) || 0
// 考试 // 考试
if (this.type === 2) { if (this.type === 2) {
this.pageSize = 100 this.pageSize = this.totalPoint
total = 100 total = this.totalPoint
} }
this.total = total this.total = total
...@@ -275,8 +277,7 @@ export default { ...@@ -275,8 +277,7 @@ export default {
}) })
}, },
// 切换 // 切换
swiperChange(e, currentItem) { swiperChange(e) {
this.currentItem = currentItem
let current = e.current let current = e.current
this.currentIndex = current this.currentIndex = current
if (current == NO_PREV_PAGE || current == NO_NEXT_PAGE) { if (current == NO_PREV_PAGE || current == NO_NEXT_PAGE) {
...@@ -450,8 +451,8 @@ export default { ...@@ -450,8 +451,8 @@ export default {
const noStart = this.list.filter((v) => !v.result).length // 未做题数 const noStart = this.list.filter((v) => !v.result).length // 未做题数
const fraction = this.total - noStart - fail// 分数 const fraction = this.total - noStart - fail// 分数
this.complete.result = [fail, noStart, fraction] this.complete.result = [fail, noStart, fraction]
this.complete.type = fraction < 60 ? 'fail' : 'pass' this.complete.type = fraction < this.passPoint ? 'fail' : 'pass'
if (!type) this.complete.visible = true if (type !== 1) this.complete.visible = true
}, },
// 考试成绩弹框确认 // 考试成绩弹框确认
submit() { submit() {
......
...@@ -12,9 +12,9 @@ ...@@ -12,9 +12,9 @@
<view class="body-view"> <view class="body-view">
<view class="head-view"> <view class="head-view">
<view class="image-view"> <view class="image-view">
<image class="image" :src="info.image || defaultImage"> </image <image class="image" :src="avatar"> </image
></view> ></view>
<view>{{ info.name }}</view> <view>{{ nikeName }}</view>
</view> </view>
<view class="line-view"></view> <view class="line-view"></view>
<view class="list-view"> <view class="list-view">
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
</view> </view>
<view class="line-view"></view> <view class="line-view"></view>
<view class="tip-view" <view class="tip-view"
>温馨提示:模拟考试中不能修改答案,没做错1道题扣2分,合格标准为90分。</view >温馨提示:模拟考试中不能修改答案,每做错1道题扣1分,合格标准为{{ info.passPoint }}分。</view
> >
<view class="bottom-view"> <view class="bottom-view">
<u-button <u-button
...@@ -47,10 +47,17 @@ export default { ...@@ -47,10 +47,17 @@ export default {
data() { data() {
return { return {
info: {}, info: {},
pic: process.uniEnv.qn_base_url + 'morentouxiang-w.png',
} }
}, },
computed: { computed: {
avatar() {
return (this.userInfo && this.userInfo.avatarUrl) || this.pic
},
nikeName() {
return (this.userInfo && this.userInfo.nickName) || ''
},
labels() { labels() {
return { return {
kemu: '考试科目', kemu: '考试科目',
...@@ -59,9 +66,6 @@ export default { ...@@ -59,9 +66,6 @@ export default {
guize: '出题规则', guize: '出题规则',
} }
}, },
defaultImage() {
return process.uniEnv.qn_base_url + 'morentouxiang-w.png'
},
buttonStyle() { buttonStyle() {
return { return {
height: '104rpx', height: '104rpx',
...@@ -74,20 +78,46 @@ export default { ...@@ -74,20 +78,46 @@ export default {
}, },
}, },
onLoad() { onLoad() {
this.info = { this.init()
name: '我就是昵称',
image: '',
kemu: '考试科目fdsafsafdsadfdsafjlkafdaslffdsafsafsafdsafdsafdsajklsa',
tishu:
'考试题数fdasfasfasfffdsafsafdsadfdsafjlkafdaslffdsafsafsafdsafdsafdsajklsaasfdsafdasfadssafasfsaf',
biaozhun:
'合格标准dasfasfasfffdsafsafdsadfdsafjlkafdaslffdsafsafsafdsafdsafdsajklsaasfdsaf',
guize:
'出题规则dasfasfasfffdsafsafdsadfdsafjlkafdaslffdsafsafsafdsafdsafdsajklsaasfdsaf',
}
}, },
methods: { methods: {
handleClick() {}, init() {
uni.showLoading({
title: '加载中'
})
this.$u.api.getExamPaper({questionWarehouseId: this.questionWarehouseId}).then(res => {
uni.hideLoading()
this.info = {
id: res.id,
kemu: res.echoMap?.questionWarehouseId?.title,
tishu: `${res.totalPoint}题`,
biaozhun: `${res.passPoint}分`,
passPoint: res.passPoint,
guize: '根据国家规定比例随机抽取'
}
})
},
handleClick() {
const params = {
questionWarehouseId: this.questionWarehouseId,
paperId: this.info.id
}
uni.showLoading({
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
}
})
})
},
}, },
} }
</script> </script>
......
...@@ -12,7 +12,7 @@ try{ ...@@ -12,7 +12,7 @@ try{
} }
// 需要永久存储,且下次APP启动需要取出的,在state中的变量名 // 需要永久存储,且下次APP启动需要取出的,在state中的变量名
let saveStateKeys = ['userInfo', 'vuex_token', 'openId', 'searchHistory', 'questionList', 'lastIndex', 'tipStatus']; let saveStateKeys = ['userInfo', 'vuex_token', 'openId', 'searchHistory', 'questionList', 'lastIndex', 'tipStatus', 'questionWarehouseId'];
// 保存变量到本地存储中 // 保存变量到本地存储中
const saveLifeData = function(key, value){ const saveLifeData = function(key, value){
...@@ -39,6 +39,7 @@ const store = new Vuex.Store({ ...@@ -39,6 +39,7 @@ const store = new Vuex.Store({
questionList: lifeData.questionList ? lifeData.questionList : [], // 练习列表 questionList: lifeData.questionList ? lifeData.questionList : [], // 练习列表
lastIndex: lifeData.lastIndex ? lifeData.lastIndex : 0, // 上次做到第几题 lastIndex: lifeData.lastIndex ? lifeData.lastIndex : 0, // 上次做到第几题
tipStatus: lifeData.tipStatus ? lifeData.tipStatus : false, // 滑动提示 tipStatus: lifeData.tipStatus ? lifeData.tipStatus : false, // 滑动提示
questionWarehouseId: lifeData.questionWarehouseId ? lifeData.questionWarehouseId : '1414854649273384960', // 科目ID
// 如果vuex_version无需保存到本地永久存储,无需lifeData.vuex_version方式 // 如果vuex_version无需保存到本地永久存储,无需lifeData.vuex_version方式
vuex_version: '1.0.0', vuex_version: '1.0.0',
}, },
......
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