lsc 2 years ago
parent
commit
09368ab483

+ 1 - 1
dist/index.html

@@ -1 +1 @@
-<!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><title>pbl-student</title><link href=./static/css/app.c9f19c180052b1f7a424d3df21d9e420.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=./static/js/manifest.3ad1d5771e9b13dbdad2.js></script><script type=text/javascript src=./static/js/vendor.58e4d5b3fd0c569e76aa.js></script><script type=text/javascript src=./static/js/app.7564153348f1f219092b.js></script></body></html><script>document.domain = "cocorobo.cn"</script>
+<!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><title>pbl-student</title><link href=./static/css/app.51b2c71b8387cff603b614434307b9e5.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=./static/js/manifest.3ad1d5771e9b13dbdad2.js></script><script type=text/javascript src=./static/js/vendor.58e4d5b3fd0c569e76aa.js></script><script type=text/javascript src=./static/js/app.2fad1725be0279112848.js></script></body></html><script>document.domain = "cocorobo.cn"</script>

File diff suppressed because it is too large
+ 0 - 0
dist/static/css/app.51b2c71b8387cff603b614434307b9e5.css


File diff suppressed because it is too large
+ 0 - 0
dist/static/css/app.51b2c71b8387cff603b614434307b9e5.css.map


File diff suppressed because it is too large
+ 0 - 0
dist/static/css/app.c9f19c180052b1f7a424d3df21d9e420.css.map


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/app.2fad1725be0279112848.js


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/app.2fad1725be0279112848.js.map


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/app.7564153348f1f219092b.js


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/app.7564153348f1f219092b.js.map


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/manifest.3ad1d5771e9b13dbdad2.js.map


+ 254 - 0
src/components/components/pdf2.vue

