diff --git a/admin/src/utils/file.ts b/admin/src/utils/file.ts
index e29acbd9..a33a0f34 100644
--- a/admin/src/utils/file.ts
+++ b/admin/src/utils/file.ts
@@ -4,7 +4,6 @@
*/
export function streamFileDownload(file: any, fileName = '文件名称.zip') {
const blob = new Blob([file], { type: 'application/octet-stream;charset=UTF-8' })
- console.log(blob.text())
const url = window.URL.createObjectURL(blob)
const link = document.createElement('a')
link.style.display = 'none'
diff --git a/app/src/App.vue b/app/src/App.vue
index 3f5f2895..27472863 100644
--- a/app/src/App.vue
+++ b/app/src/App.vue
@@ -4,9 +4,9 @@ import { useAppStore } from './stores/app'
import { useUserStore } from './stores/user'
const { getConfig } = useAppStore()
const { getUser } = useUserStore()
-onLaunch(() => {
- getConfig()
- getUser()
+onLaunch(async () => {
+ await getConfig()
+ await getUser()
})
diff --git a/app/src/pages/index/index.vue b/app/src/pages/index/index.vue
index 46b207c5..953bf080 100644
--- a/app/src/pages/index/index.vue
+++ b/app/src/pages/index/index.vue
@@ -29,7 +29,7 @@
diff --git a/app/src/stores/app.ts b/app/src/stores/app.ts
index f5991586..105483aa 100644
--- a/app/src/stores/app.ts
+++ b/app/src/stores/app.ts
@@ -8,10 +8,18 @@ export const useAppStore = defineStore({
id: 'appStore',
state: (): AppSate => ({
config: {
- website: {}
+ website: {},
+ login: {}
}
}),
- getters: {},
+ getters: {
+ getWebsiteConfig(state) {
+ return state.config.website
+ },
+ getLoginConfig(state) {
+ return state.config.login
+ }
+ },
actions: {
getImageUrl(url: string) {
return url ? `${this.config.domain}${url}` : ''
diff --git a/app/src/stores/user.ts b/app/src/stores/user.ts
index 93e57583..579e4fda 100644
--- a/app/src/stores/user.ts
+++ b/app/src/stores/user.ts
@@ -6,19 +6,23 @@ import { defineStore } from 'pinia'
interface UserSate {
userInfo: Record
token: string | null
+ temToken: string | null
}
export const useUserStore = defineStore({
id: 'userStore',
state: (): UserSate => ({
userInfo: {},
- token: cache.get(TOKEN_KEY) || null
+ token: cache.get(TOKEN_KEY) || null,
+ temToken: null
}),
getters: {
isLogin: (state) => !!state.token
},
actions: {
async getUser() {
- const data = await getUserCenter()
+ const data = await getUserCenter({
+ token: this.token || this.temToken
+ })
this.userInfo = data
},
login(token: string) {
diff --git a/app/src/utils/request/index.ts b/app/src/utils/request/index.ts
index e0b9a8cf..fc639c20 100644
--- a/app/src/utils/request/index.ts
+++ b/app/src/utils/request/index.ts
@@ -15,9 +15,9 @@ const requestHooks: RequestHooks = {
if (baseUrl) {
options.url = `${baseUrl}${options.url}`
}
+ const token = getToken()
// 添加token
- if (withToken) {
- const token = getToken()
+ if (withToken && token) {
options.header.token = token
}
return options