|  | @@ -1,25 +1,37 @@
 | 
											
												
													
														|  |  <template>
 |  |  <template>
 | 
											
												
													
														|  |    <div class="pdfView-box">
 |  |    <div class="pdfView-box">
 | 
											
												
													
														|  |      <div class="pdfView">
 |  |      <div class="pdfView">
 | 
											
												
													
														|  | -      <pdf
 |  | 
 | 
											
												
													
														|  | 
 |  | +      <!-- <pdf
 | 
											
												
													
														|  |          v-for="i in curQue.data.numPages"
 |  |          v-for="i in curQue.data.numPages"
 | 
											
												
													
														|  |          ref="pdf"
 |  |          ref="pdf"
 | 
											
												
													
														|  |          :key="i"
 |  |          :key="i"
 | 
											
												
													
														|  |          :src="pdfSrc"
 |  |          :src="pdfSrc"
 | 
											
												
													
														|  |          :page="i"
 |  |          :page="i"
 | 
											
												
													
														|  |          @progress="loadedRatio = $event"
 |  |          @progress="loadedRatio = $event"
 | 
											
												
													
														|  | -      />
 |  | 
 | 
											
												
													
														|  | 
 |  | +      /> -->
 | 
											
												
													
														|  | 
 |  | +      <iframe
 | 
											
												
													
														|  | 
 |  | +        :src="curQue.data.newpath"
 | 
											
												
													
														|  | 
 |  | +        width="100%"
 | 
											
												
													
														|  | 
 |  | +        height="1000px"
 | 
											
												
													
														|  | 
 |  | +        id="ifm"
 | 
											
												
													
														|  | 
 |  | +      ></iframe>
 | 
											
												
													
														|  |      </div>
 |  |      </div>
 | 
											
												
													
														|  | -    <div v-show="loadedRatio!==1" class="progress">
 |  | 
 | 
											
												
													
														|  | -      <el-progress type="circle" :width="70" color="#53a7ff" :percentage="Math.floor(loadedRatio*100)" />
 |  | 
 | 
											
												
													
														|  | -      <br>
 |  | 
 | 
											
												
													
														|  | 
 |  | +    <!-- <div v-show="loadedRatio !== 1" class="progress">
 | 
											
												
													
														|  | 
 |  | +      <el-progress
 | 
											
												
													
														|  | 
 |  | +        type="circle"
 | 
											
												
													
														|  | 
 |  | +        :width="70"
 | 
											
												
													
														|  | 
 |  | +        color="#53a7ff"
 | 
											
												
													
														|  | 
 |  | +        :percentage="Math.floor(loadedRatio * 100)"
 | 
											
												
													
														|  | 
 |  | +      />
 | 
											
												
													
														|  | 
 |  | +      <br />
 | 
											
												
													
														|  |        <span>{{ remindShow }}</span>
 |  |        <span>{{ remindShow }}</span>
 | 
											
												
													
														|  | -    </div>
 |  | 
 | 
											
												
													
														|  | 
 |  | +    </div> -->
 | 
											
												
													
														|  |    </div>
 |  |    </div>
 | 
											
												
													
														|  |  </template>
 |  |  </template>
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  <script>
 |  |  <script>
 | 
											
												
													
														|  |  import pdf from "vue-pdf";
 |  |  import pdf from "vue-pdf";
 | 
											
												
													
														|  | 
 |  | +const Base64 = require("js-base64").Base64;
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  export default {
 |  |  export default {
 | 
											
												
													
														|  |    // import引入的组件需要注入到对象中才能使用
 |  |    // import引入的组件需要注入到对象中才能使用
 | 
											
										
											
												
													
														|  | @@ -32,45 +44,49 @@ export default {
 | 
											
												
													
														|  |        numPages: null,
 |  |        numPages: null,
 | 
											
												
													
														|  |        remindShow: "加载文件中,文件较大请耐心等待...",
 |  |        remindShow: "加载文件中,文件较大请耐心等待...",
 | 
											
												
													
														|  |        loadedRatio: 0,
 |  |        loadedRatio: 0,
 | 
											
												
													
														|  | -      pdfSrc: ''
 |  | 
 | 
											
												
													
														|  | 
 |  | +      pdfSrc: "",
 | 
											
												
													
														|  |      };
 |  |      };
 | 
											
												
													
														|  |    },
 |  |    },
 | 
											
												
													
														|  |    created() {
 |  |    created() {
 | 
											
												
													
														|  | -    this.getNumPages();
 |  | 
 | 
											
												
													
														|  | 
 |  | +    // this.getNumPages();
 | 
											
												
													
														|  | 
 |  | +    let path =
 | 
											
												
													
														|  | 
 |  | +      `http://docpreview.utschool.cn/onlinePreview?url=` +
 | 
											
												
													
														|  | 
 |  | +      Base64.encode(this.curQue.data.file_url);
 | 
											
												
													
														|  | 
 |  | +    this.curQue.data.newpath = path;
 | 
											
												
													
														|  |    },
 |  |    },
 | 
											
												
													
														|  |    methods: {
 |  |    methods: {
 | 
											
												
													
														|  | -    getNumPages() {
 |  | 
 | 
											
												
													
														|  | -      let str = this.curQue.data.fileRelativePath;
 |  | 
 | 
											
												
													
														|  | -      str.replace(process.env.VUE_APP_BASE_API, '');
 |  | 
 | 
											
												
													
														|  | -      let loadingTask = pdf.createLoadingTask(`${process.env.VUE_APP_PDF}${str}`);
 |  | 
 | 
											
												
													
														|  | -      loadingTask.promise
 |  | 
 | 
											
												
													
														|  | -        .then(pdff => {
 |  | 
 | 
											
												
													
														|  | -          console.log("拿到结果");
 |  | 
 | 
											
												
													
														|  | -          this.pdfSrc = loadingTask;
 |  | 
 | 
											
												
													
														|  | -          this.numPages = pdff.numPages;
 |  | 
 | 
											
												
													
														|  | -          this.curQue.data.numPages = pdff.numPages;
 |  | 
 | 
											
												
													
														|  | -        })
 |  | 
 | 
											
												
													
														|  | -        .catch(err => {
 |  | 
 | 
											
												
													
														|  | -          console.error("pdf 加载失败", err);
 |  | 
 | 
											
												
													
														|  | -        });
 |  | 
 | 
											
												
													
														|  | -    },
 |  | 
 | 
											
												
													
														|  | 
 |  | +    // getNumPages() {
 | 
											
												
													
														|  | 
 |  | +    //   let str = this.curQue.data.fileRelativePath;
 | 
											
												
													
														|  | 
 |  | +    //   str.replace(process.env.VUE_APP_BASE_API, '');
 | 
											
												
													
														|  | 
 |  | +    //   let loadingTask = pdf.createLoadingTask(`${process.env.VUE_APP_PDF}${str}`);
 | 
											
												
													
														|  | 
 |  | +    //   loadingTask.promise
 | 
											
												
													
														|  | 
 |  | +    //     .then(pdff => {
 | 
											
												
													
														|  | 
 |  | +    //       console.log("拿到结果");
 | 
											
												
													
														|  | 
 |  | +    //       this.pdfSrc = loadingTask;
 | 
											
												
													
														|  | 
 |  | +    //       this.numPages = pdff.numPages;
 | 
											
												
													
														|  | 
 |  | +    //       this.curQue.data.numPages = pdff.numPages;
 | 
											
												
													
														|  | 
 |  | +    //     })
 | 
											
												
													
														|  | 
 |  | +    //     .catch(err => {
 | 
											
												
													
														|  | 
 |  | +    //       console.error("pdf 加载失败", err);
 | 
											
												
													
														|  | 
 |  | +    //     });
 | 
											
												
													
														|  | 
 |  | +    // },
 | 
											
												
													
														|  |    },
 |  |    },
 | 
											
												
													
														|  |  };
 |  |  };
 | 
											
												
													
														|  |  </script>
 |  |  </script>
 | 
											
												
													
														|  |  <style scoped>
 |  |  <style scoped>
 | 
											
												
													
														|  |  /* @import url(); 引入css类 */
 |  |  /* @import url(); 引入css类 */
 | 
											
												
													
														|  | -.pdfView-box{
 |  | 
 | 
											
												
													
														|  | -    width:100%;
 |  | 
 | 
											
												
													
														|  | 
 |  | +.pdfView-box {
 | 
											
												
													
														|  | 
 |  | +  width: 100%;
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  |  .pdfView {
 |  |  .pdfView {
 | 
											
												
													
														|  |    width: 100%;
 |  |    width: 100%;
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  | -.progress{
 |  | 
 | 
											
												
													
														|  | -    position: absolute;
 |  | 
 | 
											
												
													
														|  | -    right: 50%;
 |  | 
 | 
											
												
													
														|  | -    top: 50%;
 |  | 
 | 
											
												
													
														|  | -    text-align: center;
 |  | 
 | 
											
												
													
														|  | -    width: 500px;
 |  | 
 | 
											
												
													
														|  | -    margin-right: -250px;
 |  | 
 | 
											
												
													
														|  | 
 |  | +.progress {
 | 
											
												
													
														|  | 
 |  | +  position: absolute;
 | 
											
												
													
														|  | 
 |  | +  right: 50%;
 | 
											
												
													
														|  | 
 |  | +  top: 50%;
 | 
											
												
													
														|  | 
 |  | +  text-align: center;
 | 
											
												
													
														|  | 
 |  | +  width: 500px;
 | 
											
												
													
														|  | 
 |  | +  margin-right: -250px;
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  |  </style>
 |  |  </style>
 |