80 lines
2.1 KiB
Vue
Raw Normal View History

2025-04-22 10:22:33 +08:00
<template>
<view class="wh-full">
2025-05-13 15:39:44 +08:00
<BasicLoading
:isShow="isShow"
bgColor="#fff"
isShowTitle
textColor="#000"
title="启动中..."
:type="1"
/>
2025-04-22 10:22:33 +08:00
</view>
</template>
<script lang="ts" setup>
2025-05-13 15:39:44 +08:00
import { onLoad } from "@dcloudio/uni-app";
import pages from "@/pages.json";
import { useDataStore } from "@/store/modules/data";
import { useUserStore } from "@/store/modules/user";
import { checkOpenId, findJsByPhoneApi } from "@/api/system/login";
import { isTabBar } from "@/utils/uniapp";
2025-04-22 10:22:33 +08:00
2025-05-13 15:39:44 +08:00
const { setGlobal } = useDataStore();
const { afterLoginAction } = useUserStore();
const { setFile, getFile } = useDataStore();
const isShow = ref(true);
function toHome() {
2025-04-22 10:22:33 +08:00
if (isTabBar()) {
uni.switchTab({
2025-05-13 15:39:44 +08:00
url: "/" + (pages as any).tabBar.list[0].pagePath,
});
2025-04-22 10:22:33 +08:00
} else {
uni.reLaunch({
2025-05-13 15:39:44 +08:00
url: "/" + pages.pages[1].path,
});
}
}
onLoad(async (data: any) => {
2025-05-13 16:26:33 +08:00
console.log(data);
2025-05-13 15:39:44 +08:00
if (data && data.openId) {
setGlobal(data);
checkOpenId({ openId: data.openId, appCode: "JS" })
.then(async (res) => {
if (res.resultCode == 1) {
if (res.result) {
afterLoginAction(res.result);
const findJsByPhoneResult = await findJsByPhoneApi({
phone: res.result.telephone,
});
if (findJsByPhoneResult.resultCode == 1) {
if (findJsByPhoneResult.result) {
if (findJsByPhoneResult.result["confirmStatus"] == "A") {
toHome();
} else {
setFile({
...findJsByPhoneResult.result,
...getFile,
});
setTimeout(() => {
uni.reLaunch({
url: "/pages/view/hr/teacherProfile/index",
});
}, 1500);
}
} else {
toHome();
}
}
} else {
uni.reLaunch({
url: "/pages/system/login/login",
});
}
}
})
.catch((err) => {});
2025-04-22 10:22:33 +08:00
}
2025-05-13 15:39:44 +08:00
});
2025-04-22 10:22:33 +08:00
</script>