Przeglądaj źródła

图片资源缩略图url后缀逻辑优化

任一存 2 lat temu
rodzic
commit
0abbd4985d

+ 7 - 7
packages/qjkankan-editor/src/components/materialSelector.vue

@@ -107,7 +107,7 @@
         v-slot:materialUploadSuccessIcon="slotProps"
       >
         <img
-          :src="slotProps.uploadInfo.successInfo[slotProps.tableItemStructure.key] + (Number(slotProps.uploadInfo.fileSize) > 512 ? $imgsuffix : ``)"
+          :src="slotProps.uploadInfo.successInfo[slotProps.tableItemStructure.key] + $imgsuffix"
           alt=""
         />
       </template>
@@ -133,7 +133,7 @@
         v-slot:materialIcon="slotProps"
       >
         <img
-          :src="slotProps.materialInfo[slotProps.tableItemStructure.key] + (Number(slotProps.materialInfo.fileSize) > 512 ? $imgsuffix : ``)"
+          :src="slotProps.materialInfo[slotProps.tableItemStructure.key] + $imgsuffix"
           alt=""
         />
       </template>
@@ -169,7 +169,7 @@
         v-slot:materialUploadSuccessIcon="slotProps"
       >
         <img
-          :src="slotProps.uploadInfo.successInfo[slotProps.tableItemStructure.key] + (Number(slotProps.uploadInfo.fileSize) > 512 ? $imgsuffix : ``)"
+          :src="slotProps.uploadInfo.successInfo[slotProps.tableItemStructure.key] + $imgsuffix"
           alt=""
         />
       </template>
@@ -195,7 +195,7 @@
         v-slot:materialIcon="slotProps"
       >
         <img
-          :src="slotProps.materialInfo[slotProps.tableItemStructure.key] + (Number(slotProps.materialInfo.fileSize) > 512 ? $imgsuffix : ``)"
+          :src="slotProps.materialInfo[slotProps.tableItemStructure.key] + $imgsuffix"
           alt=""
         />
       </template>
@@ -300,7 +300,7 @@
         v-slot:materialUploadSuccessIcon="slotProps"
       >
         <img
-          :src="slotProps.uploadInfo.successInfo[slotProps.tableItemStructure.key] + (Number(slotProps.uploadInfo.fileSize) > 512 ? $imgsuffix : ``)"
+          :src="slotProps.uploadInfo.successInfo[slotProps.tableItemStructure.key] + $imgsuffix"
           alt=""
         />
       </template>
@@ -326,7 +326,7 @@
         v-slot:materialIcon="slotProps"
       >
         <img
-          :src="slotProps.materialInfo[slotProps.tableItemStructure.key] + (Number(slotProps.materialInfo.fileSize) > 512 ? $imgsuffix : ``)"
+          :src="slotProps.materialInfo[slotProps.tableItemStructure.key] + $imgsuffix"
           alt=""
         />
       </template>
@@ -354,7 +354,7 @@
         v-slot:materialIcon="slotProps"
       >
         <img
-          :src="slotProps.materialInfo[slotProps.tableItemStructure.key] + (Number(slotProps.materialInfo.fileSize) > 512 ? $imgsuffix : ``)"
+          :src="slotProps.materialInfo[slotProps.tableItemStructure.key] + $imgsuffix"
           alt=""
         />
       </template>

+ 2 - 2
packages/qjkankan-editor/src/components/materialSelectorFromWork.vue

@@ -51,7 +51,7 @@
           </span>
           <span class="table-data">
             <div class="list-img">
-              <img :src="item.icon + (Number(item.fileSize) > 512 ? $imgsuffix : ``)" alt="">
+              <img :src="item.icon + $imgsuffix" alt="">
             </div>
           </span>
           <span class="table-data">
@@ -97,7 +97,7 @@
           </span>
           <span class="table-data">
             <div class="list-img">
-              <img :src="item.icon + (Number(item.fileSize) > 512 ? $imgsuffix : ``)" alt="">
+              <img :src="item.icon + $imgsuffix" alt="">
             </div>
           </span>
           <span class="table-data">

+ 5 - 7
packages/qjkankan-editor/src/mixins/index.js

@@ -84,15 +84,13 @@ Vue.prototype.$msg.error = (string)=>{
   });
 }
 
-Vue.prototype.$videoImg =
-  "?x-oss-process=video/snapshot,t_0,f_jpg,w_0,h_0,m_fast,ar_auto";
-
+Vue.prototype.$videoImg = "?x-oss-process=video/snapshot,t_0,f_jpg,w_0,h_0,m_fast,ar_auto";
   
-Vue.prototype.$imgsuffix =
-process.env.VUE_APP_ORIGIN=='aws'?encodeURIComponent('?x-oss-process=image@resize,m_lfit,w_200@crop,w_200,h_200'.replaceAll('/','@'))
-:`?x-oss-process=image/resize,p_20&${Math.random()}`;
+Vue.prototype.$imgsuffix = '?x-oss-process=image/resize,m_lfit,w_200/crop,w_200,h_200'
 
-console.log(process.env.VUE_APP_ORIGIN);
+Vue.prototype.$getImgResizeSuffix = function(width, height) {
+  return `?x-oss-process=image/resize,m_lfit,w_${width},h_${height},limit_0`;
+}
 
 Vue.prototype.$scrollbars = [];
 

+ 1 - 1
packages/qjkankan-editor/src/views/hotspot/hotspotIconType/custom_image.vue

@@ -57,7 +57,7 @@ export default {
   methods: {
     handleSubmitFromMaterialSelector(data) {
       this.isShowSelectionWindow = false
-      this.hotspot.customIconInfo.img = data[0].icon
+      this.hotspot.customIconInfo.img = data[0].icon + this.$getImgResizeSuffix(300, 300)
     },
     onClickDelete() {
       this.hotspot.customIconInfo.img = ''

+ 1 - 1
packages/qjkankan-editor/src/views/material/image/index.vue

@@ -108,7 +108,7 @@
           >
             <img
               :id="'img' + lineData.id"
-              :src="lineData.type === 'dir' ? require('@/assets/images/icons/folder-blue.png') : itemData + (Number(lineData.fileSize)>512 ? $imgsuffix : '') "
+              :src="lineData.type === 'dir' ? require('@/assets/images/icons/folder-blue.png') : itemData + $imgsuffix"
               alt=""
               @click="lineData.type === 'dir' ? onClickFolder(lineData) : previewImage(lineData)"
             />

+ 1 - 1
packages/qjkankan-editor/src/views/material/pano/index.vue

@@ -101,7 +101,7 @@
             class="img"
             @click="previewImage(lineData)"
           >
-            <img :src="itemData + (Number(lineData.fileSize) > 512 ? $imgsuffix : '')"
+            <img :src="itemData + $imgsuffix"
               alt="" />
           </div>
           <div