|
@@ -83,7 +83,7 @@
|
|
|
class="message-card"
|
|
class="message-card"
|
|
|
:class="{ unread: item.unread }"
|
|
:class="{ unread: item.unread }"
|
|
|
>
|
|
>
|
|
|
- <div class="message-avatar">
|
|
|
|
|
|
|
+ <div class="message-avatar avatar-clickable" @click.stop="handleAvatarClick(item)">
|
|
|
<el-avatar :size="40" :src="item.userImage">
|
|
<el-avatar :size="40" :src="item.userImage">
|
|
|
<el-icon><UserFilled /></el-icon>
|
|
<el-icon><UserFilled /></el-icon>
|
|
|
</el-avatar>
|
|
</el-avatar>
|
|
@@ -180,7 +180,7 @@
|
|
|
{{ currentDetail?.userName }} {{ currentDetail?.content }}
|
|
{{ currentDetail?.userName }} {{ currentDetail?.content }}
|
|
|
</div>
|
|
</div>
|
|
|
<div class="detail-dialog-content" v-else>
|
|
<div class="detail-dialog-content" v-else>
|
|
|
- <div style=" font-size: 14px; font-weight: bold;text-align: left">
|
|
|
|
|
|
|
+ <div style="font-size: 14px; font-weight: bold; text-align: left">
|
|
|
{{ currentDetail?.createTime }}
|
|
{{ currentDetail?.createTime }}
|
|
|
</div>
|
|
</div>
|
|
|
{{ currentDetail?.content }}
|
|
{{ currentDetail?.content }}
|
|
@@ -217,9 +217,14 @@ interface NoticeItem {
|
|
|
unread: boolean;
|
|
unread: boolean;
|
|
|
/** 原始创建时间(接口返回 createdTime) */
|
|
/** 原始创建时间(接口返回 createdTime) */
|
|
|
createTime?: string;
|
|
createTime?: string;
|
|
|
- /** 互动类可能有发送者与头像 */
|
|
|
|
|
|
|
+ /** 意见反馈回复通知:context 中的 feedbackId,用于跳转反馈详情 */
|
|
|
|
|
+ feedbackId?: string | number;
|
|
|
|
|
+ /** 互动类:发送者信息,用于跳转动态主页 */
|
|
|
userName?: string;
|
|
userName?: string;
|
|
|
userImage?: string;
|
|
userImage?: string;
|
|
|
|
|
+ userId?: string | number;
|
|
|
|
|
+ phoneId?: string;
|
|
|
|
|
+ storeUserId?: string | number;
|
|
|
/** 类型,用于 processContent 展示 */
|
|
/** 类型,用于 processContent 展示 */
|
|
|
type?: string;
|
|
type?: string;
|
|
|
}
|
|
}
|
|
@@ -542,6 +547,18 @@ function parseContext(context: string | undefined): string {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+/** 从 context 解析 feedbackId(意见反馈回复通知) */
|
|
|
|
|
+function parseFeedbackIdFromContext(context: string | undefined): string | number | undefined {
|
|
|
|
|
+ if (!context) return undefined;
|
|
|
|
|
+ try {
|
|
|
|
|
+ const parsed = typeof context === "string" ? JSON.parse(context) : context;
|
|
|
|
|
+ const id = parsed?.feedbackId;
|
|
|
|
|
+ return id != null ? id : undefined;
|
|
|
|
|
+ } catch {
|
|
|
|
|
+ return undefined;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
// 互动类内容:商家端 context 可能为 "类型|split|内容1|split|内容2",取第一段或解析 JSON
|
|
// 互动类内容:商家端 context 可能为 "类型|split|内容1|split|内容2",取第一段或解析 JSON
|
|
|
function getInteractionContent(context: string | undefined): string {
|
|
function getInteractionContent(context: string | undefined): string {
|
|
|
if (!context) return "";
|
|
if (!context) return "";
|
|
@@ -578,6 +595,7 @@ async function fetchNoticeList(catKey: string) {
|
|
|
const content = isRelated ? getInteractionContent(rawContext) : parseContext(rawContext);
|
|
const content = isRelated ? getInteractionContent(rawContext) : parseContext(rawContext);
|
|
|
const dateRaw = item.createdTime ?? "";
|
|
const dateRaw = item.createdTime ?? "";
|
|
|
const dateStr = dateRaw.includes(" ") ? dateRaw.split(" ")[0].replace(/-/g, "/") : dateRaw.replace(/-/g, "/");
|
|
const dateStr = dateRaw.includes(" ") ? dateRaw.split(" ")[0].replace(/-/g, "/") : dateRaw.replace(/-/g, "/");
|
|
|
|
|
+ const feedbackId = parseFeedbackIdFromContext(rawContext);
|
|
|
return {
|
|
return {
|
|
|
id: String(item.id),
|
|
id: String(item.id),
|
|
|
title: item.title ?? "",
|
|
title: item.title ?? "",
|
|
@@ -586,9 +604,13 @@ async function fetchNoticeList(catKey: string) {
|
|
|
unread: !item.isRead,
|
|
unread: !item.isRead,
|
|
|
createTime: item.createdTime ?? "",
|
|
createTime: item.createdTime ?? "",
|
|
|
type: item.type,
|
|
type: item.type,
|
|
|
|
|
+ ...(feedbackId != null && { feedbackId }),
|
|
|
...(isRelated && {
|
|
...(isRelated && {
|
|
|
userName: item.userName ?? item.senderName ?? item.title ?? "",
|
|
userName: item.userName ?? item.senderName ?? item.title ?? "",
|
|
|
- userImage: item.userImage ?? item.storeImg ?? item.senderImg
|
|
|
|
|
|
|
+ userImage: item.userImage ?? item.storeImg ?? item.senderImg,
|
|
|
|
|
+ userId: item.userId ?? item.storeUserId,
|
|
|
|
|
+ phoneId: item.phoneId ?? item.senderId,
|
|
|
|
|
+ storeUserId: item.storeUserId ?? item.userId
|
|
|
})
|
|
})
|
|
|
};
|
|
};
|
|
|
});
|
|
});
|
|
@@ -651,7 +673,6 @@ async function handleViewDetail(item: NoticeItem) {
|
|
|
try {
|
|
try {
|
|
|
const res: any = await readNoticeById({ id: item.id });
|
|
const res: any = await readNoticeById({ id: item.id });
|
|
|
const ok = res?.code === 200 || res?.code === "200";
|
|
const ok = res?.code === 200 || res?.code === "200";
|
|
|
- console.log(res, "res");
|
|
|
|
|
if (ok) {
|
|
if (ok) {
|
|
|
const key = activeCategory.value;
|
|
const key = activeCategory.value;
|
|
|
const list = listByCategory.value[key] ?? [];
|
|
const list = listByCategory.value[key] ?? [];
|
|
@@ -664,10 +685,35 @@ async function handleViewDetail(item: NoticeItem) {
|
|
|
// 仍打开详情
|
|
// 仍打开详情
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ // 系统通知 - 意见反馈回复通知:跳转反馈详情页(与商家端 s-informList 一致)
|
|
|
|
|
+ if (activeCategory.value === "system" && item.feedbackId != null) {
|
|
|
|
|
+ emit("close");
|
|
|
|
|
+ router.push({ path: "/feedback/detail", query: { id: String(item.feedbackId) } });
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
currentDetail.value = item;
|
|
currentDetail.value = item;
|
|
|
detailVisible.value = true;
|
|
detailVisible.value = true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// 互动列表:点击头像跳转动态主页(与 dynamicManagement/index 的 handleViewUserProfile 一致)
|
|
|
|
|
+function handleAvatarClick(item: NoticeItem) {
|
|
|
|
|
+ console.log(item, "item");
|
|
|
|
|
+ const phoneId = item.phoneId ?? item.userId;
|
|
|
|
|
+ if (!phoneId) return;
|
|
|
|
|
+ emit("close");
|
|
|
|
|
+ router.push({
|
|
|
|
|
+ path: "/dynamicManagement/userDynamic",
|
|
|
|
|
+ query: {
|
|
|
|
|
+ userId: String(item.storeUserId ?? item.userId ?? ""),
|
|
|
|
|
+ phoneId: String(phoneId),
|
|
|
|
|
+ userName: item.userName ?? "",
|
|
|
|
|
+ userAvatar: item.userImage ?? ""
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
async function handleDelete(item: NoticeItem, index: number) {
|
|
async function handleDelete(item: NoticeItem, index: number) {
|
|
|
try {
|
|
try {
|
|
|
await ElMessageBox.confirm("确定要删除这条通知吗?", "提示", {
|
|
await ElMessageBox.confirm("确定要删除这条通知吗?", "提示", {
|
|
@@ -826,6 +872,9 @@ watch(activeTab, val => {
|
|
|
.message-avatar {
|
|
.message-avatar {
|
|
|
position: relative;
|
|
position: relative;
|
|
|
flex-shrink: 0;
|
|
flex-shrink: 0;
|
|
|
|
|
+ &.avatar-clickable {
|
|
|
|
|
+ cursor: pointer;
|
|
|
|
|
+ }
|
|
|
.message-unread-dot {
|
|
.message-unread-dot {
|
|
|
position: absolute;
|
|
position: absolute;
|
|
|
top: 0;
|
|
top: 0;
|