8 changed files with 274 additions and 11 deletions
@ -0,0 +1,253 @@ |
|||
<template> |
|||
<view class="min-height bg-gray-light"> |
|||
<uv-tabs :list="activeTabList" @click="changeTab" :current="current" :scrollable="false"/> |
|||
<view v-if="list.length" class="p-20"> |
|||
<template v-if="current === 0"> |
|||
<view class="card mb-25 flex justify-start" v-for="(item, index) in list" :key="index"> |
|||
<uv-image :src="item.cover" width="140rpx" height="140rpx" radius="10"/> |
|||
<view class="ml-20 flex flex-col justify-start items-start"> |
|||
<uv-text :text="item.title" size="28rpx" lineHeight="40rpx" :lines="1" |
|||
align="left" bold |
|||
color="#000"></uv-text> |
|||
<uv-text v-if="item.endDate" :text="`结束日期:${item.endDate}`" size="24rpx" |
|||
lineHeight="40rpx" :lines="1" |
|||
align="left" |
|||
color="#AAA"></uv-text> |
|||
<uv-text :text="`已学:${(item.learnSec / 3600).toFixed(2)}个学时`" size="24rpx" |
|||
lineHeight="40rpx" :lines="1" |
|||
align="left" |
|||
color="#AAA"></uv-text> |
|||
</view> |
|||
</view> |
|||
</template> |
|||
<template v-else-if="current === 1"> |
|||
<view class="card mb-20 flex justify-between" v-for="(item,index) in list" :key="index"> |
|||
<view class="flex flex-col justify-start items-start"> |
|||
<view class="name"> |
|||
<uv-text :text="item.title" size="24rpx" lineHeight="40rpx" :lines="1" bold></uv-text> |
|||
</view> |
|||
<view class="flex justify-start items-center mt-20"> |
|||
<view class="text-20 text-gray mr-35">{{ item.peopleNum }}人</view> |
|||
<view class="text-20 text-gray">竞赛时间: {{ item.startDate }} ~ {{ item.endDate }}</view> |
|||
</view> |
|||
</view> |
|||
<mprogress |
|||
:progress="item.progress" |
|||
:activeColor="item.color" |
|||
:valueColor="item.color" |
|||
:valueFontSize="12" |
|||
:valueText="item.text" |
|||
:width="50" |
|||
:borderWidth="4" |
|||
></mprogress> |
|||
</view> |
|||
</template> |
|||
<template v-else-if="current === 2"> |
|||
<view class="card mb-20 flex justify-between" v-for="(item,index) in list" |
|||
:key="index"> |
|||
<view class="info info-1"> |
|||
<view class="name"> |
|||
<uv-text :text="item.title" size="24rpx" lineHeight="40rpx" :lines="1" bold></uv-text> |
|||
</view> |
|||
<view class="my-15 text-25 text-gray">考试类型: {{ ['线上', '线下'][item.type] }}</view> |
|||
<template v-if="item.type === 1 && item.trainExamPeopleInRoom"> |
|||
<view v-if="item.trainExamPeopleInRoom.roomConfig" class="my-15 text-25 text-gray">考场: |
|||
{{ item.trainExamPeopleInRoom.roomConfig.position }} |
|||
</view> |
|||
<view v-if="item.trainExamPeopleInRoom.examSession" class="my-15 text-25 text-gray">考试时间: |
|||
{{ item.trainExamPeopleInRoom.examSession.startTime }} ~ |
|||
{{ item.trainExamPeopleInRoom.examSession.endTime }} |
|||
</view> |
|||
</template> |
|||
<template v-if="item.type === 0"> |
|||
<view class="my-15 text-25 text-gray" v-if="item.examDateMode === 0">考试截止日期: {{ item.examDate }}</view> |
|||
<view class="my-15 text-25 text-gray flex justify-start flex-col items-start" v-else> |
|||
<text>考试时间段:</text> |
|||
<text v-for="(item, index) in JSON.parse(item.examDateList)" :key="index"> |
|||
{{ item.date.join('~') }} |
|||
</text> |
|||
</view> |
|||
</template> |
|||
<view class="my-15 text-25 text-gray" v-if="item.workTypeLists && item.workTypeLists.length > 0 && item.workTypeLists[0].course">考试科目: |
|||
{{ |
|||
item.workTypeLists[0].course.title |
|||
}}({{ |
|||
['初级', '中级', '高级', '技师', '高级技师'][item.workTypeLists[0].course.level] |
|||
}}) |
|||
</view> |
|||
<view class="my-15 text-25 text-gray" v-if="!item.trainExamPeopleInfo">总分 {{ item.paper.totalPoint }} 合格分 |
|||
{{ item.paper.passPoint }} |
|||
</view> |
|||
<view class="my-15 text-25 text-gray" v-else> |
|||
<template v-if="item.text === '已完成' && item.trainExamPeopleInfo.realScore"> |
|||
<view v-if="item.type === 0 && item.trainId"> |
|||
<text>考试得分 {{ item.trainExamPeopleInfo.score }}</text> |
|||
<text class="ml-15" v-if="item.trainExamPeopleInfo.inWhiteList === 0">平时分 |
|||
{{ item.trainExamPeopleInfo.normalScore }} |
|||
</text> |
|||
<text class="ml-15">总分 |
|||
{{ item.trainExamPeopleInfo.totalScore }} |
|||
</text> |
|||
<text class="ml-15">实际得分 |
|||
{{ item.trainExamPeopleInfo.totalScore }} |
|||
</text> |
|||
</view> |
|||
<view v-else> |
|||
<text>考试得分 {{ item.trainExamPeopleInfo.score }}</text> |
|||
<text class="ml-15" v-if="item.type === 1">实操得分 {{ item.trainExamPeopleInfo.operateScore }}</text> |
|||
<text class="ml-15">总分 |
|||
{{ item.trainExamPeopleInfo.realScore }} |
|||
</text> |
|||
</view> |
|||
<view class="mt-15" |
|||
:class="[item.trainExamPeopleInfo.totalScore >= 60 ? 'text-green' : 'text-red']" |
|||
v-if="item.showResult">{{ |
|||
item.trainExamPeopleInfo.totalScore >= 60 ? '合格' : '不合格' |
|||
}} |
|||
</view> |
|||
</template> |
|||
</view> |
|||
<view class="my-15 text-25 text-gray" |
|||
v-if="item.trainExamPeopleInfo && item.trainExamPeopleInfo.highLevelStatus > 0"> |
|||
<text>专家评审结果:</text> |
|||
<text class="ml-15" |
|||
:class="[item.trainExamPeopleInfo.highLevelStatus === 1 ? 'text-green' : 'text-red']"> |
|||
{{ ['待审核', '已通过', '未通过'][item.trainExamPeopleInfo.highLevelStatus] }} |
|||
</text> |
|||
</view> |
|||
</view> |
|||
<mprogress |
|||
:progress="item.progress" |
|||
:activeColor="item.color" |
|||
:valueColor="item.color" |
|||
:valueFontSize="12" |
|||
:valueText="item.text" |
|||
:width="50" |
|||
:borderWidth="4" |
|||
></mprogress> |
|||
</view> |
|||
</template> |
|||
<template v-else-if="current === 3"> |
|||
<view class="flex justify-start items-center bg-white p-20 my-20" v-for="(item, index) in list" :key="index"> |
|||
<uv-image :src="item.url" height="150rpx" mode="heightFix" @click="handPreviewImage(item)"/> |
|||
<view class="flex ml-20 flex-col justify-start items-start"> |
|||
<text>{{ item.title }}</text> |
|||
<text class="my-20 text-25 text-gray">获得时间: {{ |
|||
dayjs(item.createTime).format('YYYY-MM-DD HH:mm:ss') |
|||
}} |
|||
</text> |
|||
<uv-button type="primary" shape="circle" size="mini" @click="save(item.url)">下载证书</uv-button> |
|||
</view> |
|||
</view> |
|||
</template> |
|||
</view> |
|||
<uv-empty v-else text="暂无数据"></uv-empty> |
|||
</view> |
|||
</template> |
|||
|
|||
<script setup> |
|||
import {ref} from 'vue' |
|||
import {userTrainListReq} from "@/api/train"; |
|||
import {matchListReq, userHasJoinMatchReq} from "@/api/match"; |
|||
import dayjs from "dayjs"; |
|||
import mprogress from "@/components/m-progress/mprogress.vue"; |
|||
import {trainExamListReq} from "@/api/trainInfo"; |
|||
import {trainUserPaperListReq} from "@/api/user"; |
|||
|
|||
const current = ref(0) |
|||
const activeTabList = [{name: '培训记录'}, {name: '竞赛记录'}, {name: '考试记录'}, {name: '申报记录'}] |
|||
const changeTab = ({index}) => { |
|||
current.value = index |
|||
if (current.value === 0) getTrainList() |
|||
else if (current.value === 1) getMatchList() |
|||
else if (current.value === 2) getExamList() |
|||
else if (current.value === 3) getPaperList() |
|||
} |
|||
|
|||
const list = ref([]) |
|||
|
|||
const getTrainList = async () => { |
|||
const res = await userTrainListReq({ |
|||
withProgress: true, |
|||
page: 1, |
|||
limit: 9999 |
|||
}) |
|||
if (res && res.data) { |
|||
list.value = res.data.list.filter(item => item.summary) |
|||
} |
|||
} |
|||
|
|||
const getMatchList = async () => { |
|||
const {data} = await matchListReq({withAll: true}) |
|||
list.value = data.filter(item => dayjs(item.endDate).isBefore(dayjs())).map(item => { |
|||
item.progress = 100 |
|||
item.color = '#f29900' |
|||
item.text = '已完成' |
|||
return item |
|||
}) |
|||
} |
|||
|
|||
const getExamList = async () => { |
|||
const res = await trainExamListReq({ |
|||
type: 0 |
|||
}) |
|||
if (res) { |
|||
list.value = res.data.filter(item => { |
|||
return (item.paper && item.trainExamPeopleInfo) |
|||
}).map(item => { |
|||
let progress = 0, text = '未完成', color = '#cacaca' |
|||
progress = 100 |
|||
color = '#f29900' |
|||
text = '已完成' |
|||
item.progress = progress |
|||
item.color = color |
|||
item.text = text |
|||
item.showResult = true |
|||
return item |
|||
}) |
|||
} |
|||
} |
|||
|
|||
const getPaperList = async () => { |
|||
const {data} = await trainUserPaperListReq() |
|||
list.value = data |
|||
} |
|||
|
|||
const handPreviewImage = (item) => { |
|||
uni.previewImage({ |
|||
current: 0, |
|||
urls: [item.url] |
|||
}) |
|||
} |
|||
|
|||
const save = (url) => { |
|||
uni.showLoading({title: '下载中'}) |
|||
uni.downloadFile({ |
|||
url, |
|||
success: function (res) { |
|||
uni.saveImageToPhotosAlbum({ |
|||
filePath: res.tempFilePath, |
|||
success: function (res) { |
|||
uni.showToast({ |
|||
title: '保存成功', |
|||
icon: 'success', |
|||
duration: 2000 |
|||
}) |
|||
uni.hideLoading() |
|||
console.log('保存成功') |
|||
}, |
|||
fail: function (err) { |
|||
console.log(err) |
|||
} |
|||
}) |
|||
}, |
|||
complete: res => { |
|||
uni.hideLoading() |
|||
console.log(res) |
|||
} |
|||
}) |
|||
|
|||
} |
|||
|
|||
getTrainList() |
|||
</script> |
After Width: | Height: | Size: 2.6 KiB |
Loading…
Reference in new issue