|
|
@ -1,12 +1,13 @@ |
|
|
|
<template> |
|
|
|
<!-- <view>培训考核</view> --> |
|
|
|
<view class="page"> |
|
|
|
|
|
|
|
|
|
|
|
<view class="header"> |
|
|
|
<view class="flex-rowl color-fff size-28 title"> |
|
|
|
{{ `答题进度 ${answered}/${total}` }} |
|
|
|
</view> |
|
|
|
<up-line-progress class="progress" :percentage="progress" activeColor="#FFBF60" inactiveColor="#D9D9D9" height="16rpx" :showText="false"></up-line-progress> |
|
|
|
<up-line-progress class="progress" :percentage="progress" activeColor="#FFBF60" inactiveColor="#D9D9D9" |
|
|
|
height="16rpx" :showText="false"></up-line-progress> |
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="box"> |
|
|
@ -16,15 +17,9 @@ |
|
|
|
主观题 |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view > |
|
|
|
<questionCard |
|
|
|
v-for="(item, qIdx) in list" |
|
|
|
:key="`question-${qIdx}`" |
|
|
|
:index="qIdx" |
|
|
|
:data="item" |
|
|
|
v-model="item.value" |
|
|
|
:type="TYPE" |
|
|
|
></questionCard> |
|
|
|
<view> |
|
|
|
<questionCard v-for="(item, qIdx) in list" :key="`question-${qIdx}`" :index="qIdx" :data="item" |
|
|
|
v-model="item.value" :type="TYPE"></questionCard> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
@ -37,62 +32,75 @@ |
|
|
|
</template> |
|
|
|
|
|
|
|
<script setup> |
|
|
|
import { ref, computed } from 'vue' |
|
|
|
import { onShow } from '@dcloudio/uni-app' |
|
|
|
import { getQuestionList } from '@/api/examination' |
|
|
|
import { |
|
|
|
ref, |
|
|
|
computed |
|
|
|
} from 'vue' |
|
|
|
import { |
|
|
|
onShow |
|
|
|
} from '@dcloudio/uni-app' |
|
|
|
import { |
|
|
|
getQuestionList |
|
|
|
} from '@/api/examination' |
|
|
|
|
|
|
|
import questionCard from '../components/questionCard.vue'; |
|
|
|
|
|
|
|
const TYPE = '培训' |
|
|
|
|
|
|
|
const list = ref([]) |
|
|
|
const total = ref(0) |
|
|
|
|
|
|
|
const initQuestion = async () => { |
|
|
|
try { |
|
|
|
let questions = (await getQuestionList({ |
|
|
|
type: TYPE |
|
|
|
})).map(item => ({ |
|
|
|
id: item.id, |
|
|
|
title: item.title, |
|
|
|
value: null, |
|
|
|
numberWords: item.numberWords |
|
|
|
})) |
|
|
|
|
|
|
|
list.value = questions |
|
|
|
total.value = questions.length |
|
|
|
|
|
|
|
} catch (err) { |
|
|
|
|
|
|
|
import questionCard from '../components/questionCard.vue'; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
const TYPE = '培训' |
|
|
|
const answered = computed(() => { |
|
|
|
|
|
|
|
const list = ref([]) |
|
|
|
const total = ref(0) |
|
|
|
return list.value.filter(item => { |
|
|
|
|
|
|
|
const initQuestion = async () => { |
|
|
|
try { |
|
|
|
let questions = (await getQuestionList({ type: TYPE })).map(item => ({ id: item.id, title: item.title, value: null })) |
|
|
|
if (item.value == null) { |
|
|
|
return false |
|
|
|
} |
|
|
|
|
|
|
|
list.value = questions |
|
|
|
total.value = questions.length |
|
|
|
|
|
|
|
} catch (err) { |
|
|
|
if (typeof item.value == 'string') { |
|
|
|
return item.value.length >= (item.numberWords || 0) |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
const answered = computed(() => { |
|
|
|
|
|
|
|
return list.value.filter(item => { |
|
|
|
|
|
|
|
if(item.value == null){ |
|
|
|
return false |
|
|
|
} |
|
|
|
|
|
|
|
if(typeof item.value == 'string'){ |
|
|
|
return item.value.length >= (item.numberWords || 0) |
|
|
|
} |
|
|
|
|
|
|
|
return true |
|
|
|
|
|
|
|
}).length |
|
|
|
|
|
|
|
// return list.value.filter(item => item.value?.length).length |
|
|
|
}) |
|
|
|
|
|
|
|
const progress = computed(() => { |
|
|
|
return Math.floor(answered.value / total.value * 100) |
|
|
|
}) |
|
|
|
|
|
|
|
const toNext = () => { |
|
|
|
uni.navigateTo({ |
|
|
|
url: "/otherPages/authentication/examination/trainCompleted/index" |
|
|
|
return true |
|
|
|
|
|
|
|
}).length |
|
|
|
|
|
|
|
// return list.value.filter(item => item.value?.length).length |
|
|
|
}) |
|
|
|
|
|
|
|
const progress = computed(() => { |
|
|
|
return Math.floor(answered.value / total.value * 100) |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
onShow(() => { |
|
|
|
initQuestion() |
|
|
|
}) |
|
|
|
const toNext = () => { |
|
|
|
uni.navigateTo({ |
|
|
|
url: "/otherPages/authentication/examination/trainCompleted/index" |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
onShow(() => { |
|
|
|
initQuestion() |
|
|
|
}) |
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
@ -107,6 +115,7 @@ onShow(() => { |
|
|
|
top: 0; |
|
|
|
background-image: linear-gradient(180deg, #FFBF60 0, #ffbf60 2%, #ffbf60 8%, #f2f2f2 90%); |
|
|
|
z-index: 99; |
|
|
|
|
|
|
|
.progress { |
|
|
|
margin-top: 19rpx; |
|
|
|
} |
|
|
|