修复bug

This commit is contained in:
zhanchao 2026-08-14 17:13:31 +08:00
parent 9f5331cd3b
commit 58c9329eb6
3 changed files with 221 additions and 49 deletions

View File

@ -1231,6 +1231,25 @@ $primary-color: #0877F1;
display: none !important; display: none !important;
} }
.custom-bubble,
.benefit-bubble {
padding: 0 !important;
border-radius: 0 !important;
background: transparent !important;
overflow: visible;
}
.custom-bubble::before,
.custom-bubble::after,
.benefit-bubble::before,
.benefit-bubble::after {
display: none !important;
}
.benefit-bubble {
max-width: 100%;
}
.message-right .message-card { .message-right .message-card {
margin-right: 8rpx; margin-right: 8rpx;
} }

View File

@ -59,6 +59,28 @@
mode="aspectFill" /> mode="aspectFill" />
</view> </view>
<!-- 权益消息 -->
<view v-else-if="getCustomMessageType(message) === 'benefit'" class="benefit-card">
<view class="benefit-title">{{ benefitData.title }}</view>
<view class="benefit-content">
<view v-for="(item, index) in benefitData.items" :key="`${item.projectId}-${index}`" class="benefit-item">
<view class="benefit-project-row">
<text v-if="index === 0" class="benefit-label">项目</text>
<text v-else class="benefit-label-placeholder"></text>
<text class="benefit-project-name">{{ item.projectName }}</text>
<text class="benefit-count">X{{ item.usageCount }}</text>
</view>
<view class="benefit-valid-row">
<text class="benefit-valid-label">有效期</text>
<text class="benefit-valid-value">{{ item.validTimeText || '无限期' }}</text>
</view>
</view>
<view class="benefit-detail-button" @click.stop="handleBenefitClick">
<text class="benefit-detail-text">查看详情</text>
</view>
</view>
</view>
<!-- 其他自定义消息 --> <!-- 其他自定义消息 -->
<!-- <view <!-- <view
v-else v-else
@ -112,8 +134,32 @@ const payloadData = computed(() => {
} }
}) })
const benefitData = computed(() => ({
title: payloadData.value.title || "医生为您录入专属权益",
patientId: payloadData.value.patientId || "",
patientName: payloadData.value.patientName || "",
corpId: payloadData.value.corpId || props.corpId || "",
teamId: payloadData.value.teamId || "",
items: Array.isArray(payloadData.value.items) ? payloadData.value.items : [],
}))
// const handleBenefitClick = () => {
const customerId = benefitData.value.patientId;
const corpId = benefitData.value.corpId;
if (!customerId || !corpId) {
toast("权益信息不完整");
return;
}
const params = [
`corpId=${encodeURIComponent(corpId)}`,
`teamId=${encodeURIComponent(benefitData.value.teamId || "")}`,
`customerId=${encodeURIComponent(customerId)}`,
`name=${encodeURIComponent(benefitData.value.patientName || "")}`,
].join("&");
uni.navigateTo({
url: `/pages/experience-coupon/my-rights?${params}`,
});
};
const getImageStyle = (imageInfo) => { const getImageStyle = (imageInfo) => {
// 使 // 使
imageInfo.width = imageInfo.width || imageInfo.Width; imageInfo.width = imageInfo.width || imageInfo.Width;
@ -299,4 +345,95 @@ async function markArticleRead(sendId, articleId) {
<style scoped lang="scss"> <style scoped lang="scss">
@import "../chat.scss"; @import "../chat.scss";
.benefit-card {
width: 520rpx;
max-width: 100%;
box-sizing: border-box;
border-radius: 10rpx;
padding: 22rpx 18rpx 18rpx;
background: linear-gradient(180deg, #0b75f2 0%, #0067df 100%);
}
.benefit-title {
color: #fff;
font-size: 32rpx;
font-weight: 600;
line-height: 1.3;
margin-bottom: 18rpx;
}
.benefit-content {
border: 4rpx solid rgba(255, 255, 255, 0.28);
border-radius: 8rpx;
padding: 24rpx 24rpx 28rpx;
background: #fff;
}
.benefit-item + .benefit-item {
margin-top: 18rpx;
}
.benefit-project-row {
display: flex;
align-items: center;
min-width: 0;
}
.benefit-label,
.benefit-label-placeholder {
flex-shrink: 0;
width: 104rpx;
color: #8b8f96;
font-size: 28rpx;
line-height: 1.4;
}
.benefit-project-name {
flex: 1;
min-width: 0;
color: #111827;
font-size: 30rpx;
line-height: 1.4;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.benefit-count {
flex-shrink: 0;
margin-left: 16rpx;
color: #111827;
font-size: 30rpx;
line-height: 1.4;
}
.benefit-valid-row {
display: flex;
margin-left: 104rpx;
margin-top: 8rpx;
}
.benefit-valid-label,
.benefit-valid-value {
color: #8b8f96;
font-size: 26rpx;
line-height: 1.4;
}
.benefit-detail-button {
height: 82rpx;
margin-top: 28rpx;
border-radius: 8rpx;
display: flex;
align-items: center;
justify-content: center;
background: linear-gradient(180deg, #0b75f2 0%, #0067df 100%);
}
.benefit-detail-text {
color: #fff;
font-size: 30rpx;
font-weight: 500;
}
</style> </style>

View File

@ -390,6 +390,19 @@ function handleSystemMessageReceived(message) {
} }
} }
//
function getCustomMessageType(message) {
try {
const data =
typeof message.payload?.data === "string"
? JSON.parse(message.payload.data)
: message.payload?.data || {};
return data?.type || "";
} catch (error) {
return "";
}
}
// //
function getBubbleClass(message) { function getBubbleClass(message) {
// //
@ -397,7 +410,10 @@ function getBubbleClass(message) {
return "image-bubble"; return "image-bubble";
} }
if (message.type === "TIMCustomElem") { if (message.type === "TIMCustomElem") {
return message.flow === "out" ? "" : ""; if (getCustomMessageType(message) === "benefit") {
return "benefit-bubble";
}
return "custom-bubble";
} }
return message.flow === "out" ? "user-bubble" : "doctor-bubble"; return message.flow === "out" ? "user-bubble" : "doctor-bubble";
} }