Skip to content

Commit

Permalink
feat: v5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
hooray committed Jan 16, 2025
1 parent 40b7f93 commit cfd23d5
Show file tree
Hide file tree
Showing 68 changed files with 1,420 additions and 702 deletions.
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
shamefully-hoist=true
strict-peer-dependencies=false
engine-strict=true
verify-deps-before-run=prompt
7 changes: 2 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,12 @@
"lint:tsc": "vue-tsc -b",
"lint:eslint": "eslint . --cache --fix",
"lint:stylelint": "stylelint \"src/**/*.{css,scss,vue}\" --cache --fix",
"postinstall": "simple-git-hooks",
"preinstall": "npx only-allow pnpm",
"postinstall": "simple-git-hooks",
"commit": "git cz",
"release": "bumpp"
},
"dependencies": {
"@headlessui/vue": "^1.7.23",
"@imengyu/vue3-context-menu": "^1.4.4",
"@vee-validate/zod": "^4.15.0",
"@vueuse/components": "^12.3.0",
"@vueuse/core": "^12.3.0",
Expand All @@ -42,8 +40,6 @@
"lucide-vue-next": "^0.469.0",
"mitt": "^3.0.1",
"nprogress": "^0.2.0",
"overlayscrollbars": "^2.10.1",
"overlayscrollbars-vue": "^0.5.9",
"path-browserify": "^1.0.1",
"path-to-regexp": "^8.2.0",
"pinia": "^2.3.0",
Expand All @@ -69,6 +65,7 @@
"@types/path-browserify": "^1.0.3",
"@types/qs": "^6.9.17",
"@unocss/eslint-plugin": "^0.65.3",
"@unocss/preset-legacy-compat": "^65.4.2",
"@vitejs/plugin-legacy": "^6.0.0",
"@vitejs/plugin-vue": "^5.2.1",
"@vitejs/plugin-vue-jsx": "^4.1.1",
Expand Down
59 changes: 15 additions & 44 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
<script setup lang="ts">
import useSettingsStore from '@/store/modules/settings'
import { ua } from '@/utils/ua'
import hotkeys from 'hotkeys-js'
import Provider from './ui/provider/index.vue'
import eventBus from './utils/eventBus'
const route = useRoute()
Expand Down Expand Up @@ -40,9 +38,6 @@ onMounted(() => {
window.addEventListener('resize', () => {
settingsStore.setMode(document.documentElement.clientWidth)
})
hotkeys('alt+i', () => {
eventBus.emit('global-system-info-toggle')
})
})
</script>

Expand Down
2 changes: 1 addition & 1 deletion src/api/modules/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default {
// 修改密码
passwordEdit: (data: {
password: string
newpassword: string
newPassword: string
}) => api.post('user/password/edit', data, {
baseURL: '/mock/',
}),
Expand Down
43 changes: 4 additions & 39 deletions src/assets/styles/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
/* 明暗模式 CSS 变量 */
/* stylelint-disable-next-line no-duplicate-selectors */
:root {
--g-box-shadow-color: rgb(0 0 0 / 12%);
color-scheme: light;

&::view-transition-old(root),
&::view-transition-new(root) {
Expand All @@ -38,7 +38,7 @@
}

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

&::view-transition-old(root) {
z-index: 9999;
Expand All @@ -50,29 +50,9 @@
}
}

body:not([data-os="macOS"]) {
::-webkit-scrollbar {
width: 12px;
height: 12px;
}

::-webkit-scrollbar-thumb {
background-color: hsl(var(--primary) / 30%);
background-clip: padding-box;
border: 3px solid transparent;
border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
background-color: hsl(var(--primary) / 50%);
}

::-webkit-scrollbar-track {
background-color: transparent;
}
}

* {
scrollbar-color: hsl(var(--border)) transparent;
scrollbar-width: thin;
border-color: hsl(var(--border));
}

Expand All @@ -88,10 +68,6 @@ body {
color: hsl(var(--foreground));
background: hsl(var(--background));
-webkit-tap-highlight-color: transparent;

&.overflow-hidden {
overflow: hidden;
}
}

#app {
Expand All @@ -102,14 +78,3 @@ body {
textarea {
font-family: inherit;
}

/* Overrides OverlayScrollbars */
[data-overlayscrollbars-contents] {
overscroll-behavior: contain;
}

.os-scrollbar {
--os-handle-bg: hsl(var(--primary) / 30%);
--os-handle-bg-hover: hsl(var(--primary) / 40%);
--os-handle-bg-active: hsl(var(--primary) / 50%);
}
2 changes: 1 addition & 1 deletion src/assets/styles/nprogress.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
position: fixed;
top: 0;
left: 0;
z-index: 2000;
z-index: 3000;
width: 100%;
height: 2px;
background: hsl(var(--primary));
Expand Down
91 changes: 91 additions & 0 deletions src/components/AccountForm/EditPasswordForm.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<script setup lang="ts">
import useUserStore from '@/store/modules/user'
import { FormControl, FormField, FormItem, FormMessage } from '@/ui/shadcn/ui/form'
import { toTypedSchema } from '@vee-validate/zod'
import { useForm } from 'vee-validate'
import { toast } from 'vue-sonner'
import * as z from 'zod'
defineOptions({
name: 'EditPasswordForm',
})
const userStore = useUserStore()
const loading = ref(false)
const form = useForm({
validationSchema: toTypedSchema(
z.object({
password: z.string().min(1, '请输入原密码'),
newPassword: z.string().min(1, '请输入新密码').min(6, '密码长度为6到18位').max(18, '密码长度为6到18位'),
checkPassword: z.string().min(1, '请确认新密码'),
}).refine(data => data.newPassword === data.checkPassword, {
message: '两次输入的密码不一致',
path: ['checkPassword'],
}),
),
initialValues: {
password: '',
newPassword: '',
checkPassword: '',
},
})
const onSubmit = form.handleSubmit((values) => {
loading.value = true
userStore.editPassword(values).then(async () => {
toast.success('模拟修改成功,请重新登录')
userStore.logout()
}).finally(() => {
loading.value = false
})
})
</script>

<template>
<div class="w-full flex-col-stretch-center">
<div class="mb-6 space-y-2">
<h3 class="text-4xl color-[var(--el-text-color-primary)] font-bold">
修改密码
</h3>
<p class="text-sm text-muted-foreground lg:text-base">
请输入原密码、新密码和确认密码
</p>
</div>
<form @submit="onSubmit">
<FormField v-slot="{ componentField, errors }" name="password">
<FormItem class="relative pb-6 space-y-0">
<FormControl>
<FaInput type="password" placeholder="请输入原密码" class="w-full" :class="errors.length && 'border-destructive'" v-bind="componentField" />
</FormControl>
<Transition enter-active-class="transition-opacity" enter-from-class="opacity-0" leave-active-class="transition-opacity" leave-to-class="opacity-0">
<FormMessage class="absolute bottom-1 text-xs" />
</Transition>
</FormItem>
</FormField>
<FormField v-slot="{ componentField, errors }" name="newPassword">
<FormItem class="relative pb-6 space-y-0">
<FormControl>
<FaInput type="password" placeholder="请输入新密码" class="w-full" :class="errors.length && 'border-destructive'" v-bind="componentField" />
</FormControl>
<Transition enter-active-class="transition-opacity" enter-from-class="opacity-0" leave-active-class="transition-opacity" leave-to-class="opacity-0">
<FormMessage class="absolute bottom-1 text-xs" />
</Transition>
</FormItem>
</FormField>
<FormField v-slot="{ componentField, errors }" name="checkPassword">
<FormItem class="relative pb-6 space-y-0">
<FormControl>
<FaInput type="password" placeholder="请确认新密码" class="w-full" :class="errors.length && 'border-destructive'" v-bind="componentField" />
</FormControl>
<Transition enter-active-class="transition-opacity" enter-from-class="opacity-0" leave-active-class="transition-opacity" leave-to-class="opacity-0">
<FormMessage class="absolute bottom-1 text-xs" />
</Transition>
</FormItem>
</FormField>
<FaButton :loading="loading" size="lg" class="mt-8 w-full" type="submit">
保存
</FaButton>
</form>
</div>
</template>
Loading

0 comments on commit cfd23d5

Please sign in to comment.