fix(ui): ts类型

This commit is contained in:
廖彦棋 2024-03-06 18:20:07 +08:00
parent d4a24a0f1d
commit f2cfcfeefc
4 changed files with 17 additions and 5 deletions

View File

@ -12,5 +12,8 @@
"dependencies": {
"axios": "^1.6.7",
"uuid": "^9.0.1"
},
"devDependencies": {
"@types/uuid": "^9.0.8"
}
}

View File

@ -22,6 +22,11 @@ importers:
specifier: ^9.0.1
version: 9.0.1
devDependencies:
'@types/uuid':
specifier: ^9.0.8
version: 9.0.8
projects/vue-admin:
dependencies:
'@arco-design/web-vue':
@ -975,6 +980,10 @@ packages:
resolution: {integrity: sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ==}
dev: true
/@types/uuid@9.0.8:
resolution: {integrity: sha512-jg+97EGIcY9AGHJJRaaPVgetKDsrTgbRjQ5Msgjh/DQKEFl0DtyRr/VCOyD1T2R1MNeWPK/u7JoGhlDZnKBAfA==}
dev: true
/@typescript-eslint/eslint-plugin@6.21.0(@typescript-eslint/parser@6.21.0)(eslint@8.57.0)(typescript@5.3.3):
resolution: {integrity: sha512-oy9+hTPCUFpngkEZUSzbf9MxI65wbKFoQYsgPdILTfbUldp5ovUuphZVe4i30emU9M/kP+T64Di0mxl7dSw3MA==}
engines: {node: ^16.0.0 || >=18.0.0}

View File

@ -48,8 +48,8 @@ function useAsyncTable<T extends Record<string, unknown>>(
page: paginationState.current,
pageSize: paginationState.pageSize,
});
tableState.data = data?.items;
paginationState.total = data.total;
tableState.data = (data as any)?.items;
paginationState.total = (data as any)?.total;
} finally {
tableState.loading = false
}

View File

@ -5,12 +5,12 @@ import router from '@/router'
export const useAuthStore = defineStore({
id: __AUTH_KEY,
state: () => ({ token: null }),
state: () => ({ token: null } as { token: string | null }),
actions: {
init() {
this.$state.token = localStorage.getItem(__AUTH_KEY);
},
async login(params) {
async login(params: any) {
try {
const { data } = await userLogin(params)
if (data) {
@ -29,7 +29,7 @@ export const useAuthStore = defineStore({
await userLogout()
if (this.$state.token) {
localStorage.removeItem(__AUTH_KEY)
this.$restate.token = null
this.$reset()
}
Message.success('退出成功');
router.push({ name: 'Login' })