更新依赖;优化登录
parent
b048308c46
commit
8048ce5751
|
@ -29,6 +29,7 @@ export default {
|
|||
'vue-router': '//jscdn.ink/@bytedo/vue-router/4.1.6/vue-router.js',
|
||||
// 这个库被vue-router依赖, 可以注释掉vue-router代码中的 @vue/devtools-api 的引入
|
||||
// 以达到减少不必须的体积的效果
|
||||
fetch: '//jscdn.ink/@bytedo/fetch/2.1.1/next.js'
|
||||
fetch: '//jscdn.ink/@bytedo/fetch/latest/next.js',
|
||||
'@bd/core': '//jscdn.ink/@bd/core/latest/index.js'
|
||||
}
|
||||
}
|
|
@ -7,7 +7,7 @@
|
|||
<title>{{title}}</title>
|
||||
<meta name="keywords" content="{{keywords}}">
|
||||
<meta name="description" content="{{description}}">
|
||||
<link rel="stylesheet" href="//jscdn.ink/@bytedo/wcui/1.0.12/css/reset-basic.css">
|
||||
<link rel="stylesheet" href="//jscdn.ink/@bd/ui/latest/css/reset-basic.css">
|
||||
<script async src="//jscdn.ink/es-module-shims/1.6.3/es-module-shims.wasm.js"></script>
|
||||
<script type="importmap">{{importmap}}</script>
|
||||
</head>
|
||||
|
|
|
@ -6,6 +6,6 @@
|
|||
"build": "fite build"
|
||||
},
|
||||
"devDependencies": {
|
||||
"fite": "^0.3.3"
|
||||
"fite": "^0.6.0"
|
||||
}
|
||||
}
|
||||
|
|
17
src/app.vue
17
src/app.vue
|
@ -8,14 +8,29 @@
|
|||
import Header from './components/header.vue'
|
||||
import Footer from './components/footer.vue'
|
||||
|
||||
import fetch from '@/lib/fetch.js'
|
||||
|
||||
export default {
|
||||
components: { Header, Footer },
|
||||
|
||||
mounted() {
|
||||
var user = localStorage.getItem('user')
|
||||
var checked = sessionStorage.getItem('session_checked')
|
||||
|
||||
if (user) {
|
||||
this.$store.user = JSON.parse(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')
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import fetch from 'fetch'
|
||||
|
||||
fetch.BASE_URL = 'https://api.jscdn.ink'
|
||||
fetch.BASE_URL = '//api.jscdn.ink'
|
||||
|
||||
fetch.inject.request(function (conf) {
|
||||
var token = localStorage.getItem('token')
|
||||
|
|
10
src/main.js
10
src/main.js
|
@ -1,11 +1,13 @@
|
|||
import { createApp } from 'vue'
|
||||
|
||||
import '//jscdn.ink/es.shim/2.1.0/index.js'
|
||||
import '//jscdn.ink/@bytedo/wcui/1.0.12/form/input.js'
|
||||
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/switch.js'
|
||||
import '//jscdn.ink/@bd/ui/latest/form/link.js'
|
||||
import '//jscdn.ink/@bd/ui/latest/layer/index.js'
|
||||
import '//jscdn.ink/@bd/ui/latest/pager/index.js'
|
||||
import '//jscdn.ink/@bytedo/wcui/1.0.12/form/dropdown.js'
|
||||
import '//jscdn.ink/@bytedo/wcui/1.0.12/form/button.js'
|
||||
import '//jscdn.ink/@bytedo/wcui/1.0.12/form/link.js'
|
||||
import '//jscdn.ink/@bytedo/wcui/1.0.12/layer/index.js'
|
||||
|
||||
import App from './app.vue'
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
|
||||
<wc-pager
|
||||
class="pager"
|
||||
layout="prev,pages,next"
|
||||
layout="prev,pages,next,info"
|
||||
red
|
||||
@page-change="pageChanged"
|
||||
:total="total"
|
||||
|
@ -99,8 +99,6 @@
|
|||
|
||||
<script>
|
||||
import '//jscdn.ink/@bytedo/wcui/1.0.12/table/index.js'
|
||||
import '//jscdn.ink/@bytedo/wcui/1.0.12/form/switch.js'
|
||||
import '//jscdn.ink/@bytedo/wcui/1.0.12/pager/index.js'
|
||||
import fetch from '@/lib/fetch.js'
|
||||
|
||||
export default {
|
||||
|
@ -344,6 +342,7 @@ export default {
|
|||
|
||||
.request-form {
|
||||
width: 640px;
|
||||
background: #fff;
|
||||
|
||||
.title {
|
||||
display: flex;
|
||||
|
|
Loading…
Reference in New Issue