From f7a0e9454c749471a300529d71cf61cd939251f5 Mon Sep 17 00:00:00 2001 From: huxuejian Date: Tue, 14 Apr 2026 16:17:40 +0800 Subject: [PATCH] =?UTF-8?q?im=E7=99=BB=E5=BD=95=E6=A0=B9=E6=8D=AE=E6=9C=BA?= =?UTF-8?q?=E6=9E=84id=E6=9D=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.vue | 2 +- pages/home/home.vue | 13 ++++---- pages/message/message.vue | 66 +++++++++++++++------------------------ store/account.js | 44 +++++++++++++++++++++----- 4 files changed, 71 insertions(+), 54 deletions(-) diff --git a/App.vue b/App.vue index 326d821..d9ca4e1 100644 --- a/App.vue +++ b/App.vue @@ -8,7 +8,7 @@ export default { console.log("App Launch: "); // 获取 openId 并初始化 IM - await this.initIMOnLaunch(); + // await this.initIMOnLaunch(); }, onShow: function () { const db = dbStore(); diff --git a/pages/home/home.vue b/pages/home/home.vue index 6315bfe..5c43a19 100644 --- a/pages/home/home.vue +++ b/pages/home/home.vue @@ -45,7 +45,7 @@ import pageLoading from "./loading.vue"; // const { useLoad, useShow } = useGuard(); const { account } = storeToRefs(useAccount()); -const { login } = useAccount(); +const { login, getTeams } = useAccount(); const team = ref(null); const teams = ref([]); @@ -77,10 +77,9 @@ async function changeTeam({ teamId, corpId, corpName }) { } } -async function getTeams(inviteTeamId = '') { +async function getMatchTeams(inviteTeamId = '') { loading.value = true; - const res = await api('getWxappRelateTeams', { openid: account.value.openid }); - teams.value = res && Array.isArray(res.data) ? res.data : []; + teams.value = await getTeams(); const matchTeamId = inviteTeamId || (team.value ? team.value.teamId : ''); const validTeam = teams.value.find(i => i.teamId && i.teamId === matchTeamId); const firstTeam = teams.value[0] @@ -110,7 +109,7 @@ onShow(async () => { corpUserIds.value[inviteTeam.teamId] = inviteTeam.corpUserId; } if (account.value && account.value.openid) { - getTeams(inviteTeam && inviteTeam.teamId ? inviteTeam.teamId : ''); + getMatchTeams(inviteTeam && inviteTeam.teamId ? inviteTeam.teamId : ''); } else { teams.value = []; } @@ -124,11 +123,13 @@ onShow(async () => { watch(account, (n, o) => { if (n && !o) { - getTeams(); + getMatchTeams(); } else if (!n && o) { teams.value = []; } }) + +