<script setup>
import config from "./config";
import store from "@/store";
import { getToken } from "@/utils/auth";

import { defineComponent, getCurrentInstance, inject, onMounted } from "vue";
import { onLoad, onShow, onHide, onLaunch } from "@dcloudio/uni-app";

let tab = inject("$tab");
const { proxy } = getCurrentInstance();

function initApp() {
  // 初始化应用配置
  initConfig();
  // 检查用户登录状态
  //#ifdef H5
  // checkLogin();
  //#endif
}

function initConfig() {
  getApp().globalData.config = config;
}

function checkLogin() {
  if (!getToken()) {
    // proxy.$tab.reLaunch("/pages/login");
  }
}

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

onHide(() => {
  console.log("App Hide");
});

onLaunch(() => {
  console.log("App Launch");
  // #ifdef APP-PLUS
  plus.screen.lockOrientation("portrait-primary");//设置不可横屏
  // #endif
  initApp();
});
</script>

<style lang="scss">
@import "@/static/scss/index.scss";
@import "@/static/scss/public.scss";
@import "static/iconfont/iconfont.css";
@import "static/iconfont/uciconfont/iconfont.css";
</style>

<style lang="scss">
@import "@/uni_modules/uview-plus/index.scss";

uni-page-body,
uni-page-refresh {
  height: 100%;
}
</style>
