mirror of
https://github.com/fumiama/paper-manager.git
synced 2026-06-08 09:34:42 +08:00
finish settings/contact page
This commit is contained in:
@@ -9,6 +9,8 @@ export enum PageEnum {
|
||||
PAGE_SETTINGS = '/settings',
|
||||
// password settings path
|
||||
PAGE_PASSWORD_SETTINGS = '/settings/password',
|
||||
// contact settings path
|
||||
PAGE_CONTACT_SETTINGS = '/settings/contact',
|
||||
// error page path
|
||||
ERROR_PAGE = '/exception',
|
||||
// error log page path
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
export default {
|
||||
name: '个人设置',
|
||||
password: '修改密码',
|
||||
contact: '修改联系方式',
|
||||
}
|
||||
|
||||
@@ -35,6 +35,16 @@ const settings: AppRouteModule = {
|
||||
hideMenu: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'contact',
|
||||
name: 'ContactSettingsPage',
|
||||
component: () => import('/@/views/page/settings/contact/index.vue'),
|
||||
meta: {
|
||||
title: t('routes.settings.contact'),
|
||||
icon: 'ion:md-contact',
|
||||
hideMenu: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
@@ -50,6 +50,9 @@
|
||||
title: '联系方式',
|
||||
description: '已记录的联系方式: ' + contact,
|
||||
extra: '修改',
|
||||
click: () => {
|
||||
go(PageEnum.PAGE_CONTACT_SETTINGS)
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import { FormSchema } from '/@/components/Form'
|
||||
|
||||
export const formSchema: FormSchema[] = [
|
||||
{
|
||||
field: 'contactOld',
|
||||
label: '当前联系方式',
|
||||
component: 'Input',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
field: 'contactNew',
|
||||
label: '新联系方式',
|
||||
component: 'Input',
|
||||
required: true,
|
||||
},
|
||||
]
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<PageWrapper title="修改当前联系方式" content="修改成功后会自动退出当前登录!">
|
||||
<PageWrapper title="修改当前联系方式" content="修改成功后会通知课程组长!">
|
||||
<div class="py-8 bg-white flex flex-col justify-center items-center">
|
||||
<BasicForm @register="register" />
|
||||
<div class="flex justify-center">
|
||||
@@ -14,7 +14,7 @@
|
||||
import { PageWrapper } from '/@/components/Page'
|
||||
import { BasicForm, useForm } from '/@/components/Form'
|
||||
|
||||
import { formSchema } from './pwd.data'
|
||||
import { formSchema } from './contact.data'
|
||||
export default defineComponent({
|
||||
name: 'ChangeContact',
|
||||
components: { BasicForm, PageWrapper },
|
||||
@@ -30,10 +30,10 @@
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const values = await validate()
|
||||
const { passwordOld, passwordNew } = values
|
||||
const { contactOld, contactNew } = values
|
||||
|
||||
// TODO custom api
|
||||
console.log(passwordOld, passwordNew)
|
||||
console.log(contactOld, contactNew)
|
||||
// const { router } = useRouter()
|
||||
// router.push(pageEnum.BASE_LOGIN)
|
||||
} catch (error) {}
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
import { FormSchema } from '/@/components/Form'
|
||||
|
||||
export const formSchema: FormSchema[] = [
|
||||
{
|
||||
field: 'passwordOld',
|
||||
label: '当前密码',
|
||||
component: 'InputPassword',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
field: 'passwordNew',
|
||||
label: '新密码',
|
||||
component: 'StrengthMeter',
|
||||
componentProps: {
|
||||
placeholder: '新密码',
|
||||
},
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入新密码',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
field: 'confirmPassword',
|
||||
label: '确认密码',
|
||||
component: 'InputPassword',
|
||||
|
||||
dynamicRules: ({ values }) => {
|
||||
return [
|
||||
{
|
||||
required: true,
|
||||
validator: (_, value) => {
|
||||
if (!value) {
|
||||
return Promise.reject('密码不能为空')
|
||||
}
|
||||
if (value !== values.passwordNew) {
|
||||
return Promise.reject('两次输入的密码不一致!')
|
||||
}
|
||||
return Promise.resolve()
|
||||
},
|
||||
},
|
||||
]
|
||||
},
|
||||
},
|
||||
]
|
||||
Reference in New Issue
Block a user