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

pull/8/head
kele 2023-07-14 11:14:26 +08:00
parent 5c3f0ab2f3
commit d4ef49b913
4 changed files with 41 additions and 20 deletions

View File

@ -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>

View File

@ -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({

View File

@ -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 <image class="md-img-box" :src="sheep.$url.cdn(data.image)" mode="widthFix"></image>
class="md-img-box"
:src="sheep.$url.cdn(data.image)"
mode="widthFix"
@load="calculatePanelHeight"
></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 = { if (props.data.image_wh) {
width: goodsPriceCard.width, totalHeight =
height: (goodsPriceCard.width / e.detail.width) * e.detail.height + goodsPriceCard.height, (goodsPriceCard.width / props.data.image_wh.w) * props.data.image_wh.h +
}; goodsPriceCard.height;
emits('getHeight', card.height); } else {
totalHeight = goodsPriceCard.width;
}
emits('getHeight', totalHeight);
}); });
} }
} }
onMounted(() => {
nextTick(() => {
getGoodsPriceCardWH();
});
});
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -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"