Compare commits
No commits in common. "566da2e79151ba688f3fdb1deb07086aceb1d878" and "526bfa65b5c248a443ed24bfcf34a96e3d73d0f5" have entirely different histories.
566da2e791
...
526bfa65b5
@ -1,8 +1,8 @@
|
||||
/**
|
||||
* @desc 当前用户
|
||||
*/
|
||||
import { defaultSuccess, defaultError, http } from '@/plugins/axios'
|
||||
import type { AxiosResponse } from 'axios'
|
||||
import { defaultSuccess, defaultError, http } from '@/plugins/axios';
|
||||
import type { AxiosResponse } from 'axios';
|
||||
export default async function (
|
||||
success: (data: auth.AuthUser) => void = defaultSuccess,
|
||||
fail: (error: { code: string; error?: string }) => void = defaultError,
|
||||
@ -12,7 +12,7 @@ export default async function (
|
||||
url: `/auth/current-user`,
|
||||
})
|
||||
.then((data: AxiosResponse<auth.AuthUser, unknown>) => {
|
||||
success(data.data)
|
||||
success(data.data);
|
||||
})
|
||||
.catch((error: { code: string; error?: string }) => fail(error))
|
||||
.catch((error: { code: string; error?: string }) => fail(error));
|
||||
}
|
||||
|
@ -67,7 +67,6 @@
|
||||
import { config } from '@/settings/application'
|
||||
import { MenuInfo } from 'ant-design-vue/es/menu/src/interface'
|
||||
import { useUserStore } from '@/stores/user'
|
||||
import api from '@/api'
|
||||
const t = useI18n()
|
||||
const user = useUserStore()
|
||||
|
||||
@ -82,13 +81,11 @@
|
||||
}
|
||||
const logout = () => {
|
||||
Modal.confirm({
|
||||
title: '退出登录',
|
||||
title: t.t('layout.user.modal.logout.title'),
|
||||
icon: createVNode(ExclamationCircleOutlined),
|
||||
content: createVNode('div', { style: 'color:red;' }, '确定退出系统吗?'),
|
||||
content: createVNode('div', { style: 'color:red;' }, t.t('layout.user.modal.logout.content')),
|
||||
onOk() {
|
||||
api.authApi.auth.logout(() => {
|
||||
user.logout()
|
||||
})
|
||||
console.log(1)
|
||||
},
|
||||
})
|
||||
}
|
||||
|
@ -101,6 +101,7 @@ export const routes: Array<RouteRecordRaw> = [
|
||||
|
||||
const getNewRouter = () => {
|
||||
// TODO 用户store判断是否登录,登录就返回过滤的,没有登录就返回全量
|
||||
|
||||
return createRouter({
|
||||
history: createWebHashHistory(),
|
||||
routes: [
|
||||
|
@ -18,12 +18,6 @@ export const useUserStore = defineStore('user', {
|
||||
isAdmin(state) {
|
||||
return state.roles.includes('admin')
|
||||
},
|
||||
isLogin(state) {
|
||||
return state.token && state.refreshToken
|
||||
},
|
||||
getPermission(state) {
|
||||
return state.permissions
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
refreshUserInfo(user: auth.AuthUser) {
|
||||
@ -47,7 +41,6 @@ export const useUserStore = defineStore('user', {
|
||||
this.sex = 'FEMALE'
|
||||
this.token = ''
|
||||
this.refreshToken = ''
|
||||
router.push({ path: '/login/user' }) // 退出登录后跳转到登录页面,未实现,要清理缓存?
|
||||
},
|
||||
},
|
||||
persist: {
|
||||
|
@ -80,7 +80,6 @@
|
||||
|
||||
// 定义一个函数来从后端获取条形码字符串并打印
|
||||
const fetchAndPrintBarcodes = (count: number) => {
|
||||
if (count <= 0) return
|
||||
// 清空之前的条形码容器
|
||||
const container = document.getElementById('barcodes-container')
|
||||
if (!container) throw new Error('条形码容器未找到')
|
||||
|
Loading…
x
Reference in New Issue
Block a user