Skip to content

Commit cfd23d5

Browse files
committed
feat: v5.0
1 parent 40b7f93 commit cfd23d5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+1420
-702
lines changed

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
shamefully-hoist=true
22
strict-peer-dependencies=false
33
engine-strict=true
4+
verify-deps-before-run=prompt

package.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,12 @@
1717
"lint:tsc": "vue-tsc -b",
1818
"lint:eslint": "eslint . --cache --fix",
1919
"lint:stylelint": "stylelint \"src/**/*.{css,scss,vue}\" --cache --fix",
20-
"postinstall": "simple-git-hooks",
2120
"preinstall": "npx only-allow pnpm",
21+
"postinstall": "simple-git-hooks",
2222
"commit": "git cz",
2323
"release": "bumpp"
2424
},
2525
"dependencies": {
26-
"@headlessui/vue": "^1.7.23",
27-
"@imengyu/vue3-context-menu": "^1.4.4",
2826
"@vee-validate/zod": "^4.15.0",
2927
"@vueuse/components": "^12.3.0",
3028
"@vueuse/core": "^12.3.0",
@@ -42,8 +40,6 @@
4240
"lucide-vue-next": "^0.469.0",
4341
"mitt": "^3.0.1",
4442
"nprogress": "^0.2.0",
45-
"overlayscrollbars": "^2.10.1",
46-
"overlayscrollbars-vue": "^0.5.9",
4743
"path-browserify": "^1.0.1",
4844
"path-to-regexp": "^8.2.0",
4945
"pinia": "^2.3.0",
@@ -69,6 +65,7 @@
6965
"@types/path-browserify": "^1.0.3",
7066
"@types/qs": "^6.9.17",
7167
"@unocss/eslint-plugin": "^0.65.3",
68+
"@unocss/preset-legacy-compat": "^65.4.2",
7269
"@vitejs/plugin-legacy": "^6.0.0",
7370
"@vitejs/plugin-vue": "^5.2.1",
7471
"@vitejs/plugin-vue-jsx": "^4.1.1",

pnpm-lock.yaml

Lines changed: 15 additions & 44 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/App.vue

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
<script setup lang="ts">
22
import useSettingsStore from '@/store/modules/settings'
33
import { ua } from '@/utils/ua'
4-
import hotkeys from 'hotkeys-js'
54
import Provider from './ui/provider/index.vue'
6-
import eventBus from './utils/eventBus'
75
86
const route = useRoute()
97
@@ -40,9 +38,6 @@ onMounted(() => {
4038
window.addEventListener('resize', () => {
4139
settingsStore.setMode(document.documentElement.clientWidth)
4240
})
43-
hotkeys('alt+i', () => {
44-
eventBus.emit('global-system-info-toggle')
45-
})
4641
})
4742
</script>
4843

src/api/modules/user.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default {
1717
// 修改密码
1818
passwordEdit: (data: {
1919
password: string
20-
newpassword: string
20+
newPassword: string
2121
}) => api.post('user/password/edit', data, {
2222
baseURL: '/mock/',
2323
}),

src/assets/styles/globals.css

Lines changed: 4 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
/* 明暗模式 CSS 变量 */
2222
/* stylelint-disable-next-line no-duplicate-selectors */
2323
:root {
24-
--g-box-shadow-color: rgb(0 0 0 / 12%);
24+
color-scheme: light;
2525

2626
&::view-transition-old(root),
2727
&::view-transition-new(root) {
@@ -38,7 +38,7 @@
3838
}
3939

4040
&.dark {
41-
--g-box-shadow-color: rgb(0 0 0 / 72%);
41+
color-scheme: dark;
4242

4343
&::view-transition-old(root) {
4444
z-index: 9999;
@@ -50,29 +50,9 @@
5050
}
5151
}
5252

53-
body:not([data-os="macOS"]) {
54-
::-webkit-scrollbar {
55-
width: 12px;
56-
height: 12px;
57-
}
58-
59-
::-webkit-scrollbar-thumb {
60-
background-color: hsl(var(--primary) / 30%);
61-
background-clip: padding-box;
62-
border: 3px solid transparent;
63-
border-radius: 6px;
64-
}
65-
66-
::-webkit-scrollbar-thumb:hover {
67-
background-color: hsl(var(--primary) / 50%);
68-
}
69-
70-
::-webkit-scrollbar-track {
71-
background-color: transparent;
72-
}
73-
}
74-
7553
* {
54+
scrollbar-color: hsl(var(--border)) transparent;
55+
scrollbar-width: thin;
7656
border-color: hsl(var(--border));
7757
}
7858

@@ -88,10 +68,6 @@ body {
8868
color: hsl(var(--foreground));
8969
background: hsl(var(--background));
9070
-webkit-tap-highlight-color: transparent;
91-
92-
&.overflow-hidden {
93-
overflow: hidden;
94-
}
9571
}
9672

9773
#app {
@@ -102,14 +78,3 @@ body {
10278
textarea {
10379
font-family: inherit;
10480
}
105-
106-
/* Overrides OverlayScrollbars */
107-
[data-overlayscrollbars-contents] {
108-
overscroll-behavior: contain;
109-
}
110-
111-
.os-scrollbar {
112-
--os-handle-bg: hsl(var(--primary) / 30%);
113-
--os-handle-bg-hover: hsl(var(--primary) / 40%);
114-
--os-handle-bg-active: hsl(var(--primary) / 50%);
115-
}

src/assets/styles/nprogress.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
position: fixed;
66
top: 0;
77
left: 0;
8-
z-index: 2000;
8+
z-index: 3000;
99
width: 100%;
1010
height: 2px;
1111
background: hsl(var(--primary));
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
<script setup lang="ts">
2+
import useUserStore from '@/store/modules/user'
3+
import { FormControl, FormField, FormItem, FormMessage } from '@/ui/shadcn/ui/form'
4+
import { toTypedSchema } from '@vee-validate/zod'
5+
import { useForm } from 'vee-validate'
6+
import { toast } from 'vue-sonner'
7+
import * as z from 'zod'
8+
9+
defineOptions({
10+
name: 'EditPasswordForm',
11+
})
12+
13+
const userStore = useUserStore()
14+
15+
const loading = ref(false)
16+
17+
const form = useForm({
18+
validationSchema: toTypedSchema(
19+
z.object({
20+
password: z.string().min(1, '请输入原密码'),
21+
newPassword: z.string().min(1, '请输入新密码').min(6, '密码长度为6到18位').max(18, '密码长度为6到18位'),
22+
checkPassword: z.string().min(1, '请确认新密码'),
23+
}).refine(data => data.newPassword === data.checkPassword, {
24+
message: '两次输入的密码不一致',
25+
path: ['checkPassword'],
26+
}),
27+
),
28+
initialValues: {
29+
password: '',
30+
newPassword: '',
31+
checkPassword: '',
32+
},
33+
})
34+
const onSubmit = form.handleSubmit((values) => {
35+
loading.value = true
36+
userStore.editPassword(values).then(async () => {
37+
toast.success('模拟修改成功,请重新登录')
38+
userStore.logout()
39+
}).finally(() => {
40+
loading.value = false
41+
})
42+
})
43+
</script>
44+
45+
<template>
46+
<div class="w-full flex-col-stretch-center">
47+
<div class="mb-6 space-y-2">
48+
<h3 class="text-4xl color-[var(--el-text-color-primary)] font-bold">
49+
修改密码
50+
</h3>
51+
<p class="text-sm text-muted-foreground lg:text-base">
52+
请输入原密码、新密码和确认密码
53+
</p>
54+
</div>
55+
<form @submit="onSubmit">
56+
<FormField v-slot="{ componentField, errors }" name="password">
57+
<FormItem class="relative pb-6 space-y-0">
58+
<FormControl>
59+
<FaInput type="password" placeholder="请输入原密码" class="w-full" :class="errors.length && 'border-destructive'" v-bind="componentField" />
60+
</FormControl>
61+
<Transition enter-active-class="transition-opacity" enter-from-class="opacity-0" leave-active-class="transition-opacity" leave-to-class="opacity-0">
62+
<FormMessage class="absolute bottom-1 text-xs" />
63+
</Transition>
64+
</FormItem>
65+
</FormField>
66+
<FormField v-slot="{ componentField, errors }" name="newPassword">
67+
<FormItem class="relative pb-6 space-y-0">
68+
<FormControl>
69+
<FaInput type="password" placeholder="请输入新密码" class="w-full" :class="errors.length && 'border-destructive'" v-bind="componentField" />
70+
</FormControl>
71+
<Transition enter-active-class="transition-opacity" enter-from-class="opacity-0" leave-active-class="transition-opacity" leave-to-class="opacity-0">
72+
<FormMessage class="absolute bottom-1 text-xs" />
73+
</Transition>
74+
</FormItem>
75+
</FormField>
76+
<FormField v-slot="{ componentField, errors }" name="checkPassword">
77+
<FormItem class="relative pb-6 space-y-0">
78+
<FormControl>
79+
<FaInput type="password" placeholder="请确认新密码" class="w-full" :class="errors.length && 'border-destructive'" v-bind="componentField" />
80+
</FormControl>
81+
<Transition enter-active-class="transition-opacity" enter-from-class="opacity-0" leave-active-class="transition-opacity" leave-to-class="opacity-0">
82+
<FormMessage class="absolute bottom-1 text-xs" />
83+
</Transition>
84+
</FormItem>
85+
</FormField>
86+
<FaButton :loading="loading" size="lg" class="mt-8 w-full" type="submit">
87+
保存
88+
</FaButton>
89+
</form>
90+
</div>
91+
</template>

0 commit comments

Comments
 (0)