<script>
import {useUserStore} from "./pinia/UserStore/index.js";
import {toPage} from "./utils/uils.js";
import {useSystemStore} from "./pinia/SystemStore/index.js";

export default {
    onLaunch: function () {
    },
    onShow: function () {
        // #ifndef MP-WEIXIN
        const ua = navigator.userAgent.toLowerCase();
        if (ua.indexOf("micromessenger") !== -1) {
            toPage('/pages/notSupported/index');
            return;
        }
        const UserStore = useUserStore();
        if (!UserStore.isLogin && window.location.href.indexOf('/pages/register/index') < 0 && window.location.href.indexOf('/pages/fastInput/index') < 0) {
            toPage('/pages/login/index');
        }
        if (UserStore.isLogin) {
            const SystemStore = useSystemStore();
            SystemStore.getMessageCount();
        }
        // #endif
    },
    onHide: function () {
    },
}
</script>

<style>
/* #ifdef MP-WEIXIN */
@import "weapp-tailwindcss/css";

@source not "dist";
/* #endif */
</style>
