<script setup>
import { onLaunch, onShow, onHide } from '@dcloudio/uni-app';
import { useUserStore } from '@/store/modules/user';

const userStore = useUserStore();

onLaunch(async (options) => {
  console.log('App Launch');

  // 未登录时仅引导到登录页；如果当前启动携带 `code`（企业微信免登回调），让登录页自行处理
  if (!userStore.token) {
    const launchCode = options?.query?.code;
    if (!launchCode) {
      uni.reLaunch({ url: '/pages/login/index' });
    }
  }
});

onShow(() => {
  console.log('App Show');
});

onHide(() => {
  console.log('App Hide');
});
</script>

<style lang="scss">
	/*每个页面公共css */
	@import "@/styles/global.scss";
	@import "@/styles/business.scss";
</style>
