2026-01-20 19:36:49 +08:00
|
|
|
<template>
|
|
|
|
|
<view class="flex flex-col justify-center items-center h-full">
|
|
|
|
|
<image class="flash-logo" src="/static/logo-plain.png" />
|
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
<script setup>
|
2026-01-29 11:42:56 +08:00
|
|
|
import { ref } from "vue";
|
2026-02-04 13:28:47 +08:00
|
|
|
import { storeToRefs } from "pinia";
|
2026-01-20 19:36:49 +08:00
|
|
|
import { onLoad } from "@dcloudio/uni-app";
|
2026-01-29 11:42:56 +08:00
|
|
|
import api from "@/utils/api";
|
2026-01-20 19:36:49 +08:00
|
|
|
import { set } from "@/utils/cache";
|
2026-01-29 11:42:56 +08:00
|
|
|
import { toast } from "@/utils/widget";
|
2026-02-04 13:28:47 +08:00
|
|
|
import useAccountStore from "@/store/account";
|
|
|
|
|
|
|
|
|
|
const env = __VITE_ENV__;
|
|
|
|
|
const appid = env.MP_WX_APP_ID;
|
|
|
|
|
const { account } = storeToRefs(useAccountStore());
|
|
|
|
|
|
2026-01-20 19:36:49 +08:00
|
|
|
|
|
|
|
|
const loading = ref(false);
|
2026-01-29 11:42:56 +08:00
|
|
|
const team = ref(null);
|
2026-01-20 19:36:49 +08:00
|
|
|
|
2026-02-04 09:16:36 +08:00
|
|
|
async function changeTeam({ teamId, corpId }) {
|
2026-01-20 19:36:49 +08:00
|
|
|
loading.value = true;
|
2026-01-29 11:42:56 +08:00
|
|
|
const res = await api("getTeamData", { teamId, corpId, withCorpName: true });
|
2026-01-20 19:36:49 +08:00
|
|
|
loading.value = false;
|
|
|
|
|
if (res && res.data) {
|
|
|
|
|
team.value = res.data;
|
2026-02-04 09:16:36 +08:00
|
|
|
team.value.corpName = res.data.corpName;
|
2026-02-04 13:28:47 +08:00
|
|
|
if (account.value) {
|
|
|
|
|
bindTeam()
|
|
|
|
|
} else {
|
|
|
|
|
set("invite-team-info", {
|
|
|
|
|
corpId: team.value.corpId,
|
|
|
|
|
teamId: team.value.teamId,
|
|
|
|
|
corpName: team.value.corpName,
|
|
|
|
|
teamName: team.value.name,
|
|
|
|
|
avatars:
|
|
|
|
|
team.value && Array.isArray(team.value.memberList)
|
|
|
|
|
? team.value.memberList.map((item) => item.avatar || "")
|
|
|
|
|
: [],
|
|
|
|
|
});
|
|
|
|
|
uni.redirectTo({
|
|
|
|
|
url: "/pages/login/login?source=teamInvite",
|
|
|
|
|
});
|
|
|
|
|
}
|
2026-01-20 19:36:49 +08:00
|
|
|
} else {
|
2026-01-29 11:42:56 +08:00
|
|
|
toast(res?.message || "获取团队信息失败");
|
2026-01-20 19:36:49 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-04 13:28:47 +08:00
|
|
|
async function bindTeam() {
|
|
|
|
|
const res = await api('bindWxappWithTeam', { appid, corpId: team.value.corpId, teamId: team.value.teamId, openid: account.value.openid });
|
|
|
|
|
if (!res || !res.success) {
|
|
|
|
|
return toast("关联团队失败");
|
|
|
|
|
}
|
|
|
|
|
const res1 = await api('getWxAppCustomerCount', { miniAppId: account.value.openid, corpId: account.value.corpId, teamId: team.value.teamId });
|
|
|
|
|
if (res1 && res1.data > 0) {
|
|
|
|
|
uni.switchTab({
|
|
|
|
|
url: "/pages/home/home",
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
uni.redirectTo({
|
|
|
|
|
url: `/pages/archive/edit-archive?teamId=${team.value.teamId}&corpId=${team.value.corpId}`
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-29 11:42:56 +08:00
|
|
|
onLoad((options) => {
|
|
|
|
|
const href =
|
|
|
|
|
typeof options.q === "string" ? decodeURIComponent(options.q) : "";
|
|
|
|
|
const [, url = ""] = href.split("?");
|
|
|
|
|
const data = url.split("&").reduce((acc, cur) => {
|
|
|
|
|
const [key, value] = cur.split("=");
|
2026-01-20 19:36:49 +08:00
|
|
|
acc[key] = value;
|
|
|
|
|
return acc;
|
2026-01-29 11:42:56 +08:00
|
|
|
}, {});
|
|
|
|
|
changeTeam(data);
|
|
|
|
|
});
|
2026-01-20 19:36:49 +08:00
|
|
|
</script>
|
|
|
|
|
<style>
|
|
|
|
|
.flash-logo {
|
|
|
|
|
width: 200rpx;
|
|
|
|
|
height: 200rpx;
|
|
|
|
|
animation: flash 2.5s infinite;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@keyframes flash {
|
|
|
|
|
0% {
|
|
|
|
|
opacity: 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
50% {
|
|
|
|
|
opacity: 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
100% {
|
|
|
|
|
opacity: 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|