SpringBoot2+Vue2实战(十八)修改密码

一、修改密码:

Header.vue


          修改密码
        

router/index.js

//拼装动态路由
            const manageRoute = {
                path: '/',
                name: 'Manage',
                component: () => import('../views/Manage.vue'),
                redirect: "/home",
                children: [
                    {
                        path: '/person',
                        name: '个人信息',
                        component: () => import('../views/Person.vue'),
                    },
                    {
                        path: '/password',
                        name: '修改密码',
                        component: () => import('../views/Password.vue'),
                    },
                ]
            }

Password.vue





UserController

@PostMapping("/password")//   /user/password
    public Result password(@RequestBody UserPasswordDto userPasswordDto){
        userService.updatePassword(userPasswordDto);
        return Result.success();
    }

UserService

void updatePassword(UserPasswordDto userPasswordDto);

UserServiceImpl

@Override
    public void updatePassword(UserPasswordDto userPasswordDto) {
        int update = userMapper.updatePassword(userPasswordDto);
        if (update < 1) {
            throw new ServiceException(Constants.CODE_600, "密码错误");
        }
    }

UserMapper

@Update("update sys_user set password = #{newPassword} where username = #{username} and password = #{password}")
    int updatePassword(UserPasswordDto userPasswordDto);

SpringBoot2+Vue2实战(十八)修改密码_第1张图片

 

你可能感兴趣的:(vue.js,javascript,前端)