Browse Source

图片真实大小放到图片地址后面方便icss获取

luolei 5 years ago
parent
commit
8190cc2db8
3 changed files with 4 additions and 5 deletions
  1. 2 2
      src/common/UploadImg.vue
  2. 1 1
      src/components/Department.vue
  3. 1 2
      src/components/Preview.vue

+ 2 - 2
src/common/UploadImg.vue

@@ -92,7 +92,7 @@ export default {
         var maxSize = 0.5 * 1024; // 4M
         var fileSize = file.size / 1024; //kb 图片大小
         var uploadSrc;
-        var uploadFile;
+        var uploadFile,imgWidth=image.width,imgHeight=image.height;
         // console.log(fileSize,'大小')
         if (fileSize > maxSize) { // 如果图片大小大于4m,进行压缩
           uploadSrc = canvas.toDataURL(file.type, 0.1);
@@ -112,7 +112,7 @@ export default {
           that.$set(that.imgs, key, uploadSrc);
           that.imgLen++;
           // 将图片信息存到store
-          that.$store.commit('setImgFile', { type: that.moduleType, pId: that.item.id, key: key, file: uploadFile })
+          that.$store.commit('setImgFile', { type: that.moduleType, pId: that.item.id, key: key, file: uploadFile,imgWidth:imgWidth, imgHeight:imgHeight})
           that.$store.commit('setImgSrc', { key: key, src: uploadSrc, type: that.moduleType })
           that.$previewRefresh(); //异步获取的图片需要刷新下
         }

+ 1 - 1
src/components/Department.vue

@@ -2,7 +2,7 @@
     <div class="department">
         <div class="departmentView">
             <div class="content">
-                <div class="list" v-for="(item,index) in departmentLis" @click="goStart(index,item.recordTime)" :key="item.hospitalDeptName">
+                <div class="list" v-for="(item,index) in departmentLis" @click="goStart(index,item.recordTime)" :key="index">
                     <div class="top">
                         <p>挂号科室:{{item.hospitalDeptName}} <img src="../images/right.png" alt=""></p>
                     </div>

+ 1 - 2
src/components/Preview.vue

@@ -230,7 +230,7 @@ export default {
             let result = data.data;
             for(let i = 0;i < result.length;i++){
               let obg = {}
-              obg.originalImage = result[i].url
+              obg.originalImage = result[i].url+'?width='+imgList[i].imgWidth+'&height='+imgList[i].imgHeight
               obg.originalName = result[i].original
               obg.orderNum = i+1
               obg.type = result[i].type
@@ -255,7 +255,6 @@ export default {
       }
     },
     getDetailText(textArr,flg){
-      console.log(textArr,flg)
       let msg = "",obg={},msgP = "";
       if(flg == 1){
         for(let k in textArr){