appstore/dist/app.js

99 lines
2.2 KiB
JavaScript
Raw Permalink Normal View History

2023-12-19 15:30:29 +08:00
/**
* {}
* @author yutent<yutent.io@gmail.com>
* @date 2023/11/14 18:52:57
*/
import { createApp } from 'wkitd'
import { css, html } from 'wkit'
import 'es.shim'
2023-12-21 13:59:15 +08:00
import Icon from '@ui/base/icon.js'
2023-12-19 15:30:29 +08:00
import '@ui/base/button.js'
import '@ui/base/link.js'
import '@ui/form/input.js'
import '@ui/form/switch.js'
import '@ui/modal/layer.js'
2023-12-28 15:48:00 +08:00
import '@ui/views/tag.js'
2023-12-19 15:30:29 +08:00
import '@ui/nav/pager.js'
2023-12-21 13:59:15 +08:00
import extIcons from '/lib/ext-icon.js'
2023-12-19 15:30:29 +08:00
import router from './router.js'
import store from './store.js'
import fetch from '/lib/fetch.js'
2023-12-19 18:53:48 +08:00
import './components/dock.js'
import './components/topbar.js'
2023-12-21 17:43:41 +08:00
import './views/about.js'
import './views/power.js'
2023-12-19 15:30:29 +08:00
2023-12-21 13:59:15 +08:00
Icon.extend(extIcons)
2023-12-19 15:30:29 +08:00
const app = createApp({
render() {
return html`
2023-12-19 18:53:48 +08:00
<wc-topbar></wc-topbar>
2023-12-19 15:30:29 +08:00
<div class="main-body"><router-view></router-view></div>
2023-12-19 18:53:48 +08:00
<wc-dock></wc-dock>
<wc-about></wc-about>
2023-12-21 17:43:41 +08:00
<wc-power></wc-power>
2023-12-19 15:30:29 +08:00
`
},
styles: css`
:host {
display: flex;
flex-direction: column;
2023-12-19 18:53:48 +08:00
width: 100vw;
2023-12-20 19:06:35 +08:00
min-width: 1024px;
2023-12-19 18:53:48 +08:00
height: 100vh;
background: radial-gradient(ellipse, var(--color-red-a), transparent),
radial-gradient(ellipse at bottom, var(--color-teal-a), transparent),
linear-gradient(
160deg,
var(--color-blue-a),
rgba(255, 255, 255, 0.3),
var(--color-blue-1)
);
}
2023-12-20 19:06:35 +08:00
2023-12-19 18:53:48 +08:00
:host::after {
display: block;
2023-12-20 19:06:35 +08:00
position: absolute;
bottom: 0;
width: 100%;
height: 75px;
background: url(/assets/img/cat.svg) no-repeat;
2023-12-19 18:53:48 +08:00
content: '';
}
2023-12-19 15:30:29 +08:00
.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))
}
2023-12-20 19:06:35 +08:00
// 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-12-19 15:30:29 +08:00
}
}
})
2023-12-19 18:53:48 +08:00
app.use(router).use(store).mount()