yellowtaotao 3 years ago
parent
commit
e469cfec0b

+ 13 - 12
src/views/home/answer/page-answer-recruit.vue

@@ -34,7 +34,7 @@
         <div class="exam-question-describe">
           {{
             examQuestionList[answerIndex].questionContent ||
-            examQuestionList[answerIndex].content
+              examQuestionList[answerIndex].content
           }}
         </div>
         <!-- 答题列表 -->
@@ -42,8 +42,9 @@
         <div
           v-if="
             examQuestionList[answerIndex].type === questionType.TrueOrFalse ||
-            examQuestionList[answerIndex].type === questionType.singleChoice ||
-            examQuestionList[answerIndex].type === questionType.multipleChoice
+              examQuestionList[answerIndex].type ===
+                questionType.singleChoice ||
+              examQuestionList[answerIndex].type === questionType.multipleChoice
           "
           class="exam-question-options"
         >
@@ -54,7 +55,7 @@
               'exam-question-options-item': true,
               'exam-question-options-item-checked': answerValue.includes(item),
               'exam-question-options-false':
-                answerValue.includes(item) && answerStatus[answerIndex] === 2,
+                answerValue.includes(item) && answerStatus[answerIndex] === 2
             }"
             @click="handleExamQuestionOptionsItemFun(item)"
           >
@@ -65,7 +66,9 @@
         <div
           v-if="examQuestionList[answerIndex].type === questionType.gapFilling"
           class="exam-question-gapFilling"
-          :class="{ 'exam-question-gapFilling-false': answerStatus[answerIndex] === 2 }"
+          :class="{
+            'exam-question-gapFilling-false': answerStatus[answerIndex] === 2
+          }"
         >
           <textarea
             v-for="(item, index) in examQuestionList[answerIndex]
@@ -79,10 +82,8 @@
             @change="handleExamQuestionOptionsItemFun(inputValue, index)"
           />
         </div>
-        <div
-          v-if="answerRecruitId === 'daily-questions'"
-          class="exam-question-button-box"
-        >
+        <!-- v-if="answerRecruitId === 'daily-questions'" -->
+        <div class="exam-question-button-box">
           <div class="exam-question-single-button-box">
             <van-button
               v-if="this.answerIndex !== 0"
@@ -118,7 +119,7 @@
             >
           </div>
         </div>
-        <div v-else class="exam-question-button-box">
+        <!-- <div v-else class="exam-question-button-box">
           <div class="exam-question-single-button-box"></div>
           <div class="exam-question-single-button-box">
             <van-button
@@ -145,7 +146,7 @@
               }}</van-button
             >
           </div>
-        </div>
+        </div> -->
       </div>
       <div v-else class="exam-question-card">
         <div v-if="isInited" class="exam-question-card-nodata">暂无数据</div>
