diff --git a/.env.production b/.env.production index 9161c39..cb1c4ea 100644 --- a/.env.production +++ b/.env.production @@ -3,4 +3,3 @@ MP_CACHE_PREFIX=production MP_WX_APP_ID=wx6ee11733526b4f04 MP_TIM_SDK_APP_ID=1600136080 MP_CORP_ID=wpLgjyawAA8N0gWmXgyJq8wpjGcOT7fg -MP_VERIFY_IM_CORP_ID=YES \ No newline at end of file diff --git a/pages/message/message.vue b/pages/message/message.vue index 0d52ee9..a8d4691 100644 --- a/pages/message/message.vue +++ b/pages/message/message.vue @@ -88,7 +88,7 @@ import { } from "@/utils/subscribe-message-config"; // 获取登录状态 -const { account, openid, isIMInitialized, hasImCorpId, teams } = storeToRefs( +const { account, openid, isIMInitialized, teams } = storeToRefs( useAccountStore() ); const { initIMAfterLogin } = useAccountStore(); @@ -543,7 +543,7 @@ const handleRefresh = async () => { refreshing.value = true; try { - if (hasImCorpId.value) await loadConversationList(); + if (isIMInitialized.value) await loadConversationList(); await loadAiConsultationList(); } finally { refreshing.value = false; @@ -640,9 +640,9 @@ onHide(() => { // 回调链会在页面销毁时自动清理 }); -watch(hasImCorpId, (n, o) => { - if (n || !o) init(); -}, { immediate: true }) +onLoad(() => { + init(); +}); // 页面卸载 onUnmounted(() => { console.log("【消息列表页】页面卸载,清理回调"); diff --git a/store/account.js b/store/account.js index 4167221..73d4aa8 100644 --- a/store/account.js +++ b/store/account.js @@ -1,4 +1,4 @@ -import { ref, watch, computed } from "vue"; +import { ref, watch } from "vue"; import { defineStore } from "pinia"; import api from '@/utils/api'; import { toast } from '@/utils/widget'; @@ -16,13 +16,6 @@ export default defineStore("accountStore", () => { const externalUserId = ref(''); const externalUserIdMap = 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); async function login(phoneCode = '', options = {}) { @@ -178,17 +171,11 @@ export default defineStore("accountStore", () => { return id; } - watch(hasImCorpId, n => { - if (n) { - initIMAfterLogin(); - } - }, { immediate: true }) - watch(openid, (n, o) => { if (n && !o) { getTeams(); } }, { 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 } })