瀏覽代碼

fix:重构+修复BUG

Tang 2 年之前
父節點
當前提交
11588adb8e

+ 1 - 1
package.json

@@ -79,4 +79,4 @@
     "last 2 versions",
     "not ie <= 8"
   ]
-}
+}

+ 209 - 0
src/pages/course-detail/components/HandOut.vue

@@ -0,0 +1,209 @@
+<template>
+  <div class="lecture-notesjy">
+    <div class="listItem">
+      <div class="titles">
+        {{ courseHandoutsData.handoutsName }}
+      </div>
+      <div class="btns">
+        <div
+          class="btn"
+          @click="previvew($tools.splitImgHost(courseHandoutsData.handoutsUrl))"
+        >
+          预览
+        </div>
+        <div
+          v-if="courseHandoutsData.canDownload == 1 ? true : false"
+          class="btn"
+          @click="
+            printView($tools.splitImgHost(courseHandoutsData.handoutsUrl))
+          "
+        >
+          打印
+        </div>
+        <div
+          v-if="courseHandoutsData.canDownload == 1 ? true : false"
+          class="btn"
+          @click="
+            download(
+              $tools.splitImgHost(courseHandoutsData.handoutsUrl),
+              courseHandoutsData.urlName
+            )
+          "
+        >
+          下载
+        </div>
+      </div>
+    </div>
+    <div class="lecture-listFooter" v-if="showPdf">
+      <div style="color: #fff">
+        {{ courseHandoutsData.urlName }}
+      </div>
+      <pdf
+        class="iframe"
+        :src="$tools.splitImgHost(courseHandoutsData.handoutsUrl)"
+        v-for="i in numPages"
+        :key="i"
+        :page="i"
+        ref="pdf"
+      ></pdf>
+      <iframe
+        id="printIframe"
+        :src="$tools.splitImgHost(courseHandoutsData.handoutsUrl)"
+        frameborder="0"
+        style="display: none"
+      ></iframe>
+    </div>
+  </div>
+</template>
+
+<script>
+import pdf from "vue-pdf";
+import Print from "print-js";
+export default {
+  components: { pdf },
+  props: {
+    goodsData: {
+      type: Object,
+      default: () => {
+        return {};
+      },
+    },
+  },
+  data() {
+    return {
+      showPdf: false,
+      courseHandoutsData: {},
+    };
+  },
+  watch: {
+    goodsData: {
+      handler(newVal, oldVal) {
+        if (newVal.handoutsId != oldVal.handoutsId) {
+          this.courseHandouts();
+        }
+      },
+      deep: true,
+    },
+  },
+  methods: {
+    previvew(url) {
+      this.showPdf = true;
+    },
+    /**
+     * 打印
+     */
+    printView(url) {
+      console.log("触发打印", url);
+      Print({
+        printable: url,
+        type: "pdf",
+        header: null,
+        targetStyles: ["*"],
+        style: "@page {margin:0 10mm}",
+      });
+    },
+    //下载
+    download(url, fileName) {
+      let xhr = new XMLHttpRequest();
+      xhr.open("get", url, true);
+      xhr.setRequestHeader("Content-Type", `application/pdf`);
+      xhr.responseType = "blob";
+      let that = this;
+      xhr.onload = function () {
+        if (this.status == 200) {
+          //接受二进制文件流
+          var blob = this.response;
+          that.downloadExportFile(blob, fileName);
+        }
+      };
+      xhr.send();
+    },
+
+    downloadExportFile(blob, tagFileName) {
+      let downloadElement = document.createElement("a");
+      let href = "";
+      if (typeof blob == "string") {
+        downloadElement.target = "_blank";
+      } else {
+        href = window.URL.createObjectURL(blob); //创建下载的链接
+      }
+      downloadElement.href = href;
+      downloadElement.download = tagFileName;
+      //下载后文件名
+      document.body.appendChild(downloadElement);
+      downloadElement.click(); //点击下载
+      document.body.removeChild(downloadElement); //下载完成移除元素
+      if (typeof blob != "string") {
+        window.URL.revokeObjectURL(href); //释放掉blob对象
+      }
+    },
+    /**
+     * 获取讲义权限
+     */
+    courseHandouts() {
+      if (this.goodsData.handoutsId) {
+        this.$request
+          .courseHandouts(this.goodsData.handoutsId)
+          .then((res) => {
+            this.courseHandoutsData = res.data;
+            const loadingTask = pdf.createLoadingTask(
+              this.$tools.splitImgHost(this.courseHandoutsData.handoutsUrl)
+            );
+            loadingTask.promise
+              .then((pdf) => {
+                this.numPages = pdf.numPages;
+              })
+              .catch((err) => {});
+          })
+          .catch((err) => {});
+      }
+    },
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+.lecture-notesjy {
+  display: flex;
+  flex-direction: column;
+  max-height: 416px;
+
+  .listItem {
+    padding-bottom: 14px;
+    margin-bottom: 10px;
+    border-bottom: 1px solid #eee;
+
+    .titles {
+      color: #fff;
+      font-weight: bold;
+      text-align: center;
+      padding: 10px;
+    }
+
+    .btns {
+      display: flex;
+      justify-content: space-around;
+      align-items: center;
+
+      .btn {
+        border-radius: 8px;
+        background-color: #fff;
+        padding: 6px 16px;
+        user-select: none;
+        cursor: pointer;
+        transition: all 0.2s;
+
+        &:hover {
+          background-color: #f2f7ff;
+          color: #3f8dfd;
+        }
+      }
+    }
+  }
+
+  .lecture-listFooter {
+    flex: 1;
+    overflow: auto;
+  }
+}
+</style>

+ 45 - 2
src/pages/course-detail/index.vue

@@ -115,7 +115,11 @@
                             ></Notes>
                           </template>
                           <template v-if="tab.name == '5'">
-                            <div class="lecture-notesjy">
+                            <Hand-out
+                              ref="handOut"
+                              :goodsData="goodsData"
+                            ></Hand-out>
+                            <div v-if="false" class="lecture-notesjy">
                               <div class="listItem">
                                 <div class="titles">
                                   {{ courseHandoutsData.handoutsName }}
@@ -1268,6 +1272,7 @@ import pdf from "vue-pdf";
 import CourseTree from "./components/CourseTree.vue";
 import AnswerQuestions from "./components/AnswerQuestions.vue";
 import Notes from "./components/Notes.vue";
+import HandOut from "./components/HandOut.vue";
 export default {
   name: "CourseDetail",
   components: {
@@ -1279,6 +1284,7 @@ export default {
     CourseTree,
     AnswerQuestions,
     Notes,
+    HandOut,
   },
   data() {
     return {
@@ -2916,6 +2922,43 @@ export default {
           if (self.needProfileModal) {
             return;
           }
+          /**
+           * 补充条件 Start
+           */
+          console.log("补充条件:",res.data.interfaceAccountId,res.data.learnStatus)
+          if (res.data.interfaceAccountId > 0 && res.data.learnStatus > 0) {
+            const confirmText = [
+              "您的学习账号已经开通,请按照步骤操作,进行学习。",
+              "1.点击【跳转学习网址】按钮",
+              "2.打开学习网址后,选择【个人用户】进行登录",
+              "(1)账号:您个人的身份证号码",
+              "(2)密码:身份证号码,再加111111",
+            ];
+            const newDatas = [];
+            const h = this.$createElement;
+            for (const i in confirmText) {
+              newDatas.push(h("p", null, confirmText[i]));
+            }
+            this.$confirm(h("div", null, newDatas), "温馨提示", {
+              beforeClose: (type, y, done) => {
+                if (type == "confirm") {
+                  window.open("http://admin.zhujianpeixun.com/", "_blank");
+                } else if (type == "cancel") {
+                  this.$router.back(-1);
+                }
+              },
+              confirmButtonText: "跳转学习网址",
+              cancelButtonText: "关闭",
+              closeOnClickModal: false,
+              closeOnPressEscape: false,
+              distinguishCancelAndClose: false,
+              showClose: false,
+            });
+            return;
+          }
+          /**
+           * 补充条件   End
+           */
           if (self.gradeDetail.learningStatus == 2) {
             this.$confirm(
               `当前课程正在申请中,正式开班后方可进行学习,请耐心等候!`,
@@ -3551,7 +3594,7 @@ export default {
             ];
           }
           this.courseBusiness();
-          this.courseHandouts();
+          // this.courseHandouts();
           if (self.goodsData.goodsPlayConfig) {
             self.goodsPlayConfig = JSON.parse(self.goodsData.goodsPlayConfig);
             if (self.goodsPlayConfig.autoPlay > 0) {

+ 568 - 503
src/pages/person-center/my-course/courseData.vue

@@ -1,91 +1,101 @@
 <template>
   <div id="courseData">
     <el-dialog title="切换科目" :visible.sync="dialogVisible" width="1100px">
-        <div class="headerStyle" v-if="Object.keys(activeItem).length">
-            <p class="title">当前科目</p>
+      <div class="headerStyle" v-if="Object.keys(activeItem).length">
+        <p class="title">当前科目</p>
+        <div class="course-items">
+          <div class="course-items__header">
             <div
-              class="course-items"
+              class="time"
+              v-if="activeItem.serviceStartTime && activeItem.serviceEndTime"
             >
-              <div class="course-items__header">
-                <div
-                  class="time"
-                  v-if="activeItem.serviceStartTime && activeItem.serviceEndTime"
-                >
-                  学习服务期:{{
-                    $tools.timestampToTime(activeItem.serviceStartTime, false)
-                  }}
-                  至
-                  {{ $tools.timestampToTime(activeItem.serviceEndTime, false) }}
-                </div>
+              学习服务期:{{
+                $tools.timestampToTime(activeItem.serviceStartTime, false)
+              }}
+              至
+              {{ $tools.timestampToTime(activeItem.serviceEndTime, false) }}
+            </div>
 
-                <div class="state">
+            <div class="state">
+              <template
+                v-if="
+                  activeItem.serviceStartTime &&
+                  (sysTime < activeItem.serviceStartTime ||
+                    sysTime > activeItem.serviceEndTime)
+                "
+              >
+                <div class="red">不在学习服务期,不可以学习了哦</div>
+              </template>
+
+              <template v-else>
+                <template
+                  v-if="
+                    !(
+                      activeItem.classEndTime &&
+                      activeItem.classEndTime < sysTime
+                    ) &&
+                    !(
+                      activeItem.classStartTime &&
+                      activeItem.classStartTime > sysTime
+                    )
+                  "
+                >
                   <template
                     v-if="
-                      activeItem.serviceStartTime &&
-                      (sysTime < activeItem.serviceStartTime ||
-                        sysTime > activeItem.serviceEndTime)
+                      activeItem.periodStatus == -1 ||
+                      activeItem.periodStatus == 2
                     "
                   >
-                    <div class="red">不在学习服务期,不可以学习了哦</div>
-                  </template>
-
-                  <template v-else>
                     <template
                       v-if="
-                        !(activeItem.classEndTime && activeItem.classEndTime < sysTime) &&
-                        !(activeItem.classStartTime && activeItem.classStartTime > sysTime)
+                        activeItem.classStatus == 1 ||
+                        activeItem.classStatus === null
                       "
                     >
                       <template
-                        v-if="activeItem.periodStatus == -1 || activeItem.periodStatus == 2"
+                        v-if="
+                          sysTime >= activeItem.serviceStartTime &&
+                          sysTime <= activeItem.serviceEndTime
+                        "
                       >
-                        <template
+                        学习状态:
+                        <div
+                          class="note"
                           v-if="
-                            activeItem.classStatus == 1 || activeItem.classStatus === null
+                            activeItem.stuAllNum + activeItem.recordNum == 0
                           "
                         >
-                          <template
-                            v-if="
-                              sysTime >= activeItem.serviceStartTime &&
-                              sysTime <= activeItem.serviceEndTime
-                            "
-                          >
-                            学习状态:
-                            <div
-                              class="note"
-                              v-if="activeItem.stuAllNum + activeItem.recordNum == 0"
-                            >
-                              未学习
-                            </div>
-                            <div
-                              class="note note--yellow"
-                              v-else-if="
-                                activeItem.stuAllNum + activeItem.recordNum > 0 &&
-                                activeItem.stuAllNum + activeItem.recordNum <
-                                  activeItem.secAllNum + activeItem.examNum
-                              "
-                            >
-                              学习中
-                            </div>
-                            <div
-                              class="note note--green"
-                              v-else-if="
-                                activeItem.stuAllNum + activeItem.recordNum >=
-                                activeItem.secAllNum + activeItem.examNum
-                              "
-                            >
-                              已学完
-                            </div>
-                          </template>
+                          未学习
+                        </div>
+                        <div
+                          class="note note--yellow"
+                          v-else-if="
+                            activeItem.stuAllNum + activeItem.recordNum > 0 &&
+                            activeItem.stuAllNum + activeItem.recordNum <
+                              activeItem.secAllNum + activeItem.examNum
+                          "
+                        >
+                          学习中
+                        </div>
+                        <div
+                          class="note note--green"
+                          v-else-if="
+                            activeItem.stuAllNum + activeItem.recordNum >=
+                            activeItem.secAllNum + activeItem.examNum
+                          "
+                        >
+                          已学完
+                        </div>
+                      </template>
 
-                          <template v-else>
-                            <span class="red" v-if="activeItem.serviceStartTime">
-                              已过学习服务期,不可以学习了哦!</span
-                            >
-                          </template>
-                        </template>
+                      <template v-else>
+                        <span class="red" v-if="activeItem.serviceStartTime">
+                          已过学习服务期,不可以学习了哦!</span
+                        >
+                      </template>
+                    </template>
 
-                        <!-- <template v-if="activeItem.profileTpStatus == 1">
+                    <!-- <template v-if="activeItem.profileTpStatus == 1">
                       资料审核状态:
                       <div class="note" v-if="activeItem.profileStatus == null">
                         未提交资料
@@ -109,293 +119,310 @@
                         待完善
                       </div>
                     </template> -->
-                      </template>
+                  </template>
 
-                      <!-- 学时审核状态可以审核 -->
-                      <template v-if="activeItem.periodStatus != -1">
-                        <template v-if="activeItem.periodStatus == 0"
-                          >机构审核:
-                          <div class="note">学时审核不通过</div>
-                        </template>
-                        <!-- <template v-else-if="activeItem.periodStatus == 2"
+                  <!-- 学时审核状态可以审核 -->
+                  <template v-if="activeItem.periodStatus != -1">
+                    <template v-if="activeItem.periodStatus == 0"
+                      >机构审核:
+                      <div class="note">学时审核不通过</div>
+                    </template>
+                    <!-- <template v-else-if="activeItem.periodStatus == 2"
                       >机构审核:
                       <div class="note note--yellow">学时待审核</div></template
                     > -->
-                        <template v-else-if="activeItem.periodStatus == 1">
-                          <template v-if="activeItem.periodPlush > 0"
-                            ><div class="note note--green">
-                              学时已上报注册中心
-                            </div></template
-                          >
-                          <template v-else
-                            >机构审核:
-                            <div class="note note--green">
-                              学时审核通过
-                            </div></template
-                          >
-                        </template>
-                        <template
-                          v-if="
-                            activeItem.subscribeId != null && activeItem.periodStatus == 1
-                          "
-                        >
-                          <template v-if="activeItem.subExamStatus === null">
-                            待预约考试
-                          </template>
+                    <template v-else-if="activeItem.periodStatus == 1">
+                      <template v-if="activeItem.periodPlush > 0"
+                        ><div class="note note--green">
+                          学时已上报注册中心
+                        </div></template
+                      >
+                      <template v-else
+                        >机构审核:
+                        <div class="note note--green">
+                          学时审核通过
+                        </div></template
+                      >
+                    </template>
+                    <template
+                      v-if="
+                        activeItem.subscribeId != null &&
+                        activeItem.periodStatus == 1
+                      "
+                    >
+                      <template v-if="activeItem.subExamStatus === null">
+                        待预约考试
+                      </template>
 
-                          <template
-                            v-else-if="
-                              activeItem.subExamStatus === 0 &&
-                              sysTime <
-                                $tools.TimeTotimestamp(
-                                  $tools.timestampToTime(
-                                    activeItem.subApplySiteExamTime,
-                                    true
-                                  ) +
-                                    ' ' +
-                                    activeItem.subApplySiteStartTime
-                                )
-                            "
-                          >
-                            待考试,考试时间:{{
-                              $tools.timestampToTime(
-                                activeItem.subApplySiteExamTime,
-                                true
-                              ) +
-                              " " +
-                              activeItem.subApplySiteStartTime
-                            }}
-                            -
-                            {{
+                      <template
+                        v-else-if="
+                          activeItem.subExamStatus === 0 &&
+                          sysTime <
+                            $tools.TimeTotimestamp(
                               $tools.timestampToTime(
                                 activeItem.subApplySiteExamTime,
                                 true
                               ) +
-                              " " +
-                              activeItem.subApplySiteEndTime
-                            }}
-                          </template>
-                          <template v-else-if="activeItem.subExamStatus === 0"
-                            >待出考试结果</template
-                          >
-                          <template v-else-if="activeItem.subExamStatus === 1">
-                            <span v-if="activeItem.subResult === null"
-                              >待出考试结果</span
-                            >
-                            <span v-if="activeItem.subResult === 0"
-                              >考试结果:不通过,需补考</span
-                            >
-                            <span v-else-if="activeItem.subResult === 1"
-                              >考试结果:通过,考试成绩为{{
-                                activeItem.subPerformance
-                              }}</span
-                            >
-                          </template>
-                          <template v-else-if="activeItem.subExamStatus === 2">
-                            缺考,无成绩,需补考
-                          </template>
-                          <template v-else-if="activeItem.subExamStatus === 3">
-                            作弊,无成绩,需补考
-                          </template>
-                          <template v-else-if="activeItem.subExamStatus === 4">
-                            替考,无成绩,需补考
-                          </template>
-                        </template>
+                                ' ' +
+                                activeItem.subApplySiteStartTime
+                            )
+                        "
+                      >
+                        待考试,考试时间:{{
+                          $tools.timestampToTime(
+                            activeItem.subApplySiteExamTime,
+                            true
+                          ) +
+                          " " +
+                          activeItem.subApplySiteStartTime
+                        }}
+                        -
+                        {{
+                          $tools.timestampToTime(
+                            activeItem.subApplySiteExamTime,
+                            true
+                          ) +
+                          " " +
+                          activeItem.subApplySiteEndTime
+                        }}
+                      </template>
+                      <template v-else-if="activeItem.subExamStatus === 0"
+                        >待出考试结果</template
+                      >
+                      <template v-else-if="activeItem.subExamStatus === 1">
+                        <span v-if="activeItem.subResult === null"
+                          >待出考试结果</span
+                        >
+                        <span v-if="activeItem.subResult === 0"
+                          >考试结果:不通过,需补考</span
+                        >
+                        <span v-else-if="activeItem.subResult === 1"
+                          >考试结果:通过,考试成绩为{{
+                            activeItem.subPerformance
+                          }}</span
+                        >
+                      </template>
+                      <template v-else-if="activeItem.subExamStatus === 2">
+                        缺考,无成绩,需补考
+                      </template>
+                      <template v-else-if="activeItem.subExamStatus === 3">
+                        作弊,无成绩,需补考
+                      </template>
+                      <template v-else-if="activeItem.subExamStatus === 4">
+                        替考,无成绩,需补考
                       </template>
                     </template>
                   </template>
+                </template>
+              </template>
+            </div>
+          </div>
+          <div class="course-items__body clearfix">
+            <div class="img">
+              <img
+                :src="$tools.splitImgHost(activeItem.coverUrl, true)"
+                alt=""
+              />
+            </div>
+            <div class="text">
+              <div class="title">
+                {{ activeItem.goodsName }}
+                <div class="note">
+                  {{ activeItem.courseNum }}课程
+                  {{ activeItem.secAllNum + activeItem.examNum }}节
+                  {{ activeItem.classHours }}学时
                 </div>
               </div>
-              <div class="course-items__body clearfix">
-                <div class="img">
-                  <img :src="$tools.splitImgHost(activeItem.coverUrl, true)" alt="" />
-                </div>
-                <div class="text">
-                  <div class="title">
-                    {{ activeItem.goodsName }}
-                    <div class="note">
-                      {{ activeItem.courseNum }}课程
-                      {{ activeItem.secAllNum + activeItem.examNum }}节
-                      {{ activeItem.classHours }}学时
-                    </div>
-                  </div>
-                  <div class="progress">
-                    学习进度
-                    <el-progress
-                      class="progress-line"
-                      :stroke-width="16"
-                      :format="progressText(activeItem)"
-                      :percentage="
-                        ((activeItem.stuAllNum + activeItem.recordNum) /
-                          (activeItem.secAllNum + activeItem.examNum) || 0) * 100
-                      "
-                    ></el-progress>
-                  </div>
-                </div>
-                <div class="btns-wrap">
-                  <div class="btns">
-                    <el-button
-                      type="primary"
-                      class="btn btn--normal"
-                      :class="{
-                        disabled:
-                          (activeItem.serviceStartTime &&
-                            (sysTime <= activeItem.serviceStartTime ||
-                              sysTime >= activeItem.serviceEndTime)) ||
-                          (activeItem.classStartTime &&
-                            sysTime <= activeItem.classStartTime) ||
-                          (activeItem.classEndTime && sysTime >= activeItem.classEndTime) ||
-                          activeItem.learningStatus == 2 ||
-                          activeItem.classStatus == 0 ||
-                          (activeItem.learningStatus == 3 &&
-                            sysTime < activeItem.learningTimeStart),
-                      }"
-                      @click="goCourseDetail(activeItem)"
-                      >进入学习</el-button
-                    >
-
-                    <el-button
-                      type="primary"
-                      class="btn"
-                      @click="appointment(activeItem)"
-                      v-if="
-                        activeItem.applyStatus === 1 &&
-                        !(
-                          sysTime <= activeItem.serviceStartTime ||
-                          sysTime >= activeItem.serviceEndTime ||
-                          (activeItem.classStartTime &&
-                            sysTime <= activeItem.classStartTime) ||
-                          (activeItem.classEndTime && sysTime >= activeItem.classEndTime) ||
-                          activeItem.learningStatus == 2 ||
-                          activeItem.classStatus == 0 ||
-                          (activeItem.learningStatus == 3 &&
-                            sysTime < activeItem.learningTimeStart) || !activeItem.examApplyGoodsList.length
-                        )
-                      "
-                      >预约考试</el-button
-                    >
-
-                    <el-button
-                      type="danger"
-                      class="btn btn--warm"
-                      @click="selectClass(activeItem)"
-                      v-if="
-                        activeItem.gradeStatus == 1 &&
-                        activeItem.status == 1 &&
-                        activeItem.serviceEndTime > sysTime &&
-                        activeItem.serviceStartTime < sysTime &&
-                        activeItem.classEndTime &&
-                        activeItem.classEndTime < sysTime &&
-                        (activeItem.periodStatus == 0 || activeItem.periodStatus == -1) &&
-                        activeItem.studyCount > 0
-                      "
-                    >
-                      选班重学
-                    </el-button>
-                    <el-button
-                      type="primary"
-                      class="btn"
-                      v-if="
-                        activeItem.beforeStatus === 1 &&
-                        !(
-                          sysTime <= activeItem.serviceStartTime ||
-                          sysTime >= activeItem.serviceEndTime ||
-                          (activeItem.classStartTime &&
-                            sysTime <= activeItem.classStartTime) ||
-                          (activeItem.classEndTime && sysTime >= activeItem.classEndTime) ||
-                          activeItem.learningStatus == 2 ||
-                          activeItem.classStatus == 0 ||
-                          (activeItem.learningStatus == 3 &&
-                            sysTime < activeItem.learningTimeStart)
-                        )
-                      "
-                      @click="appBeforeAddress(activeItem)"
-                      >进入刷题</el-button
-                    >
-                  </div>
-                </div>
+              <div class="progress">
+                学习进度
+                <el-progress
+                  class="progress-line"
+                  :stroke-width="16"
+                  :format="progressText(activeItem)"
+                  :percentage="
+                    ((activeItem.stuAllNum + activeItem.recordNum) /
+                      (activeItem.secAllNum + activeItem.examNum) || 0) * 100
+                  "
+                ></el-progress>
               </div>
-              <template
-                v-if="
-                  !(
-                    sysTime < activeItem.serviceStartTime ||
-                    sysTime > activeItem.serviceEndTime
-                  )
-                "
-              >
-                <div
-                  class="course-items__footer"
-                  v-if="activeItem.classEndTime && activeItem.classEndTime < sysTime"
+            </div>
+            <div class="btns-wrap">
+              <div class="btns">
+                <el-button
+                  type="primary"
+                  class="btn btn--normal"
+                  :class="{
+                    disabled:
+                      (activeItem.serviceStartTime &&
+                        (sysTime <= activeItem.serviceStartTime ||
+                          sysTime >= activeItem.serviceEndTime)) ||
+                      (activeItem.classStartTime &&
+                        sysTime <= activeItem.classStartTime) ||
+                      (activeItem.classEndTime &&
+                        sysTime >= activeItem.classEndTime) ||
+                      activeItem.learningStatus == 2 ||
+                      activeItem.classStatus == 0 ||
+                      (activeItem.learningStatus == 3 &&
+                        sysTime < activeItem.learningTimeStart),
+                  }"
+                  @click="goCourseDetail(activeItem)"
+                  >进入学习</el-button
                 >
-                  <span class="text"
-                    >班级有效期:{{
-                      $tools.timestampToTime(activeItem.classStartTime, true, true)
-                    }}
-                    -
-                    {{
-                      $tools.timestampToTime(activeItem.classEndTime, true, true)
-                    }}</span
-                  >
-                  <span class="text text--red"
-                    >班级状态:已过期,有疑问请联系020-87085982</span
-                  >
-                </div>
 
-                <div
-                  class="course-items__footer"
-                  v-else-if="
-                    activeItem.classStartTime && activeItem.classStartTime > sysTime
+                <el-button
+                  type="primary"
+                  class="btn"
+                  @click="appointment(activeItem)"
+                  v-if="
+                    activeItem.applyStatus === 1 &&
+                    !(
+                      sysTime <= activeItem.serviceStartTime ||
+                      sysTime >= activeItem.serviceEndTime ||
+                      (activeItem.classStartTime &&
+                        sysTime <= activeItem.classStartTime) ||
+                      (activeItem.classEndTime &&
+                        sysTime >= activeItem.classEndTime) ||
+                      activeItem.learningStatus == 2 ||
+                      activeItem.classStatus == 0 ||
+                      (activeItem.learningStatus == 3 &&
+                        sysTime < activeItem.learningTimeStart) ||
+                      !activeItem.examApplyGoodsList.length
+                    )
                   "
+                  >预约考试</el-button
                 >
-                  <span class="text"
-                    >班级有效期:{{
-                      $tools.timestampToTime(activeItem.classStartTime, true, true)
-                    }}
-                    -
-                    {{
-                      $tools.timestampToTime(activeItem.classEndTime, true, true)
-                    }}</span
-                  >
-                  <span class="text"
-                    >班级状态:未到学习时间,有疑问请联系 020-87085982</span
-                  >
-                </div>
 
-                <template v-else>
-                  <div
-                    class="course-items__footer"
-                    v-if="
-                      activeItem.gradeId != 0 &&
-                      activeItem.gradeStatus == 1 &&
-                      activeItem.classStatus != null
-                    "
-                  >
-                    <span class="text"
-                      >班级状态:
-                      {{
-                        activeItem.classStatus == 1
-                          ? "已开班"
-                          : activeItem.classStatus == 0
-                          ? "未开班"
-                          : ""
-                      }}
-                    </span>
-                    <span class="text"
-                      >班级有效期:{{
-                        $tools.timestampToTime(activeItem.classStartTime, true, true)
-                      }}-{{
-                        $tools.timestampToTime(activeItem.classEndTime, true, true)
-                      }}</span
-                    >
-                  </div>
-                  <div class="course-items__footer" v-if="activeItem.classStatus == 0">
-                    <span class="text">教务处正在为您开通班级,请耐心等待</span>
-                  </div>
-                </template>
-              </template>
+                <el-button
+                  type="danger"
+                  class="btn btn--warm"
+                  @click="selectClass(activeItem)"
+                  v-if="
+                    activeItem.gradeStatus == 1 &&
+                    activeItem.status == 1 &&
+                    activeItem.serviceEndTime > sysTime &&
+                    activeItem.serviceStartTime < sysTime &&
+                    activeItem.classEndTime &&
+                    activeItem.classEndTime < sysTime &&
+                    (activeItem.periodStatus == 0 ||
+                      activeItem.periodStatus == -1) &&
+                    activeItem.studyCount > 0
+                  "
+                >
+                  选班重学
+                </el-button>
+                <el-button
+                  type="primary"
+                  class="btn"
+                  v-if="
+                    activeItem.beforeStatus === 1 &&
+                    !(
+                      sysTime <= activeItem.serviceStartTime ||
+                      sysTime >= activeItem.serviceEndTime ||
+                      (activeItem.classStartTime &&
+                        sysTime <= activeItem.classStartTime) ||
+                      (activeItem.classEndTime &&
+                        sysTime >= activeItem.classEndTime) ||
+                      activeItem.learningStatus == 2 ||
+                      activeItem.classStatus == 0 ||
+                      (activeItem.learningStatus == 3 &&
+                        sysTime < activeItem.learningTimeStart)
+                    )
+                  "
+                  @click="appBeforeAddress(activeItem)"
+                  >进入刷题</el-button
+                >
+              </div>
+            </div>
+          </div>
+          <template
+            v-if="
+              !(
+                sysTime < activeItem.serviceStartTime ||
+                sysTime > activeItem.serviceEndTime
+              )
+            "
+          >
+            <div
+              class="course-items__footer"
+              v-if="
+                activeItem.classEndTime && activeItem.classEndTime < sysTime
+              "
+            >
+              <span class="text"
+                >班级有效期:{{
+                  $tools.timestampToTime(activeItem.classStartTime, true, true)
+                }}
+                -
+                {{
+                  $tools.timestampToTime(activeItem.classEndTime, true, true)
+                }}</span
+              >
+              <span class="text text--red"
+                >班级状态:已过期,有疑问请联系020-87085982</span
+              >
             </div>
-          
+
+            <div
+              class="course-items__footer"
+              v-else-if="
+                activeItem.classStartTime && activeItem.classStartTime > sysTime
+              "
+            >
+              <span class="text"
+                >班级有效期:{{
+                  $tools.timestampToTime(activeItem.classStartTime, true, true)
+                }}
+                -
+                {{
+                  $tools.timestampToTime(activeItem.classEndTime, true, true)
+                }}</span
+              >
+              <span class="text"
+                >班级状态:未到学习时间,有疑问请联系 020-87085982</span
+              >
+            </div>
+
+            <template v-else>
+              <div
+                class="course-items__footer"
+                v-if="
+                  activeItem.gradeId != 0 &&
+                  activeItem.gradeStatus == 1 &&
+                  activeItem.classStatus != null
+                "
+              >
+                <span class="text"
+                  >班级状态:
+                  {{
+                    activeItem.classStatus == 1
+                      ? "已开班"
+                      : activeItem.classStatus == 0
+                      ? "未开班"
+                      : ""
+                  }}
+                </span>
+                <span class="text"
+                  >班级有效期:{{
+                    $tools.timestampToTime(
+                      activeItem.classStartTime,
+                      true,
+                      true
+                    )
+                  }}-{{
+                    $tools.timestampToTime(activeItem.classEndTime, true, true)
+                  }}</span
+                >
+              </div>
+              <div
+                class="course-items__footer"
+                v-if="activeItem.classStatus == 0"
+              >
+                <span class="text">教务处正在为您开通班级,请耐心等待</span>
+              </div>
+            </template>
+          </template>
         </div>
+      </div>
       <div class="my-course">
         <div class="my-course__header">
           <el-tabs :value="activeName" @tab-click="tabChange">
@@ -678,7 +705,8 @@
                           item.learningStatus == 2 ||
                           item.classStatus == 0 ||
                           (item.learningStatus == 3 &&
-                            sysTime < item.learningTimeStart)  || !item.examApplyGoodsList.length
+                            sysTime < item.learningTimeStart) ||
+                          !item.examApplyGoodsList.length
                         )
                       "
                       >预约考试</el-button
@@ -832,12 +860,21 @@
       </div>
     </el-dialog>
     <!-- 预约考试弹窗 -->
-    <appoint-test :appointModal.sync="appointModal" :appointItem='appointItem'></appoint-test>
+    <appoint-test
+      :appointModal.sync="appointModal"
+      :appointItem="appointItem"
+    ></appoint-test>
 
     <!-- 选班重学弹窗 -->
-    <SelectClassModal ref="selectClassModal" @selectClassOk="selectClassOk"></SelectClassModal>
+    <SelectClassModal
+      ref="selectClassModal"
+      @selectClassOk="selectClassOk"
+    ></SelectClassModal>
 
-    <RebuildModal ref="rebuildModal" @rebuildSubmit="rebuildSubmit($event)"></RebuildModal>
+    <RebuildModal
+      ref="rebuildModal"
+      @rebuildSubmit="rebuildSubmit($event)"
+    ></RebuildModal>
 
     <ExercisesModal ref="exercisesModal"></ExercisesModal>
     <!-- <el-dialog
@@ -892,9 +929,7 @@
         </el-descriptions>
 
         <div class="">
-          <el-checkbox v-model="confirmChecked"
-            >确认个人信息无误</el-checkbox
-          >
+          <el-checkbox v-model="confirmChecked">确认个人信息无误</el-checkbox>
         </div>
       </div>
       <span slot="footer" class="dialog-footer">
@@ -919,7 +954,7 @@ import { mapGetters, mapActions } from "vuex";
 import SelectClassModal from "@/components/selectClassModal";
 import RebuildModal from "@/components/rebuildModal";
 import ExercisesModal from "@/components/exercisesModal";
-import AppointTest from './components/AppointTest.vue'
+import AppointTest from "./components/AppointTest.vue";
 import * as baseUrls from "@/axios.js";
 export default {
   name: "MyCourse",
@@ -968,7 +1003,7 @@ export default {
     ...mapActions(["getUserInfo"]),
     openBoxs(data) {
       console.log(data);
-      this.activeItem = data
+      this.activeItem = data;
       this.dialogVisible = true;
     },
     activeFunc() {},
@@ -1047,6 +1082,37 @@ export default {
       this.courseGoodsList();
     },
     async goCourseDetail(item) {
+      if (item.interfaceAccountId > 0 && item.learnStatus > 0 && false) {
+        const confirmText = [
+          "您的学习账号已经开通,请按照步骤操作,进行学习。",
+          "1.点击【跳转学习网址】按钮",
+          "2.打开学习网址后,选择【个人用户】进行登录",
+          "(1)账号:您个人的身份证号码",
+          "(2)密码:身份证号码,再加111111",
+        ];
+        const newDatas = [];
+        const h = this.$createElement;
+        for (const i in confirmText) {
+          newDatas.push(h("p", null, confirmText[i]));
+        }
+        this.$confirm(h("div", null, newDatas), "温馨提示", {
+          beforeClose: (type,y,done) => {
+            if (type == "confirm") {
+              window.open("http://admin.zhujianpeixun.com/", "_blank");
+            } else if (type == "cancel") {
+              // this.$router.back(-1);
+              done()
+            }
+          },
+          confirmButtonText: "跳转学习网址",
+          cancelButtonText: "关闭",
+          closeOnClickModal: false,
+          closeOnPressEscape: false,
+          distinguishCancelAndClose: false,
+          showClose: false,
+        });
+        return;
+      }
       this.$emit("backData", item);
       this.dialogVisible = false;
       return;
@@ -1614,193 +1680,192 @@ export default {
     }
   }
 }
-.headerStyle{
-    .title{
-        padding: 6px 12px;
-        color: #3f8dfd;
-        background-color: #F8F8F9;
-
-    }
+.headerStyle {
+  .title {
+    padding: 6px 12px;
+    color: #3f8dfd;
+    background-color: #f8f8f9;
+  }
 }
 .course-items {
-        margin-top: 10px;
-        background: #fafbfc;
-        border-radius: 8px;
-        overflow: hidden;
-        padding-bottom: 24px;
-        margin-bottom: 24px;
-        border-bottom: 2px solid #eee;
-        &__header {
-          height: 40px;
-          border-bottom: 1px solid #eee;
-          padding: 0 18px;
-
-          .state {
-            margin-top: 8px;
-            float: left;
-            font-size: 14px;
-            font-family: Microsoft YaHei;
-            font-weight: 400;
-            color: #666666;
+  margin-top: 10px;
+  background: #fafbfc;
+  border-radius: 8px;
+  overflow: hidden;
+  padding-bottom: 24px;
+  margin-bottom: 24px;
+  border-bottom: 2px solid #eee;
+  &__header {
+    height: 40px;
+    border-bottom: 1px solid #eee;
+    padding: 0 18px;
+
+    .state {
+      margin-top: 8px;
+      float: left;
+      font-size: 14px;
+      font-family: Microsoft YaHei;
+      font-weight: 400;
+      color: #666666;
+
+      .red {
+        color: #ff3b30;
+      }
 
-            .red {
-              color: #ff3b30;
-            }
+      .note {
+        vertical-align: middle;
+        display: inline-block;
+        padding: 0 10px;
+        height: 24px;
+        background: #ffeceb;
+        border: 1px solid #ff3b30;
+        border-radius: 12px;
+        font-size: 14px;
+        font-family: Microsoft YaHei;
+        font-weight: 400;
+        color: #ff3b30;
+        text-align: center;
+        line-height: 24px;
+        margin-right: 10px;
 
-            .note {
-              vertical-align: middle;
-              display: inline-block;
-              padding: 0 10px;
-              height: 24px;
-              background: #ffeceb;
-              border: 1px solid #ff3b30;
-              border-radius: 12px;
-              font-size: 14px;
-              font-family: Microsoft YaHei;
-              font-weight: 400;
-              color: #ff3b30;
-              text-align: center;
-              line-height: 24px;
-              margin-right: 10px;
+        &--yellow {
+          border-color: #ffb001;
+          color: #ffb001;
+          background: #fff8e8;
+        }
 
-              &--yellow {
-                border-color: #ffb001;
-                color: #ffb001;
-                background: #fff8e8;
-              }
+        &--green {
+          border-color: #56dc68;
+          color: #56dc68;
+          background: #e6feea;
+        }
+      }
+    }
 
-              &--green {
-                border-color: #56dc68;
-                color: #56dc68;
-                background: #e6feea;
-              }
-            }
-          }
+    .time {
+      float: right;
+      line-height: 40px;
+      text-align: right;
+      font-size: 12px;
+      font-family: Microsoft YaHei;
+      font-weight: 400;
+      color: #666666;
+
+      &--red {
+        color: #ff3b30;
+      }
+    }
+  }
 
-          .time {
-            float: right;
-            line-height: 40px;
-            text-align: right;
-            font-size: 12px;
-            font-family: Microsoft YaHei;
-            font-weight: 400;
-            color: #666666;
+  &__body {
+    .img {
+      float: left;
+      width: 160px;
+      height: 90px;
+
+      img {
+        max-width: 100%;
+        max-height: 100%;
+      }
+    }
 
-            &--red {
-              color: #ff3b30;
-            }
-          }
+    .text {
+      float: left;
+      margin-left: 12px;
+      .title {
+        margin-top: 10px;
+        font-size: 16px;
+        font-family: Microsoft YaHei;
+        font-weight: bold;
+        color: #333333;
+        .note {
+          display: inline-block;
+          vertical-align: middle;
+          border: 1px solid #333333;
+          border-radius: 4px;
+          font-size: 12px;
+          font-family: Microsoft YaHei;
+          font-weight: 400;
+          color: #333333;
+          padding: 2px 5px;
+          margin-left: 12px;
         }
+      }
 
-        &__body {
-          .img {
-            float: left;
-            width: 160px;
-            height: 90px;
+      .progress {
+        margin-top: 30px;
 
-            img {
-              max-width: 100%;
-              max-height: 100%;
-            }
-          }
+        font-size: 14px;
+        font-family: Microsoft YaHei;
+        font-weight: 400;
+        color: #333333;
 
-          .text {
-            float: left;
-            margin-left: 12px;
-            .title {
-              margin-top: 10px;
-              font-size: 16px;
-              font-family: Microsoft YaHei;
-              font-weight: bold;
-              color: #333333;
-              .note {
-                display: inline-block;
-                vertical-align: middle;
-                border: 1px solid #333333;
-                border-radius: 4px;
-                font-size: 12px;
-                font-family: Microsoft YaHei;
-                font-weight: 400;
-                color: #333333;
-                padding: 2px 5px;
-                margin-left: 12px;
-              }
-            }
+        &-line {
+          width: 220px;
+          display: inline-block;
+        }
 
-            .progress {
-              margin-top: 30px;
+        /deep/ .el-progress-bar {
+          padding-right: 70px;
+          margin-right: -70px;
+        }
+      }
+    }
 
-              font-size: 14px;
-              font-family: Microsoft YaHei;
-              font-weight: 400;
-              color: #333333;
+    .btns-wrap {
+      display: table;
+      float: right;
+      height: 90px;
+      width: 130px;
 
-              &-line {
-                width: 220px;
-                display: inline-block;
-              }
+      .btns {
+        display: table-cell;
+        vertical-align: middle;
+        text-align: center;
 
-              /deep/ .el-progress-bar {
-                padding-right: 70px;
-                margin-right: -70px;
-              }
+        .btn {
+          cursor: pointer;
+          margin: 2px 0;
+          width: 122px;
+          height: 32px;
+          padding: 0;
+          border-radius: 16px;
+          display: inline-block;
+          text-align: center;
+          line-height: 32px;
+          color: #fff;
+
+          &--normal {
+            &.disabled {
+              background: rgb(101, 164, 253);
+              border-color: rgb(101, 164, 253);
             }
           }
 
-          .btns-wrap {
-            display: table;
-            float: right;
-            height: 90px;
-            width: 130px;
-
-            .btns {
-              display: table-cell;
-              vertical-align: middle;
-              text-align: center;
-
-              .btn {
-                cursor: pointer;
-                margin: 2px 0;
-                width: 122px;
-                height: 32px;
-                padding: 0;
-                border-radius: 16px;
-                display: inline-block;
-                text-align: center;
-                line-height: 32px;
-                color: #fff;
+          &--warm {
+            background: #ff3b30;
 
-                &--normal {
-                  &.disabled {
-                    background: rgb(101, 164, 253);
-                    border-color: rgb(101, 164, 253);
-                  }
-                }
-
-                &--warm {
-                  background: #ff3b30;
-
-                  &:hover {
-                    background: #f56c6c;
-                  }
-                }
-              }
+            &:hover {
+              background: #f56c6c;
             }
           }
         }
+      }
+    }
+  }
 
-        &__footer {
-          padding: 20px 18px;
-          font-size: 14px;
-          color: #333;
+  &__footer {
+    padding: 20px 18px;
+    font-size: 14px;
+    color: #333;
 
-          .text {
-            margin-right: 20px;
+    .text {
+      margin-right: 20px;
 
-            &--red {
-              color: #ff3b30;
-            }
-          }
-        }
+      &--red {
+        color: #ff3b30;
       }
+    }
+  }
+}
 </style>

+ 1 - 0
src/pages/person-center/my-course/index.vue

@@ -1317,6 +1317,7 @@ export default {
         learningStatus,
         learningTimeStart,
       } = this.goodsData;
+      console.log(interfaceAccountId,learnStatus,"xzx")
       if (interfaceAccountId > 0) {
         learnStatus == 1
           ? this.rebuildSubmit(this.goodsData)