<script setup>
import { onUnmounted } from "vue";
import { onLaunch, onShow, onHide } from "@dcloudio/uni-app";
import { store } from "@/store/index.js";
import { useGlobalEventRemove, useInit, updateActivePageOnShow } from "@/utils/useBarcodeModule.js";
import { useRouteMonitor } from "@/utils/useRouteMonitor.js";
import { playClickSound } from "@/config/audioUtil.js";

onLaunch(() => {
    // 尝试去获取本地的 token 和用户信息，填充到 store 中
    let token = uni.getStorageSync("token");
    if (token) {
        let userInfo = uni.getStorageSync("userInfo");
        if (userInfo) {
            if (userInfo.userId) {
                store.setUserInfo(userInfo);
            }
        }
    }

    // #ifdef APP-PLUS
    // 初始化扫码模块
    // useInit();
    // #endif
});
onShow(() => {});

onUnmounted(() => {
    console.log("App Unmounted");
});
</script>

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

/*每个页面公共css */
page {
    background: #f5f6fa;
    height: 100%;
}
</style>
