ykt-team-wxapp/pages/login/redirect-page.vue

77 lines
1.8 KiB
Vue
Raw Normal View History

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-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-01-20 19:36:49 +08:00
2026-01-29 11:42:56 +08:00
const teamId = ref("");
const corpId = ref("");
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
async function changeTeam({ teamId, corpId, corpName }) {
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;
team.value.corpName = corpName;
2026-01-29 11:42:56 +08:00
set("invite-team-info", {
2026-01-20 19:36:49 +08:00
corpId: team.value.corpId,
teamId: team.value.teamId,
corpName: team.value.corpName,
teamName: team.value.name,
2026-01-29 11:42:56 +08:00
avatars:
team.value && Array.isArray(team.value.memberList)
? team.value.memberList.map((item) => item.avatar || "")
: [],
});
2026-01-20 19:36:49 +08:00
uni.redirectTo({
2026-01-29 11:42:56 +08:00
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-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) => {
console.log(cur);
const [key, value] = cur.split("=");
console.log(key, "=====", value);
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>