chore: 从 git 中移除 backend/target 目录

- 使用 git rm --cached 从版本控制中删除 target 目录
- .gitignore 已配置忽略 target 和 node_modules
- 本地文件保留,仅从 git 索引中删除

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
andyandClaude Sonnet 4.5 committed 2026-01-26 16:12:04 +08:00
1 parent 934b8aad40
commit ea8f8390da
99 files changed
+3551 -724

No files matched your search

+124 -5
View File
@@ -25,6 +25,10 @@
<el-icon><Shop /></el-icon>
<span>经销商管理</span>
</el-menu-item>
<el-menu-item v-if="userStore.isAdmin" index="/system-config">
<el-icon><Setting /></el-icon>
<span>系统配置</span>
</el-menu-item>
</el-menu>
</el-aside>
<el-container>
@@ -47,6 +51,10 @@
</span>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item @click="showChangePasswordDialog = true">
<el-icon><Lock /></el-icon>
修改密码
</el-dropdown-item>
<el-dropdown-item @click="handleLogout">
<el-icon><SwitchButton /></el-icon>
退出登录
@@ -61,14 +69,55 @@
<router-view />
</el-main>
</el-container>
<!-- 修改密码对话框 -->
<el-dialog
v-model="showChangePasswordDialog"
title="修改密码"
width="500px"
@close="handleDialogClose"
>
<el-form ref="formRef" :model="passwordForm" :rules="passwordRules" label-width="100px">
<el-form-item label="原密码" prop="oldPassword">
<el-input
v-model="passwordForm.oldPassword"
type="password"
placeholder="请输入原密码"
show-password
/>
</el-form-item>
<el-form-item label="新密码" prop="newPassword">
<el-input
v-model="passwordForm.newPassword"
type="password"
placeholder="请输入新密码(6-20位)"
show-password
/>
</el-form-item>
<el-form-item label="确认密码" prop="confirmPassword">
<el-input
v-model="passwordForm.confirmPassword"
type="password"
placeholder="请再次输入新密码"
show-password
/>
</el-form-item>
</el-form>
<template #footer>
<el-button @click="showChangePasswordDialog = false">取消</el-button>
<el-button type="primary" @click="handleChangePassword">确定</el-button>
</template>
</el-dialog>
</el-container>
</template>
<script setup lang="ts">
import { computed } from 'vue'
import { computed, reactive, ref } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { ElMessageBox } from 'element-plus'
import { ElMessage, ElMessageBox, type FormInstance, type FormRules } from 'element-plus'
import { useUserStore } from '@/stores/user'
import { changePassword } from '@/api/auth'
import { hashPassword } from '@/utils/crypto'
const route = useRoute()
const router = useRouter()
@@ -77,11 +126,81 @@ const userStore = useUserStore()
const activeMenu = computed(() => route.path)
const currentPageTitle = computed(() => route.meta.title as string || '首页')
// 修改密码对话框
const showChangePasswordDialog = ref(false)
const formRef = ref<FormInstance>()
const passwordForm = reactive({
oldPassword: '',
newPassword: '',
confirmPassword: ''
})
const passwordRules: FormRules = {
oldPassword: [{ required: true, message: '请输入原密码', trigger: 'blur' }],
newPassword: [
{ required: true, message: '请输入新密码', trigger: 'blur' },
{ min: 6, max: 20, message: '新密码长度必须在6-20位之间', trigger: 'blur' }
],
confirmPassword: [
{ required: true, message: '请再次输入新密码', trigger: 'blur' },
{
validator: (rule, value, callback) => {
if (value !== passwordForm.newPassword) {
callback(new Error('两次输入的密码不一致'))
} else {
callback()
}
},
trigger: 'blur'
}
]
}
const handleChangePassword = async () => {
if (!formRef.value) return
await formRef.value.validate(async (valid) => {
if (valid) {
try {
// 对密码进行 SHA-256 哈希后再传输
const hashedOldPassword = await hashPassword(passwordForm.oldPassword)
const hashedNewPassword = await hashPassword(passwordForm.newPassword)
await changePassword({
oldPassword: hashedOldPassword,
newPassword: hashedNewPassword
})
ElMessage.success('密码修改成功,请重新登录')
showChangePasswordDialog.value = false
// 退出登录
userStore.logout()
router.push('/login')
} catch (error) {
console.error('修改密码失败', error)
}
}
})
}
const handleDialogClose = () => {
formRef.value?.resetFields()
Object.assign(passwordForm, {
oldPassword: '',
newPassword: '',
confirmPassword: ''
})
}
const handleLogout = async () => {
try {
await ElMessageBox.confirm('确定要退出登录吗?', '提示', {
type: 'warning'
})
await ElMessageBox.confirm(
'确定要退出登录吗?',
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}
)
userStore.logout()
router.push('/login')
} catch {