@@ -422,7 +423,7 @@ export default {
     },
     // 操作:确定
     handleSureFun() {
-      if (!this.examQuestionList.length) {
+      if (!(this.examQuestionList.length > 0)) {
         return;
       }
       this.examQuestionList[this.answerIndex].userAnswer = this.answerValue;

+ 1 - 1
src/views/home/answer/through/through-question-doing.vue

@@ -410,7 +410,7 @@ export default {
     },
     // 操作:确定
     handleSureFun() {
-      if (!this.examQuestionList.length) {
+      if (!(this.examQuestionList.length > 0)) {
         return;
       }
       this.examQuestionList[this.answerIndex].userAnswer = this.answerValue;

+ 16 - 15
src/views/home/exam/page-exam-item-doing.vue

@@ -177,7 +177,7 @@ export default {
     //   Toast("正在考试中,无法退出");
     //   history.pushState(null, null, document.URL);
     // });
-
+    this.$refs.uploadUserInput.click(); // 调用拍照工具
     this.initDataFun(); // 初始化数据信息
   },
   beforeDestroy() {
@@ -346,16 +346,16 @@ export default {
           return;
         }
         this.startTimeSeconds = this.startTimeSeconds + 1000; // 新增开始进行了考试的时长
-        if (
-          this.examBeforeHalfEndTimeSeconds / 2 > diffTime &&
-          !this.isOverHalfTime
-        ) {
-          console.log("超过一半考试时间了");
-          // this.$nextTick(() => {
-          //   this.$refs.uploadUserInput.click(); // 调用拍照工具
-          // });
-          this.isOverHalfTime = true;
-        }
+        // if (
+        //   this.examBeforeHalfEndTimeSeconds / 2 > diffTime &&
+        //   !this.isOverHalfTime
+        // ) {
+        //   console.log("超过一半考试时间了");
+        //   this.isOverHalfTime = true;
+        //   this.$nextTick(() => {
+        //     this.$refs.uploadUserInput.click(); // 调用拍照工具
+        //   });
+        // }
         let hours = Math.floor(diffTime / (1000 * 60 * 60));
         let minutes = Math.floor(
           (diffTime - hours * 60 * 60 * 1000) / (1000 * 60)
@@ -479,15 +479,15 @@ export default {
     },
     // 操作:确定
     handleSureFun() {
-      if (!this.examQuestionList.length) {
+      if (!(this.examQuestionList.length > 0)) {
         return;
       }
       this.examQuestionList[this.answerIndex].userAnswer = this.answerValue;
       this.handleNextFun();
       // 若超过了了考试时间的1/3,则需要调用拍照
-      if (this.isOverHalfTime && !this.isTakePhoto) {
-        this.$refs.uploadUserInput.click(); // 调用拍照工具
-      }
+      // if (this.isOverHalfTime && !this.isTakePhoto) {
+      //   this.$refs.uploadUserInput.click(); // 调用拍照工具
+      // }
     },
     // 操作:交卷 isAuto:true(时间到了的自动交卷)  false(手动交卷)
     handleSubmitFun() {
@@ -606,6 +606,7 @@ export default {
     takePhotoCallbackFun(event) {
       let file = event.target.files[0]; // 获取文件对象
       if (file) {
+        console.log("拍照文件", file);
         this.isTakePhoto = true;
         // let fd = new FormData(); // 构造formdata对象
         // fd.append("file", file); // 向formdata里面存放键值对存放图片文件

+ 5 - 2
src/views/home/learn/page-learn-child.vue

@@ -38,7 +38,7 @@
                 <div class="contentItemDescriptionTime">
                   {{
                     formateDatesFun(contentItem.createdTime) ||
-                    contentItem.createdTime
+                      contentItem.createdTime
                   }}
                 </div>
                 <div class="contentItemDescriptionStudyNeedTime">
@@ -93,7 +93,6 @@ export default {
   watch: {
     // 监听:工种
     chooseEngneeringWork(value) {
-      console.log(value.value);
       if (value.value) {
         this.getContentList(); // 查询:考试的场次列表信息
       }
@@ -102,6 +101,7 @@ export default {
   methods: {
     //   查询子目录
     getChildList() {
+      this.$store.commit("toggleLoading", true);
       let path = {
         categoryId: this.parentId
       };
@@ -110,6 +110,7 @@ export default {
         .then(res => {
           res.data.shift();
           this.learnChildList = res.data;
+          this.$store.commit("toggleLoading", false);
           this.getContentList();
         })
         .catch(() => {
@@ -123,6 +124,7 @@ export default {
     },
     //   查询子目录
     getContentList() {
+      this.$store.commit("toggleLoading", true);
       let path = {
         categoryId: this.learnChildList[this.choosedChildIndex].id
       };
@@ -140,6 +142,7 @@ export default {
         .then(res => {
           this.formatNeedStudyTodayFun(res.data);
           this.finished = true;
+          this.$store.commit("toggleLoading", false);
         })
         .catch(() => {
           this.$store.commit("toggleLoading", false);

+ 34 - 9
src/views/home/learn/page-learn-recommend.vue

@@ -1,10 +1,21 @@
 <template>
   <div class="contentBody">
-    <van-list v-model="loading" :finished="finished" finished-text="没有更多了" @load="onLoad">
+    <van-list
+      v-model="loading"
+      :finished="finished"
+      finished-text="没有更多了"
+      @load="onLoad"
+    >
       <template>
         <van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
           <van-swipe-item v-for="(item, index) in swiperList" :key="index">
-            <van-image width="100%" height="100%" fit="cover" :src="item.url" :show-error="true" />
+            <van-image
+              width="100%"
+              height="100%"
+              fit="cover"
+              :src="item.url"
+              :show-error="true"
+            />
           </van-swipe-item>
         </van-swipe>
       </template>
@@ -16,18 +27,20 @@
         <div slot="default" class="contentItemDiv" v-if="contentItem">
           <div class="contentItemTitleTitleRow">
             <div class="contentItemTitle">{{ contentItem.name }}</div>
-            <div v-if="contentItem.isNeedStudyToday" class="contentItemstates">今日必学</div>
+            <div v-if="contentItem.isNeedStudyToday" class="contentItemstates">
+              今日必学
+            </div>
           </div>
           <div class="contentItemDescription">
             <div class="contentItemDescriptionTime">
               {{
-              formateDatesFun(contentItem.createdTime) ||
-              contentItem.createdTime
+                formateDatesFun(contentItem.createdTime) ||
+                  contentItem.createdTime
               }}
             </div>
             <div class="contentItemDescriptionStudyNeedTime">
               所需学习时间:{{
-              getTimeHoursMinuteSecondsFun(contentItem.readTimeInSec)
+                getTimeHoursMinuteSecondsFun(contentItem.readTimeInSec)
               }}
             </div>
           </div>
@@ -38,6 +51,7 @@
 </template>
 
 <script>
+import { mapState } from "vuex";
 export default {
   name: "page-learn-recommend",
   components: {},
@@ -52,14 +66,25 @@ export default {
       finished: false
     };
   },
-  computed: {},
+  computed: {
+    ...mapState({
+      chooseEngneeringWork: state => state.user.chooseEngneeringWork
+    })
+  },
+  watch: {
+    // 监听:工种
+    chooseEngneeringWork(value) {
+      if (value.value) {
+        this.getNewsfeed(); // 查询子目录
+      }
+    }
+  },
   created() {
     this.getNewsfeed();
   },
   mounted() {},
-  watch: {},
   methods: {
-    //   查询子目录
+    // 查询子目录
     getNewsfeed() {
       this.$_http
         .get(this.$_API.JTXT_GET_NEWSFEED)