sc
This commit is contained in:
@@ -6,9 +6,9 @@ VITE_DEV=true
|
|||||||
# 请求路径
|
# 请求路径
|
||||||
# VITE_BASE_URL='http://localhost:48080'
|
# VITE_BASE_URL='http://localhost:48080'
|
||||||
|
|
||||||
VITE_BASE_URL='http://47.98.161.246:48080'
|
# VITE_BASE_URL='http://47.98.161.246:48080'
|
||||||
# VITE_BASE_URL='http://114.55.169.15:48080'
|
# VITE_BASE_URL='http://114.55.169.15:48080'
|
||||||
# VITE_BASE_URL='http://114.215.207.150:48080'
|
VITE_BASE_URL='http://114.215.207.150:48080'
|
||||||
|
|
||||||
# 上传路径
|
# 上传路径
|
||||||
VITE_UPLOAD_URL='http://47.98.161.246:48080/admin-api/system/file/upload'
|
VITE_UPLOAD_URL='http://47.98.161.246:48080/admin-api/system/file/upload'
|
||||||
|
|||||||
@@ -2,7 +2,8 @@ import { store } from '../index'
|
|||||||
import { defineStore } from 'pinia'
|
import { defineStore } from 'pinia'
|
||||||
import { getAccessToken, removeToken } from '@/utils/auth'
|
import { getAccessToken, removeToken } from '@/utils/auth'
|
||||||
import { CACHE_KEY } from '@/hooks/web/useCache'
|
import { CACHE_KEY } from '@/hooks/web/useCache'
|
||||||
import { getInfo, loginOut } from '@/api/login'
|
import { loginOut } from '@/api/login'
|
||||||
|
import { getUser as getUserInfo } from '@/api/system/user'
|
||||||
|
|
||||||
import cache from '@/plugins/cache'
|
import cache from '@/plugins/cache'
|
||||||
|
|
||||||
@@ -50,11 +51,17 @@ export const useUserStore = defineStore('admin-user', {
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
let userInfo = cache.local.get(CACHE_KEY.USER)
|
let userInfo = cache.local.get(CACHE_KEY.USER)
|
||||||
if (!userInfo || !userInfo?.menus || userInfo.menus.length == 0) {
|
// if (!userInfo || !userInfo?.menus || userInfo.menus.length == 0) {
|
||||||
userInfo = await getInfo({})
|
// userInfo = await getInfo({})
|
||||||
|
// }
|
||||||
|
if (!userInfo?.user) {
|
||||||
|
const userId = localStorage.getItem('userId')
|
||||||
|
userInfo = {
|
||||||
|
user: await getUserInfo(Number(userId))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.permissions = userInfo.permissions
|
// this.permissions = userInfo.permissions
|
||||||
this.roles = userInfo.roles
|
// this.roles = userInfo.roles
|
||||||
this.user = userInfo.user
|
this.user = userInfo.user
|
||||||
this.isSetUser = true
|
this.isSetUser = true
|
||||||
cache.local.set(CACHE_KEY.USER, userInfo)
|
cache.local.set(CACHE_KEY.USER, userInfo)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<Error type="403" @error-click="push('/Home/index')" />
|
<Error type="403" @error-click="push('/index')" />
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" name="Error403" setup>
|
<script lang="ts" name="Error403" setup>
|
||||||
const { push } = useRouter()
|
const { push } = useRouter()
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<Error @error-click="push('/Home/index')" />
|
<Error @error-click="push('/index')" />
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" name="Error404" setup>
|
<script lang="ts" name="Error404" setup>
|
||||||
const { push } = useRouter()
|
const { push } = useRouter()
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<Error type="500" @error-click="push('/Home/index')" />
|
<Error type="500" @error-click="push('/index')" />
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" name="Error500" setup>
|
<script lang="ts" name="Error500" setup>
|
||||||
const { push } = useRouter()
|
const { push } = useRouter()
|
||||||
|
|||||||
@@ -200,6 +200,8 @@ const handleLogin = async (params) => {
|
|||||||
if (res?.tenantId) {
|
if (res?.tenantId) {
|
||||||
authUtil.setTenantId(res.tenantId)
|
authUtil.setTenantId(res.tenantId)
|
||||||
}
|
}
|
||||||
|
// 设置userId
|
||||||
|
localStorage.setItem('userId', res.userId)
|
||||||
|
|
||||||
ElLoading.service({
|
ElLoading.service({
|
||||||
lock: true,
|
lock: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user