From 99391eb963830c16237027520379891639613bf1 Mon Sep 17 00:00:00 2001 From: liwenqiang Date: Fri, 19 Apr 2024 12:03:03 +0800 Subject: [PATCH 1/8] =?UTF-8?q?button=E6=B7=BB=E5=8A=A0title?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/settings.json | 1 + src/components/EssentialLink.vue | 1 + src/i18n/en-US/index.ts | 3 +-- src/i18n/zh-CN/index.ts | 3 +-- src/i18n/zh-TW/index.ts | 3 +-- src/layouts/MainLayout.vue | 10 +++------- src/pages/ErrorNotFound.vue | 11 ++--------- src/pages/LoginPage.vue | 14 +++++++------- src/pages/system/dictionary/IndexPage.vue | 12 ++++++------ src/pages/system/dictionary/SubPage.vue | 15 ++++++--------- src/pages/system/group/IndexPage.vue | 12 ++++++------ src/pages/system/region/IndexPage.vue | 12 ++++++------ src/pages/system/role/IndexPage.vue | 12 ++++++------ src/pages/system/user/IndexPage.vue | 12 ++++++------ src/router/routes.ts | 1 - 15 files changed, 53 insertions(+), 69 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 6ff0621..1f7c574 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,6 +2,7 @@ "editor.bracketPairColorization.enabled": true, "editor.guides.bracketPairs": true, "editor.formatOnSave": true, + "editor.defaultFormatter": "dbaeumer.vscode-eslint", "editor.codeActionsOnSave": [ "source.fixAll.eslint" ], diff --git a/src/components/EssentialLink.vue b/src/components/EssentialLink.vue index 843ef53..0239589 100644 --- a/src/components/EssentialLink.vue +++ b/src/components/EssentialLink.vue @@ -17,6 +17,7 @@ export interface EssentialLinkProps { icon?: string; } withDefaults(defineProps(), { + title: '', link: '#', icon: '' }) diff --git a/src/i18n/en-US/index.ts b/src/i18n/en-US/index.ts index a0db661..728ecff 100644 --- a/src/i18n/en-US/index.ts +++ b/src/i18n/en-US/index.ts @@ -26,11 +26,10 @@ export default { no: 'NO.', name: 'Name', - alias: 'Alias', id: 'ID', superior: 'Superior', description: 'Description', - modifyTime: 'Modify Time', + lastModifiedDate: 'Last Modified Date', username: 'Username', password: 'Password', diff --git a/src/i18n/zh-CN/index.ts b/src/i18n/zh-CN/index.ts index b26493d..8c4b2bd 100644 --- a/src/i18n/zh-CN/index.ts +++ b/src/i18n/zh-CN/index.ts @@ -26,11 +26,10 @@ export default { no: '序号', name: '名称', - alias: '别名', id: '主键', superior: '上级', description: '描述', - modifyTime: '更新时间', + lastModifiedDate: '更新时间', username: '账号', password: '密码', diff --git a/src/i18n/zh-TW/index.ts b/src/i18n/zh-TW/index.ts index 01acffa..98109fc 100644 --- a/src/i18n/zh-TW/index.ts +++ b/src/i18n/zh-TW/index.ts @@ -26,11 +26,10 @@ export default { no: '序號', name: '名稱', - alias: '別名', id: '主鍵', superior: '上級', description: '描述', - modifyTime: '更新時間', + lastModifiedDate: '更新時間', username: '賬號', password: '密碼', diff --git a/src/layouts/MainLayout.vue b/src/layouts/MainLayout.vue index fce964a..b055770 100644 --- a/src/layouts/MainLayout.vue +++ b/src/layouts/MainLayout.vue @@ -6,8 +6,8 @@ Management System - + - - - + @@ -35,6 +32,9 @@ + + avatar @@ -42,10 +42,10 @@ - Sign out + Change Password - - Home + + Sign Out @@ -72,11 +72,25 @@ import { ref } from 'vue' import { useI18n } from 'vue-i18n' import { useUserStore } from 'stores/user-store' +import { useRouter } from 'vue-router' +import { useQuasar } from 'quasar' +import { api } from 'boot/axios' + import SideBarLeft from './SideBarLeft.vue' const userStore = useUserStore() +const router = useRouter() +const $q = useQuasar() const { locale } = useI18n({ useScope: 'global' }) const leftDrawerOpen = ref(false) + +function onLogout() { + api.post('/logout').then(() => { + userStore.clearUser() + + router.replace('/login') + }).catch(error => $q.notify({ type: 'negative', message: error.message })) +} diff --git a/src/mocks/regions.ts b/src/mocks/regions.ts index a4c2709..2c06d86 100644 --- a/src/mocks/regions.ts +++ b/src/mocks/regions.ts @@ -21,9 +21,36 @@ export const regionsHandlers = [ const url = new URL(request.url) const page = url.searchParams.get('page') const size = url.searchParams.get('size') + + // sort and filter + const sortBy = url.searchParams.get('sortBy') as never + if (sortBy) { + datas.sort((a: Region, b: Region) => { + if (a[sortBy] > b[sortBy]) { + return 1 + } + if (a[sortBy] < b[sortBy]) { + return -1 + } + return 0 + }) + } + + let data = { + } + + const filter = url.searchParams.get('filter') + if (filter) { + const result = datas.filter(item => item.name.includes(filter)).slice(Number(page) * Number(size), (Number(page) + 1) * Number(size)) + data = { + content: result, + totalElements: result.length + } + return HttpResponse.json(data) + } // Construct a JSON response with the list of all Dictionarys // as the response body. - const data = { + data = { content: Array.from(datas.slice(Number(page) * Number(size), (Number(page) + 1) * Number(size))), totalElements: datas.length } diff --git a/src/pages/DashboardPage.vue b/src/pages/DashboardPage.vue index 1c0b7be..0b35dd9 100644 --- a/src/pages/DashboardPage.vue +++ b/src/pages/DashboardPage.vue @@ -1,5 +1,5 @@ diff --git a/src/pages/LoginPage.vue b/src/pages/LoginPage.vue index e23d2ee..cb87950 100644 --- a/src/pages/LoginPage.vue +++ b/src/pages/LoginPage.vue @@ -6,7 +6,7 @@ - + diff --git a/src/pages/system/dictionary/IndexPage.vue b/src/pages/system/dictionary/IndexPage.vue index e106925..e3a294f 100644 --- a/src/pages/system/dictionary/IndexPage.vue +++ b/src/pages/system/dictionary/IndexPage.vue @@ -1,5 +1,5 @@