@@ -0,0 +1,254 @@
+<template>
+  <div class="pdf">
+    <div class="show">
+      <pdf
+        ref="pdf"
+        :src="pdfUrl"
+        :page="pageNum"
+        :rotate="pageRotate"
+        @password="password"
+        @progress="loadedRatio = $event"
+        @page-loaded="pageLoaded($event)"
+        @num-pages="pageTotalNum = $event"
+        @error="pdfError($event)"
+        @link-clicked="page = $event"
+      ></pdf>
+    </div>
+
+    <div class="pdf_footer">
+      <div class="info">
+        <div>当前页数/总页数:{{pageNum}}/{{pageTotalNum}}</div>
+      </div>
+      <div class="operate">
+        <div class="btn" @click.stop="prePage">上一页</div>
+        <div class="btn" @click.stop="nextPage">下一页</div>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+import pdf from "vue-pdf";
+export default {
+  name: "vue_pdf_preview",
+  props: {
+    // 当前pdf路径
+    pdfUrl: {
+      type: String,
+      default:
+        "https://ccrb.s3.cn-northwest-1.amazonaws.com.cn/0629%E5%AE%9E%E6%97%B6%E8%AF%BE%E5%A0%82%E6%A8%A1%E6%8B%9F%E6%BC%94%E7%A4%BA%E8%AF%BE%E4%BB%B61656920880446.pdf",
+    },
+    ppage: {
+      type: Number,
+      default: 1,
+    },
+  },
+  components: {
+    pdf,
+  },
+  data() {
+    return {
+      // 总页数
+      pageTotalNum: 1,
+      // 当前页数
+      pageNum: 1,
+      // 加载进度
+      loadedRatio: 0,
+      // 页面加载完成
+      curPageNum: 0,
+      // 放大系数 默认百分百
+      scale: 69,
+      // 旋转角度 ‘90’的倍数才有效
+      pageRotate: 0,
+      // 单击内部链接时触发 (目前我没有遇到使用场景)
+      page: 0,
+    };
+  },
+  watch: {
+    ppage(val) {
+      this.pageNum = val;
+    },
+    pageTotalNum(val) {
+      this.$emit("getPageTotal", val);
+    },
+  },
+  computed: {},
+  created() {},
+  mounted() {
+    this.pageNum = this.ppage;
+    var a = document.getElementsByClassName("pdf")[0].offsetWidth;
+    let _this = this;
+    this.$refs.pdf.$el.style.width =
+      document.getElementsByClassName("pdf")[0].offsetHeight * 1.77 + "px";
+    window.addEventListener("resize", () => {
+      this.$refs.pdf.$el.style.width =
+        document.getElementsByClassName("pdf")[0].offsetHeight * 1.77 + "px";
+    });
+  },
+  methods: {
+    //下载PDF
+    fileDownload(data, fileName) {
+      let blob = new Blob([data], {
+        //type类型后端返回来的数据中会有,根据自己实际进行修改
+        type: "application/pdf;charset-UTF-8",
+      });
+      let filename = fileName || "pdf.pdf";
+      if (typeof window.navigator.msSaveBlob !== "undefined") {
+        window.navigator.msSaveBlob(blob, filename);
+      } else {
+        var blobURL = window.URL.createObjectURL(blob);
+        // 创建隐藏<a>标签进行下载
+        var tempLink = document.createElement("a");
+        tempLink.style.display = "none";
+        tempLink.href = blobURL;
+        tempLink.setAttribute("download", filename);
+        if (typeof tempLink.download === "undefined") {
+          tempLink.setAttribute("target", "_blank");
+        }
+        document.body.appendChild(tempLink);
+        tempLink.click();
+        document.body.removeChild(tempLink);
+        window.URL.revokeObjectURL(blobURL);
+      }
+    },
+
+    //放大
+    scaleD() {
+      this.scale += 5;
+      this.$refs.pdf.$el.style.width = parseInt(this.scale) + "%";
+    },
+
+    //缩小
+    scaleX() {
+      // scale 是百分百展示 不建议缩放
+      if (this.scale == 100) {
+        return;
+      }
+      this.scale += -5;
+      console.log(parseInt(this.scale) + "%");
+      this.$refs.pdf.$el.style.width = parseInt(this.scale) + "%";
+    },
+    // 切换上一页
+    prePage() {
+      var p = this.pageNum;
+      p = p > 1 ? p - 1 : this.pageTotalNum;
+      this.pageNum = p;
+      this.getPage(p);
+    },
+    // 切换下一页
+    nextPage() {
+      var p = this.pageNum;
+      p = p < this.pageTotalNum ? p + 1 : 1;
+      this.pageNum = p;
+      this.getPage(p);
+    },
+    // 顺时针选中角度
+    clock() {
+      this.pageRotate += 90;
+    },
+    // 逆时针旋转角度
+    counterClock() {
+      this.pageRotate -= 90;
+    },
+    // pdf 有密码 则需要输入秘密
+    password(updatePassword, reason) {
+      updatePassword(prompt('password is "test"'));
+      console.log("...reason...");
+      console.log(reason);
+      console.log("...reason...");
+    },
+    // 页面加载成功  当前页数
+    pageLoaded(e) {
+      this.$emit("current", e);
+      this.curPageNum = e;
+    },
+    // 异常监听
+    pdfError(error) {
+      console.error(error);
+    },
+    // 打印所有
+    pdfPrintAll() {
+      this.$refs.pdf.print();
+    },
+    // 打印 第一页和第二页
+    pdfPrint() {
+      // 第一个参数 文档打印的分辨率
+      // 第二个参数 文档打印的页数
+      this.$refs.pdf.print(100, [1, 2]);
+    },
+    // 获取当前页面pdf的文字信息内容
+    logContent() {
+      this.$refs.pdf.pdf.forEachPage(function (page) {
+        return page.getTextContent().then(function (content) {
+          let text = content.items.map((item) => item.str);
+          let allStr = content.items.reduce((initVal, item) => (initVal += item.str), "");
+          console.log(allStr); // 内容字符串
+          console.log(text); // 内容数组
+        });
+      });
+    },
+  },
+};
+</script>
+
+<style scoped>
+.pdf {
+  height: 100%;
+  position: relative;
+  box-sizing: border-box;
+}
+.pdf .show {
+  overflow: auto;
+  margin: auto;
+  width: 100%;
+  /* height: calc(100%); */
+  min-height: 100%;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+}
+
+.pdf .pdf_footer {
+  position: sticky;
+  bottom: 0;
+  left: 0;
+  right: 0;
+  padding: 10px 0;
+  width: 100%;
+  height: 75px;
+  background-color: rgba(255, 255, 255, 0.5);
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  flex-direction: column;
+}
+.pdf .pdf_footer .info {
+  display: flex;
+  flex-wrap: wrap;
+  width: 100%;
+  justify-content: center;
+}
+/* .pdf .pdf_footer .info div {
+  width: 30%;
+} */
+.pdf .pdf_footer .operate {
+  margin: 10px 0 0;
+  display: flex;
+  flex-wrap: wrap;
+  justify-content: center;
+  width: 100%;
+}
+.pdf .pdf_footer .operate div {
+  text-align: center;
+  font-size: 15px;
+}
+.pdf .pdf_footer .operate .btn {
+  cursor: pointer;
+  margin: 5px 10px;
+  width: 100px;
+  border-radius: 10px;
+  padding: 5px;
+  color: #fff;
+  background-color: #066ebe;
+}
+</style>

