Преглед изворни кода

七大元模考 增加上下题切换

谢杰标 пре 2 година
родитељ
комит
7ea4ce3a8c

+ 394 - 0
components/common/BankBom.vue

@@ -0,0 +1,394 @@
+<template>
+  <div>
+    <view class="bank-control fl_b">
+      <view class="fl_b left">
+        <view class="btn-item" style="" @click="openFooterTab">
+          <image src="/static/icon_sheet.png"></image>
+          <text>答题卡</text>
+        </view>
+        <view class="btn-item" @click="$emit('submit')">
+          <image src="/static/icon_paper.png" mode=""></image>
+          <text @click="$emit('submit')">交卷</text>
+        </view>
+      </view>
+      <view class="fl">
+        <view class="tab up" @click="prev">上一题</view>
+        <view class="tab down" @click="next">下一题</view>
+      </view>
+      <view class="collect" @click="collect" v-if="isShowCollect">
+        <image v-if="true" src="/static/icon_star.png"></image>
+        <image v-else src="/static/icon_star_sel.png"></image>
+      </view>
+    </view>
+    <u-popup v-model="show" mode="bottom" border-radius="14" height="680rpx">
+      <view class="popupView">
+        <view class="popupTops">
+          <view class="topIcon"></view>
+          点击编号即可跳转至对应题目
+        </view>
+        <view class="popupContent">
+          <scroll-view scroll-y="true" style="height: 506rpx">
+            <view class="boxSty">
+              <view
+                v-for="(item, index) in questionList"
+                :key="index"
+                @click="changeIndex(index)"
+                :class="{
+                  isRight: bankType == 1 && isRight(item, index),
+                  isWrong: bankType == 1 && isWrong(item, index),
+                  isPart: bankType == 1 && isPart(item, index),
+                  isOver: bankType == 1 && isOver(item, index),
+                  check_ans: bankType == 2 && isCheck(item, index),
+                }"
+                class="liListSty"
+              >
+                {{ index + 1 }}
+              </view>
+            </view>
+          </scroll-view>
+        </view>
+      </view>
+    </u-popup>
+  </div>
+</template>
+
+<script>
+export default {
+  name: "SaasMiniprogramBankBom",
+  props: {
+    isShowCollect: {
+      type: Boolean,
+      default: true,
+    },
+    isCollect: {
+      type: Boolean,
+      default: false,
+    },
+    questionList: {
+      type: Array,
+      default: () => {
+        return [];
+      },
+    },
+    bankType: {
+      type: Number,
+    },
+    current: {
+      type: Number,
+    },
+  },
+  data() {
+    return {
+      show: false,
+    };
+  },
+  mounted() {},
+  methods: {
+    changeIndex(index) {
+      this.$emit("update:current", index);
+    },
+    prev() {
+      if (this.current == 0) {
+        uni.showToast({
+          icon: "none",
+          title: "已经是第一题了!",
+        });
+        return;
+      }
+      this.changeIndex(this.current - 1);
+    },
+    next() {
+      if (this.current >= this.questionList.length - 1) {
+        uni.showToast({
+          icon: "none",
+          title: "已经是最后一题了!",
+        });
+        return;
+      }
+      this.changeIndex(this.current + 1);
+    },
+    collect() {
+      if (!this.isCollect) {
+        this.$api
+          .collectQuestion({
+            examId: this.id,
+            questionId: this.questionList[index].questionId,
+            goodsId: this.goodsId || "",
+            orderGoodsId: this.orderGoodsId,
+            doMode: 1, //做题模式 1章卷 2随机练习
+          })
+          .then((res) => {
+            if (res.data.code == 200) {
+              this.$set(this.collectList, index, true);
+              uni.showToast({
+                title: "收藏成功",
+                duration: 2000,
+                icon: "none",
+              });
+              this.getCollectInfo(index);
+            }
+          });
+      } else {
+        this.$api
+          .deleteCollectQuestion(this.collectList[index].collectQuestionId)
+          .then((res) => {
+            if (res.data.code == 200) {
+              this.$set(this.collectList, index, false);
+              uni.showToast({
+                title: "取消收藏成功",
+                duration: 2000,
+                icon: "none",
+              });
+            }
+          });
+      }
+      return;
+    },
+    openFooterTab() {
+      this.show = true;
+    },
+    isCheck(item, index) {
+      // 案例题处理
+      let { ques, type, ans } = item;
+      if (type == 4) {
+        return ans.length == ques.length;
+      }
+      if (ques) {
+        return true;
+      }
+    },
+    isRight(item, index) {
+      //单选
+      if (this.questionList[index].ques) {
+        if (item.type == 1) {
+          return this.questionList[index].ques == this.questionList[index].ans;
+          //多选
+        } else if (item.type == 2) {
+          //每一项都相等
+          return this.questionList[index].ans.every((item, i) => {
+            return item == this.questionList[index].ques[i];
+          });
+          //判断
+        } else if (item.type == 3) {
+          return this.questionList[index].ques == this.questionList[index].ans;
+          // } else if (item.type == 5) {
+          // 	if(this.questionList[index].ques.text){
+          // 		return true
+          // 	}else{
+          // 		return false
+          // 	}
+        } else {
+          return false;
+        }
+      } else {
+        return false;
+      }
+    },
+    isWrong(item, index) {
+      if (this.questionList[index].ques) {
+        //单选
+        if (item.type == 1) {
+          return this.questionList[index].ques != this.questionList[index].ans;
+          //多选
+        } else if (item.type == 2) {
+          //每一项都相等
+          return this.questionList[index].ques.some((item, i) => {
+            return this.questionList[index].ans.indexOf(item) == -1;
+          });
+          //判断
+        } else if (item.type == 3) {
+          return this.questionList[index].ques != this.questionList[index].ans;
+        } else {
+          return false;
+        }
+      } else {
+        return false;
+      }
+    },
+    isPart(item, index) {
+      if (this.questionList[index].ques) {
+        if (item.type == 2) {
+          let isWrong = this.questionList[index].ques.some((item, i) => {
+            return this.questionList[index].ans.indexOf(item) == -1;
+          });
+
+          let isRight = this.questionList[index].ans.every((item, i) => {
+            return item == this.questionList[index].ques[i];
+          });
+
+          if (!isRight && !isWrong) {
+            return true;
+          }
+        }
+      } else {
+        return false;
+      }
+    },
+    isOver(item, index) {
+      if (this.questionList[index].ques) {
+        if (item.type == 4) {
+          //案例题
+          let isOver = item.jsonStr.every((jsonItem, indexs) => {
+            if (
+              jsonItem.type == 1 ||
+              jsonItem.type == 2 ||
+              jsonItem.type == 3
+            ) {
+              if (item.ques[indexs]) {
+                return true;
+              } else {
+                return false;
+              }
+            } else if (jsonItem.type == 5) {
+              if (
+                item.ques[indexs] &&
+                (item.ques[indexs].text || item.ques[indexs].imageList.length)
+              ) {
+                console.log("chil");
+                return true;
+              } else {
+                return false;
+              }
+            }
+          });
+
+          if (isOver) {
+            return true;
+          } else {
+            return false;
+          }
+        } else if (item.type == 5) {
+          //简答题
+          //每一项都相等
+          if (item.ques && (item.ques.imageList.length || item.ques.text)) {
+            return true;
+          }
+          //判断
+        } else {
+          return false;
+        }
+      } else {
+        return false;
+      }
+    },
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+.bank-control {
+  background-color: #fff;
+  z-index: 10078;
+  position: fixed;
+  bottom: 0rpx;
+  width: 100%;
+  height: 120rpx;
+  padding: 16rpx 28rpx 16rpx 48rpx;
+  .left {
+    width: 180rpx;
+  }
+  .btn-item {
+    text {
+      color: #333333;
+      font-size: 24rpx;
+      margin-top: 10rpx;
+      display: block;
+    }
+  }
+  image {
+    width: 40rpx;
+    height: 40rpx;
+    display: block;
+    margin: 0 auto;
+  }
+  .tab {
+    height: 88rpx;
+    line-height: 88rpx;
+    text-align: center;
+    border-radius: 16rpx;
+    font-size: 30rpx;
+    padding: 0 56rpx;
+  }
+  .up {
+    background: #e5f1ff;
+    color: #498afe;
+  }
+  .down {
+    background: #498afe;
+    color: #ffffff;
+    margin-left: 28rpx;
+  }
+  .collect {
+    position: fixed;
+    top: 50rpx;
+    right: 42rpx;
+  }
+}
+.popupView {
+  height: 100%;
+  padding-bottom: 100rpx;
+  .popupTops {
+    height: 77rpx;
+    border-bottom: 1rpx solid #eee;
+    text-align: center;
+    line-height: 77rpx;
+    font-size: 24rpx;
+    color: #999;
+    position: relative;
+    .topIcon {
+      position: absolute;
+      top: 10rpx;
+      left: 50%;
+      transform: translateX(-50%);
+      width: 80rpx;
+      height: 8rpx;
+      background-color: #999;
+      border-radius: 4rpx;
+    }
+  }
+  .boxSty {
+    padding: 44rpx 41rpx 0rpx;
+  }
+  .liListSty {
+    border: 1rpx solid #eeeeee;
+    width: 88rpx;
+    height: 88rpx;
+    border-radius: 32rpx;
+    text-align: center;
+    line-height: 88rpx;
+    color: #333;
+    font-size: 32rpx;
+    float: left;
+    margin: 20rpx 23rpx;
+
+    &.isRight {
+      border: 1rpx solid #eeeeee;
+      color: #fff;
+      background: #36c75a;
+    }
+
+    &.isWrong {
+      border: 1rpx solid #eeeeee;
+      color: #fff;
+      background: #ff3b30;
+    }
+
+    &.isPart {
+      border: 1rpx solid #eeeeee;
+      color: #fff;
+      background: #ffc53d;
+    }
+
+    &.isOver {
+      border: 1rpx solid #eeeeee;
+      color: #fff;
+      background: blue;
+    }
+    &.check_ans {
+      border: 1rpx solid #eeeeee;
+      color: #fff;
+      background: #007aff;
+    }
+  }
+}
+</style>

+ 1 - 1
pages/learn/index.vue

@@ -722,7 +722,7 @@ export default {
     this.getCourseLiveQues();
   },
   onReachBottom() {
-    if (this.courseLists.length <= this.total) {
+    if (this.courseLists.length < this.total) {
       this.paramC.pageNum++;
       this.getCourseList();
     }

+ 24 - 317
pages5/examBank/index.vue

@@ -768,56 +768,16 @@
               </template>
             </view>
           </template>
-
-          <view class="footer_btn">
-            <view class="collect"> </view>
-            <view class="flex_center" @click="openFooterTab">
-              <view class="up-icon">
-                <image src="/static/up.png"></image>
-              </view>
-              答题卡
-            </view>
-            <view class="collect show" @click="pdsubmit">
-              <view>
-                <image src="/static/jj.png" mode=""></image>
-                <view>交卷</view>
-              </view>
-            </view>
-          </view>
         </view>
       </swiper-item>
     </swiper>
-
-    <u-popup v-model="show" mode="bottom" border-radius="14" height="680rpx">
-      <view class="popupView">
-        <view class="popupTops">
-          <view class="topIcon"></view>
-          点击编号即可跳转至对应题目
-        </view>
-        <view class="popupContent">
-          <scroll-view scroll-y="true" style="height: 506rpx">
-            <view class="boxSty">
-              <view
-                v-for="(item, index) in questionList"
-                :key="index"
-                @click="changeIndex(index)"
-                :class="{
-                  isRight: bankType == 1 && isRight(item, index),
-                  isWrong: bankType == 1 && isWrong(item, index),
-                  isPart: bankType == 1 && isPart(item, index),
-                  isOver: bankType == 1 && isOver(item, index),
-                  check_ans: bankType == 2 && isCheck(item, index),
-                }"
-                class="liListSty"
-              >
-                {{ index + 1 }}
-              </view>
-            </view>
-          </scroll-view>
-        </view>
-      </view>
-    </u-popup>
-
+    <bank-bom
+      :isShowCollect="false"
+      :questionList="questionList"
+      :bankType="bankType"
+      :current.sync="current"
+      @submit="pdsubmit"
+    ></bank-bom>
     <view class="dialog" v-if="showDialog">
       <image class="pointer" src="/static/pointer.png" mode=""></image>
       <view class="text">左右滑动切换上下题</view>
@@ -906,10 +866,8 @@
 
 <script>
 import { mapGetters, mapActions } from "vuex";
+import BankBom from "../../components/common/BankBom.vue";
 export default {
-  computed: {
-    ...mapGetters(["sysTime"]),
-  },
   data() {
     return {
       subscribeId: 0,
@@ -921,7 +879,6 @@ export default {
       judge: ["正确", "错误"],
       ans: [],
       ques: [],
-      show: false,
       showDialog: false,
       bankList: [],
       collectList: [],
@@ -951,8 +908,6 @@ export default {
     };
   },
   async onLoad(option) {
-    console.log(option);
-
     this.examStartTime = option.examStartTime;
     this.examEndTime = option.examEndTime;
     this.subscribeId = option.subscribeId || "";
@@ -1764,17 +1719,15 @@ export default {
         });
 
       //错题集id提交(客观题)
-      if (doWrongQuestionIds.length) {
-        this.$api
-          .mockWrongRecord({
-            eachExamId: this.eachExamId,
-            examId: this.examId,
-            questionIds: form.questionIds,
-            recordId: this.recordId,
-            doMode: this.doMode,
-          })
-          .then((res) => {});
-      }
+      this.$api
+        .mockWrongRecord({
+          eachExamId: this.eachExamId,
+          examId: this.examId,
+          questionIds: form.questionIds,
+          recordId: this.recordId,
+          doMode: this.doMode,
+        })
+        .then((res) => {});
     },
 
     /**
@@ -2016,44 +1969,6 @@ export default {
       this.isDoOver();
     },
 
-    isCheck(item, index) {
-      // 案例题处理
-      let { ques, type, ans } = item;
-      if (type == 4) {
-        return ans.length == ques.length;
-      }
-      if (ques) {
-        return true;
-      }
-    },
-    isRight(item, index) {
-      //单选
-      if (this.questionList[index].ques) {
-        if (item.type == 1) {
-          return this.questionList[index].ques == this.questionList[index].ans;
-          //多选
-        } else if (item.type == 2) {
-          //每一项都相等
-          return this.questionList[index].ans.every((item, i) => {
-            return item == this.questionList[index].ques[i];
-          });
-          //判断
-        } else if (item.type == 3) {
-          return this.questionList[index].ques == this.questionList[index].ans;
-          // } else if (item.type == 5) {
-          // 	if(this.questionList[index].ques.text){
-          // 		return true
-          // 	}else{
-          // 		return false
-          // 	}
-        } else {
-          return false;
-        }
-      } else {
-        return false;
-      }
-    },
-
     right(bankIndex, ansIndex, option) {
       if (
         this.questionList[bankIndex].ques[ansIndex] &&
@@ -2098,99 +2013,14 @@ export default {
       }
     },
 
-    isWrong(item, index) {
-      if (this.questionList[index].ques) {
-        //单选
-        if (item.type == 1) {
-          return this.questionList[index].ques != this.questionList[index].ans;
-          //多选
-        } else if (item.type == 2) {
-          //每一项都相等
-          return this.questionList[index].ques.some((item, i) => {
-            return this.questionList[index].ans.indexOf(item) == -1;
-          });
-          //判断
-        } else if (item.type == 3) {
-          return this.questionList[index].ques != this.questionList[index].ans;
-        } else {
-          return false;
-        }
-      } else {
-        return false;
-      }
-    },
-    isPart(item, index) {
-      if (this.questionList[index].ques) {
-        if (item.type == 2) {
-          let isWrong = this.questionList[index].ques.some((item, i) => {
-            return this.questionList[index].ans.indexOf(item) == -1;
-          });
-
-          let isRight = this.questionList[index].ans.every((item, i) => {
-            return item == this.questionList[index].ques[i];
-          });
-
-          if (!isRight && !isWrong) {
-            return true;
-          }
-        }
-      } else {
-        return false;
-      }
-    },
-    isOver(item, index) {
-      if (this.questionList[index].ques) {
-        if (item.type == 4) {
-          //案例题
-          let isOver = item.jsonStr.every((jsonItem, indexs) => {
-            if (
-              jsonItem.type == 1 ||
-              jsonItem.type == 2 ||
-              jsonItem.type == 3
-            ) {
-              if (item.ques[indexs]) {
-                return true;
-              } else {
-                return false;
-              }
-            } else if (jsonItem.type == 5) {
-              if (
-                item.ques[indexs] &&
-                (item.ques[indexs].text || item.ques[indexs].imageList.length)
-              ) {
-                console.log("chil");
-                return true;
-              } else {
-                return false;
-              }
-            }
-          });
-
-          if (isOver) {
-            return true;
-          } else {
-            return false;
-          }
-        } else if (item.type == 5) {
-          //简答题
-          //每一项都相等
-          if (item.ques && (item.ques.imageList.length || item.ques.text)) {
-            return true;
-          }
-          //判断
-        } else {
-          return false;
-        }
-      } else {
-        return false;
-      }
-    },
-
     tabSelect(index, bankindex) {
       this.$set(this.questionList[bankindex], "current", index);
     },
 
     showPhoto(contentStr) {
+      // #ifdef H5
+      return;
+      // #endif
       if (contentStr && typeof contentStr == "string") {
         let reg = /<img[^>]*src[=\'\"\s]+([^\'\"]*)[\'\"]?[^>]*>/gi;
         let strArr = contentStr.match(reg);
@@ -2221,11 +2051,15 @@ export default {
     },
   },
   computed: {
+    ...mapGetters(["sysTime"]),
     doMode() {
       // 做题模式 1章卷 2随机练习 3模拟组卷
       return this.examData.simulateStatus ? 3 : undefined;
     },
   },
+  components: {
+    BankBom,
+  },
 };
 </script>
 
@@ -2452,29 +2286,6 @@ export default {
   align-items: center;
   margin-bottom: 30rpx;
 }
-.popupView {
-  height: 100%;
-  padding-bottom: 100rpx;
-  .popupTops {
-    height: 77rpx;
-    border-bottom: 1rpx solid #eee;
-    text-align: center;
-    line-height: 77rpx;
-    font-size: 24rpx;
-    color: #999;
-    position: relative;
-    .topIcon {
-      position: absolute;
-      top: 10rpx;
-      left: 50%;
-      transform: translateX(-50%);
-      width: 80rpx;
-      height: 8rpx;
-      background-color: #999;
-      border-radius: 4rpx;
-    }
-  }
-}
 .pageContent {
   position: relative;
   background-color: #eaeef1;
@@ -2503,111 +2314,7 @@ export default {
   color: #666;
   font-size: 30rpx;
 }
-.footer_btn {
-  background-color: #fff;
-  z-index: 10078;
-  position: fixed;
-  bottom: 0rpx;
-  display: flex;
-  align-items: center;
-  justify-content: space-between;
-  width: 100%;
-  height: 98rpx;
-  padding: 0rpx 38rpx;
-  border-top: 1rpx solid #eee;
 
-  .flex_center {
-    flex: 1;
-    display: flex;
-    justify-content: center;
-    align-items: center;
-    flex-direction: column;
-    margin: 0 200rpx;
-    font-size: 24rpx;
-    color: #999999;
-
-    .up-icon {
-      margin-bottom: 18rpx;
-      width: 100%;
-      display: flex;
-      justify-content: center;
-      image {
-        width: 58rpx;
-        height: 21rpx;
-      }
-    }
-  }
-  .collect {
-    visibility: hidden;
-    width: 100rpx;
-
-    &.show {
-      visibility: visible;
-    }
-
-    > view {
-      display: flex;
-      flex-direction: column;
-      align-items: center;
-      justify-content: center;
-
-      image {
-        width: 32rpx;
-        height: 32rpx;
-        margin-bottom: 6rpx;
-      }
-
-      view {
-        font-size: 24rpx;
-        color: #999999;
-      }
-    }
-  }
-}
-.boxSty {
-  padding: 44rpx 41rpx 0rpx;
-}
-.liListSty {
-  border: 1rpx solid #eeeeee;
-  width: 88rpx;
-  height: 88rpx;
-  border-radius: 32rpx;
-  text-align: center;
-  line-height: 88rpx;
-  color: #333;
-  font-size: 32rpx;
-  float: left;
-  margin: 20rpx 23rpx;
-
-  &.isRight {
-    border: 1rpx solid #eeeeee;
-    color: #fff;
-    background: #36c75a;
-  }
-
-  &.isWrong {
-    border: 1rpx solid #eeeeee;
-    color: #fff;
-    background: #ff3b30;
-  }
-
-  &.isPart {
-    border: 1rpx solid #eeeeee;
-    color: #fff;
-    background: #ffc53d;
-  }
-
-  &.isOver {
-    border: 1rpx solid #eeeeee;
-    color: #fff;
-    background: blue;
-  }
-  &.check_ans {
-    border: 1rpx solid #eeeeee;
-    color: #fff;
-    background: #007aff;
-  }
-}
 .answerInfos {
   padding: 25rpx 25rpx 25rpx 23rpx;
 }

+ 3 - 4
pages5/examReport/index.vue

@@ -57,7 +57,7 @@
           </view>
         </view>
       </view>
-      <view class="dis_fst">
+      <!-- <view class="dis_fst">
         <navigator
           hover-class="none"
           :url="
@@ -115,7 +115,7 @@
             去做题
           </button>
         </navigator>
-      </view>
+      </view> -->
     </view>
     <view class="bottom">
       <view class="circle-wrap">
@@ -556,8 +556,7 @@ export default {
     },
     mockSubscribeInfo() {
       this.$api.mockSubscribeInfo(this.subscribeId).then((res) => {
-        console.log("subscribeInfo", this.subscribeInfo);
-        this.subscribeInfo = res.data.data;
+        this.subscribeInfo = res.data.data || {};
       });
     },
     openRemind() {

+ 484 - 355
pages5/mockExam/examApply.vue

@@ -1,56 +1,83 @@
 <template>
-<!-- 模考报名页面 -->
-    <view class="exam_apply">
-        <nav-bar title="模考报名" class="navbar"></nav-bar>
-        <!-- background="{ background: '#498AFE' }" -->
-        <image class="mock_bg" src="../static/mock_bg.png"></image>
-		<!-- <u-navbar :is-back="false" title="模考报名" :border-bottom="false"  title-color="#fff" back-icon-color="#ffffff" background="{ background: '#498AFE' }">
+  <!-- 模考报名页面 -->
+  <view class="exam_apply">
+    <nav-bar title="模考报名" class="navbar"></nav-bar>
+    <!-- background="{ background: '#498AFE' }" -->
+    <image class="mock_bg" src="../static/mock_bg.png"></image>
+    <!-- <u-navbar :is-back="false" title="模考报名" :border-bottom="false"  title-color="#fff" back-icon-color="#ffffff" background="{ background: '#498AFE' }">
 		</u-navbar> -->
-        
-        <!-- <u-line color="#D6D6DB" /> -->
-        <view class="mains">
-            <u-form :model="examform" ref="uForm" :rules="rules" label-width='74'>
-                <view class="items">
-                    <view class="item_title">
-                        <text class="star_red">*</text>
-                        <text class="number">01</text>
-                        <text class="category">姓名</text>
-                    </view>
-                    <u-form-item label=" " label-width="74" prop="userName" :border-bottom='false'>
-                        <view class="inputs">
-                            <input v-model.trim="examform.userName" class="uni-input" placeholder="请输入" />
-                        </view>
-                    </u-form-item>
-                </view>
 
-                <view class="items">
-                    <view class="item_title">
-                        <text class="star_red">*</text>
-                        <text class="number">02</text>
-                        <text class="category">性别</text>
-                    </view>
-                    <u-form-item label=" " label-width="74" prop="userSex" :border-bottom='false'>
-                        <u-radio-group v-model="examform.userSex" :wrap='true' @change="radioGroupChange">
-                            <u-radio value="1" name='1'>男</u-radio>
-                            <u-radio value="2" name='2'>女</u-radio>
-                        </u-radio-group>
-                    </u-form-item>
-                </view>
+    <!-- <u-line color="#D6D6DB" /> -->
+    <view class="mains">
+      <u-form :model="examform" ref="uForm" :rules="rules" label-width="74">
+        <view class="items">
+          <view class="item_title">
+            <text class="star_red">*</text>
+            <text class="number">01</text>
+            <text class="category">姓名</text>
+          </view>
+          <u-form-item
+            label=" "
+            label-width="74"
+            prop="userName"
+            :border-bottom="false"
+          >
+            <view class="inputs">
+              <input
+                v-model.trim="examform.userName"
+                class="uni-input"
+                placeholder="请输入"
+              />
+            </view>
+          </u-form-item>
+        </view>
 
-                <view class="items">
-                    <view class="item_title">
-                        <text class="star_red">*</text>
-                        <text class="number">03</text>
-                        <text class="category">企业名称</text>
-                    </view>
-                    <u-form-item label=" " label-width="74" prop="companyName" :border-bottom='false'>
-                        <view class="inputs">
-                            <input v-model.trim="examform.companyName" class="uni-input" placeholder="请输入" />
-                        </view>
-                    </u-form-item>
-                </view>
+        <view class="items">
+          <view class="item_title">
+            <text class="star_red">*</text>
+            <text class="number">02</text>
+            <text class="category">性别</text>
+          </view>
+          <u-form-item
+            label=" "
+            label-width="74"
+            prop="userSex"
+            :border-bottom="false"
+          >
+            <u-radio-group
+              v-model="examform.userSex"
+              :wrap="true"
+              @change="radioGroupChange"
+            >
+              <u-radio value="1" name="1">男</u-radio>
+              <u-radio value="2" name="2">女</u-radio>
+            </u-radio-group>
+          </u-form-item>
+        </view>
+
+        <view class="items">
+          <view class="item_title">
+            <!-- <text class="star_red">*</text> -->
+            <text class="number">03</text>
+            <text class="category">企业名称</text>
+          </view>
+          <u-form-item
+            label=" "
+            label-width="74"
+            prop="companyName"
+            :border-bottom="false"
+          >
+            <view class="inputs">
+              <input
+                v-model.trim="examform.companyName"
+                class="uni-input"
+                placeholder="请输入"
+              />
+            </view>
+          </u-form-item>
+        </view>
 
-                <!-- <view class="items">
+        <!-- <view class="items">
                     <view class="item_title">
                         <text class="star_red">*</text>
                         <text class="number">04</text>
@@ -63,7 +90,7 @@
                     </u-form-item>
                 </view> -->
 
-                <!-- <view class="items">
+        <!-- <view class="items">
                     <view class="item_title">
                         <text class="star_red">*</text>
                         <text class="number">04</text>
@@ -75,343 +102,445 @@
                         </view>
                     </u-form-item>
                 </view> -->
-                <view class="items">
-                    <view class="item_title">
-                        <text class="star_red">*</text>
-                        <text class="number">04</text>
-                        <text class="category">报考专业</text>
-                    </view>
-                    <u-form-item label=" " label-width="74" prop="majorId" :border-bottom='false'>
-                        <view class="inputs">
-                            <view class="item_box">
-                                <picker class="picker" mode="selector" :range="majorList" range-key="majorName" :value="examform.majorId"
-                                 @change="majorChange">
-                                    <view class="pick_con" style="fontSize: 40rpx">{{ majorName }}</view>
-                                </picker>
-                                <u-icon class="icon" name="arrow-down"></u-icon>
-                            </view>
-                        </view>
-                    </u-form-item>
-                </view>
-                <view class="items">
-                    <view class="item_title">
-                        <text class="star_red">*</text>
-                        <text class="number">05</text>
-                        <text class="category">报考科目</text>
-                    </view>
-                    <u-form-item label=" " label-width="74" prop="userMajors" :border-bottom='false'>
-                        <template v-if="subjectLists.length">
-                            <u-checkbox-group :wrap='true' @change="checkboxGroupChange">
-                                <u-checkbox v-model="item.checked" v-for="(item, index) in subjectLists" :key="index" :name="item.subjectId">
-                                    {{ item.name }}
-                                </u-checkbox>
-                            </u-checkbox-group>
-                        </template>
-                        <template v-else>
-                            <view class="grays">请先选择报考专业</view>
-                        </template>
-                    </u-form-item>
-                </view>
-            </u-form>
-            <!-- 提交按钮 -->
-            <view class="btns">
-                <view v-if="endTime <= sysTime" class="submits disable">提交</view>
-                <view v-else class="submits" @click="submit()">
-                    提交
-                </view>
+        <view class="items">
+          <view class="item_title">
+            <text class="star_red">*</text>
+            <text class="number">04</text>
+            <text class="category">报考专业</text>
+          </view>
+          <u-form-item
+            label=" "
+            label-width="74"
+            prop="majorId"
+            :border-bottom="false"
+          >
+            <view class="inputs">
+              <view class="item_box">
+                <picker
+                  class="picker"
+                  mode="selector"
+                  :range="majorList"
+                  range-key="majorName"
+                  :value="examform.majorId"
+                  @change="majorChange"
+                >
+                  <view class="pick_con" style="fontsize: 40rpx">{{
+                    majorName
+                  }}</view>
+                </picker>
+                <u-icon class="icon" name="arrow-down"></u-icon>
+              </view>
             </view>
+          </u-form-item>
+        </view>
+        <view class="items">
+          <view class="item_title">
+            <text class="star_red">*</text>
+            <text class="number">05</text>
+            <text class="category">报考科目</text>
+          </view>
+          <u-form-item
+            label=" "
+            label-width="74"
+            prop="userMajors"
+            :border-bottom="false"
+          >
+            <template v-if="subjectLists.length">
+              <u-checkbox-group :wrap="true" @change="checkboxGroupChange">
+                <u-checkbox
+                  v-model="item.checked"
+                  v-for="(item, index) in subjectLists"
+                  :key="index"
+                  :name="item.subjectId"
+                >
+                  {{ item.name }}
+                </u-checkbox>
+              </u-checkbox-group>
+            </template>
+            <template v-else>
+              <view class="grays">请先选择报考专业</view>
+            </template>
+          </u-form-item>
         </view>
+      </u-form>
+      <!-- 提交按钮 -->
+      <view class="btns">
+        <view v-if="endTime <= sysTime" class="submits disable">提交</view>
+        <view v-else class="submits" @click="submit()"> 提交 </view>
+      </view>
     </view>
+  </view>
 </template>
 
 <script>
+import { tenantId, BASE_URL } from "@/common/request.js";
 export default {
-    name: 'examApply',
-    
-    data() {
-        var validatorMajor = (rule, value, callback) => {
-            if (value.length) {
-                callback()
-            } else {
-                callback(new Error("请选择报考科目"))
-            }
+  name: "examApply",
+
+  data() {
+    var validatorMajor = (rule, value, callback) => {
+      if (value.length) {
+        callback();
+      } else {
+        callback(new Error("请选择报考科目"));
+      }
+    };
+    var validatorMajorId = (rule, value, callback) => {
+      if (value) {
+        callback();
+      } else {
+        callback(new Error("请选择专业"));
+      }
+    };
+    return {
+      examform: {
+        userName: "",
+        userSex: "",
+        companyName: "",
+        // userIdCard: '',
+        // userPhone: '',
+        userMajors: [],
+        majorId: "",
+      },
+      rules: {
+        userName: [
+          {
+            required: true,
+            message: "请输入姓名",
+            trigger: ["blur", "change"],
+          },
+        ],
+        userSex: [
+          {
+            required: true,
+            message: "请选择性别",
+            trigger: ["blur", "change"],
+          },
+        ],
+        // companyName: [
+        //   {
+        //     required: true,
+        //     message: "请输入企业名称",
+        //     trigger: ["blur", "change"],
+        //   },
+        // ],
+        // userIdCard: [{ required: true, message: '请输入身份证号', trigger: ['blur', 'change']}],
+        majorId: [{ validator: validatorMajorId, trigger: ["change", "blur"] }],
+        userMajors: [
+          { validator: validatorMajor, trigger: ["blur", "change"] },
+        ],
+      },
+      checkboxList: [],
+      activityId: "", // 活动id
+      subLoading: true,
+      majorList: [], // 专业
+      subjectLists: [], // 科目
+      majorName: "",
+      startTime: "",
+      endTime: "",
+      sysTime: "", // 当前时间
+    };
+  },
+  onLoad(option) {
+    this.sysTime = +this.$method.timest();
+    // console.log('option--: ', option)
+    if (option.scene) {
+      let tid = decodeURIComponent(option.scene);
+      this.activityId = tid.split("=")[1];
+      // this.getActivity()
+    } else {
+      this.activityId = option.tid;
+      // this.getActivity()
+    }
+  },
+  onShow() {
+    console.log("activityId: ", this.activityId);
+    if (!uni.getStorageSync("user_account")) {
+      // 未登录
+      console.log("未登录");
+      uni.navigateTo({
+        url: "/pages4/login/login?isBack=true",
+      });
+      return;
+    } else {
+      // 已登录
+      console.log("已登录");
+      this.getActivity1();
+    }
+  },
+  // 必须要在onReady生命周期,因为onLoad生命周期组件可能尚未创建完毕
+  onReady() {
+    this.$refs.uForm.setRules(this.rules);
+  },
+  methods: {
+    // 获取活动信息(专业和科目)
+    getActivity() {
+      this.$http({
+        url: `/apply/activity/detail/${this.activityId}`,
+        method: "get",
+      }).then((res) => {
+        if (res.data.code == 200) {
+          this.hadCheck();
+          let data = res.data.data || {};
+          const { majorList, subjectList, endTime, startTime } = data;
+          this.majorList = majorList || [];
+          this.startTime = startTime;
+          this.endTime = endTime;
+          if (subjectList) {
+            this.checkboxList = subjectList.map((item) => {
+              return {
+                name: "《" + item.subjectName + "》",
+                checked: false,
+                ...item,
+              };
+            });
+            console.log("checkboxList:", this.checkboxList);
+          }
         }
-        var validatorMajorId = (rule, value, callback) => {
-            if (value) {
-                callback()
-            } else {
-                callback(new Error("请选择专业"))
+      });
+    },
+    getActivity1() {
+      let token = uni.getStorageSync("token");
+      token &&
+        uni.request({
+          url: BASE_URL + `/apply/activity/detail/${this.activityId}`,
+          method: "get",
+          data: {},
+          header: {
+            AuthorizationToken: "WX " + token,
+            TenantId: tenantId,
+          },
+          success: (res) => {
+            if (res.data.code == 200) {
+              this.hadCheck();
+              let data = res.data.data || {};
+              const { majorList, subjectList, endTime, startTime } = data;
+              this.majorList = majorList || [];
+              this.startTime = startTime;
+              this.endTime = endTime;
+              if (subjectList) {
+                this.checkboxList = subjectList.map((item) => {
+                  return {
+                    name: "《" + item.subjectName + "》",
+                    checked: false,
+                    ...item,
+                  };
+                });
+                console.log("checkboxList:", this.checkboxList);
+              }
+            } else if (res.data.code == 401) {
+              uni.navigateTo({
+                url: "/pages4/login/login?isBack=true",
+              });
             }
-        }
-        return {
-            examform: {
-                userName: '',
-                userSex: '',
-                companyName: '',
-                // userIdCard: '',
-                // userPhone: '',
-                userMajors: [],
-                majorId: '',
-            },
-            rules: {
-                userName: [{ required: true, message: '请输入姓名', trigger: ['blur', 'change']}],
-                userSex: [{ required: true, message: '请选择性别', trigger: ['blur', 'change']}],
-                companyName: [{ required: true, message: '请输入企业名称', trigger: ['blur', 'change']}],
-                // userIdCard: [{ required: true, message: '请输入身份证号', trigger: ['blur', 'change']}],
-                majorId: [{ validator: validatorMajorId, trigger: ['change','blur']}],
-                userMajors: [{ validator: validatorMajor, trigger: ['blur', 'change']}],
-            },
-            checkboxList: [],
-            activityId: '', // 活动id
-            subLoading: true,
-            majorList: [], // 专业
-            subjectLists: [], // 科目
-            majorName: '',
-            startTime: '',
-            endTime: '',
-            sysTime: '', // 当前时间
-        }
+          },
+          fail: (err) => {
+            uni.showToast({
+              title: "请求接口失败",
+              icon: "none",
+            });
+          },
+        });
     },
-    onLoad(option) {
-        this.sysTime = +this.$method.timest()
-        // console.log('option--: ', option)
-        if (option.scene) {
-            let tid = decodeURIComponent(option.scene)
-            this.activityId = tid.split('=')[1]
-            // this.getActivity()
-        } else {
-            this.activityId = option.tid
-            // this.getActivity()
+    // 校验用户是否已报名
+    hadCheck() {
+      this.$http({
+        url: `/apply/activity/check/${this.activityId}`,
+        method: "get",
+      }).then((res) => {
+        if (res.data.data) {
+          // 已经报名
+          uni.navigateTo({
+            url:
+              "/pages5/mockExam/registrationSuccess?endTime=" +
+              this.endTime +
+              "&startTime=" +
+              this.startTime +
+              "&activityId=" +
+              this.activityId,
+          });
         }
+      });
     },
-    onShow() {
-        console.log('activityId: ', this.activityId)
-        if (!uni.getStorageSync('user_account')) { // 未登录
-            console.log('未登录')
-			uni.navigateTo({
-				url: '/pages4/login/login?isBack=true'
-			})
-			return
-		} else {
-            // 已登录
-            console.log('已登录')
-            this.getActivity()
-        }
+    checkboxGroupChange(e) {
+      this.examform.userMajors = e;
     },
-    // 必须要在onReady生命周期,因为onLoad生命周期组件可能尚未创建完毕
-	onReady() {
-		this.$refs.uForm.setRules(this.rules)
-	},
-    methods: {
-        // 获取活动信息(专业和科目)
-        getActivity() {
-            this.$http({
-                url: `/apply/activity/detail/${this.activityId}`,
-                method: 'get',
-            }).then((res) => {
-                if (res.data.code == 200) {
-                    this.hadCheck()
-                    let data = res.data.data || {}
-                    const { majorList, subjectList, endTime, startTime} = data
-                    this.majorList = majorList || []
-                    this.startTime = startTime
-                    this.endTime = endTime
-                    if (subjectList) {
-                        this.checkboxList = subjectList.map((item) => {
-                            return {
-                                name: '《' + item.subjectName + '》',
-                                checked: false,
-                                ...item
-                            }
-                        })
-                        console.log('checkboxList:', this.checkboxList)
-                    }
-                }
-            })
-        },
-        // 校验用户是否已报名
-        hadCheck() {
-            this.$http({
-                url: `/apply/activity/check/${this.activityId}`,
-                method: 'get',
-            }).then((res) => {
-                if (res.data.data) {
-                    // 已经报名
-                    uni.navigateTo({
-                        url: '/pages5/mockExam/registrationSuccess?endTime=' + this.endTime + '&startTime=' + this.startTime 
-                        + '&activityId=' + this.activityId
-                    })
-                }
-            })
-        },
-		checkboxGroupChange(e) {
-            this.examform.userMajors = e
-		},
-		radioGroupChange(e) {
-			console.log(e, this.examform.userSex);
-		},
-        majorChange(e) {
-            let index = e.detail.value
-            const { majorName, majorId, mockMajorId } = this.majorList[index]
-            this.majorName = majorName
-            this.examform.majorId = majorId
-            // console.log('1111majorId', this.examform.majorId)
-            this.subjectLists = this.checkboxList.filter(e => e.mockMajorId == mockMajorId)
-            this.examform.userMajors = []
-            this.subjectLists = this.subjectLists.map((item) => {
-                return {
-                    name: '《' + item.subjectName + '》',
-                    checked: false,
-                    ...item
-                }
+    radioGroupChange(e) {
+      console.log(e, this.examform.userSex);
+    },
+    majorChange(e) {
+      let index = e.detail.value;
+      const { majorName, majorId, mockMajorId } = this.majorList[index];
+      this.majorName = majorName;
+      this.examform.majorId = majorId;
+      // console.log('1111majorId', this.examform.majorId)
+      this.subjectLists = this.checkboxList.filter(
+        (e) => e.mockMajorId == mockMajorId
+      );
+      this.examform.userMajors = [];
+      this.subjectLists = this.subjectLists.map((item) => {
+        return {
+          name: "《" + item.subjectName + "》",
+          checked: false,
+          ...item,
+        };
+      });
+    },
+    submit() {
+      this.$refs.uForm.validate((valid) => {
+        if (valid) {
+          if (!this.subLoading) {
+            return;
+          }
+          this.subLoading = false;
+          const { userName, userSex, companyName, majorId, userMajors } =
+            this.examform;
+          let arrs = [];
+          userMajors.forEach((item, index) => {
+            let findItem = this.subjectLists.find((e) => e.subjectId == item);
+            if (findItem) {
+              arrs.push(findItem);
+            }
+          });
+          let mockSubjectIds = arrs.map((e) => e.subjectId).join(",");
+          let mockMajorSubjectIds = arrs
+            .map((e) => e.mockMajorSubjectId)
+            .join(",");
+          let params = {
+            activityId: this.activityId,
+            userName: userName,
+            userSex: userSex,
+            companyName: companyName,
+            mockMajorId: majorId,
+            mockSubjectIds: mockSubjectIds,
+            mockMajorSubjectIds: mockMajorSubjectIds,
+          };
+          // console.log('eret', params)
+          this.$http({
+            url: "/apply/activity/launch",
+            method: "post",
+            data: params,
+            // noToken: true,
+          })
+            .then((res) => {
+              this.subLoading = true;
+              if (res.data.code == 200) {
+                let data = res.data.data;
+                uni.navigateTo({
+                  url:
+                    "/pages5/mockExam/registrationSuccess?endTime=" +
+                    data.endTime +
+                    "&startTime=" +
+                    data.startTime +
+                    "&activityId=" +
+                    this.activityId,
+                });
+              }
             })
-        },
-        submit() {
-            this.$refs.uForm.validate(valid => {
-				if (valid) {
-                    if (!this.subLoading) {
-                        return
-                    }
-                    this.subLoading = false
-                    const { userName, userSex, companyName, majorId, userMajors} = this.examform
-                    let arrs = []
-                    userMajors.forEach((item, index) => {
-                        let findItem = this.subjectLists.find(e => e.subjectId == item)
-                        if (findItem) {
-                            arrs.push(findItem)
-                        }
-                    })
-                    let mockSubjectIds = arrs.map(e => e.subjectId).join(',')
-                    let mockMajorSubjectIds = arrs.map(e => e.mockMajorSubjectId).join(',')
-                    let params = {
-                        activityId: this.activityId,
-                        userName: userName,
-                        userSex: userSex,
-                        companyName: companyName,
-                        mockMajorId: majorId,
-                        mockSubjectIds: mockSubjectIds,
-                        mockMajorSubjectIds: mockMajorSubjectIds, 
-                    }
-                    // console.log('eret', params)
-                    this.$http({
-                        url: '/apply/activity/launch',
-                        method: 'post',
-                        data: params,
-                        // noToken: true,
-                    }).then((res) => {
-                        this.subLoading = true
-                        if (res.data.code == 200) {
-                            let data = res.data.data
-                            uni.navigateTo({
-                                url: '/pages5/mockExam/registrationSuccess?endTime=' + data.endTime + '&startTime=' + data.startTime 
-                                + '&activityId=' + this.activityId
-                            })
-                        }
-                    }).catch((err) => {
-                        this.subLoading = true
-                    })
-				} else {
-					console.log('验证失败');
-				}
-			})
-            
+            .catch((err) => {
+              this.subLoading = true;
+            });
+        } else {
+          console.log("验证失败");
         }
+      });
     },
-}
+  },
+};
 </script>
 
 <style>
 page {
-    background: linear-gradient(90deg, #EDF1FF 0%, #D9F0FF 100%);
+  background: linear-gradient(90deg, #edf1ff 0%, #d9f0ff 100%);
 }
 </style>
 <style lang="scss" scoped>
 .exam_apply {
+  width: 100%;
+  height: 100%;
+  .mock_bg {
     width: 100%;
-    height: 100%;
-    .mock_bg {
-        width: 100%;
-        height: 760rpx;
-        z-index: -999;
-        top: 0;
+    height: 760rpx;
+    z-index: -999;
+    top: 0;
+  }
+  .navbar {
+    background-color: #498afe;
+  }
+  .mains {
+    padding: 16rpx;
+    position: relative;
+    top: -270rpx;
+  }
+  .items {
+    padding: 40rpx 0rpx 40rpx 24rpx;
+    background-color: #fff;
+    border-radius: 16rpx;
+    margin-bottom: 16rpx;
+    .star_red {
+      color: #f84b39;
     }
-    .navbar {
-        background-color: #498AFE;
+    .number {
+      font-size: 32rpx;
+      font-weight: 800;
+      color: #222222;
+      margin: 0rpx 20rpx 0rpx 4rpx;
     }
-    .mains {
-        padding: 16rpx;
-        position: relative;
-        top: -270rpx;
+    .category {
+      font-size: 32rpx;
+      font-weight: 400;
+      color: #222222;
     }
-    .items {
-        padding: 40rpx 0rpx 40rpx 24rpx;
-        background-color: #fff;
-        border-radius: 16rpx;
-        margin-bottom: 16rpx;
-        .star_red {
-            color: #F84B39;
-        }
-        .number {
-            font-size: 32rpx;
-            font-weight: 800;
-            color: #222222;
-            margin: 0rpx 20rpx 0rpx 4rpx;
-        }
-        .category {
-            font-size: 32rpx;
-            font-weight: 400;
-            color: #222222;
-        }
-        .inputs {
-            width: 580rpx;
-            height: 88rpx;
-            background: #FFFFFF;
-            border-radius: 8rpx;
-            border: 2rpx solid #C2C2C2;
-            display: flex;
-            align-items: center;
-            padding-left: 24rpx;
-        }
-        .item_box {
-            height: 86rpx;
-            display: flex;
-            align-items: center;
-            .pick_con {
-                width: 500rpx;
-                height: 86rpx;
-                // font-size: 32rpx;
-            }
-            .text {
-                flex:1;
-                display: flex;
-                align-items: center;
-            }
-        }
-        .grays {
-            color: #999;
-            font-size: 28rpx;
-        }
+    .inputs {
+      width: 580rpx;
+      height: 88rpx;
+      background: #ffffff;
+      border-radius: 8rpx;
+      border: 2rpx solid #c2c2c2;
+      display: flex;
+      align-items: center;
+      padding-left: 24rpx;
     }
-    .btns {
-        width: 100%;
+    .item_box {
+      height: 86rpx;
+      display: flex;
+      align-items: center;
+      .pick_con {
+        width: 500rpx;
+        height: 86rpx;
+        // font-size: 32rpx;
+      }
+      .text {
+        flex: 1;
         display: flex;
         align-items: center;
-        justify-items: center;
+      }
     }
-    .submits {
-        width: 686rpx;
-        height: 96rpx;
-        line-height: 96rpx;
-        text-align: center;
-        background: #3F8DFD;
-        border-radius: 16rpx;
-        font-size: 32rpx;
-        font-weight: 500;
-        color: #FFFFFF;
+    .grays {
+      color: #999;
+      font-size: 28rpx;
     }
-    .disable {
-		background: #498AFE;
-		opacity: 0.5;
-	}
+  }
+  .btns {
+    width: 100%;
+    display: flex;
+    align-items: center;
+    justify-items: center;
+  }
+  .submits {
+    width: 686rpx;
+    height: 96rpx;
+    line-height: 96rpx;
+    text-align: center;
+    background: #3f8dfd;
+    border-radius: 16rpx;
+    font-size: 32rpx;
+    font-weight: 500;
+    color: #ffffff;
+  }
+  .disable {
+    background: #498afe;
+    opacity: 0.5;
+  }
 }
-</style>
+</style>

+ 2 - 2
pages5/mockRecord/mock_record.vue

@@ -28,10 +28,10 @@
 					</view>
 				</view>
 				<view class="btns">
-					<view class="btn" v-if="record.status == 1" @click="doRepeat(record.examId, record.goodsId, record.moduleExamId, record.chapterExamId,index,record)">重做</view>
+					<!-- <view class="btn" v-if="record.status == 1" @click="doRepeat(record.examId, record.goodsId, record.moduleExamId, record.chapterExamId,index,record)">重做</view> -->
 					<view class="btn" @click="questionBankExplain(record)" v-if="record.status == 1">解析</view>
 					<view class="btn" @click="questionReport(record)" v-if="record.status == 1">报告</view>
-					<view class="btn continue" @click="moreRecord(record,index)" >更多记录</view>
+					<!-- <view class="btn continue" @click="moreRecord(record,index)" >更多记录</view> -->
 				</view>
 			</view>
 		</view>

BIN
static/icon_paper.png


BIN
static/icon_sheet.png


BIN
static/icon_star.png


BIN
static/icon_star_sel.png