Эх сурвалжийг харах

小程序客服图片报警处理,瀑布流重构

kele 2 жил өмнө
parent
commit
d4ef49b913

+ 19 - 3
pages/chat/index.vue

@@ -495,9 +495,9 @@
     });
     });
     chat.showTools = false;
     chat.showTools = false;
     // scrollBottom();
     // scrollBottom();
-    setTimeout(()=>{
+    setTimeout(() => {
       chat.msg = '';
       chat.msg = '';
-    },100)
+    }, 100);
   }
   }
 
 
   // 点击猜你想问
   // 点击猜你想问
@@ -546,7 +546,7 @@
           let emojiFile = selEmojiFile(item);
           let emojiFile = selEmojiFile(item);
           newData = newData.replace(
           newData = newData.replace(
             item,
             item,
-            `<img class="chat-img" style="width:25px;height:25px;margin:0 3px" src="${sheep.$url.cdn(
+            `<img class="chat-img" src="${sheep.$url.cdn(
               '/static/img/chat/emoji/' + emojiFile,
               '/static/img/chat/emoji/' + emojiFile,
             )}"/>`,
             )}"/>`,
           );
           );
@@ -587,6 +587,7 @@
     background-size: 750rpx 100%;
     background-size: 750rpx 100%;
     z-index: 1;
     z-index: 1;
   }
   }
+
   .chat-wrap {
   .chat-wrap {
     // :deep() {
     // :deep() {
     //   .ui-navbar-box {
     //   .ui-navbar-box {
@@ -701,10 +702,12 @@
           background: #fff;
           background: #fff;
           color: #333;
           color: #333;
         }
         }
+
         :deep() {
         :deep() {
           .imgred {
           .imgred {
             width: 100%;
             width: 100%;
           }
           }
+
           .imgred,
           .imgred,
           img {
           img {
             width: 100%;
             width: 100%;
@@ -852,3 +855,16 @@
     }
     }
   }
   }
 </style>
 </style>
+<style>
+  .chat-img {
+    width: 25px;
+    height: 25px;
+    margin: 0 3px;
+  }
+  .full-img {
+    object-fit: cover;
+    width: 100px;
+    height: 100px;
+    border-radius: 6px;
+  }
+</style>

+ 3 - 3
pages/chat/socket.js

