2023-11-14 19:14:01 +08:00
|
|
|
/**
|
|
|
|
* {}
|
|
|
|
* @author yutent<yutent.io@gmail.com>
|
|
|
|
* @date 2023/11/14 18:52:57
|
|
|
|
*/
|
|
|
|
|
|
|
|
import { createApp } from 'wkitd'
|
|
|
|
import { css, html } from 'wkit'
|
2023-11-14 18:29:28 +08:00
|
|
|
|
|
|
|
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'
|
2023-11-14 19:14:01 +08:00
|
|
|
import fetch from '/lib/fetch.js'
|
|
|
|
|
|
|
|
import './components/header.js'
|
|
|
|
import './components/footer.js'
|
2023-11-14 18:29:28 +08:00
|
|
|
|
|
|
|
const app = createApp({
|
|
|
|
render() {
|
|
|
|
return html`
|
|
|
|
<wc-header></wc-header>
|
|
|
|
<div class="main-body"><router-view></router-view></div>
|
|
|
|
<wc-footer></wc-footer>
|
|
|
|
`
|
2023-11-14 19:14:01 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
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')
|
|
|
|
})
|
|
|
|
}
|
2023-11-14 18:29:28 +08:00
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
app.use(router).use(store).mount('.app')
|