Sfoglia il codice sorgente

fix 多考试上传图片附件转换

Michael Wang 5 anni fa
parent
commit
43c8ca9365
2 ha cambiato i file con 4 aggiunte e 4 eliminazioni
  1. 0 1
      .env.development
  2. 4 3
      src/features/OfflineExam/OfflineExamUploadCug.vue

+ 0 - 1
.env.development

@@ -15,4 +15,3 @@ VUE_APP_TK_SERVER_API_URL=http://ecs-test.qmth.com.cn
 VUE_APP_CORE_HOST_URL=https://ecs-test.qmth.com.cn:8878
 VUE_APP_OE_ADMIN_HOST_URL=https://ecs-test.qmth.com.cn:8878
 VUE_APP_OE_STUDENT_HOST_URL=https://ecs-test.qmth.com.cn:8878
-

+ 4 - 3
src/features/OfflineExam/OfflineExamUploadCug.vue

@@ -34,7 +34,7 @@
     </div>
     <Modal v-model="showPreview" fullscreen footer-hide :closable="false">
       <!-- <div slot="header"></div> -->
-      <img id="previewId" class="preview-image" />
+      <img :id="previewId" class="preview-image" />
     </Modal>
   </div>
 </template>
@@ -66,6 +66,7 @@ export default {
       // imageSrc
       previewImage: null,
       showPreview: false,
+      previewId: "previewId" + Date.now(),
     };
   },
   async created() {
@@ -291,9 +292,9 @@ export default {
 
             return new Promise(resolve => {
               var reader = new FileReader();
-              reader.onload = function(e) {
+              reader.onload = e => {
                 document
-                  .getElementById("previewId")
+                  .getElementById(this.previewId)
                   .setAttribute("src", e.target.result);
 
                 setTimeout(resolve, 2500);