+ 6 - 5
src/components/project.vue

@@ -50,20 +50,20 @@
                   )
                 "
               >
-                <!-- <img
+                <img
                   :src="
                     item.cover != null && item.cover != ''
                       ? JSON.parse(item.cover)[0].url
                       : mpj
                   "
                   alt=""
-                /> -->
-				<img
+                />
+				<!-- <img
                   :src="
                     mpj
                   "
                   alt=""
-                />
+                /> -->
               </div>
               <div class="projct_nav">
                 <div
@@ -101,7 +101,8 @@ export default {
       myCourse: [],
       studentMessage: [],
       tx: require("../assets/avatar.png"),
-      mpj: require("../assets/project.png"),
+      // mpj: require("../assets/project.png"),
+      mpj:"https://ccrb.s3.cn-northwest-1.amazonaws.com.cn/noBanner1656409780264.jpg",
       userid: this.$route.query.userid,
       oid:this.$route.query.oid,
     };

+ 76 - 79
src/components/study.vue

@@ -224,6 +224,20 @@
                       :src="pptImgUrl1"
                     ></iframe>
                   </div>
+                  <div
+                    class="wheel"
+                    v-if="showType == 3"
+                    style="height: 520px; width: 90%; margin: 0 0 20px 30px"
+                  >
+                    <!-- <iframe
+                      style="width: 100%; height: 100%; border: none"
+                      :src="pptImgUrl1"
+                    ></iframe> -->
+                    <pdf
+                      :pdfUrl="pptImgUrl1"
+                      style="width: 100%; height: 100%; overflow: auto"
+                    ></pdf>
+                  </div>
                 </div>
               </div>
 
@@ -819,17 +833,10 @@
                         v-for="(w, wIndex) in workStudent[toolIndex]"
                         :key="wIndex"
                       >
-                        <div class="workImg" v-if="w.type == 0">
-                          <img
-                            :src="w.works"
-                            @click="previewImg(w.works)"
-                            alt
-                          />
-                        </div>
-                        <div class="workImg" v-if="w.type == 1">
+                        <div class="workImg">
                           <img
                             src="../assets/icon/works/noImg.png"
-                            @click="openFile(w.works)"
+                            @click="openTools(4, toolIndex, taskCount, w.works)"
                             alt
                           />
                         </div>
@@ -931,27 +938,28 @@
                     >
                       <div
                         class="works"
-                        style="width: 200px; height: 140px; padding-top: 25px"
-                        v-for="(w, wIndex) in workStudent[toolIndex]"
+                        v-for="(w, wIndex) in worksStudent[toolIndex]"
                         :key="wIndex"
                       >
-                        <div class="workImg" v-if="w.type == 0">
-                          <img
-                            :src="w.works"
-                            @click="previewImg(w.works)"
-                            alt
-                          />
-                        </div>
-                        <div class="workImg" v-if="w.type == 1">
-                          <img
+                        <div class="workImg">
+                          <!-- <img
                             src="../assets/icon/works/noImg.png"
