Bläddra i källkod

Merge branch 'beta' of https://git.cocorobo.cn/CocoRoboLabs/pbl-teacher-table into beta

lsc 11 månader sedan
förälder
incheckning
67c22dec5f

+ 1 - 1
src/components/pages/aiAddCourse/aiBox.vue

@@ -482,7 +482,7 @@ export default {
     getChatList() {
       return new Promise((resolve, reject) => {
         if (this.loading) return this.$message.info("请稍等...");
-        this.chatList = [];
+        this.array = [];
         this.loading = true;
         let params = {
           userid: this.userid,

+ 10 - 13
src/components/pages/classroomObservation/components/chatArea.vue

@@ -35,12 +35,12 @@
 				v-show="pageStatus == 1 && !showIndexPage"
 				:data="transcriptionData"
 			>
-				<el-button
+				<!-- <el-button
 					style="position: absolute; bottom: 10px; right: 20px"
 					type="primary"
 					@click.stop="saveEditorBar(true)"
 					>保存</el-button
-				>
+				> -->
 			</transcription>
 			<!-- ai对话 -->
 			<tape
@@ -54,11 +54,10 @@
 			<EditorBar
 				class="editorBar"
 				v-model="editorBarData.content"
-				v-show="
+				v-if="
 					pageStatus == 2 &&
 					!showIndexPage &&
-					editorBarData.type == '0' &&
-					!editorBarData.url
+					editorBarData.type == '0'
 				"
 				v-loading="uploadFileLoading"
 			>
@@ -71,8 +70,7 @@
 			</EditorBar>
 			<iframe
 				ref="viframe"
-				v-show="pageStatus == 2 && !showIndexPage && editorBarData.type == '1'"
-				v-if="editorBarData.url"
+				v-if="pageStatus == 2 && !showIndexPage && editorBarData.type == '1' && /\.(xlsx|doc|docx)$/i.test(editorBarData.url)"
 				style="width: 100%; height: 100%; border: none"
 				v-loading="uploadFileLoading"
 				:src="
@@ -80,6 +78,7 @@
 					encodeURIComponent(editorBarData.url)
 				"
 			></iframe>
+			<vpdf style="width: 100%; height: 100%;border: none" :pdfUrl="editorBarData.url" v-if="pageStatus == 2 && !showIndexPage && editorBarData.type == '1' && /\.(pdf)$/i.test(editorBarData.url)" />
 			<!-- </div> -->
 		</div>
 		<div class="ca-bottom">
@@ -91,7 +90,7 @@
 							<div class="ca-b-o-h-s-l-text">课堂观察</div>
 							<span class="ca-b-o-h-s-l-icon2 el-icon-caret-top"></span>
 						</div> -->
-
+<!-- 
 						<div class="ca-b-o-h-l-select" style="color: #3681fc">
 							<div
 								style="cursor: pointer"
@@ -115,9 +114,7 @@
 									>{{ i.lang }}</el-radio
 								>
 							</div>
-
-							<!-- <span class="ca-b-o-h-s-l-icon2 el-icon-caret-top"></span> -->
-						</div>
+						</div> -->
 
 						<div
 							class="ca-b-o-h-l-btn"
@@ -366,7 +363,7 @@ import Recorder from "js-audio-recorder";
 import MarkdownIt from "markdown-it";
 import EditorBar from "./wangEnduit.vue";
 const lamejs = require("lamejs");
-
+import vpdf from './vpdf'
 const recorder = new Recorder({
 	sampleBits: 16, // 采样位数,支持 8 或 16,默认是16
 	sampleRate: 48000, // 采样率,支持 11025、16000、22050、24000、44100、48000,根据浏览器默认值,我的chrome是48000
@@ -464,6 +461,7 @@ export default {
 		transcription,
 		tape,
 		EditorBar,
+		vpdf,
 	},
 	directives: {
 		"click-outside": clickOutside, // 注册自定义指令
@@ -1318,7 +1316,6 @@ export default {
 				blob.name = `${this.tid}-classroomObservation.txt`;
 				this.uploadFile(blob);
 			} else {
-				if(!this.editorBarData.content)return this.$message.info("请输入内容")
 				this.$emit("updateTranscription", {
 					transcriptionData: this.transcriptionData.content,
 					editorBarData: this.editorBarData,

+ 4 - 4
src/components/pages/classroomObservation/components/messageArea.vue

@@ -66,7 +66,7 @@
 				:fileId="fileId"
 				v-loading="extendLoading"
 			/>
-			<analysis
+			<!-- <analysis
 				@updateMessage="updateMessage"
 				ref="analysis3"
 				@delItem="delAnalysisItem"
@@ -78,7 +78,7 @@
 				:tid="tid"
 				:fileId="fileId"
 				v-loading="valueAddedLoading"
-			/>
+			/> -->
 			<!-- <currencyAnalysis
 				@updateMessage="updateMessage"
 				@delItem="delAnalysisItem"
@@ -245,7 +245,7 @@ export default {
 				{ id: 0, name: "通用课堂分析" },
 				{ id: 1, name: "科学课堂分析" },
 				{ id: 2, name: "扩展分析" },
-				{ id: 3, name: "增值性分析" },
+				//{ id: 3, name: "增值性分析" },
 			],
 			dialogTagDataList: [
 				{
@@ -660,7 +660,7 @@ export default {
 			this.getCurrencyAndBaseMessageData();
 			this.getScienceData();
 			this.getExtendData();
-			this.getValueAddedData();
+			// this.getValueAddedData();
 			// this.getFileId();
 		},
 		saveData(data) {

+ 0 - 281
src/components/pages/classroomObservation/components/pdf.vue

@@ -1,281 +0,0 @@
-<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,
-      loading: null,
-    };
-  },
-  watch: {
-    ppage(val) {
-      this.pageNum = val;
-    },
-    pageTotalNum(val) {
-      if (val) {
-        this.loading.close();
-        // this.$parent.setData();
-        this.$parent.getRealTimeClass();
-      }
-      this.$emit("getPageTotal", val);
-    },
-  },
-  computed: {},
-  created() {},
-  mounted() {
-    this.loading = this.$loading.service({
-      background: "rgba(255, 255, 255, 0.7)",
-      target: document.querySelector(".pdf"),
-    });
-    this.pageNum = this.ppage;
-    let dwidth = document.body.offsetWidth;
-    let cwidth = document.getElementsByClassName("pdf")[0].offsetHeight * 1.77;
-    let owidth = "";
-    if (cwidth > dwidth) {
-      owidth = dwidth + "px";
-    } else {
-      owidth = cwidth + "px";
-    }
-    var a = document.getElementsByClassName("pdf")[0].offsetWidth;
-    let _this = this;
-    this.$refs.pdf.$el.style.width = owidth;
-    this.$emit("getWidth", owidth);
-    window.addEventListener("resize", () => {
-      dwidth = document.body.offsetWidth;
-      cwidth = document.getElementsByClassName("pdf")[0].offsetHeight * 1.77;
-      if (cwidth > dwidth) {
-        owidth = dwidth + "px";
-      } else {
-        owidth = cwidth + "px";
-      }
-      this.$refs.pdf.$el.style.width = owidth;
-      this.$emit("getWidth", owidth);
-    });
-  },
-  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%);
-  display: flex;
-  align-items: center;
-  justify-content: center;
-}
-
-.pdf .pdf_footer {
-  position: absolute;
-  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 - 17
src/components/pages/classroomObservation/components/tape.vue

@@ -105,28 +105,13 @@
 					</div>
 				</div>
 			</div>
-			<!-- <div class="t-ca-item" v-for="(item,index) in chatData" :key="index">
-				<div class="t-ca-i-left">
-					<div class="t-ca-i-l-avatar">
-						<el-avatar size="medium" :src="require('../../../../assets/icon/classroomObservation/ai.png')"></el-avatar>
-					</div>
-				</div>
-				<div class="t-ca-i-right">
-					<div class="t-ca-i-r-name">{{ item.name }}</div>
-					<div class="t-ca-i-r-time">{{ item.create_at }}</div>
-					<div class="t-ca-i-r-content">{{ item.content }}</div>
-				</div>
-			</div> -->
 		</div>
 	</div>
 </template>
 
 <script>
-import pdf from "./pdf.vue";
 export default {
-	components: {
-		pdf,
-	},
+	components: {},
 	props: {
 		chatData: {
 			type: Array,
@@ -533,6 +518,10 @@ export default {
 }
 
 .t_ca_b_ai_c_m_left>>>ol{
-	margin-left: 15px;
+	margin-left: 25px;
+}
+
+.t_ca_b_ai_c_m_left>>>ul{
+	margin-left: 25px;
 }
 </style>

+ 252 - 0
src/components/pages/classroomObservation/components/vpdf.vue

@@ -0,0 +1,252 @@
+<template>
+  <!--使用 pdfvuer 实现 滑动浏览 单印章-->
+  <div class="pdf">
+    <div class="loading" v-show="isloading">
+      <span>pdf可能会加载时间有点长,请耐心等待...</span>
+    </div>
+    <!-- <div id="contentArea" class="show" v-if="!loading">
+      <pdf :scale.sync="scale" :resize="true" ref="wrapper" class="p-pdf" :src="pdfData" v-for="i in numPages" :key="i"
+        :id="i" :page="i" style="width: 100%">
+      </pdf>
+    </div> -->
+    <iframe ref="viframe" style="width: 100%; height: 99%; border: none"
+      :src="'https://cloud.cocorobo.cn/pdf.js/web/viewer.html?file=' + pdfUrl"></iframe>
+    <!-- <div class="rightArea">
+      <div class="toolGroup">
+        <div class="page">第 {{ page }} / {{ numPages }} 页</div>
+        <el-button type="primary" @click.stop="prePage">上一页</el-button>
+        <el-button type="primary" @click.stop="nextPage">下一页</el-button>
+      </div>
+    </div> -->
+  </div>
+</template>
+
+<script>
+// import pdfvuer from "pdfvuer"; // pdfvuer 版本为@1.6.1
+// import "pdfjs-dist/build/pdf.worker.entry";
+// const PDF = require("pdfjs-dist");
+// PDF.GlobalWorkerOptions.workerSrc = "../../common/pdf.worker.js";
+
+export default {
+  name: "Pdfvuer",
+  components: {
+    // pdf: pdfvuer,
+  },
+  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,
+    },
+  },
+  data() {
+    return {
+      page: 1, // 当前页
+      numPages: 0, // 总页数
+      pdfData: undefined,
+      inputPage: 1, // 输入的页码
+      isloading: false,
+      scale: "page-width",
+    };
+  },
+  mounted() {
+    // this.isloading = this.$loading.service({
+    //   background: "rgba(255, 255, 255, 0.7)",
+    //   target: document.querySelector(".loading"),
+    //   text: "加载中...",
+    //   spinner: "",
+    // });
+    this.isloading = false;
+    this.$refs.viframe.onload = function () {
+      this.isloading = false
+    }
+    console.log(this.isloading);
+    // this.getPdf();
+  },
+  beforeDestroy() { },
+  watch: {
+    pdfUrl: function (s) {
+      // this.isloading = this.$loading.service({
+      //   background: "rgba(255, 255, 255, 0.7)",
+      //   target: document.querySelector(".loading"),
+      //   text: "加载中...",
+      //   spinner: "",
+      // });
+      this.isloading = false;
+      this.$refs.viframe.onload = function () {
+        this.isloading = false
+      }
+      // this.getPdf();
+    },
+  },
+  methods: {
+    // 获取 pdf 信息
+    getPdf() {
+      this.pdfData = pdfvuer.createLoadingTask({
+        url: this.pdfUrl,
+        cMapUrl: "https://cdn.jsdelivr.net/npm/pdfjs-dist@2.16.105/cmaps/",
+        cMapPacked: true,
+      });
+      this.pdfData
+        .then((pdf) => {
+          // this.isloading.close();
+          this.isloading = false
+          this.numPages = pdf.numPages;
+        })
+        .catch((err) => {
+          console.log(err);
+        });
+    },
+    // 上一页
+    prePage() {
+      let page = this.page;
+      page = page > 1 ? page - 1 : 1;
+      this.page = page;
+    },
+    // 下一页
+    nextPage() {
+      let page = this.page;
+      page = page < this.numPages ? page + 1 : this.numPages;
+      this.page = page;
+    },
+  },
+};
+</script>
+<style scoped>
+.loading {
+  height: 100%;
+  width: 100%;
+  /* background: #000; */
+  position: absolute;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  /* background-color: rgba(255, 255, 255, 0.7); */
+  background-color: rgba(255, 255, 255, 1);
+  z-index: 9;
+  font-size: 20px;
+  color: #007fff;
+}
+
+.pdf {
+  height: 100%;
+  width: 100%;
+  position: relative;
+  box-sizing: border-box;
+  overflow-x: hidden;
+  overflow-y: auto;
+}
+
+.pdf .show {
+  margin: auto;
+  width: 100%;
+  display: flex;
+  flex-wrap: wrap;
+}
+
+.pdf .show .p-pdf {
+  overflow: hidden;
+}
+
+.pdf .show .p-pdf .line {
+  position: absolute;
+  width: 50px;
+  right: -50px;
+  background: rgb(255, 186, 96);
+  height: 2px;
+}
+
+.pdf .show .p-pdf span {
+  width: 100%;
+  text-align: center;
+  color: #fff;
+}
+
+.pdf .show .p-pdf span+span {
+  margin-top: 10px;
+}
+
+.pdfbox {
+  /* border: 3px solid #000; */
+  /* box-sizing: border-box; */
+  /* border-radius: 4px; */
+  /* overflow: hidden; */
+}
+
+.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 .p-pdf .viewerContainer {
+  width: 100%;
+}
+
+/* .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;
+}
+
+.pdf::-webkit-scrollbar {
+  /*滚动条整体样式*/
+  width: 6px;
+  /*高宽分别对应横竖滚动条的尺寸*/
+  height: 6px;
+}
+
+/*定义滚动条轨道 内阴影+圆角*/
+.pdf::-webkit-scrollbar {
+  border-radius: 10px;
+  background-color: #b8bdc9;
+}
+
+/*定义滑块 内阴影+圆角*/
+.pdf::-webkit-scrollbar-thumb {
+  border-radius: 10px;
+  -webkit-box-shadow: inset 0 0 6px rgb(96, 125, 184);
+  background-color: #2c5ab3;
+}
+</style>