diff --git a/pages/message/index.vue b/pages/message/index.vue
index 3c7b679..bced8f0 100644
--- a/pages/message/index.vue
+++ b/pages/message/index.vue
@@ -20,7 +20,11 @@
>
{{ chatStatusInfo.badgeText }}
-
+
接收提醒
@@ -195,7 +199,10 @@ import ChatInput from "./components/chat-input.vue";
import SystemMessage from "./components/system-message.vue";
import ConsultCancel from "./components/consult-cancel.vue";
import ConsultApply from "./components/consult-apply.vue";
-import { requestConversationSubscribeMessage } from "@/utils/subscribe-message";
+import {
+ checkConversationSubscribeEntryVisible,
+ requestConversationSubscribeMessage,
+} from "@/utils/subscribe-message";
import {
SUBSCRIBE_MESSAGE_ROLE,
SUBSCRIBE_MESSAGE_SCENE,
@@ -203,8 +210,9 @@ import {
const timChatManager = globalTimChatManager;
-// corpId 从群组信息中获取
-const corpId = ref("");
+// corpId 从群组信息中获取
+const corpId = ref("");
+const showSubscribeEntry = ref(false);
// 获取登录状态
const { account, openid, isIMInitialized } = storeToRefs(useAccountStore());
@@ -866,10 +874,11 @@ const handleScrollToUpper = async () => {
};
// 页面显示
-onShow(() => {
- if (!account.value || !openid.value) {
- uni.redirectTo({
- url: "/pages/login/login",
+onShow(() => {
+ loadSubscribeEntryState();
+ if (!account.value || !openid.value) {
+ uni.redirectTo({
+ url: "/pages/login/login",
});
return;
}
@@ -915,8 +924,16 @@ onShow(() => {
}
startIMMonitoring(30000);
- }
-});
+ }
+});
+
+watch(
+ () => corpId.value,
+ () => {
+ loadSubscribeEntryState();
+ },
+ { immediate: true }
+);
// 页面隐藏
onHide(() => {
@@ -1090,9 +1107,16 @@ const handleSubscribeReminder = async () => {
},
});
};
-
-// 页面卸载
-onUnmounted(() => {
+
+const loadSubscribeEntryState = async () => {
+ showSubscribeEntry.value = await checkConversationSubscribeEntryVisible(
+ corpId.value || "",
+ true
+ );
+};
+
+// 页面卸载
+onUnmounted(() => {
clearMessageCache();
// 移除键盘监听
diff --git a/pages/message/message.vue b/pages/message/message.vue
index 6633d88..f0389f6 100644
--- a/pages/message/message.vue
+++ b/pages/message/message.vue
@@ -52,7 +52,11 @@
-
+
接收提醒
@@ -68,7 +72,10 @@ import { mergeConversationWithGroupDetails } from "@/utils/conversation-merger.j
import { globalUnreadListenerManager } from "@/utils/global-unread-listener.js";
import useGroupAvatars from "./hooks/use-group-avatars.js";
import GroupAvatar from "@/components/group-avatar.vue";
-import { requestConversationSubscribeMessage } from "@/utils/subscribe-message";
+import {
+ checkConversationSubscribeEntryVisible,
+ requestConversationSubscribeMessage,
+} from "@/utils/subscribe-message";
import {
SUBSCRIBE_MESSAGE_ROLE,
SUBSCRIBE_MESSAGE_SCENE,
@@ -86,6 +93,7 @@ const loading = ref(false);
const loadingMore = ref(false);
const hasMore = ref(false);
const refreshing = ref(false);
+const showSubscribeEntry = ref(false);
// 群聊头像管理
const { loadGroupAvatars, getAvatarList } = useGroupAvatars();
@@ -516,14 +524,31 @@ const handleSubscribeReminder = async () => {
});
};
+const loadSubscribeEntryState = async () => {
+ const currentCorpId = teams.value.find((item) => item?.corpId)?.corpId || "";
+ showSubscribeEntry.value = await checkConversationSubscribeEntryVisible(
+ currentCorpId,
+ true
+ );
+};
+
// 页面显示
onShow(async () => {
// 页面显示时刷新 tabBar 徽章
// if (globalUnreadListenerManager.isInitialized) {
// await globalUnreadListenerManager.refreshBadge();
// }
+ await loadSubscribeEntryState();
});
+watch(
+ () => teams.value.map((item) => item?.corpId).join(","),
+ () => {
+ loadSubscribeEntryState();
+ },
+ { immediate: true }
+);
+
// 页面隐藏
onHide(() => {
console.log("【消息列表页】页面隐藏");
diff --git a/utils/api.js b/utils/api.js
index 210f151..96306a9 100644
--- a/utils/api.js
+++ b/utils/api.js
@@ -73,6 +73,7 @@ const urlsConfig = {
createConsultGroup: "createConsultGroup",
cancelConsultApplication: "cancelConsultApplication",
getGroupList: "getGroupList",
+ getConversationSubscribeConfig: "getConversationSubscribeConfig",
saveConversationSubscribeResult: "saveConversationSubscribeResult",
sendConversationSubscribeEvent: "sendConversationSubscribeEvent"
},
diff --git a/utils/subscribe-message.js b/utils/subscribe-message.js
index 8309fd8..f3091e1 100644
--- a/utils/subscribe-message.js
+++ b/utils/subscribe-message.js
@@ -8,6 +8,7 @@ const SUBSCRIBE_BAN_STATUS = "ban";
const SUBSCRIBE_FILTER_STATUS = "filter";
const SUBSCRIBE_CANCEL_STATUS = "cancel";
const SUBSCRIBE_FAILED_STATUS = "failed";
+const subscribeDisplayConfigCache = new Map();
function canUseSubscribeMessage() {
return (
@@ -142,6 +143,33 @@ async function reportSubscribeResult(records = []) {
}
}
+export async function checkConversationSubscribeEntryVisible(
+ corpId = "",
+ forceRefresh = false
+) {
+ const normalizedCorpId = String(corpId || "").trim();
+ if (!normalizedCorpId) return false;
+
+ if (!forceRefresh && subscribeDisplayConfigCache.has(normalizedCorpId)) {
+ return subscribeDisplayConfigCache.get(normalizedCorpId);
+ }
+
+ try {
+ const result = await api(
+ "getConversationSubscribeConfig",
+ { corpId: normalizedCorpId },
+ false
+ );
+ const enabled = !!result?.data?.enabled;
+ subscribeDisplayConfigCache.set(normalizedCorpId, enabled);
+ return enabled;
+ } catch (error) {
+ console.error("获取订阅提醒显示配置失败:", error);
+ subscribeDisplayConfigCache.set(normalizedCorpId, false);
+ return false;
+ }
+}
+
export async function requestConversationSubscribeMessage(context = {}) {
const templates = resolveSubscribeTemplates({
role: context.role,