-                            @click="openFile(w.works)"
-                            alt
-                          />
-                        </div>
-                        <div class="worksName">
-                          姓名:
-                          <span>{{ w.sName }}</span>
+                            @click="openTools(15, toolIndex, taskCount, w.works)"
+                            alt=""
+                          />-->
+                          <div class="answerBg">
+                            <div>{{ w.sName }}</div>
+                            <el-tooltip
+                              class="item"
+                              effect="light"
+                              :content="JSON.parse(w.works)[0].answer"
+                              placement="top"
+                            >
+                              <div class="answerContent">
+                                {{ JSON.parse(w.works)[0].answer }}
+                              </div>
+                            </el-tooltip>
+                          </div>
                         </div>
                       </div>
                     </div>
@@ -1044,20 +1052,13 @@
                         v-for="(w, wIndex) in workStudent[toolIndex]"
                         :key="wIndex"
                       >
-                        <div class="workImg" v-if="w.type == 0">
+                        <div class="workImg">
                           <img
                             :src="w.works"
                             @click="previewImg(w.works)"
                             alt
                           />
                         </div>
-                        <div class="workImg" v-if="w.type == 1">
-                          <img
-                            src="../assets/icon/works/noImg.png"
-                            @click="openFile(w.works)"
-                            alt
-                          />
-                        </div>
                         <div class="worksName">
                           姓名:
                           <span>{{ w.sName }}</span>
@@ -1153,20 +1154,13 @@
                         v-for="(w, wIndex) in workStudent[toolIndex]"
                         :key="wIndex"
                       >
-                        <div class="workImg" v-if="w.type == 0">
+                        <div class="workImg">
                           <img
                             :src="w.works"
                             @click="previewImg(w.works)"
                             alt
                           />
                         </div>
-                        <div class="workImg" v-if="w.type == 1">
-                          <img
-                            src="../assets/icon/works/noImg.png"
-                            @click="openFile(w.works)"
-                            alt
-                          />
-                        </div>
                         <div class="worksName">
                           姓名:
                           <span>{{ w.sName }}</span>
@@ -1262,20 +1256,13 @@
                         v-for="(w, wIndex) in workStudent[toolIndex]"
                         :key="wIndex"
                       >
-                        <div class="workImg" v-if="w.type == 0">
+                        <div class="workImg">
                           <img
                             :src="w.works"
                             @click="previewImg(w.works)"
                             alt
                           />
                         </div>
-                        <div class="workImg" v-if="w.type == 1">
-                          <img
-                            src="../assets/icon/works/noImg.png"
-                            @click="openFile(w.works)"
-                            alt
-                          />
-                        </div>
                         <div class="worksName">
                           姓名:
                           <span>{{ w.sName }}</span>
@@ -1371,20 +1358,13 @@
                         v-for="(w, wIndex) in workStudent[toolIndex]"
                         :key="wIndex"
                       >
-                        <div class="workImg" v-if="w.type == 0">
+                        <div class="workImg">
                           <img
                             :src="w.works"
                             @click="previewImg(w.works)"
                             alt
                           />
                         </div>
-                        <div class="workImg" v-if="w.type == 1">
-                          <img
-                            src="../assets/icon/works/noImg.png"
-                            @click="openFile(w.works)"
-                            alt
-                          />
-                        </div>
                         <div class="worksName">
                           姓名:
                           <span>{{ w.sName }}</span>
@@ -1819,11 +1799,11 @@
 
 <script>
 import "../common/aws-sdk-2.235.1.min.js";
