/** * {} * @author yutent * @date 2023/11/14 18:52:57 */ import { createApp } from 'wkitd' import { css, html } from 'wkit' import 'es.shim' // import '//jscdn.ink/@bd/ui/latest/form/input.js' // import '//jscdn.ink/@bd/ui/latest/form/button.js' // import '//jscdn.ink/@bd/ui/latest/form/checkbox.js' // import '//jscdn.ink/@bd/ui/latest/form/switch.js' // import '//jscdn.ink/@bd/ui/latest/form/link.js' // import '//jscdn.ink/@bd/ui/latest/layer/index.js' // // import 'http://127.0.0.1:8090/dist/layer/index.js' // import '//jscdn.ink/@bd/ui/latest/pager/index.js' // import '//jscdn.ink/@bytedo/wcui/1.0.12/form/dropdown.js' // import App from './app.vue' import router from './router.js' import store from './store.js' import fetch from '/lib/fetch.js' import './components/header.js' import './components/footer.js' const app = createApp({ render() { return html`
` }, styles: css` :host { display: flex; flex-direction: column; width: 100%; min-height: 100vh; } .main-body { flex: 1; } `, mounted() { var user = localStorage.getItem('user') var checked = sessionStorage.getItem('session_checked') if (user) { if (checked) { return (this.$store.user = JSON.parse(user)) } fetch('/login/check') .then(r => { localStorage.setItem('token', r.data.token) sessionStorage.setItem('session_checked', 1) this.$store.user = JSON.parse(user) }) .catch(r => { localStorage.removeItem('token') localStorage.removeItem('user') }) } } }) app.use(router).use(store).mount('.app')