no message

This commit is contained in:
wangdongbo 2026-09-20 15:16:14 +08:00
parent c4e3ea701b
commit 39ac674871
3 changed files with 7 additions and 21 deletions

View File

@ -3,4 +3,3 @@ MP_CACHE_PREFIX=production
MP_WX_APP_ID=wx6ee11733526b4f04 MP_WX_APP_ID=wx6ee11733526b4f04
MP_TIM_SDK_APP_ID=1600136080 MP_TIM_SDK_APP_ID=1600136080
MP_CORP_ID=wpLgjyawAA8N0gWmXgyJq8wpjGcOT7fg MP_CORP_ID=wpLgjyawAA8N0gWmXgyJq8wpjGcOT7fg
MP_VERIFY_IM_CORP_ID=YES

View File

@ -88,7 +88,7 @@ import {
} from "@/utils/subscribe-message-config"; } from "@/utils/subscribe-message-config";
// 获取登录状态 // 获取登录状态
const { account, openid, isIMInitialized, hasImCorpId, teams } = storeToRefs( const { account, openid, isIMInitialized, teams } = storeToRefs(
useAccountStore() useAccountStore()
); );
const { initIMAfterLogin } = useAccountStore(); const { initIMAfterLogin } = useAccountStore();
@ -543,7 +543,7 @@ const handleRefresh = async () => {
refreshing.value = true; refreshing.value = true;
try { try {
if (hasImCorpId.value) await loadConversationList(); if (isIMInitialized.value) await loadConversationList();
await loadAiConsultationList(); await loadAiConsultationList();
} finally { } finally {
refreshing.value = false; refreshing.value = false;
@ -640,9 +640,9 @@ onHide(() => {
// 回调链会在页面销毁时自动清理 // 回调链会在页面销毁时自动清理
}); });
watch(hasImCorpId, (n, o) => { onLoad(() => {
if (n || !o) init(); init();
}, { immediate: true }) });
// 页面卸载 // 页面卸载
onUnmounted(() => { onUnmounted(() => {
console.log("【消息列表页】页面卸载,清理回调"); console.log("【消息列表页】页面卸载,清理回调");

View File

@ -1,4 +1,4 @@
import { ref, watch, computed } from "vue"; import { ref, watch } from "vue";
import { defineStore } from "pinia"; import { defineStore } from "pinia";
import api from '@/utils/api'; import api from '@/utils/api';
import { toast } from '@/utils/widget'; import { toast } from '@/utils/widget';
@ -16,13 +16,6 @@ export default defineStore("accountStore", () => {
const externalUserId = ref(''); const externalUserId = ref('');
const externalUserIdMap = ref({}); const externalUserIdMap = ref({});
const teams = ref([]); const teams = ref([]);
const hasImCorpId = computed(() => {
// 正式环境IM账号优先 暂时只有wpLgjyawAA8N0gWmXgyJq8wpjGcOT7fg机构的才开启IM账号
if (env.MP_VERIFY_IM_CORP_ID === 'YES') {
return teams.value.some(i => i.corpId === 'wpLgjyawAA8N0gWmXgyJq8wpjGcOT7fg')
}
return true
});
const teamsPromise = ref(null); const teamsPromise = ref(null);
async function login(phoneCode = '', options = {}) { async function login(phoneCode = '', options = {}) {
@ -178,17 +171,11 @@ export default defineStore("accountStore", () => {
return id; return id;
} }
watch(hasImCorpId, n => {
if (n) {
initIMAfterLogin();
}
}, { immediate: true })
watch(openid, (n, o) => { watch(openid, (n, o) => {
if (n && !o) { if (n && !o) {
getTeams(); getTeams();
} }
}, { immediate: true }) }, { immediate: true })
return { account, teams, hasImCorpId, login, initIMAfterLogin, logout, openid, isIMInitialized, externalUserId, getExternalUserId, getTeams } return { account, teams, login, initIMAfterLogin, logout, openid, isIMInitialized, externalUserId, getExternalUserId, getTeams }
}) })