-// import pdf from "./components/pdf";
+import pdf from "./components/pdf2";
 import EditorBar from "../components/tools/wangEnduit.vue";
 import Time from "../components/tools/time.vue";
 export default {
-  components: { EditorBar, Time },
+  components: { EditorBar, Time, pdf },
   data() {
     return {
       dialogVisible: false,
@@ -1917,7 +1897,7 @@ export default {
       dialogVisible1: false,
       dialogVisible2: false,
       dialogVisible3: false,
-      dialogVisible6:false,
+      dialogVisible6: false,
       dialogVisible4: false,
       isNoHomeWork: false,
       dialogVisible5: false,
@@ -1934,7 +1914,7 @@ export default {
       answerList: [],
       navList: [],
       worksStudent: [],
-      workStudent:[],
+      workStudent: [],
       noWorksS: [],
       isWorksS: [],
       noWorksStudent: [],
@@ -2099,9 +2079,9 @@ export default {
           console.error(err);
         });
     },
-    selectStudent(){
+    selectStudent() {
       let params = {
-        uid:this.userid,
+        uid: this.userid,
         cid: this.id,
         s: this.courseType,
         t: this.taskCount,
@@ -2235,7 +2215,7 @@ export default {
             file.name.split(".")[0] +
             new Date().getTime() +
             "." +
-            file.name.split(".")[file.name.split(".").length-1],
+            file.name.split(".")[file.name.split(".").length - 1],
           ContentType: file.type,
           Body: file,
           "Access-Control-Allow-Credentials": "*",
@@ -2649,12 +2629,22 @@ export default {
                 this.taskCount
               ].chapterData[0].type == 3
             ) {
-              this.showType = 2;
-              this.pptImgUrl1 =
-                "https://view.officeapps.live.com/op/view.aspx?src=" +
+              let _url =
                 this.chapInfoList[this.courseType].chapterInfo[0].taskJson[
                   this.taskCount
                 ].chapterData[0].url;
+              if (
+                _url
+                  .split(".")
+                  [_url.split(".").length - 1].toLocaleUpperCase() == "PDF"
+              ) {
+                this.showType = 3;
+                this.pptImgUrl1 = _url;
+              } else {
+                this.showType = 2;
+                this.pptImgUrl1 =
+                  "https://view.officeapps.live.com/op/view.aspx?src=" + _url;
+              }
             } else if (
               this.chapInfoList[this.courseType].chapterInfo[0].taskJson[
                 this.taskCount
@@ -2668,6 +2658,13 @@ export default {
             }
           }
 
+          this.selectStudent();
+          this.selectSWorks();
+          let _this = this;
+          _this.timer = setInterval(function () {
+            _this.selectSWorks();
+            _this.selectStudent();
+          }, 5000);
           this.$nextTick(function () {
             setTimeout(() => {
               // for (
@@ -2689,13 +2686,6 @@ export default {
                 a - 100 + "px";
             }, 500);
           });
-          this.selectStudent();
-          this.selectSWorks();
-          let _this = this;
-          _this.timer = setInterval(function () {
-            _this.selectSWorks();
-            _this.selectStudent();
-          }, 5000);
         })
         .catch((err) => {
           loading.close();
@@ -2773,7 +2763,7 @@ export default {
     },
     downFile(f, i) {
       this.pptImgUrl1 = "";
-      var a = ["PPT", "PPTX", "PDF", "XLSX", "XLS", "DOC", "DOCX"];
+      var a = ["PPT", "PPTX", "XLSX", "XLS", "DOC", "DOCX"]; //"PDF",
       console.log(
         a.indexOf(
           f.url.split(".")[f.url.split(".").length - 1].toLocaleUpperCase()
@@ -2788,6 +2778,13 @@ export default {
           "https://view.officeapps.live.com/op/view.aspx?src=" + f.url;
         // this.dialogVisible3 = true;
         this.showType = 2;
+      } else if (
+        f.url.split(".")[f.url.split(".").length - 1].toLocaleUpperCase() ==
+        "PDF"
+      ) {
+        this.pptImgUrl1 = f.url;
+        // this.dialogVisible3 = true;
+        this.showType = 3;
       } else {
         window.open(this.file[i].url);
       }
@@ -3777,8 +3774,8 @@ export default {
   border-bottom: 1px solid #d7d7d7;
   padding-bottom: 5px;
   background: #d2e3ff;
-  width: 70px;
-  min-width: 70px;
+  width: 55px;
+  min-width: 55px;
   border-radius: 5px;
   color: #4d97d6;
   text-align: center;

Some files were not shown because too many files changed in this diff