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