From 8f685b98d924cabe0026163398e1867b54b3a988 Mon Sep 17 00:00:00 2001
From: 阳洁 <2077506045@qq.com>
Date: 星期五, 23 二月 2024 14:07:15 +0800
Subject: [PATCH] API-Fan产品增加练习页面

---
 src/lang/th.js                    |    1 
 /dev/null                         |    0 
 src/lang/zh.js                    |    2 
 src/lang/en.js                    |    1 
 src/views/exam/paper/guide.vue    |   10 ++
 src/router.js                     |   12 +++
 dist-20240222.zip                 |    0 
 src/views/exam/paper/exercise.vue |  208 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 8 files changed, 232 insertions(+), 2 deletions(-)

diff --git a/dist-20240222.zip b/dist-20240222.zip
new file mode 100644
index 0000000..e3e4ed7
--- /dev/null
+++ b/dist-20240222.zip
Binary files differ
diff --git a/dist.zip b/dist.zip
deleted file mode 100644
index e79735c..0000000
--- a/dist.zip
+++ /dev/null
Binary files differ
diff --git a/src/lang/en.js b/src/lang/en.js
index 07866ca..f8c20b5 100644
--- a/src/lang/en.js
+++ b/src/lang/en.js
@@ -29,6 +29,7 @@
   finishSubmit: 'You have completed the work behavior questionnaire, and the data has been successfully uploaded to the server and saved. Thank you.',
   selectData: 'Date',
   startDo: 'Next',
+  startDo_apifan: 'The test has officially started.',
   second: ' second ',
   min: ' minute ',
   hour: ' hour ',
diff --git a/src/lang/th.js b/src/lang/th.js
index df569f7..7b1d119 100644
--- a/src/lang/th.js
+++ b/src/lang/th.js
@@ -29,6 +29,7 @@
   finishSubmit: 'You have completed the work behavior questionnaire, and the data has been successfully uploaded to the server and saved. Thank you.',
   selectData: 'Date',
   startDo: 'Start the Test',
+  startDo_apifan: 'The test has officially started.',
   second: ' second ',
   min: ' minute ',
   hour: ' hour ',
diff --git a/src/lang/zh.js b/src/lang/zh.js
index 4d473a0..f45dc7b 100644
--- a/src/lang/zh.js
+++ b/src/lang/zh.js
@@ -28,6 +28,7 @@
   finishSubmit: '鎮ㄥ凡缁忓畬鎴愪簡宸ヤ綔琛屼负闂嵎锛屾暟鎹凡缁忔垚鍔熷湴涓婁紶鑷虫湇鍔″櫒锛屽苟宸茬粡淇濆瓨濂姐�傝阿璋€��',
   selectData: '閫夋嫨鏃ユ湡',
   startDo: '寮�濮嬫祴璇�',
+  startDo_apifan: '姝e紡寮�濮嬫祴璇�',
   second: '绉�',
   min: '鍒�',
   hour: '灏忔椂',
@@ -41,6 +42,7 @@
   examinee: '娴嬭瘯鑰咃細',
   close: '鍏抽棴',
   pleaseAnswerCarefully: '*璇疯鐪熶綔绛�',
+  pleaseAnswerCarefully_exercise: '*褰撳墠涓虹粌涔犵幆鑺傦紝缁冧範缁撴潫鍚庤鐐瑰嚮鈥滄寮忓紑濮嬫祴璇曗�濇寜閽寮忚繘琛屾祴璇曘��',
   pleaseAnswerCarefullyCiaq: '*璇疯鐪熶綔绛斻�傜壒鍒彁绀猴紝鏈祴楠屽叧娉ㄧ殑鏄綘瀵瑰悇绫绘椿鍔ㄧ殑鍏磋叮鎴栧枩濂斤紝鑰岄潪鑳藉姏绛夊叾浠栧洜绱狅紒',
   submitTimeout: ':鎻愪氦鍚庡彴瓒呮椂',
   submitExceptionInfo: '淇濆瓨鏈嶅姟鍣ㄧ綉缁滃紓甯革紝璇峰叧闂祻瑙堥噸鏂扮偣鍑婚摼鎺ョ瓟棰�',