@@ -494,7 +494,7 @@ export function useChatWebSocket(socketConfig) {
         const img = await readImg(file);
         const img = await readImg(file);
         const blob = await compressImg(img, file.type);
         const blob = await compressImg(img, file.type);
         const { data } = await upload(file.name, blob);
         const { data } = await upload(file.name, blob);
-        let image = `<img src='${data.fullurl}'  style='object-fit: cover;width:100px;height:100px;border-radius:6px'>`;
+        let image = `<img class="full-url" src='${data.fullurl}'>`;
         document.execCommand('insertHTML', false, image);
         document.execCommand('insertHTML', false, image);
       } else {
       } else {
         document.execCommand('insertHTML', false, paste.getData('text'));
         document.execCommand('insertHTML', false, paste.getData('text'));
@@ -516,7 +516,7 @@ export function useChatWebSocket(socketConfig) {
         const img = await readImg(file);
         const img = await readImg(file);
         const blob = await compressImg(img, file.type);
         const blob = await compressImg(img, file.type);
         const { data } = await upload(file.name, blob);
         const { data } = await upload(file.name, blob);
-        let image = `<img src='${data.fullurl}'   style='object-fit: cover;width:100px;height:100px;border-radius:6px'>`;
+        let image = `<img class="full-url" src='${data.fullurl}' >`;
         document.execCommand('insertHTML', false, image);
         document.execCommand('insertHTML', false, image);
       } else {
       } else {
         ElMessage({
         ElMessage({
@@ -818,4 +818,4 @@ export function useChatWebSocket(socketConfig) {
     showTime,
     showTime,
     formatTime,
     formatTime,
   };
   };
-}
+}

+ 18 - 14
sheep/components/s-goods-column/s-goods-column.vue

@@ -65,12 +65,7 @@
       <view v-if="tagStyle.show" class="tag-icon-box">
       <view v-if="tagStyle.show" class="tag-icon-box">
         <image class="tag-icon" :src="sheep.$url.cdn(tagStyle.src)"></image>
         <image class="tag-icon" :src="sheep.$url.cdn(tagStyle.src)"></image>
       </view>
       </view>
-      <image
-        class="md-img-box"
-        :src="sheep.$url.cdn(data.image)"
-        mode="widthFix"
-        @load="calculatePanelHeight"
-      ></image>
+      <image class="md-img-box" :src="sheep.$url.cdn(data.image)" mode="widthFix"></image>
       <view
       <view
         class="md-goods-content ss-flex-col ss-row-around ss-p-b-20 ss-p-t-20 ss-p-x-16"
         class="md-goods-content ss-flex-col ss-row-around ss-p-b-20 ss-p-t-20 ss-p-x-16"
         :id="elId"
         :id="elId"
@@ -296,7 +291,7 @@
    * @event {Function()} click 										- 点击卡片
    * @event {Function()} click 										- 点击卡片
    *
    *
    */
    */
-  import { computed, reactive, getCurrentInstance } from 'vue';
+  import { computed, reactive, getCurrentInstance, onMounted, nextTick } from 'vue';
   import sheep from '@/sheep';
   import sheep from '@/sheep';
   import { formatSales } from '@/sheep/hooks/useGoods';
   import { formatSales } from '@/sheep/hooks/useGoods';
   import { formatStock } from '@/sheep/hooks/useGoods';
   import { formatStock } from '@/sheep/hooks/useGoods';
@@ -417,23 +412,32 @@
     emits('click');
     emits('click');
   };
   };
 
 
-  // 获取实时卡片高度
+  // 获取卡片实时高度
   const { proxy } = getCurrentInstance();
   const { proxy } = getCurrentInstance();
   const elId = `sheep_${Math.ceil(Math.random() * 10e5).toString(36)}`;
   const elId = `sheep_${Math.ceil(Math.random() * 10e5).toString(36)}`;
-  function calculatePanelHeight(e) {
+  function getGoodsPriceCardWH() {
     if (props.size === 'md') {
     if (props.size === 'md') {
       const view = uni.createSelectorQuery().in(proxy);
       const view = uni.createSelectorQuery().in(proxy);
       view.select(`#${elId}`).fields({ size: true, scrollOffset: true });
       view.select(`#${elId}`).fields({ size: true, scrollOffset: true });
       view.exec((data) => {
       view.exec((data) => {
+        let totalHeight = 0;
         const goodsPriceCard = data[0];
         const goodsPriceCard = data[0];
-        const card = {
-          width: goodsPriceCard.width,
-          height: (goodsPriceCard.width / e.detail.width) * e.detail.height + goodsPriceCard.height,
-        };
-        emits('getHeight', card.height);
+        if (props.data.image_wh) {
+          totalHeight =
+            (goodsPriceCard.width / props.data.image_wh.w) * props.data.image_wh.h +
+            goodsPriceCard.height;
+        } else {
+          totalHeight = goodsPriceCard.width;
+        }
+        emits('getHeight', totalHeight);
       });
       });
     }
     }
   }
   }
+  onMounted(() => {
+    nextTick(() => {
+      getGoodsPriceCardWH();
+    });
+  });
 </script>
 </script>
 
 
 <style lang="scss" scoped>
 <style lang="scss" scoped>

+ 1 - 0
sheep/components/s-share-modal/canvas-poster/index.vue

@@ -20,6 +20,7 @@
           height: poster.height + 'px',
           height: poster.height + 'px',
           width: poster.width + 'px',
           width: poster.width + 'px',
         }"
         }"
+		:show-menu-by-longpress="true"
       ></image>
       ></image>
       <canvas
       <canvas
         class="hideCanvas"
         class="hideCanvas"