| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274 |
- <!-- 特殊考试 -->
- <template>
- <view class="specialExam-component">
- <view class="card" v-if="examType">
- <view class="card-header">
- <view class="header-left">
- <view class="card-title">{{examData.examName}}</view>
- <view class="header-subtitle">{{examData.examKind==1&&examData.conditionType == 4?'前置条件已满足可以参加考试':'满足前置条件后可参加考试'}}</view>
- </view>
- </view>
- <view class="card-body">
- <view class="card-min-box" v-if="examData.needStudy"
- style="padding:6rpx 0;">
- <view class="card-min-left-box">
- <view style="height:24rpx;line-height:24rpx;margin-top:10rpx;">学时要求</view>
- <view style="height:24rpx;line-height:24rpx;">{{examData.completedStudyHours}} / {{examData.studyHoursRequirement}} 学时</view>
- </view>
- <view class="card-min-right-box-1" @click="tableButton(1,item)"
- v-if="examData.needStudy">开始学习</view>
- </view>
- <view class="card-min-box" v-if="examData.examStudy">
- <view class="card-min-left-box">
- <view>考前学习</view>
- </view>
- <view class="card-min-right-box-1" @click="tableButton(2,item)">开始学习</view>
- </view>
- <view class="card-min-box" v-if="examData.mockExam">
- <view class="card-min-left-box">
- <view>模拟考试</view>
- </view>
- <view class="card-min-right-box-1" @click="tableButton(3,item)"
- v-if="!examData.examStudy">开始考试</view>
- <view class="card-min-right-box-2" v-if="examData.examStudy">待通过模拟考试后解锁</view>
- </view>
- <view class="card-min-box">
- <view class="card-min-left-box">
- <view>在线考试</view>
- </view>
- <view class="card-min-right-box-1" @click="tableButton(4,item)"
- v-if="examData.examKind==1&&examData.conditionType == 4">开始考试</view>
- <view class="card-min-right-box-2" v-if="examData.examKind==1&&examData.conditionType != 4">待通过模拟考试后解锁</view>
- </view>
- </view>
- </view>
-
- <!-- 考试承诺书弹窗 -->
- <uni-popup ref="preExamDialog" type="center" :mask-click="false">
- <view class="pre-exam-dialog">
- <view class="dialog-header">
- <text class="dialog-title">考试承诺书</text>
- </view>
- <view class="dialog-body">
- <scroll-view scroll-y class="content-scroll">
- <richTextPdf ref="richTextPdf" :content="richTextHtml" />
- </scroll-view>
- </view>
- <view class="dialog-footer">
- <view v-if="preButtonType" class="btn btn-border" @click="downloadCommitment">下载</view>
- <view class="btn btn-primary" @click="confirmCommitment">确认</view>
- </view>
- </view>
- </uni-popup>
- </view>
- </template>
- <script>
- import {
- examUserExamStudyTaskList,
- } from '@/pages_safetyEducationExamination/api/index.js'
- import richTextPdf from '@/pages_safetyEducationExamination/component/richTextPdf.vue'
- export default {
- components: {
- richTextPdf
- },
- data() {
- return {
- examType:true,
- examData:{},
- // 承诺书相关
- preButtonType: false,
- richTextHtml: '',
- preData: null,
- itemData:{},
- }
- },
- created() {
-
- },
- mounted() {
- this.examUserExamStudyTaskList();
- },
- methods: {
- goToPage(item) {
- this.$set(this,'itemData',this.examData);
- goToExamPage(this.examData, {
- openCommitmentDialog: (examItem) => {
- this.preButtonType = examItem.commitmentPrintEnabled == 1;
- this.richTextHtml = examItem.commitmentContent;
- this.preData = examItem;
- this.$refs.preExamDialog.open();
- },
- });
- },
- // 下载承诺书
- downloadCommitment() {
- uni.showToast({ title: '正在下载,请耐心等候', icon: 'none' });
- this.$refs.richTextPdf.downloadPDF();
- },
- // 确认承诺书
- async confirmCommitment() {
- await confirmCommitmentAndStart(this.preData, () => {
- this.$refs.preExamDialog.close();
- startFormalExam(this.itemData);
- });
- },
- // 获取任务列表
- async loadTaskList() {
- try {
- const { data } = await examUserExamStudyTaskList({ page: 1, pageSize: 1, examStatus: 2, isSpecialExam: false });
- if (data.code === 200) {
- this.$set(this, 'onlineExamList', data.data.records);
- }
- } catch (e) { console.error('获取考试任务失败', e); }
- },
- async examUserExamStudyTaskList() {
- try {
- let obj = { page: 1, pageSize: 1, examStatus: 2, isSpecialExam: true };
- const { data } = await examUserExamStudyTaskList(obj);
- if (data.code === 200) {
- if(data.data.records[0]){
- // data.data.records[0].needStudy = true;
- this.$set(this,'examType',true);
- this.$set(this,'examData',data.data.records[0]);
- }else{
- this.$set(this,'examType',false);
- }
- }
- } catch (e) { console.error('获取特殊考试任务失败', e); }
- },
- },
-
- }
- </script>
- <style lang="stylus" scoped>
- .specialExam-component {
-
- .card {
- margin: 0 32rpx 32rpx;
- background: #fff;
- border-radius: 24rpx;
- overflow: hidden;
- margin-bottom: 24rpx;
- box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.03);
- border: 1px solid #dde3ed;
- }
-
- .card-header {
- padding: 20rpx 28rpx;
- display: flex;
- justify-content: space-between;
- align-items: center;
-
- .card-title {
- font-size: 28rpx;
- color: #333;
- }
- .header-subtitle{
- margin-top:10rpx;
- font-size:22rpx;
- color:#8896a7;
- }
- .header-link {
- font-size: 24rpx;
- color: #1857d4;
- }
- }
- .card-body{
- padding-bottom:28rpx;
- .card-min-box:nth-child(1){
- border-top:none;
- }
- .card-min-box{
- margin:0 32rpx;
- border-top:1px solid #8896a7;
- display: flex;
- .card-min-left-box{
- flex:1;
- view{
- height:80rpx;
- line-height:80rpx;
- }
- view:nth-child(1){
- font-size:24rpx;
- }
- view:nth-child(2){
- font-size:22rpx;
- color:#8896a7;
- margin-top:4px;
- }
- }
- .card-min-right-box-1{
- height:80rpx;
- line-height:80rpx;
- font-size:24rpx;
- color:#1857d4;
- }
- .card-min-right-box-2{
- height:80rpx;
- line-height:80rpx;
- font-size:24rpx;
- color:#8896a7;
- }
- }
- }
-
- }
-
- // 承诺书弹窗样式
- .pre-exam-dialog {
- width: 600rpx;
- max-height: 80vh;
- background: #fff;
- border-radius: 20rpx;
- overflow: hidden;
- }
-
- .dialog-header {
- padding: 32rpx;
- border-bottom: 1rpx solid #eee;
-
- .dialog-title {
- font-size: 32rpx;
- font-weight: 600;
- color: #333;
- }
- }
-
- .dialog-body {
- height: 800rpx;
- overflow: hidden;
-
- .content-scroll {
- height: 100%;
- }
- }
-
- .dialog-footer {
- display: flex;
- gap: 20rpx;
- padding: 24rpx 32rpx;
- border-top: 1rpx solid #eee;
-
- .btn {
- flex: 1;
- height: 72rpx;
- line-height: 72rpx;
- text-align: center;
- font-size: 28rpx;
- border-radius: 12rpx;
- }
-
- .btn-border {
- background: #fff;
- color: #1857d4;
- border: 1rpx solid #1857d4;
- }
-
- .btn-primary {
- background: #1857d4;
- color: #fff;
- }
- }
- </style>
|