Browse Source

留言修改

dev-V1.0.6
wangmingyong@163.com 3 months ago
parent
commit
48c299e354
  1. 11
      zdxt-web-client/zdxt-efcode-enforcement-app/src/views/enforcement/enforce/enforcementChat.vue
  2. 50
      zdxt-web-client/zdxt-efcode-enterprise-app/src/views/enterprise/enforcement/enforcementChat.vue
  3. 41
      zdxt-web-client/zdxt-efcode-enterprise-app/src/views/enterprise/law/lawServiceDetail.vue

11
zdxt-web-client/zdxt-efcode-enforcement-app/src/views/enforcement/enforce/enforcementChat.vue

@ -51,8 +51,8 @@
@touchmove="onTouchMove" @touchmove="onTouchMove"
> >
<div class="msg-sender">{{ msg.msgFrom === 0 ? (msg.bureauDeptName || useCommon.bureauUnitName || '执法单位') : msg.userName }}</div> <div class="msg-sender">{{ msg.msgFrom === 0 ? (msg.bureauDeptName || '执法单位') : msg.userName }}</div>
<span>{{ msg.content }}</span> <span v-html="msg.content"></span>
</div> </div>
</div> </div>
<div v-if="msg.msgFrom === 0" class="msg-avatar right-avatar">执</div> <div v-if="msg.msgFrom === 0" class="msg-avatar right-avatar">执</div>
@ -124,9 +124,6 @@ const route = useRoute();
const { useCommon } = $globalStore; const { useCommon } = $globalStore;
// ========== 从路由参数获取信息 ========== // ========== 从路由参数获取信息 ==========
const noticeId = route.query.noticeId|| ''; const noticeId = route.query.noticeId|| '';
const bureauDeptName = ref(route.query.bureauDeptName || '深圳司法局');
const contactPerson = ref(route.query.contactPerson || '付明明 周昂');
const noticeTitle = ref(route.query.title || '安全生产检查');
// ========== 消息列表 ========== // ========== 消息列表 ==========
const messageList = ref([]); const messageList = ref([]);
// ========== 加载留言列表 ========== // ========== 加载留言列表 ==========
@ -309,7 +306,7 @@ const sendMessage = () => {
const now = new Date(); const now = new Date();
const timeStr = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}-${String(now.getDate()).padStart(2, '0')} ${String(now.getHours()).padStart(2, '0')}:${String(now.getMinutes()).padStart(2, '0')}`; const timeStr = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}-${String(now.getDate()).padStart(2, '0')} ${String(now.getHours()).padStart(2, '0')}:${String(now.getMinutes()).padStart(2, '0')}`;
const selfAvatar='';
const newMsg = { const newMsg = {
id: Date.now(), id: Date.now(),
sender: 'self', sender: 'self',
@ -317,6 +314,7 @@ const sendMessage = () => {
time: timeStr, time: timeStr,
avatar: selfAvatar, avatar: selfAvatar,
isRecalled: false, isRecalled: false,
msgFrom: 0,
}; };
messageList.value.push(newMsg); messageList.value.push(newMsg);
@ -338,7 +336,6 @@ const sendMessage = () => {
messageList.value.pop(); messageList.value.pop();
}); });
} }
// 滚动到底部 // 滚动到底部
nextTick(() => { nextTick(() => {
scrollToBottom(); scrollToBottom();

50
zdxt-web-client/zdxt-efcode-enterprise-app/src/views/enterprise/enforcement/enforcementChat.vue

@ -38,12 +38,7 @@
:class="{ 'self': msg.sender === 'self' }" :class="{ 'self': msg.sender === 'self' }"
> >
<!-- 对方头像在左 --> <!-- 对方头像在左 -->
<img <div v-if="msg.msgFrom === 0" class="msg-avatar left-avatar">执</div>
v-if="msg.sender === 'other'"
:src="msg.avatar"
class="avatar"
alt="avatar"
/>
<div class="message-content"> <div class="message-content">
<div <div
@ -61,17 +56,19 @@
@touchend="onTouchEnd" @touchend="onTouchEnd"
@touchmove="onTouchMove" @touchmove="onTouchMove"
> >
{{ msg.content }} <div class="msg-sender">{{ msg.msgFrom === 0 ? (msg.bureauDeptName || useCommon.bureauUnitName || '执法单位') : msg.userName }}</div>
<span>{{ msg.content }}</span>
</div> </div>
</div> </div>
<!-- 自己头像在右 --> <!-- 自己头像在右 -->
<img <div v-if="msg.msgFrom === 1" class="msg-avatar right-avatar">企</div>
<!-- <img
v-if="msg.sender === 'self'" v-if="msg.sender === 'self'"
:src="msg.avatar" :src="msg.avatar"
class="avatar" class="avatar"
alt="avatar" alt="avatar"
/> /> -->
</div> </div>
</div> </div>
</div> </div>
@ -133,13 +130,7 @@ const { useCommon } = $globalStore;
// ========== 从路由参数获取信息 ========== // ========== 从路由参数获取信息 ==========
const noticeId = ref(route.query.id || ''); const noticeId = ref(route.query.id || '');
const bureauDeptName = ref(route.query.bureauDeptName || '深圳司法局');
const contactPerson = ref(route.query.contactPerson || '付明明 周昂');
const noticeTitle = ref(route.query.title || '安全生产检查');
// ========== 头像占位 ========== // ========== 头像占位 ==========
const selfAvatar = 'https://placehold.co/40x40/447bf5/fff?text=我';
const otherAvatar = 'https://placehold.co/40x40/999/fff?text=官';
// ========== 消息列表 ========== // ========== 消息列表 ==========
const messageList = ref([]); const messageList = ref([]);
@ -163,8 +154,10 @@ const fetchMessageList = () => {
sender: isSelf ? 'self' : 'other', sender: isSelf ? 'self' : 'other',
content: item.message, content: item.message,
time:item.createTime|| '', time:item.createTime|| '',
avatar: isSelf ? selfAvatar : otherAvatar,
isRecalled: item.isRecalled || false, isRecalled: item.isRecalled || false,
msgFrom: item.msgFrom || 0,
userName: item.userName || '',
bureauDeptName: item.bureauDeptName || '',
}; };
}); });
@ -365,17 +358,17 @@ const sendMessage = () => {
if (res.code === 200) { if (res.code === 200) {
const now = new Date(); const now = new Date();
const timeStr = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}-${String(now.getDate()).padStart(2, '0')} ${String(now.getHours()).padStart(2, '0')}:${String(now.getMinutes()).padStart(2, '0')}`; const timeStr = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}-${String(now.getDate()).padStart(2, '0')} ${String(now.getHours()).padStart(2, '0')}:${String(now.getMinutes()).padStart(2, '0')}`;
const selfAvatar='';
messageList.value.push({ messageList.value.push({
id: res.data?.id || Date.now(), id: res.data?.id || Date.now(),
sender: 'self', sender: 'self',
content: text, content: text,
time: timeStr, time: timeStr,
avatar: selfAvatar, avatar: selfAvatar,
msgFrom: 1,
isRecalled: false, isRecalled: false,
}); });
inputMessage.value = ''; inputMessage.value = '';
// 滚动到底部 // 滚动到底部
nextTick(() => { nextTick(() => {
scrollToBottom(); scrollToBottom();
@ -517,6 +510,7 @@ const onMoreClick = () => {
text-align: center; text-align: center;
border-radius: 0.08rem; border-radius: 0.08rem;
} }
.msg-sender { color: #ccc; }
} }
/* ===== 长按/右击菜单 ===== */ /* ===== 长按/右击菜单 ===== */
@ -635,4 +629,24 @@ const onMoreClick = () => {
opacity: 0.8; opacity: 0.8;
} }
} }
.msg-avatar {
width: 36px;
height: 36px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: 14px;
font-weight: 600;
color: #fff;
flex-shrink: 0;
}
.left-avatar {
background: linear-gradient(135deg, #f5a623, #f7c948);
}
.right-avatar {
background: linear-gradient(135deg, #1890ff, #0b63d1);
}
</style> </style>

41
zdxt-web-client/zdxt-efcode-enterprise-app/src/views/enterprise/law/lawServiceDetail.vue

@ -1,17 +1,17 @@
<template> <template>
<div class="law-service-detail-page"> <div class="law-service-detail-page">
<!-- 顶部导航栏 --> <!-- 顶部导航栏 -->
<van-nav-bar <!-- <van-nav-bar
title="涉企普法" title="涉企普法"
left-text="关闭" left-text="关闭"
left-arrow left-arrow
@click-left="onClickLeft" @click-left="onClickLeft"
> > -->
<!-- <template #right> <!-- <template #right>
<van-icon name="filter-o" size="20" @click="onFilterClick" /> <van-icon name="filter-o" size="20" @click="onFilterClick" />
<van-icon name="search" size="20" style="margin-left: 12px;" @click="onSearchClick" /> <van-icon name="search" size="20" style="margin-left: 12px;" @click="onSearchClick" />
</template> --> </template> -->
</van-nav-bar> <!-- </van-nav-bar> -->
<!-- 内容区域 --> <!-- 内容区域 -->
<div class="detail-content"> <div class="detail-content">
@ -206,6 +206,7 @@ const previewImage = (index) => {
font-size: 0.37rem; font-size: 0.37rem;
color: #333; color: #333;
line-height: 1.8; line-height: 1.8;
overflow: hidden;
p { p {
text-indent: 2em; text-indent: 2em;
@ -234,10 +235,13 @@ const previewImage = (index) => {
} }
img { img {
max-width: 100%; max-width: 100% !important;
height: auto; width: auto !important;
height: auto !important;
border-radius: 0.15rem; border-radius: 0.15rem;
margin: 0.2rem 0; margin: 0.2rem 0;
display: block;
object-fit: contain;
} }
a { a {
@ -271,7 +275,8 @@ const previewImage = (index) => {
margin-top: 0.2rem; margin-top: 0.2rem;
border-radius: 0.15rem; border-radius: 0.15rem;
overflow: hidden; overflow: hidden;
background: #f5f5f5; background: #fbfdff;
position: relative;
} }
.detail-iframe { .detail-iframe {
@ -279,4 +284,28 @@ const previewImage = (index) => {
height: 500px; height: 500px;
background: #fff; background: #fff;
} }
.copy-link-btn {
position: absolute;
bottom: 0.3rem;
right: 0.3rem;
display: flex;
align-items: center;
gap: 0.1rem;
padding: 0.15rem 0.3rem;
background: rgba(0, 0, 0, 0.6);
color: #fff;
font-size: 0.28rem;
border-radius: 0.2rem;
cursor: pointer;
z-index: 10;
:deep(.van-icon) {
color: #fff;
}
&:active {
background: rgba(0, 0, 0, 0.8);
}
}
</style> </style>

Loading…
Cancel
Save