Commit b3fa6588 authored by Facius's avatar Facius

Merge branch 'dev-v1.0.0' of https://git.banshouhui.com/wuzhenzhe/study into dev-v1.0.0

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