修改密码页面添加
This commit is contained in:
@@ -33,9 +33,9 @@ type DropdownOption =
|
|||||||
const options = computed(() => {
|
const options = computed(() => {
|
||||||
const opts: DropdownOption[] = [
|
const opts: DropdownOption[] = [
|
||||||
{
|
{
|
||||||
label: '个人中心',
|
label: '修改密码',
|
||||||
key: 'user-center',
|
key: 'user-center',
|
||||||
icon: SvgIconVNode({ icon: 'ph:user-circle', fontSize: 18 })
|
icon: SvgIconVNode({ icon: 'boxicons:lock-open', fontSize: 18 })
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'divider',
|
type: 'divider',
|
||||||
@@ -67,8 +67,7 @@ function handleDropdown(key: DropdownKey) {
|
|||||||
if (key === 'logout') {
|
if (key === 'logout') {
|
||||||
logout();
|
logout();
|
||||||
} else {
|
} else {
|
||||||
// If your other options are jumps from other routes, they will be directly supported here
|
routerPushByKey('systemmanage_changepassword');
|
||||||
// routerPushByKey(key);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -255,7 +255,8 @@ const local: App.I18n.Schema = {
|
|||||||
report: '统计报表',
|
report: '统计报表',
|
||||||
signstatistics: '质量会签统计',
|
signstatistics: '质量会签统计',
|
||||||
factoryoverview: '全工厂统计概览',
|
factoryoverview: '全工厂统计概览',
|
||||||
systemmanage_setting: '系统配置'
|
systemmanage_setting: '系统配置',
|
||||||
|
systemmanage_changepassword: '修改密码'
|
||||||
},
|
},
|
||||||
form: {
|
form: {
|
||||||
required: '不能为空',
|
required: '不能为空',
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ export const views: Record<LastLevelRouteKey, RouteComponent | (() => Promise<Ro
|
|||||||
report: () => import("@/views/report/index.vue"),
|
report: () => import("@/views/report/index.vue"),
|
||||||
riskstatistics: () => import("@/views/riskStatistics/index.vue"),
|
riskstatistics: () => import("@/views/riskStatistics/index.vue"),
|
||||||
signstatistics: () => import("@/views/signStatistics/index.vue"),
|
signstatistics: () => import("@/views/signStatistics/index.vue"),
|
||||||
|
systemmanage_changepassword: () => import("@/views/systemManage/changePassword/index.vue"),
|
||||||
systemmanage_role: () => import("@/views/systemManage/role/index.vue"),
|
systemmanage_role: () => import("@/views/systemManage/role/index.vue"),
|
||||||
systemmanage_setting: () => import("@/views/systemManage/setting/index.vue"),
|
systemmanage_setting: () => import("@/views/systemManage/setting/index.vue"),
|
||||||
systemmanage_template: () => import("@/views/systemManage/template/index.vue"),
|
systemmanage_template: () => import("@/views/systemManage/template/index.vue"),
|
||||||
|
|||||||
@@ -56,7 +56,6 @@ export const generatedRoutes: GeneratedRoute[] = [
|
|||||||
component: 'view.changeledger_mychanges',
|
component: 'view.changeledger_mychanges',
|
||||||
meta: {
|
meta: {
|
||||||
title: '我发起的变更',
|
title: '我发起的变更',
|
||||||
icon: '',
|
|
||||||
i18nKey: 'route.changeledger_mychanges'
|
i18nKey: 'route.changeledger_mychanges'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -66,7 +65,6 @@ export const generatedRoutes: GeneratedRoute[] = [
|
|||||||
component: 'view.changeledger_workshopchanges',
|
component: 'view.changeledger_workshopchanges',
|
||||||
meta: {
|
meta: {
|
||||||
title: '本车间变更',
|
title: '本车间变更',
|
||||||
icon: '',
|
|
||||||
i18nKey: 'route.changeledger_workshopchanges'
|
i18nKey: 'route.changeledger_workshopchanges'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -100,7 +98,6 @@ export const generatedRoutes: GeneratedRoute[] = [
|
|||||||
component: 'view.docs_archives',
|
component: 'view.docs_archives',
|
||||||
meta: {
|
meta: {
|
||||||
title: '资料档案库',
|
title: '资料档案库',
|
||||||
icon: '',
|
|
||||||
i18nKey: 'route.docs_archives'
|
i18nKey: 'route.docs_archives'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -110,7 +107,6 @@ export const generatedRoutes: GeneratedRoute[] = [
|
|||||||
component: 'view.docs_query',
|
component: 'view.docs_query',
|
||||||
meta: {
|
meta: {
|
||||||
title: '变更归档查询',
|
title: '变更归档查询',
|
||||||
icon: '',
|
|
||||||
i18nKey: 'route.docs_query'
|
i18nKey: 'route.docs_query'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -167,7 +163,6 @@ export const generatedRoutes: GeneratedRoute[] = [
|
|||||||
component: 'view.my_closeconfirm',
|
component: 'view.my_closeconfirm',
|
||||||
meta: {
|
meta: {
|
||||||
title: '关闭确认',
|
title: '关闭确认',
|
||||||
icon: '',
|
|
||||||
i18nKey: 'route.my_closeconfirm'
|
i18nKey: 'route.my_closeconfirm'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -177,7 +172,6 @@ export const generatedRoutes: GeneratedRoute[] = [
|
|||||||
component: 'view.my_datachangecenter',
|
component: 'view.my_datachangecenter',
|
||||||
meta: {
|
meta: {
|
||||||
title: '变更数据中心',
|
title: '变更数据中心',
|
||||||
icon: '',
|
|
||||||
i18nKey: 'route.my_datachangecenter'
|
i18nKey: 'route.my_datachangecenter'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -187,7 +181,6 @@ export const generatedRoutes: GeneratedRoute[] = [
|
|||||||
component: 'view.my_effect',
|
component: 'view.my_effect',
|
||||||
meta: {
|
meta: {
|
||||||
title: '变更投入和效果',
|
title: '变更投入和效果',
|
||||||
icon: '',
|
|
||||||
i18nKey: 'route.my_effect'
|
i18nKey: 'route.my_effect'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -197,7 +190,6 @@ export const generatedRoutes: GeneratedRoute[] = [
|
|||||||
component: 'view.my_highrisk',
|
component: 'view.my_highrisk',
|
||||||
meta: {
|
meta: {
|
||||||
title: '本专业高风险',
|
title: '本专业高风险',
|
||||||
icon: '',
|
|
||||||
i18nKey: 'route.my_highrisk'
|
i18nKey: 'route.my_highrisk'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -207,7 +199,6 @@ export const generatedRoutes: GeneratedRoute[] = [
|
|||||||
component: 'view.my_highriskdetail',
|
component: 'view.my_highriskdetail',
|
||||||
meta: {
|
meta: {
|
||||||
title: '高风险场景详情',
|
title: '高风险场景详情',
|
||||||
icon: '',
|
|
||||||
hideInMenu: true,
|
hideInMenu: true,
|
||||||
i18nKey: 'route.my_highriskdetail'
|
i18nKey: 'route.my_highriskdetail'
|
||||||
}
|
}
|
||||||
@@ -218,7 +209,6 @@ export const generatedRoutes: GeneratedRoute[] = [
|
|||||||
component: 'view.my_initiatechange',
|
component: 'view.my_initiatechange',
|
||||||
meta: {
|
meta: {
|
||||||
title: '发起变更',
|
title: '发起变更',
|
||||||
icon: '',
|
|
||||||
i18nKey: 'route.my_initiatechange'
|
i18nKey: 'route.my_initiatechange'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -228,7 +218,6 @@ export const generatedRoutes: GeneratedRoute[] = [
|
|||||||
component: 'view.my_mydraft',
|
component: 'view.my_mydraft',
|
||||||
meta: {
|
meta: {
|
||||||
title: '我的草稿',
|
title: '我的草稿',
|
||||||
icon: '',
|
|
||||||
i18nKey: 'route.my_mydraft'
|
i18nKey: 'route.my_mydraft'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -238,7 +227,6 @@ export const generatedRoutes: GeneratedRoute[] = [
|
|||||||
component: 'view.my_mytask',
|
component: 'view.my_mytask',
|
||||||
meta: {
|
meta: {
|
||||||
title: '我的任务',
|
title: '我的任务',
|
||||||
icon: '',
|
|
||||||
i18nKey: 'route.my_mytask'
|
i18nKey: 'route.my_mytask'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -248,7 +236,6 @@ export const generatedRoutes: GeneratedRoute[] = [
|
|||||||
component: 'view.my_pending',
|
component: 'view.my_pending',
|
||||||
meta: {
|
meta: {
|
||||||
title: '待我处理',
|
title: '待我处理',
|
||||||
icon: '',
|
|
||||||
i18nKey: 'route.my_pending'
|
i18nKey: 'route.my_pending'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -258,7 +245,6 @@ export const generatedRoutes: GeneratedRoute[] = [
|
|||||||
component: 'view.my_pendingchange',
|
component: 'view.my_pendingchange',
|
||||||
meta: {
|
meta: {
|
||||||
title: '待投用变更',
|
title: '待投用变更',
|
||||||
icon: '',
|
|
||||||
i18nKey: 'route.my_pendingchange'
|
i18nKey: 'route.my_pendingchange'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -268,7 +254,6 @@ export const generatedRoutes: GeneratedRoute[] = [
|
|||||||
component: 'view.my_process',
|
component: 'view.my_process',
|
||||||
meta: {
|
meta: {
|
||||||
title: '流程演示',
|
title: '流程演示',
|
||||||
icon: '',
|
|
||||||
i18nKey: 'route.my_process'
|
i18nKey: 'route.my_process'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -278,7 +263,6 @@ export const generatedRoutes: GeneratedRoute[] = [
|
|||||||
component: 'view.my_processdetail',
|
component: 'view.my_processdetail',
|
||||||
meta: {
|
meta: {
|
||||||
title: '流程演示详情',
|
title: '流程演示详情',
|
||||||
icon: '',
|
|
||||||
hideInMenu: true,
|
hideInMenu: true,
|
||||||
i18nKey: 'route.my_processdetail'
|
i18nKey: 'route.my_processdetail'
|
||||||
}
|
}
|
||||||
@@ -289,7 +273,6 @@ export const generatedRoutes: GeneratedRoute[] = [
|
|||||||
component: 'view.my_pssr',
|
component: 'view.my_pssr',
|
||||||
meta: {
|
meta: {
|
||||||
title: 'PSSR监督',
|
title: 'PSSR监督',
|
||||||
icon: '',
|
|
||||||
i18nKey: 'route.my_pssr'
|
i18nKey: 'route.my_pssr'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -339,13 +322,22 @@ export const generatedRoutes: GeneratedRoute[] = [
|
|||||||
i18nKey: 'route.systemmanage'
|
i18nKey: 'route.systemmanage'
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
|
{
|
||||||
|
name: 'systemmanage_changepassword',
|
||||||
|
path: '/systemmanage/changepassword',
|
||||||
|
component: 'view.systemmanage_changepassword',
|
||||||
|
meta: {
|
||||||
|
title: '修改密码',
|
||||||
|
i18nKey: 'route.systemmanage_changepassword',
|
||||||
|
order: 5
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'systemmanage_role',
|
name: 'systemmanage_role',
|
||||||
path: '/systemmanage/role',
|
path: '/systemmanage/role',
|
||||||
component: 'view.systemmanage_role',
|
component: 'view.systemmanage_role',
|
||||||
meta: {
|
meta: {
|
||||||
title: '角色管理',
|
title: '角色管理',
|
||||||
icon: '',
|
|
||||||
order: 2,
|
order: 2,
|
||||||
i18nKey: 'route.systemmanage_role'
|
i18nKey: 'route.systemmanage_role'
|
||||||
}
|
}
|
||||||
@@ -356,7 +348,6 @@ export const generatedRoutes: GeneratedRoute[] = [
|
|||||||
component: 'view.systemmanage_setting',
|
component: 'view.systemmanage_setting',
|
||||||
meta: {
|
meta: {
|
||||||
title: '系统配置',
|
title: '系统配置',
|
||||||
icon: '',
|
|
||||||
order: 4,
|
order: 4,
|
||||||
i18nKey: 'route.systemmanage_setting'
|
i18nKey: 'route.systemmanage_setting'
|
||||||
}
|
}
|
||||||
@@ -367,7 +358,6 @@ export const generatedRoutes: GeneratedRoute[] = [
|
|||||||
component: 'view.systemmanage_template',
|
component: 'view.systemmanage_template',
|
||||||
meta: {
|
meta: {
|
||||||
title: '审批模板管理',
|
title: '审批模板管理',
|
||||||
icon: '',
|
|
||||||
order: 3,
|
order: 3,
|
||||||
i18nKey: 'route.systemmanage_template'
|
i18nKey: 'route.systemmanage_template'
|
||||||
}
|
}
|
||||||
@@ -378,7 +368,6 @@ export const generatedRoutes: GeneratedRoute[] = [
|
|||||||
component: 'view.systemmanage_user',
|
component: 'view.systemmanage_user',
|
||||||
meta: {
|
meta: {
|
||||||
title: '架构及用户管理',
|
title: '架构及用户管理',
|
||||||
icon: '',
|
|
||||||
order: 1,
|
order: 1,
|
||||||
i18nKey: 'route.systemmanage_user'
|
i18nKey: 'route.systemmanage_user'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -194,6 +194,7 @@ const routeMap: RouteMap = {
|
|||||||
"riskstatistics": "/riskstatistics",
|
"riskstatistics": "/riskstatistics",
|
||||||
"signstatistics": "/signstatistics",
|
"signstatistics": "/signstatistics",
|
||||||
"systemmanage": "/systemmanage",
|
"systemmanage": "/systemmanage",
|
||||||
|
"systemmanage_changepassword": "/systemmanage/changepassword",
|
||||||
"systemmanage_role": "/systemmanage/role",
|
"systemmanage_role": "/systemmanage/role",
|
||||||
"systemmanage_setting": "/systemmanage/setting",
|
"systemmanage_setting": "/systemmanage/setting",
|
||||||
"systemmanage_template": "/systemmanage/template",
|
"systemmanage_template": "/systemmanage/template",
|
||||||
|
|||||||
@@ -100,3 +100,12 @@ export function resetPasswordApi(id: number) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 修改用户密码
|
||||||
|
export function changePasswordApi(params: { oldPassword: string, password: string }) {
|
||||||
|
return request({
|
||||||
|
url: `/api/user/change-password`,
|
||||||
|
method: 'post',
|
||||||
|
data: params
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
Vendored
+6
@@ -42,6 +42,7 @@ declare module 'vue' {
|
|||||||
NCascader: typeof import('naive-ui')['NCascader']
|
NCascader: typeof import('naive-ui')['NCascader']
|
||||||
NCheckbox: typeof import('naive-ui')['NCheckbox']
|
NCheckbox: typeof import('naive-ui')['NCheckbox']
|
||||||
NCheckboxGroup: typeof import('naive-ui')['NCheckboxGroup']
|
NCheckboxGroup: typeof import('naive-ui')['NCheckboxGroup']
|
||||||
|
NCol: typeof import('naive-ui')['NCol']
|
||||||
NColorPicker: typeof import('naive-ui')['NColorPicker']
|
NColorPicker: typeof import('naive-ui')['NColorPicker']
|
||||||
NDataTable: typeof import('naive-ui')['NDataTable']
|
NDataTable: typeof import('naive-ui')['NDataTable']
|
||||||
NDatePicker: typeof import('naive-ui')['NDatePicker']
|
NDatePicker: typeof import('naive-ui')['NDatePicker']
|
||||||
@@ -64,6 +65,7 @@ declare module 'vue' {
|
|||||||
NMenu: typeof import('naive-ui')['NMenu']
|
NMenu: typeof import('naive-ui')['NMenu']
|
||||||
NMessageProvider: typeof import('naive-ui')['NMessageProvider']
|
NMessageProvider: typeof import('naive-ui')['NMessageProvider']
|
||||||
NModal: typeof import('naive-ui')['NModal']
|
NModal: typeof import('naive-ui')['NModal']
|
||||||
|
NNInput: typeof import('naive-ui')['NNInput']
|
||||||
NNotificationProvider: typeof import('naive-ui')['NNotificationProvider']
|
NNotificationProvider: typeof import('naive-ui')['NNotificationProvider']
|
||||||
NPagination: typeof import('naive-ui')['NPagination']
|
NPagination: typeof import('naive-ui')['NPagination']
|
||||||
NPopconfirm: typeof import('naive-ui')['NPopconfirm']
|
NPopconfirm: typeof import('naive-ui')['NPopconfirm']
|
||||||
@@ -71,6 +73,7 @@ declare module 'vue' {
|
|||||||
NProgress: typeof import('naive-ui')['NProgress']
|
NProgress: typeof import('naive-ui')['NProgress']
|
||||||
NRadio: typeof import('naive-ui')['NRadio']
|
NRadio: typeof import('naive-ui')['NRadio']
|
||||||
NRadioGroup: typeof import('naive-ui')['NRadioGroup']
|
NRadioGroup: typeof import('naive-ui')['NRadioGroup']
|
||||||
|
NRow: typeof import('naive-ui')['NRow']
|
||||||
NScrollbar: typeof import('naive-ui')['NScrollbar']
|
NScrollbar: typeof import('naive-ui')['NScrollbar']
|
||||||
NSelect: typeof import('naive-ui')['NSelect']
|
NSelect: typeof import('naive-ui')['NSelect']
|
||||||
NSpace: typeof import('naive-ui')['NSpace']
|
NSpace: typeof import('naive-ui')['NSpace']
|
||||||
@@ -132,6 +135,7 @@ declare global {
|
|||||||
const NCascader: typeof import('naive-ui')['NCascader']
|
const NCascader: typeof import('naive-ui')['NCascader']
|
||||||
const NCheckbox: typeof import('naive-ui')['NCheckbox']
|
const NCheckbox: typeof import('naive-ui')['NCheckbox']
|
||||||
const NCheckboxGroup: typeof import('naive-ui')['NCheckboxGroup']
|
const NCheckboxGroup: typeof import('naive-ui')['NCheckboxGroup']
|
||||||
|
const NCol: typeof import('naive-ui')['NCol']
|
||||||
const NColorPicker: typeof import('naive-ui')['NColorPicker']
|
const NColorPicker: typeof import('naive-ui')['NColorPicker']
|
||||||
const NDataTable: typeof import('naive-ui')['NDataTable']
|
const NDataTable: typeof import('naive-ui')['NDataTable']
|
||||||
const NDatePicker: typeof import('naive-ui')['NDatePicker']
|
const NDatePicker: typeof import('naive-ui')['NDatePicker']
|
||||||
@@ -154,6 +158,7 @@ declare global {
|
|||||||
const NMenu: typeof import('naive-ui')['NMenu']
|
const NMenu: typeof import('naive-ui')['NMenu']
|
||||||
const NMessageProvider: typeof import('naive-ui')['NMessageProvider']
|
const NMessageProvider: typeof import('naive-ui')['NMessageProvider']
|
||||||
const NModal: typeof import('naive-ui')['NModal']
|
const NModal: typeof import('naive-ui')['NModal']
|
||||||
|
const NNInput: typeof import('naive-ui')['NNInput']
|
||||||
const NNotificationProvider: typeof import('naive-ui')['NNotificationProvider']
|
const NNotificationProvider: typeof import('naive-ui')['NNotificationProvider']
|
||||||
const NPagination: typeof import('naive-ui')['NPagination']
|
const NPagination: typeof import('naive-ui')['NPagination']
|
||||||
const NPopconfirm: typeof import('naive-ui')['NPopconfirm']
|
const NPopconfirm: typeof import('naive-ui')['NPopconfirm']
|
||||||
@@ -161,6 +166,7 @@ declare global {
|
|||||||
const NProgress: typeof import('naive-ui')['NProgress']
|
const NProgress: typeof import('naive-ui')['NProgress']
|
||||||
const NRadio: typeof import('naive-ui')['NRadio']
|
const NRadio: typeof import('naive-ui')['NRadio']
|
||||||
const NRadioGroup: typeof import('naive-ui')['NRadioGroup']
|
const NRadioGroup: typeof import('naive-ui')['NRadioGroup']
|
||||||
|
const NRow: typeof import('naive-ui')['NRow']
|
||||||
const NScrollbar: typeof import('naive-ui')['NScrollbar']
|
const NScrollbar: typeof import('naive-ui')['NScrollbar']
|
||||||
const NSelect: typeof import('naive-ui')['NSelect']
|
const NSelect: typeof import('naive-ui')['NSelect']
|
||||||
const NSpace: typeof import('naive-ui')['NSpace']
|
const NSpace: typeof import('naive-ui')['NSpace']
|
||||||
|
|||||||
Vendored
+2
@@ -48,6 +48,7 @@ declare module "@elegant-router/types" {
|
|||||||
"riskstatistics": "/riskstatistics";
|
"riskstatistics": "/riskstatistics";
|
||||||
"signstatistics": "/signstatistics";
|
"signstatistics": "/signstatistics";
|
||||||
"systemmanage": "/systemmanage";
|
"systemmanage": "/systemmanage";
|
||||||
|
"systemmanage_changepassword": "/systemmanage/changepassword";
|
||||||
"systemmanage_role": "/systemmanage/role";
|
"systemmanage_role": "/systemmanage/role";
|
||||||
"systemmanage_setting": "/systemmanage/setting";
|
"systemmanage_setting": "/systemmanage/setting";
|
||||||
"systemmanage_template": "/systemmanage/template";
|
"systemmanage_template": "/systemmanage/template";
|
||||||
@@ -140,6 +141,7 @@ declare module "@elegant-router/types" {
|
|||||||
| "report"
|
| "report"
|
||||||
| "riskstatistics"
|
| "riskstatistics"
|
||||||
| "signstatistics"
|
| "signstatistics"
|
||||||
|
| "systemmanage_changepassword"
|
||||||
| "systemmanage_role"
|
| "systemmanage_role"
|
||||||
| "systemmanage_setting"
|
| "systemmanage_setting"
|
||||||
| "systemmanage_template"
|
| "systemmanage_template"
|
||||||
|
|||||||
@@ -0,0 +1,98 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, computed, onMounted } from 'vue';
|
||||||
|
import { useAppStore } from '@/store/modules/app';
|
||||||
|
import { Icon } from '@iconify/vue'
|
||||||
|
import { useThemeStore } from '@/store/modules/theme';
|
||||||
|
import { useRouterPush } from '@/hooks/common/router';
|
||||||
|
import { changePasswordApi } from '@/service/api/user';
|
||||||
|
|
||||||
|
const appStore = useAppStore();
|
||||||
|
const themeStore = useThemeStore();
|
||||||
|
const { toLogin } = useRouterPush();
|
||||||
|
const gap = computed(() => (appStore.isMobile ? 0 : 16));
|
||||||
|
|
||||||
|
const formModel = ref<{oldPassword: string;password: string;confirmPassword: string;}>({
|
||||||
|
oldPassword: '',
|
||||||
|
password: '',
|
||||||
|
confirmPassword: '',
|
||||||
|
});
|
||||||
|
const rules = {
|
||||||
|
oldPassword: [{ required: true, message: '请输入旧密码', trigger: ['blur'] }],
|
||||||
|
password: [{ required: true, message: '请输入新密码', trigger: ['blur'] }],
|
||||||
|
confirmPassword: [{ validator: (rule: any, value: string, callback: any) => {
|
||||||
|
if (value !== formModel.value.password) {
|
||||||
|
callback(new Error('两次输入密码不一致'));
|
||||||
|
} else {
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
}, required: true, message: '两次输入密码不一致', trigger: ['blur'] }],
|
||||||
|
}
|
||||||
|
|
||||||
|
const formRef = ref<any>(null);
|
||||||
|
const btnLoading = ref<boolean>(false);
|
||||||
|
|
||||||
|
const submitForm = async (e: MouseEvent) => {
|
||||||
|
e.preventDefault()
|
||||||
|
formRef.value?.validate(async (errors: any) => {
|
||||||
|
if (!errors) {
|
||||||
|
btnLoading.value = true;
|
||||||
|
const {error} = await changePasswordApi({
|
||||||
|
oldPassword: formModel.value.oldPassword,
|
||||||
|
password: formModel.value.password,
|
||||||
|
});
|
||||||
|
if(!error){
|
||||||
|
window.$message?.success('修改成功')
|
||||||
|
toLogin();
|
||||||
|
}
|
||||||
|
btnLoading.value = false;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<NSpace vertical :size="16">
|
||||||
|
<!-- 修改密码 -->
|
||||||
|
<NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px' }">
|
||||||
|
<div class="border mb-3 py-2 px-3" :style="{ borderRadius: themeStore.themeRadius + 'px' }">
|
||||||
|
<NGrid :x-gap="gap" :y-gap="16" responsive="screen" item-responsive>
|
||||||
|
<NGi span="24 s:24 m:24">
|
||||||
|
<div class="h-100% flex items-center gap-2">
|
||||||
|
<Icon icon="boxicons:lock-open" class="size-16px" :style="{ color: themeStore.themeColor }" />
|
||||||
|
<p class="text-[16px] font-600">修改密码</p>
|
||||||
|
</div>
|
||||||
|
</NGi>
|
||||||
|
</NGrid>
|
||||||
|
</div>
|
||||||
|
<div class="scroll">
|
||||||
|
<div class="mt-5 max-w-[800px] mx-auto">
|
||||||
|
<NForm ref="formRef" :model="formModel" :rules="rules">
|
||||||
|
<NFormItem path="oldPassword" label="旧密码">
|
||||||
|
<NInput v-model:value="formModel.oldPassword" type="password" clearable show-password-on="click" placeholder="请输入旧密码" />
|
||||||
|
</NFormItem>
|
||||||
|
<NFormItem path="password" label="新密码">
|
||||||
|
<NInput v-model:value="formModel.password" type="password" clearable show-password-on="click" placeholder="请输入新密码" />
|
||||||
|
</NFormItem>
|
||||||
|
<NFormItem path="confirmPassword" label="确认密码">
|
||||||
|
<NInput v-model:value="formModel.confirmPassword" type="password" clearable show-password-on="click" placeholder="请确认新密码" />
|
||||||
|
</NFormItem>
|
||||||
|
</NForm>
|
||||||
|
<NButton type="primary" block :loading="btnLoading" @click="submitForm">修改密码</NButton>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</NCard>
|
||||||
|
</NSpace>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.scroll {
|
||||||
|
height: calc(100vh - 205px);
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Reference in New Issue
Block a user