diff --git a/src/router.js b/src/router.js
index e07934d..5bbd595 100644
--- a/src/router.js
+++ b/src/router.js
@@ -144,6 +144,18 @@
       ]
     },
     {
+      path: '/exam',
+      component: Layout,
+      children: [
+        {
+          path: 'exercise',
+          component: () => import('@/views/exam/paper/exercise'),
+          name: 'ExamPaperExercise',
+          meta: { title: 'exercise' }
+        }
+      ]
+    },
+    {
       path: '/report',
       component: Layout,
       children: [
diff --git a/src/views/exam/paper/exercise.vue b/src/views/exam/paper/exercise.vue
new file mode 100644
index 0000000..8c70b0b
--- /dev/null
+++ b/src/views/exam/paper/exercise.vue
@@ -0,0 +1,208 @@
+<template>
+  <div>
+    <el-container  class="app-item-contain">
+00      <el-main style="padding-top: 3%;">
+        <el-form :model="form" ref="form" label-width="100%">
+          <el-row :key="index"  v-for="(titleItem,index) in titleItems">
+            <div class="q-content">{{titleItem.description}}</div>
+            <el-card class="exampaper-item-box" v-if="titleItem.questionItems.length!==0"  style="border:2px solid #2b90ff;">
+              <div class="align-center"><span style="font-size: small; float: left">{{$t('examinee')}}{{memberName}}</span><span style="margin-top: 0px;padding-right: 11%">鈼弡{form.name}}鈼�</span></div>
+              <hr style="border : 1px dashed #b3d8ff;" />
+              <el-row style="margin-left:7px;margin-bottom:10px;">{{ questionItem.note }}</el-row>
+              <el-row style="margin-left:7px;margin-bottom:10px;">{{ questionItem.guide }}</el-row>
+              <el-form-item :key="itemOrder" label-width="1px">
+                <QuestionEdit @callNextSubject="nextSubject" :qType="questionItem.questionType" :question="questionItem"
+                              :answer="answer.answerItems[questionItem.itemOrder-1]" :qLabel="itemOrder+'/'+itemSize"/>
+              </el-form-item>
+              <hr style="border : 0.5px dashed #b3d8ff;" />
+              <div style="color: red;font-size: smaller">{{$t('pleaseAnswerCarefully_exercise')}}</div>
+              
+              <el-row class="do-align-center" v-if="itemOrder > 1">
+                <el-button @click="doExam" type="success" round>{{$t('startDo_apifan')}}</el-button>
+                <el-button @click="preSubject" type="warning" round>{{$t('lastQuestion')}}</el-button>
+              </el-row>
+              <el-row class="do-align-center" v-if="itemOrder <= 1">
+                <el-button @click="doExam" type="success" round>{{$t('startDo_apifan')}}</el-button>
+                <el-button @click="nextSubject" type="primary" round>{{$t('nextQuestion')}}</el-button>
+              </el-row>
+            </el-card>
+          </el-row>
+        </el-form>
+
+      </el-main>
+    </el-container>
+    <el-row class="do-exam-title footer">
+      <el-col :span="24">
+        <!--<el-popover placement="top" title="棰樼洰鍒楄〃" width="200" trigger="click" ref="popovertag">-->
+          <!--<el-tag type="success" slot="reference">棰樼洰</el-tag>-->
+          <!--<span :key="item.itemOrder" v-for="(item) in answer.answerItems">-->
+             <!--<el-tag :type="questionCompleted(item.completed)" class="do-exam-title-tag"-->
+                     <!--&gt;{{item.itemOrder}}</el-tag>-->
+        <!--</span>-->
+        <!--</el-popover>-->
+        <span class="do-exam-time">
+          <!--<label>{{$t('remainingTime')}}</label>-->
+          <!--<label>{{formatSecondsG(remainTime,$t('hour'),$t('min'),$t('second'))}}</label>-->
+        </span>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import { mapState, mapGetters, mapMutations } from 'vuex'
+import { formatSeconds, formatSecondsG, formatDate } from '@/utils'
+import QuestionEdit from '../components/QuestionEdit'
+import examPaperApi from '@/api/examPaper'
+import examPaperAnswerApi from '@/api/examPaperAnswer'
+import demographyApi from '@/api/demography'
+
+export default {
+  name: 'exercise',
+  components: { QuestionEdit },
+  data () {
+    return {
+      memberName: this.$route.query.formDo.memberName,
+      form: {
+        name: this.$route.query.formDo.name
+      },
+      itemOrder: 1,
+      itemSize: 2,
+      description: '',
+      guide: '',
+      questionItem: {
+        title: '鎴戝杽浜庝富鍔ㄥ拰闄岀敓浜轰氦璋堛��',
+        items: [
+          { content: '闈炲父涓嶅悓鎰�', prefix: '1', score: 0 },
+          { content: '涓嶅悓鎰�', prefix: '2', score: 0 },
+          { content: '涓嶇‘瀹�', prefix: '3', score: 0 },
+          { content: '鍚屾剰', prefix: '4', score: 0 },
+          { content: '闈炲父鍚屾剰', prefix: '5', score: 0 }
+        ],
+        questionType: 1,
+        note: '浠ヤ笅涓哄伐浣滆涓�/棰樼洰椋庢牸鐨勪緥瀛�',
+        guide: '璇蜂粩缁嗛槄璇讳笅闈㈢殑闄堣堪锛屽垽鏂偍鍦ㄥ澶х▼搴︿笂鍚屾剰姣忎竴闄堣堪瀵规偍鐨勬弿杩帮紝鐒跺悗鐐瑰嚮鐩稿簲鐨勯�夐」銆�'
+      },
+      answer: {
+        questionId: null,
+        doTime: 0,
+        answerItems: [],
+        verifyStatus: 2
+      },
+      titleItems: [
+        {
+          questionItems: [
+            {
+              title: '鎴戝杽浜庝富鍔ㄥ拰闄岀敓浜轰氦璋堛��',
+              items: [
+                { content: '闈炲父涓嶅悓鎰�', prefix: '1', score: 0 },
+                { content: '涓嶅悓鎰�', prefix: '2', score: 0 },
+                { content: '涓嶇‘瀹�', prefix: '3', score: 0 },
+                { content: '鍚屾剰', prefix: '4', score: 0 },
+                { content: '闈炲父鍚屾剰', prefix: '5', score: 0 }
+              ],
+              questionType: 1
+            },
+            {
+              title: '浣跨敤澶嶅嵃鏈恒��',
+              items: [
+                { content: '浠庢潵娌℃湁', prefix: '1', score: 0 },
+                { content: '1-2娆�', prefix: '2', score: 0 },
+                { content: '濂藉嚑娆�', prefix: '3', score: 0 },
+                { content: '缁忓父', prefix: '4', score: 0 }
+              ],
+              questionType: 1
+            }
+          ]
+        }
+      ],
+      isSubmit: false
+    }
+  },
+  created: function () {
+  },
+  mounted () {
+  },
+  beforeDestroy () {
+  },
+  watch: {
+  },
+  methods: {
+    nextSubject () {
+      if (this.itemOrder === 2) {
+        this.isSubmit = true
+        return
+      }
+      this.questionItem = {
+        title: '浣跨敤澶嶅嵃鏈恒��',
+        items: [
+          { content: '浠庢潵娌℃湁', prefix: '1', score: 0 },
+          { content: '1-2娆�', prefix: '2', score: 0 },
+          { content: '濂藉嚑娆�', prefix: '3', score: 0 },
+          { content: '缁忓父', prefix: '4', score: 0 }
+        ],
+        questionType: 1,
+        note: '浠ヤ笅涓哄熀鏈妧鑳借繃寰�缁忛獙棰樼洰鐨勪緥瀛�',
+        guide: '鎮ㄥ湪杩囧幓涓�骞翠腑浣跨敤杩囪繖浜涘熀鏈妧鑳界殑棰戝害锛屽苟鐐瑰嚮鐩稿簲鐨勯�夐」銆�'
+
+      }
+      this.itemOrder = 2
+    },
+    preSubject () {
+      this.isSubmit = false
+      this.questionItem = {
+        title: '鎴戝杽浜庝富鍔ㄥ拰闄岀敓浜轰氦璋堛��',
+        items: [
+          { content: '闈炲父涓嶅悓鎰�', prefix: '1', score: 0 },
+          { content: '涓嶅悓鎰�', prefix: '2', score: 0 },
+          { content: '涓嶇‘瀹�', prefix: '3', score: 0 },
+          { content: '鍚屾剰', prefix: '4', score: 0 },
+          { content: '闈炲父鍚屾剰', prefix: '5', score: 0 }
+        ],
+        questionType: 1,
+        note: '浠ヤ笅涓哄伐浣滆涓�/棰樼洰椋庢牸鐨勪緥瀛�',
+        guide: '璇蜂粩缁嗛槄璇讳笅闈㈢殑闄堣堪锛屽垽鏂偍鍦ㄥ澶х▼搴︿笂鍚屾剰姣忎竴闄堣堪瀵规偍鐨勬弿杩帮紝鐒跺悗鐐瑰嚮鐩稿簲鐨勯�夐」銆�'
+      }
+      this.itemOrder = 1
+    },
+    doExam () {
+      let _this = this
+      examPaperApi.updateTestMemberStatus(_this.memberToken).then(re => {
+        _this.$router.push({ path: '/exam/' + _this.doUrl, query: { formDo: _this.$route.query.formDo } })
+      }).catch(re => {
+        _this.$message.error(re.message + ' 鏇存柊鐘舵�佸け璐�')
+      })
+    }
+  },
+  computed: {
+    ...mapState('exam', { doUrl: state => state.doUrl }),
+    ...mapState('user', { memberToken: state => state.memberToken })
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+  .align-center {
+    text-align: center;
+  }
+
+  .exam-question-item {
+    padding: 10px;
+    font-size: large;
+
+    .el-form-item__label {
+      font-size: large !important;
+    }
+  }
+
+  .question-title-padding {
+    padding-left: 25px;
+    padding-right: 25px;
+  }
+  .footer {
+    position: absolute;
+    position: fixed;
+    z-index: 1000;
+    bottom: 0px;
+  }
+</style>
diff --git a/src/views/exam/paper/guide.vue b/src/views/exam/paper/guide.vue
index 4aca1bf..b2531c6 100644
--- a/src/views/exam/paper/guide.vue
+++ b/src/views/exam/paper/guide.vue
@@ -7,8 +7,9 @@
       <el-main style="padding-top:0%">
         <div v-html="formDo.guide"></div>
         <el-row class="do-align-center">
-          <el-button @click="doExam" type="primary" round>{{$t('startDo')}}</el-button>
+          <el-button v-if="formDo.productType !== 'APIFan'" @click="doExam" type="primary" round>{{$t('startDo')}}</el-button>
           <el-button v-if="formDo.questionTemplateId === 'job'" @click="openExplain" type="danger" round>鎵撳紑宀椾綅璇存槑</el-button>
+          <el-button v-if="formDo.productType === 'APIFan'" @click="openExercise" type="primary" round>缁х画</el-button>
         </el-row>
       </el-main>
     </el-container>
@@ -27,7 +28,6 @@
   created () {
   },
   mounted () {
-    console.log(this.formDo)
     // 鏇挎崲APIFan鎸囧璇腑鐨勫彉閲�
     if (this.formDo.productType === 'APIFan') {
       let guide = this.formDo.guide
@@ -56,6 +56,12 @@
     openExplain: function () {
       let _this = this
       window.open(_this.formDo.jobDescriptionFile)
+    },
+
+    // 鎵撳紑缁冧範椤甸潰
+    openExercise: function () {
+      let _this = this
+      _this.$router.push({ path: '/exam/exercise', query: { formDo: _this.$route.query.formDo } })
     }
   },
   computed: {

--
Gitblit v1.9.1