Merge remote-tracking branch 'origin/develop' into develop

master^2
YunaiV 2024-11-20 09:18:57 +08:00
commit cb8431fbd4
2 changed files with 27 additions and 42 deletions

View File

@ -65,16 +65,15 @@
alignItems: 'center', alignItems: 'center',
}); // }); //
const queryParams = reactive({ const queryParams = reactive({
pageNo: 1, // no: 1, //
pageSize: 20, limit: 20,
createTime: undefined, createTime: undefined,
}); });
const pagingRef = ref(null); // const pagingRef = ref(null); //
const queryList = async (pageNo, pageSize) => { const queryList = async (no, limit) => {
// //
// pageNopageSize queryParams.no = no;
queryParams.pageNo = pageNo; queryParams.limit = limit;
queryParams.pageSize = pageSize;
await getMessageList(); await getMessageList();
}; };
// //
@ -84,7 +83,7 @@
pagingRef.value.completeByNoMore([], true); pagingRef.value.completeByNoMore([], true);
return; return;
} }
if (queryParams.pageNo > 1 && refreshMessage.value) { if (queryParams.no > 1 && refreshMessage.value) {
const newMessageList = []; const newMessageList = [];
for (const message of data) { for (const message of data) {
if (messageList.value.some((val) => val.id === message.id)) { if (messageList.value.some((val) => val.id === message.id)) {
@ -98,9 +97,10 @@
refreshMessage.value = false; // refreshMessage.value = false; //
return; return;
} }
if (data.slice(-1).length > 0) {
// createTime // createTime
queryParams.createTime = formatDate(data.at(-1).createTime); queryParams.createTime = formatDate(data.slice(-1)[0].createTime);
}
pagingRef.value.completeByNoMore(data, false); pagingRef.value.completeByNoMore(data, false);
}; };
/** 刷新消息列表 */ /** 刷新消息列表 */
@ -115,7 +115,7 @@
} }
// //
if (queryParams.pageNo > 1) { if (queryParams.no > 1) {
showNewMessageTip.value = true; showNewMessageTip.value = true;
} else { } else {
onScrollToUpper(); onScrollToUpper();
@ -130,7 +130,7 @@
/** 监听滚动到底部事件(因为 scroll 翻转了顶就是底) */ /** 监听滚动到底部事件(因为 scroll 翻转了顶就是底) */
const onScrollToUpper = () => { const onScrollToUpper = () => {
// //
if (queryParams.pageNo === 1) { if (queryParams.no === 1) {
return; return;
} }
showNewMessageTip.value = false; showNewMessageTip.value = false;

View File

@ -68,10 +68,12 @@
</view> </view>
</template> </template>
<template v-if="message.contentType === KeFuMessageContentTypeEnum.PRODUCT"> <template v-if="message.contentType === KeFuMessageContentTypeEnum.PRODUCT">
<div class="ss-m-b-10">
<GoodsItem <GoodsItem
:goodsData="getMessageContent(message)" :goodsData="getMessageContent(message)"
@tap="sheep.$router.go('/pages/goods/index', { id: getMessageContent(message).spuId })" @tap="sheep.$router.go('/pages/goods/index', { id: getMessageContent(message).spuId })"
/> />
</div>
</template> </template>
<template v-if="message.contentType === KeFuMessageContentTypeEnum.ORDER"> <template v-if="message.contentType === KeFuMessageContentTypeEnum.ORDER">
<OrderItem <OrderItem
@ -84,7 +86,7 @@
v-if="message.senderType === UserTypeEnum.MEMBER" v-if="message.senderType === UserTypeEnum.MEMBER"
class="chat-avatar ss-m-l-24" class="chat-avatar ss-m-l-24"
:src=" :src="
sheep.$url.cdn(message.senderAvatar) || sheep.$url.cdn(userInfo.avatar) ||
sheep.$url.static('/static/img/shop/chat/default.png') sheep.$url.static('/static/img/shop/chat/default.png')
" "
mode="aspectFill" mode="aspectFill"
@ -122,7 +124,9 @@
default: () => [], default: () => [],
}, },
}); });
const getMessageContent = computed(() => (item) => jsonParse(item.content)); // const getMessageContent = computed(() => (item) => jsonParse(item.content)); //
const userInfo = computed(() => sheep.$store('user').userInfo);
//======================= ======================= //======================= =======================
@ -145,7 +149,7 @@
let emojiFile = selEmojiFile(item); let emojiFile = selEmojiFile(item);
newData = newData.replace( newData = newData.replace(
item, item,
`<img class="chat-img" style="width: 24px;height: 24px;margin: 0 3px;" src="${sheep.$url.cdn( `<img class="chat-img" style="width: 24px;height: 24px;margin: 0 3px;vertical-align: middle;" src="${sheep.$url.cdn(
'/static/img/chat/emoji/' + emojiFile, '/static/img/chat/emoji/' + emojiFile,
)}"/>`, )}"/>`,
); );
@ -167,7 +171,7 @@
<style scoped lang="scss"> <style scoped lang="scss">
.message-item { .message-item {
margin-bottom: 33rpx; margin-bottom: 10rpx;
} }
.date-message, .date-message,
@ -231,18 +235,23 @@
.message-box { .message-box {
max-width: 50%; max-width: 50%;
font-size: 16px; font-size: 16px;
line-height: 20px;
white-space: normal; white-space: normal;
word-break: break-all; word-break: break-all;
word-wrap: break-word; word-wrap: break-word;
padding: 20rpx; padding: 20rpx;
border-radius: 10rpx;
color: #fff; color: #fff;
background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient)); background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
margin-top: 18px;
margin-bottom: 9px;
border-top-left-radius: 10px;
border-bottom-right-radius: 10px;
border-bottom-left-radius: 10px;
&.admin { &.admin {
background: #fff; background: #fff;
color: #333; color: #333;
margin-top: 18px;
margin-bottom: 9px;
border-radius: 0 10px 10px 10px;
} }
:deep() { :deep() {
@ -270,30 +279,6 @@
border-radius: 6rpx; border-radius: 6rpx;
} }
.template-wrap {
// width: 100%;
padding: 20rpx 24rpx;
background: #fff;
border-radius: 10rpx;
.title {
font-size: 26rpx;
font-weight: 500;
color: #333;
margin-bottom: 29rpx;
}
.item {
font-size: 24rpx;
color: var(--ui-BG-Main);
margin-bottom: 16rpx;
&:last-of-type {
margin-bottom: 0;
}
}
}
.error-img { .error-img {
width: 400rpx; width: 400rpx;
height: 400rpx; height: 400rpx;